:root {
    color-scheme:dark;
    --bg:#090909;
    --fg:#f7f7f7;
    --muted:#858585;
    --line:#303030
}

* {
    box-sizing:border-box
}

body {
    margin:0;
    background:var(--bg);
    color:var(--fg);
    font-family:Inter,Arial,Helvetica,sans-serif;
    -webkit-font-smoothing:antialiased
}

.shell {
    max-width:1050px;
    margin:auto;
    padding:28px 36px
}

.top,footer {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:16px
}

.top {
    padding-bottom:22px;
    border-bottom:1px solid var(--line)
}

.eyebrow,.online,.kicker,.sectionlabel,footer,.bottom,.counter span {
    font-size:10px;
    font-weight:750;
    letter-spacing:2px
}

.eyebrow,.kicker,.sectionlabel,footer,.bottom,.counter span {
    color:var(--muted)
}

.online {
    display:flex;
    align-items:center;
    gap:9px
}

.dot {
    width:7px;
    height:7px;
    border-radius:50%;
    background:#fff;
    box-shadow:0 0 10px #fff8
}

.hero {
    padding:55px 0 48px;
    display:flex;
    justify-content:space-between;
    align-items:end;
    gap:20px
}

.kicker {
    margin:0 0 12px
}

h1 {
    font-size:clamp(80px,15vw,160px);
    letter-spacing:-.105em;
    line-height:.85;
    margin:0;
    font-weight:900
}

.period {
    color:#777
}

.intro {
    font-size:15px;
    color:#aaa;
    margin:24px 0 0
}

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

button {
    font:inherit;
    cursor:pointer
}

.actions button {
    border-radius:4px;
    padding:15px 20px;
    font-size:11px;
    font-weight:800;
    letter-spacing:1px;
    transition:transform .18s,background .18s
}

.actions button:hover {
    transform:translateY(-2px)
}

.primary {
    background:#fff;
    color:#111;
    border:1px solid #fff
}

.primary:hover {
    background:#ddd
}

.secondary {
    background:transparent;
    color:#eee;
    border:1px solid #555
}

.secondary:hover {
    background:#222
}

.game {
    border:1px solid var(--line);
    padding:27px 30px 23px;
    background:#111
}

.gamehead {
    display:flex;
    justify-content:space-between;
    align-items:end;
    margin-bottom:25px
}

.sectionlabel {
    display:block;
    margin-bottom:9px
}

h2 {
    font-size:28px;
    letter-spacing:-1px;
    margin:0
}

.counter {
    display:flex;
    align-items:baseline;
    gap:8px
}

.counter strong {
    font-size:32px;
    letter-spacing:-2px
}

.board-wrap {
    max-width:770px;
    margin:auto
}

.letters,.board {
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:8px
}

.letters {
    margin-bottom:10px
}

.letters span {
    text-align:center;
    font-size:16px;
    font-weight:900;
    letter-spacing:4px;
    padding:5px
}

.cell {
    position:relative;
    aspect-ratio:1;
    background:#1c1c1c;
    border:1px solid #3b3b3b;
    color:#f4f4f4;
    padding:10px;
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    font-size:clamp(10px,1.55vw,15px);
    font-weight:700;
    line-height:1.3;
    overflow:hidden;
    overflow-wrap:anywhere;
    transition:background .2s,color .2s,border-color .2s,transform .2s
}

.cell:hover {
    border-color:#eee;
    transform:scale(1.025);
    z-index:1
}

.cell:focus-visible,.actions button:focus-visible {
    outline:2px solid white;
    outline-offset:3px
}

.cell.selected {
    background:#f4f4f4;
    color:#111;
    border-color:#fff;
    animation:pop .26s cubic-bezier(.2,1.5,.5,1)
}

.cell.selected:after {
    content:'✓';
    position:absolute;
    right:7px;
    top:3px;
    font-size:14px;
    opacity:.45
}

.cell.free {
    background:#333;
    color:#fff
}

.cell.free.selected {
    background:#f4f4f4;
    color:#111
}

.cell.winner {
    box-shadow:inset 0 0 0 3px #888
}

.bottom {
    display:flex;
    justify-content:space-between;
    gap:16px;
    padding-top:22px
}

.bottom #status {
    color:#eee
}

footer {
    border-top:1px solid var(--line);
    padding:27px 0;
    margin-top:35px
}

.toast {
    position:fixed;
    left:50%;
    bottom:30px;
    transform:translate(-50%,25px);
    background:#fff;
    color:#111;
    padding:16px 30px;
    border-radius:5px;
    font-size:16px;
    font-weight:900;
    letter-spacing:2px;
    opacity:0;
    pointer-events:none;
    transition:opacity .25s,transform .25s
}

.toast.show {
    opacity:1;
    transform:translate(-50%,0)
}

@keyframes pop {
    0% {
        transform:scale(.9)
    }
    70% {
        transform:scale(1.045)
    }
    100% {
        transform:scale(1)
    }
}

@media(max-width:700px) {
    .shell {
        padding:18px 12px
    }
    .hero {
        padding:42px 6px 28px;
        display:block
    }
    h1 {
        font-size:clamp(76px,19vw,130px)
    }
    .actions {
        margin-top:27px
    }
    .actions button {
        flex:1;
        padding:14px 10px
    }
    .game {
        padding:18px 10px
    }
    .gamehead {
        padding:0 5px
    }
    h2 {
        font-size:22px
    }
    .counter strong {
        font-size:26px
    }
    .counter span {
        font-size:8px
    }
    .letters,.board {
        gap:4px
    }
    .cell {
        padding:4px;
        font-size:clamp(9px,2.3vw,13px)
    }
    .bottom {
        font-size:8px;
        line-height:1.7
    }
    footer {
        font-size:8px;
        line-height:1.6
    }
    .online {
        font-size:8px
    }
}

@media(prefers-reduced-motion:reduce) {
    *,*:before,*:after {
        animation-duration:.01ms!important;
        transition-duration:.01ms!important
    }
}

/* Keep the long JSAL wordmark readable on smaller screens. */
h1 {
    font-size:clamp(30px,5.9vw,74px);
    letter-spacing:-.075em;
    line-height:1.02;
    overflow-wrap:anywhere
}

.brand-break {
    display:block
}

.hero {
    align-items:center
}

@media(max-width:620px) {
    h1 {
        font-size:clamp(29px,8.4vw,52px)
    }
    .hero {
        padding-top:35px
    }
}

/* Public GitHub repository link in the footer */
.source-link {
    display: inline-flex;
    align-items: center;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--fg);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-decoration: none;
    transition: background 0.18s, border-color 0.18s;
}

.source-link:hover {
    background: #222;
    border-color: #eee;
}

.source-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}
