:root {
    color-scheme: dark;
    --bg: #071019;
    --surface: rgba(9, 19, 29, 0.86);
    --surface-strong: rgba(13, 25, 38, 0.96);
    --text: #f3f7f6;
    --muted: #88939e;
    --line: rgba(116, 138, 154, 0.28);
    --line-strong: #2ee7ff;
    --accent: #20d7ff;
    --accent-dark: #12a8c7;
    --lime: #b8ff3d;
    --soft: rgba(32, 215, 255, 0.08);
    --warning: #b8ff3d;
    --grid-line: rgba(55, 80, 98, 0.22);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
        radial-gradient(circle at 73% 70%, rgba(32, 215, 255, 0.13), transparent 22%),
        var(--bg);
    background-size: 96px 96px, 96px 96px, 100% 100%, auto;
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

button,
input {
    font: inherit;
}

.page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 52px;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    min-height: 58px;
    padding: 0 0 26px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
}

.brand-mark {
    font-size: 30px;
    letter-spacing: 0;
}

.brand-divider {
    display: inline-block;
    width: 2px;
    height: 34px;
    background: var(--accent);
    box-shadow: 0 0 14px rgba(32, 215, 255, 0.7);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 42px;
}

.site-nav a {
    color: rgba(243, 247, 246, 0.58);
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--text);
}

.section-label,
.eyebrow,
.panel-heading span,
.muted {
    color: var(--muted);
    font-size: 14px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
    gap: 42px;
    align-items: center;
    min-height: 310px;
    padding: 34px 0 40px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--lime);
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 16px;
    font-size: clamp(54px, 8vw, 92px);
    line-height: 0.95;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 22px;
}

h3 {
    margin-bottom: 0;
    font-size: 16px;
}

.intro {
    max-width: 620px;
    margin-bottom: 0;
    color: #a5afb9;
    font-size: 18px;
    line-height: 1.55;
}

.role {
    margin-bottom: 14px;
    color: var(--accent);
    font-size: 24px;
    font-weight: 800;
}

.runtime-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: min(620px, 100%);
    margin-top: 22px;
    padding: 14px 16px;
    border: 1px solid rgba(32, 215, 255, 0.36);
    border-left: 3px solid var(--lime);
    border-radius: 8px;
    background: rgba(9, 19, 29, 0.72);
}

.runtime-note span {
    display: block;
    margin-bottom: 5px;
    color: var(--lime);
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.runtime-note p {
    margin: 0;
    color: #a5afb9;
    font-size: 14px;
    line-height: 1.45;
}

.runtime-note a {
    flex: 0 0 auto;
    padding: 9px 12px;
    border: 1px solid rgba(184, 255, 61, 0.48);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.runtime-note a:hover {
    border-color: var(--lime);
    background: rgba(184, 255, 61, 0.08);
}

.hero-signal {
    display: grid;
    gap: 14px;
    justify-self: end;
    min-width: 310px;
    color: rgba(154, 166, 177, 0.55);
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.5;
}

.hero-signal::after {
    content: "";
    display: block;
    width: 170px;
    height: 170px;
    margin-top: 26px;
    border: 1px solid rgba(32, 215, 255, 0.45);
    border-radius: 50%;
    background:
        radial-gradient(circle, var(--accent) 0 3px, transparent 4px),
        repeating-radial-gradient(circle, rgba(32, 215, 255, 0.26) 0 1px, transparent 1px 28px);
    box-shadow: 0 0 38px rgba(32, 215, 255, 0.13);
}

.hero-signal span {
    display: block;
}

.workspace {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(12px);
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.step-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.step-heading.compact {
    margin-bottom: 0;
}

.step-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.step-number {
    display: inline-grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(32, 215, 255, 0.65);
    border-radius: 6px;
    color: var(--lime);
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    font-weight: 700;
    background: rgba(32, 215, 255, 0.08);
}

.drop-zone {
    display: grid;
    min-height: 132px;
    place-items: center;
    padding: 22px;
    border: 1px dashed rgba(32, 215, 255, 0.55);
    border-radius: 8px;
    background: var(--soft);
    cursor: pointer;
    text-align: center;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
    border-color: var(--lime);
    background: rgba(184, 255, 61, 0.08);
    transform: translateY(-1px);
}

.drop-zone input {
    display: none;
}

.drop-zone span {
    display: block;
    color: var(--text);
    font-weight: 700;
}

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

.preview-wrap {
    display: grid;
    min-height: 220px;
    margin-top: 16px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

#preview {
    display: none;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
}

.examples {
    margin-top: 18px;
}

.examples-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

.example-button {
    display: grid;
    gap: 4px;
    min-height: 42px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-strong);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.example-button:hover {
    border-color: rgba(32, 215, 255, 0.75);
}

.example-button.selected {
    border-color: var(--lime);
    box-shadow: 0 0 18px rgba(184, 255, 61, 0.18);
}

.example-button img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    object-fit: cover;
}

.example-button span {
    overflow: hidden;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.example-button small {
    color: var(--lime);
    font-family: Consolas, "Courier New", monospace;
    font-size: 10px;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    width: 100%;
    max-width: 432px;
    aspect-ratio: 1;
    border: 2px solid rgba(32, 215, 255, 0.9);
    background: rgba(32, 215, 255, 0.9);
    box-shadow: 0 0 24px rgba(32, 215, 255, 0.08);
}

.sudoku-cell {
    width: 100%;
    min-width: 0;
    height: 100%;
    border: 0;
    border-right: 1px solid rgba(79, 97, 111, 0.55);
    border-bottom: 1px solid rgba(79, 97, 111, 0.55);
    background: #0d1722;
    color: var(--text);
    text-align: center;
    font-size: 24px;
    font-weight: 700;
}

.sudoku-cell:nth-child(3n) {
    border-right: 2px solid rgba(32, 215, 255, 0.9);
}

.sudoku-cell:nth-child(n + 19):nth-child(-n + 27),
.sudoku-cell:nth-child(n + 46):nth-child(-n + 54) {
    border-bottom: 2px solid rgba(32, 215, 255, 0.9);
}

.sudoku-cell:focus {
    position: relative;
    z-index: 1;
    outline: 2px solid var(--lime);
}

.sudoku-cell.given {
    background: #0f1a25;
    color: var(--text);
}

.readonly .sudoku-cell {
    pointer-events: none;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.button {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.primary {
    background: var(--accent);
    color: #061018;
    box-shadow: 0 0 24px rgba(32, 215, 255, 0.24);
}

.primary:hover {
    background: var(--accent-dark);
}

.secondary {
    background: transparent;
    border-color: rgba(32, 215, 255, 0.75);
    color: var(--text);
}

.ghost {
    border-color: var(--line);
    background: transparent;
    color: var(--text);
}

code {
    color: var(--warning);
}

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

    .hero-signal {
        justify-self: start;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .sudoku-grid {
        max-width: 520px;
    }

    .examples-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .page-shell {
        width: min(100% - 24px, 1120px);
    }

    .brand {
        gap: 12px;
        font-size: 18px;
    }

    .brand-mark {
        font-size: 26px;
    }

    .brand-divider {
        height: 28px;
    }

    .site-nav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
    }

    .site-nav a {
        min-width: 0;
        padding: 8px 6px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: rgba(9, 19, 29, 0.58);
        font-size: 13px;
        text-align: center;
    }

    h1 {
        font-size: 50px;
    }

    .role {
        font-size: 20px;
    }

    .intro {
        font-size: 16px;
    }

    .panel {
        padding: 14px;
    }

    .runtime-note {
        align-items: flex-start;
        flex-direction: column;
    }

    .preview-wrap {
        min-height: 180px;
    }

    .sudoku-grid {
        max-width: 100%;
    }

    .actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .button {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .page-shell {
        width: min(100% - 18px, 1180px);
        padding-top: 18px;
    }

    .site-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
    }

    .hero {
        min-height: 180px;
        padding-top: 30px;
    }

    .hero-signal {
        display: none;
    }

    .sudoku-cell {
        font-size: 16px;
    }

    .examples-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 390px) {
    .site-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    h1 {
        font-size: 42px;
    }

    .role {
        font-size: 18px;
    }

    .step-heading {
        gap: 10px;
    }

    .step-number {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
    }

    .sudoku-cell {
        font-size: 14px;
    }
}
