:root {
    color-scheme: light;
    --ink: #17213a;
    --muted: #526078;
    --accent: #5545d9;
    --accent-dark: #4535c4;
    --border: #dce0eb;
    --connected: #087f73;
    --surface: #ffffff;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; background: #f5f3f9; color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid #6656dc; outline-offset: 3px; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

.site-shell {
    position: relative;
    isolation: isolate;
    min-height: 100svh;
    max-width: 1800px;
    margin: auto;
    padding: 0 clamp(22px, 5vw, 84px);
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 4% 5%, #fbe2c9 0%, transparent 46%),
        radial-gradient(ellipse at 97% 83%, #d4e7f9 0%, transparent 51%),
        radial-gradient(ellipse at 48% 100%, #f1def0 0%, transparent 47%),
        #f6f7fb;
}
.site-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(#7788ad0b 1px, transparent 1px), linear-gradient(90deg, #7788ad0b 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(105deg, transparent 15%, black 100%);
    pointer-events: none;
}
.site-header, .site-footer {
    width: min(100%, 1260px);
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.site-header { min-height: 90px; border-bottom: 1px solid #d8dce7a0; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 24px; font-weight: 760; letter-spacing: -1.3px; }
.brand img { display: block; object-fit: contain; }
.brand-accent { color: var(--accent); }
.website-link { display: inline-flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px; border: 1px solid #d6dae6; background: #ffffff80; font-size: 13px; font-weight: 650; }
.website-link:hover { border-color: var(--accent); color: var(--accent); }

.main-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 510px);
    align-items: center;
    gap: clamp(36px, 7vw, 106px);
    width: min(100%, 1260px);
    flex: 1;
    margin: auto;
    padding-block: clamp(42px, 6vh, 85px);
}
.intro { animation: appear .65s ease-out both; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--accent-dark); font-size: 11px; font-weight: 780; letter-spacing: .15em; }
.status-dot { flex: 0 0 9px; width: 9px; height: 9px; background: #169d82; border-radius: 50%; box-shadow: 0 0 0 4px #1e9f8220; animation: pulse 2.8s ease-in-out 3; }
h1 { margin: 24px 0; font-size: clamp(48px, 5.4vw, 83px); line-height: 1.015; font-weight: 780; letter-spacing: -.068em; }
h1 span { color: var(--accent); background: linear-gradient(105deg, #5740d8 8%, #286bb9 95%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.intro-copy { max-width: 500px; margin: 0; font-size: clamp(16px, 1.4vw, 18px); line-height: 1.75; color: var(--muted); }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 28px; padding: 14px 0; border-block: 1px solid #d8dce7; font-size: 13px; font-weight: 650; }
.status-label { font-size: 10px; font-weight: 750; letter-spacing: .10em; color: var(--muted); }
.feature-list { display: flex; flex-wrap: wrap; gap: 12px 18px; margin: 26px 0; }
.feature-list span { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); font-weight: 600; }
.feature-list svg { width: 17px; height: 17px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.invitation { display: flex; gap: 9px; align-items: baseline; color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0; }
.invitation span { color: var(--accent); font-weight: 800; font-size: 19px; }

.game-card {
    min-width: 0;
    border: 1px solid #ffffff;
    border-radius: 24px;
    padding: clamp(19px, 2.4vw, 32px);
    background: #ffffffde;
    box-shadow: 0 18px 65px #3b4d8215, 0 2px 6px #3b4d8209;
    animation: appear .65s .12s ease-out both;
}
.game-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.game-kicker { color: var(--accent-dark); font-size: 10px; font-weight: 760; letter-spacing: .12em; margin: 0 0 6px; }
h2 { margin: 0; font-size: clamp(28px, 3vw, 40px); letter-spacing: -.045em; line-height: 1.1; }
.heading-dot { color: var(--accent); }
.level-label { flex-shrink: 0; padding: 7px 9px; border: 1px solid #e0ddf2; color: var(--accent-dark); background: #f1edfc; border-radius: 6px; font: 600 10px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .02em; }
.game-description { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 12px 0 18px; }
.game-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 12px 0; border-block: 1px solid #e1e4ee; margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding-inline: 12px; border-left: 1px solid #e1e4ee; }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat span { color: var(--muted); font-size: 9px; letter-spacing: .12em; font-weight: 700; }
.stat strong { font-size: 14px; font-weight: 720; font-variant-numeric: tabular-nums; }
.board-wrap { position: relative; max-width: 392px; margin-inline: auto; }
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 8px; border-radius: 15px; border: 1px solid #dfe3ed; background: #e9edf6; }
.tile {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-width: 0;
    border: 1px solid #d9dfea;
    border-radius: 7px;
    background: #f8faff;
    color: #8a9ab6;
    padding: 0;
    transition: background .17s, border-color .17s, color .17s, box-shadow .17s;
}
.tile:not(:disabled):hover { background: #eeeaff; border-color: #8875e4; }
.tile:focus-visible { z-index: 2; outline-offset: 1px; }
.tile svg { display: block; width: 100%; height: 100%; overflow: visible; }
.tile .pipe { stroke: currentColor; stroke-width: 7; stroke-linecap: round; }
.tile .junction { fill: currentColor; }
.tile .signal {
    fill: none;
    stroke: #ffffffa8;
    stroke-width: 2;
    stroke-dasharray: 5 17;
    stroke-linecap: round;
    animation: signal-travel .9s linear 2 both;
}
@keyframes signal-travel {
    from { stroke-dashoffset: 22; opacity: .85; }
    to { stroke-dashoffset: 0; opacity: 0; }
}
.tile.connected { color: #169e91; background: #e9faf4; border-color: #a3d9c9; }
.tile.source { background: #e9e5fc; color: #6754d7; border-color: #b8a8ef; }
.tile.vault { background: #e2e9f5; color: #5a739d; border-color: #c5d0e5; }
.tile.vault.connected { background: #d5f6e9; color: #087e68; border-color: #86cdb6; }
.tile .endpoint-bg { fill: currentColor; }
.tile .endpoint-icon { fill: none; stroke: #ffffff; stroke-width: 2.3; stroke-linejoin: round; stroke-linecap: round; }
.tile.hinted { outline: 2px dashed #6d54df; outline-offset: -4px; }
.board-legend { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 20px; margin: 14px 0 16px; font-size: 11px; font-weight: 600; color: var(--muted); }
.board-legend span { display: inline-flex; align-items: center; gap: 6px; }
.board-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; }
.legend-file { background: #6754d7; }
.legend-path { background: #169e91; }
.legend-vault { background: #5a739d; }
.game-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 15px; border-top: 1px solid #e1e4ee; }
.secondary-button { min-height: 39px; padding: 8px 12px; background: #fff; color: var(--ink); border: 1px solid #dbe0ea; border-radius: 8px; font-size: 12px; font-weight: 650; }
.secondary-button span { color: var(--accent); font-size: 15px; margin-right: 4px; }
.secondary-button:hover:not(:disabled) { background: #f2effc; border-color: #c0b6eb; }
.secondary-button:disabled { opacity: .5; }
.live-status { margin-left: auto; color: var(--connected); font-size: 11px; font-weight: 650; max-width: 100%; }
.board-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 15px; border-radius: 15px; background: #f6fbf9ed; border: 1px solid #acd9ca; }
.completion-content { text-align: center; animation: appear .25s ease-out both; }
.completion-symbol { display: inline-grid; place-items: center; background: #d5f5e7; color: #087f68; width: 48px; height: 48px; border-radius: 50%; font-size: 26px; font-weight: 800; }
.completion-content h3 { font-size: clamp(21px, 4vw, 29px); letter-spacing: -.04em; margin: 13px 0 6px; }
.completion-content p { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0 auto 16px; max-width: 250px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 9px; padding: 12px 18px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; }
.primary-button:hover { background: var(--accent-dark); }

.site-footer { min-height: 64px; padding-block: 16px; border-top: 1px solid #d8dce7a0; color: var(--muted); font-size: 11px; }
.site-footer a { font-weight: 650; }
.site-footer a:hover { color: var(--accent); }
@keyframes appear { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px #1e9f8212; } }
@media (max-width: 1000px) {
    .main-layout { gap: 32px; grid-template-columns: minmax(0, 1fr) minmax(0, 445px); }
    h1 { font-size: clamp(43px, 5.8vw, 63px); }
    .feature-list { gap: 10px 15px; }
}
@media (max-width: 760px) {
    .site-header { min-height: 74px; }
    .main-layout { grid-template-columns: minmax(0, 1fr); max-width: 550px; padding-block: 38px; gap: 30px; }
    .desktop-break { display: none; }
    h1 span { display: block; }
    h1 { font-size: clamp(43px, 9vw, 67px); max-width: 520px; margin-block: 19px; }
    .intro-copy { font-size: 16px; }
    .status-line { margin-top: 21px; }
    .feature-list { margin-block: 18px; }
    .site-footer { flex-wrap: wrap; gap: 8px 16px; }
    .footer-note { order: 3; width: 100%; }
}
@media (max-width: 390px) {
    .site-shell { padding-inline: 15px; }
    .brand { font-size: 21px; }
    .brand img { width: 30px; height: 30px; }
    .website-link { padding: 8px 10px; font-size: 11px; }
    .game-card { padding: 14px; border-radius: 17px; }
    .game-heading { align-items: center; }
    .level-label { font-size: 9px; padding: 5px 6px; }
    .live-status { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .tile .signal { display: none; }
}
