/* ============ theme ============ */
:root {
    --bg: #0e1f1c;
    --panel: #16302b;
    --line: #2b4a43;
    --chalk: #e8efe9;
    --dim: #7f9a92;
    --miss: #4d625c;
    --r1: #3b8dff;
    --r2: #34c26b;
    --r3: #f0b92e;
    --r4: #d946ef;
    --r5: #f97316;
    --r6: #ef4444;
    --fx: rgba(255, 255, 255, .035);
    --good: #2f9e5a;
    --bad: #3a2a2a;
    --msg: #ffb4a8;
    --chipbad: #e6c7c7;
    --you: #3b8dff;
    --opp: #ff8a3d;
    --head: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
    --body: 'Figtree', system-ui, sans-serif;
    color-scheme: dark;
}

/* Dark is the default. Light is opt-in with the "Light" switch in the header (it sets data-scheme="light" on <html>). */
:root[data-scheme="light"] {
    --bg: #f3f1ea;
    --panel: #ffffff;
    --line: #cdd5cf;
    --chalk: #14231f;
    --dim: #5d736b;
    --miss: #9aa9a3;
    --r1: #2a6fd6;
    --r2: #22a45a;
    --r3: #e0a410;
    --r4: #b832c7;
    --r5: #d9650b;
    --r6: #c93636;
    --fx: rgba(0, 0, 0, .045);
    --bad: #ece1e1;
    --msg: #b3261e;
    --chipbad: #6b4a4a;
    color-scheme: light;
}

/* "Patterns" switch: colour-blind-friendly colours (here) plus a pattern on each dot (bottom of this file) */
:root[data-theme="Patterns"] {
    --r1: #56B4E9;
    --r2: #009E73;
    --r3: #F0E442;
    --r4: #CC79A7;
    --r5: #E69F00;
    --r6: #D55E00;
}

* {
    box-sizing: border-box
}

[hidden] {
    display: none !important
}

html,
body {
    margin: 0
}

html {
    scrollbar-gutter: stable
}

body {
    background: var(--bg);
    color: var(--chalk);
    font-family: var(--body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 24px 14px 48px;
}

main {
    width: 100%;
    max-width: 560px;
    position: relative;
    z-index: 1
}

h1 {
    font: 900 clamp(2.4rem, 9vw, 3.6rem)/.95 var(--head);
    margin: 0;
    letter-spacing: .01em;
    white-space: nowrap
}

h2 {
    font: 900 1.7rem var(--head);
    margin: 0 0 6px
}

.sub {
    color: var(--dim);
    margin: 6px 0 16px
}

.dim {
    color: var(--dim)
}

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    flex-wrap: wrap
}

.topRight {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto
}

.topRight .switch {
    font-size: .8rem;
    color: var(--dim);
    font-weight: 600
}

/* ============ buttons + inputs ============ */
button {
    padding: 12px 18px;
    border-radius: 8px;
    border: 0;
    background: var(--r3);
    color: #1c1503;
    font: 700 1rem var(--body);
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, filter .2s, background .2s, border-color .2s;
}

button:disabled,
input:disabled {
    opacity: .45;
    cursor: not-allowed
}

button.primary {
    background: linear-gradient(180deg, #ffd45e, var(--r3) 55%, #d9a21a);
    box-shadow: 0 3px 0 #9c7410, inset 0 1px 0 rgba(255, 255, 255, .5)
}

button.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.06)
}

button.primary:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #9c7410
}

button.alt {
    background: var(--panel);
    color: var(--chalk);
    border: 1px solid var(--line)
}

button.alt:hover:not(:disabled) {
    border-color: var(--r3)
}

button.big {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem
}

input[type="text"],
input:not([type]) {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--chalk);
    font: inherit;
}

input:focus-visible,
button:focus-visible {
    outline: 2px solid var(--r3);
    outline-offset: 2px
}

#input:focus {
    border-color: var(--r3);
    box-shadow: 0 0 0 4px rgba(240, 185, 46, .18)
}

.pill {
    font-size: .75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--dim);
    white-space: nowrap
}

.pill[data-state="online"] {
    color: #7dffa8;
    border-color: #2f9e5a
}

.pill[data-state="reconnecting"],
.pill[data-state="replaced"] {
    color: var(--msg);
    border-color: var(--msg)
}

.banner {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 90, 77, .14);
    border: 1px solid var(--msg);
    color: var(--msg);
    font-weight: 600
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    display: grid;
    gap: 14px
}

.card.center {
    text-align: center;
    justify-items: center
}

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

.field>span {
    font-size: .8rem;
    color: var(--dim);
    font-weight: 600
}

.modeSeg {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px
}

.modeSeg button {
    display: grid;
    gap: 2px;
    padding: 10px 6px;
    background: var(--bg);
    color: var(--chalk);
    border: 1px solid var(--line)
}

.modeSeg button small {
    font: 400 .68rem var(--body);
    color: var(--dim)
}

.modeSeg button.on {
    border-color: var(--r3);
    box-shadow: 0 0 0 3px rgba(240, 185, 46, .2)
}

.modeSeg button:disabled {
    opacity: .35
}

.switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    position: relative;
    font-weight: 600
}

.switch small {
    color: var(--dim);
    font-weight: 400
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0
}

.track {
    width: 38px;
    height: 22px;
    border-radius: 22px;
    background: var(--line);
    position: relative;
    flex: none;
    transition: background .2s
}

.track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--chalk);
    transition: transform .3s cubic-bezier(.3, 1.6, .5, 1)
}

.switch input:checked+.track {
    background: linear-gradient(90deg, #ff6a00, var(--r3));
    box-shadow: 0 0 12px rgba(255, 106, 0, .5)
}

.switch input:checked+.track::after {
    transform: translateX(16px)
}

.switch input:focus-visible+.track {
    outline: 2px solid var(--r3);
    outline-offset: 2px
}

.how {
    color: var(--dim);
    font-size: .85rem;
    padding-left: 20px;
    margin: 16px 0 0;
    display: grid;
    gap: 6px
}

.spinner {
    width: 46px;
    height: 46px;
    border: 4px solid var(--line);
    border-top-color: var(--r3);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 6px auto
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

/* ============ turn bar ============ */
.turnBar {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    transition: border-color .2s, box-shadow .2s
}

.turnBar.mine {
    border-color: var(--r3);
    box-shadow: 0 0 0 3px rgba(240, 185, 46, .18)
}

.vs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px
}

.vsTxt {
    color: var(--dim);
    font-weight: 700;
    font-size: .8rem
}

.who {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    opacity: .65;
    transition: opacity .2s, background .2s, border-color .2s
}

.who.turn {
    opacity: 1;
    border-color: var(--r3);
    background: rgba(240, 185, 46, .12)
}

.who b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.who small {
    color: var(--dim);
    font-size: .7rem
}

.clock {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px
}

#clockNum {
    font: 900 1.9rem/1 var(--head);
    min-width: 1.7em;
    text-align: center
}

.clockTrack {
    flex: 1;
    height: 8px;
    border-radius: 8px;
    background: var(--line);
    overflow: hidden
}

#clockBar {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--r1), var(--r3));
    transition: width .12s linear
}

.turnBar.low #clockBar {
    background: #ff5a4d
}

.turnBar.low #clockNum {
    color: #ff5a4d;
    animation: pulse .5s ease-in-out infinite alternate
}

@keyframes pulse {
    to {
        transform: scale(1.18)
    }
}

.turnBar.over .clock {
    display: none
}

.turnMsg {
    margin-top: 8px;
    font-weight: 600
}

/* ============ legend + dots + trail ============ */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: .78rem;
    color: var(--dim);
    margin: 0 0 10px
}

.legend span {
    display: flex;
    align-items: center;
    gap: 6px
}

.dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: .62rem;
    line-height: 1;
    font-style: normal
}

.dot.x {
    background: none;
    color: var(--miss);
    font-weight: 900;
    font-size: .8rem
}

.dot.t1 {
    background: var(--r1)
}

.dot.t2 {
    background: var(--r4)
}

.dot.t3 {
    background: var(--r2)
}

.dot.t4 {
    background: var(--r3)
}

.dot.t5 {
    background: none;
    font-size: .8rem
}

.dot.t6 {
    background: #000;
    box-shadow: 0 0 0 1px var(--line)
}

.dot.u1 {
    background: var(--r1)
}

.dot.u2 {
    background: var(--r4)
}

.dot.u3 {
    background: var(--r2)
}

.dot.u4 {
    background: var(--r5)
}

.dot.u5 {
    background: var(--r6)
}

.dot.u6 {
    background: var(--r3)
}

.dot.u7 {
    background: none;
    font-size: .8rem
}

.dot.u8 {
    background: #000;
    box-shadow: 0 0 0 1px var(--line)
}

.trail {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 10px
}

.season {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px
}

.season .dot {
    width: min(38px, 100%);
    aspect-ratio: 1;
    height: auto;
    font-size: 1.25rem
}

.season .dot.x {
    font-size: 1.5rem
}

.season .dot.t5,
.season .dot.u7 {
    font-size: 1.6rem
}

.season b {
    font: 700 .78rem var(--body);
    color: var(--dim)
}

.season.hidden .dot {
    border: 2px dashed var(--line);
    background: none;
    color: var(--line);
    font-weight: 700
}

.season.new .dot {
    animation: pop .45s ease-out
}

@keyframes pop {
    from {
        transform: scale(.4);
        opacity: 0
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

.status {
    display: flex;
    justify-content: space-between;
    margin: 14px 2px 10px;
    font-weight: 600
}

.status em {
    font-style: normal;
    color: var(--dim);
    font-weight: 400
}

/* ============ hints ============ */
.hints {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px
}

.hint {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--panel);
    min-height: 58px
}

.hint small {
    display: block;
    color: var(--dim);
    font-size: .75rem
}

.hint strong {
    font: 700 1.2rem var(--head);
    letter-spacing: .02em
}

.hint.on {
    background: var(--good);
    border-color: var(--good)
}

.hint.on small {
    color: #d6f2e0
}

.hint.on strong {
    color: #fff
}

.hint.part {
    background: var(--r3);
    border-color: var(--r3)
}

.hint.part small {
    color: #3b2e08
}

.hint.part strong {
    color: #1c1503
}

.hint.reveal {
    border-color: var(--r3)
}

/* ============ guess form + autocomplete ============ */
form {
    display: flex;
    gap: 8px
}

form.off {
    opacity: .7
}

.acWrap {
    position: relative;
    flex: 1;
    min-width: 0
}

.acList {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    margin: 0;
    padding: 4px;
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .4);
    transform-origin: top;
    animation: acOpen .18s cubic-bezier(.2, 1.2, .4, 1) both;
}

.acList.up {
    top: auto;
    bottom: calc(100% + 6px);
    transform-origin: bottom
}

.acList.closing {
    animation: acCollapse .18s ease-in forwards;
    pointer-events: none
}

@keyframes acOpen {
    from {
        opacity: 0;
        transform: scaleY(.88)
    }

    to {
        opacity: 1;
        transform: none
    }
}

@keyframes acCollapse {
    to {
        opacity: 0;
        transform: scaleY(.82)
    }
}

.acList li {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 9px 12px;
    min-height: 44px;
    border-radius: 8px;
    cursor: pointer
}

.acList li b {
    font-weight: 600
}

.acList li small {
    color: var(--dim);
    font-size: .75rem
}

.acList li:hover,
.acList li.on {
    background: var(--bg)
}

.shake {
    animation: shake .45s
}

@keyframes shake {

    10%,
    90% {
        transform: translateX(-2px)
    }

    20%,
    80% {
        transform: translateX(4px)
    }

    30%,
    50%,
    70% {
        transform: translateX(-7px)
    }

    40%,
    60% {
        transform: translateX(7px)
    }
}

/* ============ guess rows ============ */
#guesses {
    margin-top: 10px
}

.guess {
    display: grid;
    grid-template-columns: 1fr repeat(3, auto);
    gap: 6px;
    align-items: center;
    margin-top: 6px
}

.guess .n {
    font-weight: 600;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    border-radius: 8px;
    background: var(--panel);
    display: grid;
    gap: 1px
}

.guess.mine .n {
    border-left-color: var(--you)
}

.guess.theirs .n {
    border-left-color: var(--opp)
}

.guess .n small {
    font-size: .68rem;
    color: var(--dim);
    font-weight: 600
}

.guess.timed {
    grid-template-columns: 1fr
}

.guess.timed .n {
    color: var(--dim);
    font-weight: 400
}

.guess:first-child {
    animation: rowIn .4s cubic-bezier(.2, 1.2, .4, 1) both
}

@keyframes rowIn {
    from {
        opacity: 0;
        transform: translateY(-10px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.chip {
    padding: 8px 10px;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    background: var(--bad);
    color: var(--chipbad);
    min-width: 58px;
    text-align: center
}

.chip.ok {
    background: var(--good);
    color: #fff
}

.chip.part {
    background: var(--r3);
    color: #1c1503
}

.cdot {
    display: inline-block;
    font-style: normal;
    font-size: 1rem;
    line-height: 1;
    margin: 0 2px;
    filter: drop-shadow(1px 0 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 1px 0 #fff) drop-shadow(0 -1px 0 #fff)
}

@media (max-width: 420px) {
    .guess {
        grid-template-columns: 1fr 1fr 1fr
    }

    .guess .n {
        grid-column: 1 / -1
    }

    .guess.timed {
        grid-template-columns: 1fr
    }
}

/* ============ end card ============ */
.end {
    margin-top: 16px;
    padding: 16px;
    border-radius: 12px;
    background: var(--panel);
    border: 2px solid var(--r3);
    text-align: center;
    animation: endIn .5s cubic-bezier(.2, 1.3, .4, 1) both
}

.end.lost {
    border-color: #ff5a4d
}

.end.draw {
    border-color: var(--dim)
}

@keyframes endIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(.95)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.endHead {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px
}

.endHead h2 {
    margin: 0;
    font-size: 2rem
}

.bigTrophy {
    font-size: 2.4rem;
    line-height: 1;
    display: inline-block;
    animation: trophyIn 1.1s cubic-bezier(.3, 1.6, .5, 1) both
}

@keyframes trophyIn {
    0% {
        transform: translateY(-40px) scale(.2) rotate(-25deg);
        opacity: 0
    }

    60% {
        transform: translateY(6px) scale(1.15) rotate(8deg);
        opacity: 1
    }

    100% {
        transform: none
    }
}

.end p {
    margin: 6px 0;
    color: var(--dim)
}

.answerLine {
    color: var(--chalk) !important;
    font-size: 1.05rem
}

.answerSub {
    font-size: .85rem
}

.rematchNote {
    color: var(--r3) !important;
    font-weight: 700
}

.endBtns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px
}

/* ============ toast ============ */
.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 60;
    max-width: calc(100% - 28px);
    padding: 10px 16px;
    border-radius: 10px;
    background: #241a1a;
    color: #ffd6cf;
    border: 1px solid var(--msg);
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4)
}

.toast.show {
    animation: toastIn .25s ease both
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, 10px)
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0)
    }
}

#confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100lvh;
    pointer-events: none;
    z-index: 70
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important
    }
}


/* ================= PATTERNS: a non-colour marker on each dot (switch in the header) ================= */
:root[data-theme="Patterns"] .dot.t1,
:root[data-theme="Patterns"] .dot.t2,
:root[data-theme="Patterns"] .dot.t3,
:root[data-theme="Patterns"] .dot.t4,
:root[data-theme="Patterns"] .dot.u1,
:root[data-theme="Patterns"] .dot.u2,
:root[data-theme="Patterns"] .dot.u3,
:root[data-theme="Patterns"] .dot.u4,
:root[data-theme="Patterns"] .dot.u5,
:root[data-theme="Patterns"] .dot.u6 {
    position: relative;
    overflow: hidden
}

:root[data-theme="Patterns"] .dot.t1::after,
:root[data-theme="Patterns"] .dot.t2::after,
:root[data-theme="Patterns"] .dot.t3::after,
:root[data-theme="Patterns"] .dot.t4::after,
:root[data-theme="Patterns"] .dot.u1::after,
:root[data-theme="Patterns"] .dot.u2::after,
:root[data-theme="Patterns"] .dot.u3::after,
:root[data-theme="Patterns"] .dot.u4::after,
:root[data-theme="Patterns"] .dot.u5::after,
:root[data-theme="Patterns"] .dot.u6::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
}

/* diagonal stripes */
:root[data-theme="Patterns"] .dot.t1::after,
:root[data-theme="Patterns"] .dot.u1::after {
    background: repeating-linear-gradient(45deg, transparent 0 3px, rgb(0 0 0 / 38%) 3px 4px)
}

/* dots */
:root[data-theme="Patterns"] .dot.t2::after,
:root[data-theme="Patterns"] .dot.u2::after {
    background-image: radial-gradient(rgb(0 0 0 / 48%) 1px, transparent 1.5px);
    background-size: 5px 5px
}

/* horizontal stripes */
:root[data-theme="Patterns"] .dot.t3::after,
:root[data-theme="Patterns"] .dot.u3::after {
    background: repeating-linear-gradient(0deg, transparent 0 3px, rgb(0 0 0 / 38%) 3px 4px)
}

/* crosshatch */
:root[data-theme="Patterns"] .dot.t4::after,
:root[data-theme="Patterns"] .dot.u4::after {
    background: repeating-linear-gradient(45deg, transparent 0 4px, rgb(0 0 0 / 35%) 4px 5px), repeating-linear-gradient(-45deg, transparent 0 4px, rgb(0 0 0 / 35%) 4px 5px)
}

/* vertical stripes */
:root[data-theme="Patterns"] .dot.u5::after {
    background: repeating-linear-gradient(90deg, transparent 0 3px, rgb(0 0 0 / 38%) 3px 4px)
}

/* a single centre dot */
:root[data-theme="Patterns"] .dot.u6::after {
    background: radial-gradient(circle, rgb(0 0 0 / 55%) 0 1.5px, transparent 2px) center / 100% 100% no-repeat
}

/* ================= BACKGROUND: moving field stripes, glow, floating balls ================= */
.bgfx {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0
}

.bgfx::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -120px;
    right: 0;
    background: repeating-linear-gradient(100deg, transparent 0 60px, var(--fx) 60px 120px);
    animation: stripes 24s linear infinite
}

.bgfx::after {
    content: "";
    position: absolute;
    inset: -5%;
    background: radial-gradient(600px 420px at 12% 8%, rgba(59, 141, 255, .16), transparent 65%),
        radial-gradient(520px 420px at 92% 88%, rgba(240, 185, 46, .14), transparent 65%),
        radial-gradient(420px 360px at 80% 20%, rgba(217, 70, 239, .08), transparent 65%);
    opacity: .7;
    animation: blobs 16s ease-in-out infinite alternate
}

.bgfx span {
    position: absolute;
    top: 0;
    z-index: 1;
    will-change: transform;
    animation: ballUp linear infinite
}

@keyframes stripes {
    to {
        transform: translateX(120px)
    }
}

@keyframes blobs {
    to {
        transform: translate3d(-3%, 2%, 0) scale(1.08)
    }
}

@keyframes ballUp {
    from {
        transform: translate3d(0, 110vh, 0) rotate(0deg)
    }

    to {
        transform: translate3d(var(--drift), -20vh, 0) rotate(var(--spin))
    }
}

/* ================= TICKER ================= */
.ticker {
    overflow: hidden;
    white-space: nowrap;
    margin: 0 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--dim);
    font: 700 .72rem var(--body);
    letter-spacing: .14em;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent)
}

.tickerTrack {
    display: inline-block;
    padding: 7px 0;
    animation: tick 30s linear infinite
}

.tickerTrack span {
    padding-right: 1.4em
}

.ticker:hover .tickerTrack {
    animation-play-state: paused
}

@keyframes tick {
    to {
        transform: translateX(-50%)
    }
}

/* ================= TITLE + BUTTONS ================= */
.siteTitle {
    padding-bottom: .14em;
    margin-bottom: -.14em;
    background: linear-gradient(90deg, var(--chalk) 0%, var(--r3) 25%, var(--r1) 50%, var(--r3) 75%, var(--chalk) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: shimmer 7s linear infinite
}

@keyframes shimmer {
    to {
        background-position: 200% 0
    }
}

button:disabled {
    transform: none !important;
    box-shadow: none !important
}

button.primary {
    position: relative;
    overflow: hidden;
    box-shadow: 0 3px 0 #9c7410, 0 8px 18px rgba(240, 185, 46, .25), inset 0 1px 0 rgba(255, 255, 255, .5)
}

button.primary::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    left: -60%;
    transform: skewX(-20deg);
    transition: left .5s;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent)
}

button.primary:hover:not(:disabled)::after {
    left: 130%
}

button.alt:hover:not(:disabled) {
    box-shadow: 0 0 0 3px rgba(240, 185, 46, .2)
}

.modeSeg button {
    transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), border-color .2s, box-shadow .2s
}

.modeSeg button:hover:not(:disabled) {
    transform: translateY(-3px)
}

.switch input:checked+.track {
    box-shadow: 0 0 12px rgba(240, 185, 46, .55)
}

/* ================= TRAIL, LEGEND, HINTS, GUESSES ================= */
.trail {
    box-shadow: 0 10px 30px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .05)
}

.season.hidden .dot {
    animation: breathe 2.4s ease-in-out infinite
}

.season.hidden:nth-child(3n) .dot {
    animation-delay: .4s
}

.season.hidden:nth-child(3n+1) .dot {
    animation-delay: .8s
}

@keyframes breathe {

    0%,
    100% {
        opacity: .5
    }

    50% {
        opacity: 1
    }
}

.season:not(.hidden) .dot {
    transition: transform .2s cubic-bezier(.3, 1.6, .5, 1)
}

.season:not(.hidden) .dot:hover {
    transform: scale(1.18)
}

.dot.t5,
.dot.u7 {
    animation: gleam 2.6s ease-in-out infinite
}

@keyframes gleam {

    0%,
    100% {
        filter: drop-shadow(0 0 0 rgba(240, 185, 46, 0))
    }

    50% {
        filter: drop-shadow(0 0 6px rgba(240, 185, 46, .95))
    }
}

.status {
    position: relative
}

.status::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    height: 3px;
    border-radius: 3px;
    width: calc(var(--p, 0) * 100%);
    background: linear-gradient(90deg, var(--r1), var(--r3));
    transition: width .6s ease
}

.legend span {
    animation: legIn .4s ease both;
    animation-delay: calc(var(--i, 0) * 45ms)
}

@keyframes legIn {
    from {
        opacity: 0;
        transform: translateX(-10px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.legend .dot {
    transition: transform .2s cubic-bezier(.3, 1.6, .5, 1)
}

.legend span:hover .dot {
    transform: scale(1.35)
}

.hint {
    position: relative;
    overflow: hidden
}

.hint.on::after,
.hint.part::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform: translateX(-120%);
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%);
    animation: sweep .9s .15s ease-out forwards
}

@keyframes sweep {
    to {
        transform: translateX(120%)
    }
}

/* newest guess (the first row): the chips flip over one by one */
.guess:first-child .chip {
    animation: flip .55s ease both
}

.guess:first-child .chip:nth-child(2) {
    animation-delay: .12s
}

.guess:first-child .chip:nth-child(3) {
    animation-delay: .26s
}

.guess:first-child .chip:nth-child(4) {
    animation-delay: .40s
}

@keyframes flip {
    0% {
        transform: perspective(400px) rotateX(90deg);
        opacity: 0
    }

    60% {
        transform: perspective(400px) rotateX(-14deg);
        opacity: 1
    }

    100% {
        transform: perspective(400px) rotateX(0)
    }
}

.acWrap input {
    padding-right: 34px
}

.acWrap::after {
    content: "▾";
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dim);
    pointer-events: none;
    transition: transform .25s cubic-bezier(.3, 1.5, .5, 1), color .2s
}

.acWrap:has(.acList:not([hidden]):not(.closing))::after {
    transform: translateY(-50%) rotate(180deg);
    color: var(--r3)
}

/* ================= END CARD: spinning rainbow border + shimmering headline ================= */
@property --ang {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg
}

@keyframes angle {
    to {
        --ang: 360deg
    }
}

.end {
    border: 2px solid transparent;
    animation: endIn .5s cubic-bezier(.2, 1.3, .4, 1) both, angle 5s linear infinite;
    background: linear-gradient(var(--panel), var(--panel)) padding-box, conic-gradient(from var(--ang), var(--r3), var(--r1), var(--r4), var(--r2), var(--r3)) border-box
}

.end.lost {
    background: linear-gradient(var(--panel), var(--panel)) padding-box, conic-gradient(from var(--ang), #ff5a4d, #8a1c1c, #ff9a8a, #ff5a4d) border-box
}

.end.draw {
    background: linear-gradient(var(--panel), var(--panel)) padding-box, conic-gradient(from var(--ang), var(--dim), var(--line), var(--chalk), var(--dim)) border-box
}

.end h2 {
    background: linear-gradient(90deg, var(--chalk), var(--r3), var(--chalk));
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: shimmer 3s linear infinite
}

.end.lost h2 {
    background-image: linear-gradient(90deg, var(--chalk), #ff5a4d, var(--chalk))
}

.bigTrophy {
    animation: trophyIn 1.1s cubic-bezier(.3, 1.6, .5, 1) both, gleam 2.4s 1.1s ease-in-out infinite
}

/* keep the confetti smooth: freeze the heavy loops while it plays (fx.js adds body.party) */
body.party .siteTitle,
body.party .end h2,
body.party .bgfx::before,
body.party .bgfx::after,
body.party .bgfx span,
body.party .tickerTrack {
    animation-play-state: paused
}

body.party .end,
body.party .bigTrophy {
    animation-play-state: running, paused
}

@media (max-width: 600px) {
    .bgfx span:nth-child(n+9) {
        display: none
    }
}

@media (max-width: 380px) {
    h1 {
        font-size: 2.2rem
    }
}

@media (prefers-reduced-motion: reduce) {
    .bgfx span {
        display: none
    }
}


/* ================= INVITE A FRIEND ================= */
.or {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dim);
    font-size: .8rem;
    font-weight: 600
}

.or::before,
.or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line)
}

.joinRow {
    display: flex;
    gap: 8px
}

.joinRow input {
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 700
}

.joinRow input::placeholder {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400
}

.roomCode {
    font: 900 3rem/1 var(--head);
    letter-spacing: .25em;
    padding: 10px 14px 10px 22px;
    border: 2px dashed var(--r3);
    border-radius: 12px;
    user-select: all
}

#roomLink {
    text-align: center;
    font-size: .85rem
}

.toast.ok {
    border-color: #2f9e5a;
    color: #d6f2e0;
    background: #12261c
}


/* ================= PRIVATE LOBBY (up to 7 players) ================= */
:root {
    --p0: #3b8dff;
    --p1: #ff8a3d;
    --p2: #34c26b;
    --p3: #b07cff;
    --p4: #ef4444;
    --p5: #f0b92e;
    --p6: #a97142
}

:root[data-theme="Patterns"] {
    --p0: #56B4E9;
    --p1: #E69F00;
    --p2: #009E73;
    --p3: #CC79A7;
    --p4: #D55E00;
    --p5: #F0E442;
    --p6: #8d6e63
}

.center {
    text-align: center
}

.card:has(.members) {
    gap: 12px
}

.roomHead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px
}

.roomHead h2 {
    margin: 0
}

.members {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px
}

.member {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg)
}

.member.you {
    border-color: var(--r3)
}

.member.away {
    opacity: .55
}

.mName {
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left
}

.mName small {
    color: var(--dim);
    font-weight: 400
}

.mRight {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none
}

.mWins {
    font-weight: 700;
    font-size: .85rem
}

.mReady {
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--dim)
}

.mReady.yes {
    color: #7dffa8;
    border-color: #2f9e5a
}

.members.board {
    margin: 10px 0
}

.lobbyHint {
    color: var(--dim);
    font-size: .85rem;
    margin: 6px 0
}

/* the bar at the top of a game: one chip per player, each with its own colour */
.vs {
    flex-wrap: wrap;
    justify-content: center
}

.who {
    padding: 5px 10px
}

.pmark {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--pc, var(--line));
    flex: none
}

.who.gone {
    opacity: .35;
    text-decoration: line-through
}

.who .wins {
    color: var(--r3);
    font-weight: 700
}

.guess .n {
    border-left-color: var(--pc, var(--line))
}

.turnRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px
}

.turnRow .turnMsg {
    margin-top: 0
}

button.tiny {
    padding: 5px 12px;
    font-size: .8rem
}
