:root {
    --bg: #0f1217;
    --panel: rgba(19, 25, 34, 0.82);
    --panel-strong: rgba(10, 15, 22, 0.95);
    --line: rgba(160, 190, 222, 0.15);
    --line-strong: rgba(160, 190, 222, 0.28);
    --text: #eef3f9;
    --muted: #98a9bc;
    --accent: #8ec5ff;
    --accent-strong: #5a87e2;
    --accent-soft: rgba(142, 197, 255, 0.14);
    --success: #9fe0b0;
    --danger: #ff9f9f;
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
    --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(88, 137, 214, 0.34), transparent 24%),
        radial-gradient(circle at 85% 12%, rgba(95, 173, 255, 0.12), transparent 18%),
        linear-gradient(145deg, #0c0f14 0%, #131922 48%, #0f141b 100%);
}

.shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: 100vh;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    overflow-y: auto;
    padding: 36px 24px;
    background:
        linear-gradient(165deg, rgba(74, 111, 182, 0.94) 0 54%, rgba(13, 18, 26, 0.98) 54% 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.sidebar::before {
    content: "";
    position: absolute;
    inset: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    pointer-events: none;
}

.brand h1,
.hero h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.05;
}

.brand {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 14px;
}

.eyebrow {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.24em;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.68);
}

.lede,
.hero-copy,
.empty-state {
    color: var(--muted);
}

.lede {
    margin: 0;
    max-width: 24ch;
    line-height: 1.7;
}

.task-nav {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 14px;
    margin-top: 6px;
}

.task-button {
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)),
        rgba(8, 12, 17, 0.16);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    transition: border-color 0.08s ease, background 0.08s ease, box-shadow 0.08s ease;
}

.task-button:hover,
.task-button.is-active {
    border-color: rgba(255, 255, 255, 0.36);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05)),
        rgba(8, 12, 17, 0.34);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

.task-button strong,
.task-button small {
    display: block;
}

.task-button small {
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.68);
}

.panel {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    border-radius: 28px;
}

.content {
    padding: 34px;
    display: grid;
    gap: 24px;
    min-width: 0;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    padding: 34px;
    background:
        radial-gradient(circle at top right, rgba(142, 197, 255, 0.16), transparent 22%),
        linear-gradient(120deg, rgba(120, 169, 255, 0.12), transparent 45%),
        var(--panel-strong);
    border: 1px solid var(--line-strong);
    border-radius: 32px;
    box-shadow: var(--shadow);
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ghost-button,
.submit-button {
    appearance: none;
    border: none;
    cursor: pointer;
    border-radius: 14px;
    padding: 14px 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: box-shadow 0.18s ease, background 0.18s ease;
}

.ghost-button {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ghost-button:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.12);
}

.panel {
    padding: 28px;
}

.solver-form {
    display: grid;
    gap: 20px;
}

.field-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
    display: grid;
    gap: 10px;
}

.field label {
    font-weight: 700;
    color: #f6f9fc;
}

.field input {
    width: 100%;
    padding: 15px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 10, 16, 0.68);
    color: var(--text);
    font: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.field input:focus {
    outline: none;
    border-color: rgba(142, 197, 255, 0.5);
    box-shadow: 0 0 0 4px rgba(142, 197, 255, 0.12);
    transform: translateY(-1px);
}

.field small {
    color: var(--muted);
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.submit-button {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #08111a;
    box-shadow: 0 14px 32px rgba(90, 135, 226, 0.3);
    transition: box-shadow 0.06s ease, filter 0.06s ease;
}

.submit-button:hover {
    box-shadow: 0 16px 34px rgba(90, 135, 226, 0.36);
    filter: brightness(1.03);
}

.status-message {
    min-height: 1.2rem;
    color: var(--muted);
}

.status-message.error {
    color: var(--danger);
}

.status-message.success {
    color: var(--success);
}

.hidden {
    display: none;
}

.result-view {
    display: grid;
    gap: 24px;
}

.summary-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.summary-item {
    padding: 18px;
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
        rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.summary-item strong,
.result-banner strong {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.bit-value {
    font-family: Consolas, "Courier New", monospace;
    font-size: 1.02rem;
    letter-spacing: 0.08em;
    word-break: break-word;
}

.section-block {
    display: grid;
    gap: 18px;
}

.section-block h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
}

.table-stack {
    display: grid;
    gap: 16px;
}

.table-card {
    padding: 18px 18px 16px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
        rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.table-title {
    margin: 0 0 14px;
    font-size: 1rem;
}

.table-wrapper {
    overflow-x: auto;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.95rem;
    line-height: 1.45;
}

.result-table th,
.result-table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.result-table th {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.result-table tbody tr:last-child td {
    border-bottom: none;
}

.steps-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.step-card {
    padding: 20px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
        rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: none;
}

.step-title {
    margin: 0 0 10px;
    font-size: 1.02rem;
}

.step-lines {
    margin: 0;
    white-space: pre-wrap;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.5;
    color: #d9e4f0;
}

.result-banner {
    padding: 20px 22px;
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(142, 197, 255, 0.2), rgba(90, 135, 226, 0.06)),
        rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(142, 197, 255, 0.3);
    box-shadow: none;
}

@media (max-width: 920px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        padding: 24px 18px;
        height: auto;
        overflow: visible;
    }

    .hero {
        flex-direction: column;
        padding: 26px;
    }

    .hero-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .content {
        padding: 18px;
    }
}
