/* =========================================================
   FIGHTDLE — GUESS THE KNOCKOUT
   Fonts, tokens and focus states come from /shared/brand.css; the logo,
   mode bar, modals and footer from /shared/layout.css. The page shell below
   is the same as Higher or Lower's, so the two sit identically.
   ========================================================= */

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: var(--font-body);
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    color: var(--ink);
    text-align: center;
    overflow: auto;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(to bottom, rgba(0,0,0,.35) 0%, rgba(0,0,0,.55) 50%, rgba(0,0,0,.78) 100%),
        url('/IMAGES/BACKGROUNDFINAL.png') center / cover no-repeat;
    background-color: #101010;
}

.container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding-bottom: 50px;
}

@media (max-width: 768px) {
    body { overflow-x: hidden; }
    .container { width: 100%; padding: 15px; }
}

/* === GAME === */
.ko-game {
    margin: 20px auto 0;
    width: 100%;
    max-width: 720px;
    padding: 0 4px;
}

/* === HEADING === */
.ko-heading {
    display: flex;
    justify-content: center;
    margin: 0 0 10px;
}

.ko-title-pill {
    font-family: var(--font-display);
    font-size: clamp(15px, 3.8vw, 19px);
    letter-spacing: .03em;
    color: var(--gold);
    background: rgba(30, 30, 30, .88);
    border: 2px solid var(--gold);
    border-radius: var(--radius-sm);
    padding: 7px 15px;
    white-space: nowrap;
}

/* Level chips, sitting just above the clip. */
.ko-levels {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 0 0 8px;
}

.ko-level-chip {
    min-width: 70px;
    padding: 7px 12px;
    font-family: var(--font-display);
    font-size: clamp(14px, 3.4vw, 17px);
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    background: rgba(30, 30, 30, .8);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
}

.ko-level-chip.is-current {
    background: var(--gold);
    border-color: var(--gold);
    color: #1a1a1a;
}

.ko-level-chip.is-done {
    background: rgba(30, 30, 30, .5);
    border-color: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .3);
}

/* === HOW TO PLAY ===
   Values from the computed styles of Connections' "How to play" panel. */
.ko-howto {
    margin: 0 auto 14px;
    padding: 14px 14px 12px;
    background: rgba(30, 30, 30, .85);
    border: 2px solid var(--gold);
    border-radius: 10px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .5);
}

.ko-howto h2 {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 5vw, 1.9rem);
    font-weight: 400;
    letter-spacing: .5px;
    color: #fff;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.ko-howto ul {
    margin: 0;
    padding-left: 18px;
    list-style-position: inside;
}

.ko-howto li {
    margin: 8px 0;
    font-size: clamp(.98rem, 2.6vw, 1.02rem);
    line-height: 1.35;
    color: #e9e9e9;
}

.ko-howto li::marker { color: var(--gold); }
.ko-howto strong { color: var(--gold); }

/* === THE CLIP === */
.ko-stage {
    position: relative;
    width: 100%;
    background: #000;
    border: 2px solid var(--gold);
    border-radius: 14px;
    overflow: hidden;
}

/* The clips are 16:9. Fixing the box to that ratio means swapping to the next
   level's file can't make the page jump while the new one loads. */
.ko-stage video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #000;
    /* The level files are small and get scaled up to fit. Smooth scaling
       would blur the block edges into mush; this keeps them hard. */
    image-rendering: pixelated;
    -webkit-user-select: none;
    user-select: none;
}

/* The full clip is real footage, so it gets normal smooth scaling back. */
.ko-stage.is-revealed video { image-rendering: auto; }

/* Level 1 is Level 2's own file with the colour taken out, so no extra clip
   is needed. Moving on to Level 2 keeps the same video playing and just lets
   the colour fade back in. */
.ko-stage video { transition: filter .6s var(--ease); }
.ko-stage.is-grey video { filter: grayscale(1); }

.ko-tap,
.ko-error {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    margin: 0;
    font-family: var(--font-display);
    font-size: 20px;
    letter-spacing: .04em;
    color: var(--ink);
    background: rgba(0, 0, 0, .6);
    border: none;
    border-radius: 0;
    cursor: pointer;
}

.ko-stage.needs-tap .ko-tap { display: grid; }
.ko-stage.has-error .ko-error { display: grid; cursor: default; }

/* === SCREEN-READER ONLY === */
.ko-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* === GUESS INPUT === */
.ko-play { margin-top: 14px; }

/* "Guesses" as a small heading with the hearts in a row beneath it. */
.ko-hearts-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.ko-hearts-label {
    font-family: var(--font-display);
    font-size: clamp(18px, 4.6vw, 22px);
    letter-spacing: .03em;
}

.ko-hearts { display: flex; }

/* Connections' heart size and spacing. Lost hearts are the black heart itself
   rather than a faded red one, so there's no mistaking which are spent. */
.ko-heart {
    font-size: 18px;
    line-height: 1;
    margin: 0 2px;
}

/* A black heart on a near-black page all but disappears, so the spent ones
   get a thin light edge: still clearly black, but you can see the shape. */
.ko-heart.is-lost {
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, .85)) drop-shadow(0 0 1px rgba(255, 255, 255, .5));
}

/* Positioning context for the suggestion list, so it hangs off the box. */
.ko-input-wrap {
    position: relative;
    width: min(360px, 100%);
    margin: 0 auto;
}

/* Matches Classic's guess box: gold-framed, translucent field, red button. */
.ko-input-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #333232;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--gold);
}

.ko-input-box input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    font-size: 16px;               /* below 16px iOS zooms in on focus */
    font-family: var(--font-body);
    letter-spacing: .02em;
    color: var(--ink);
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: var(--radius-sm);
    text-align: center;
}

.ko-input-box input::placeholder { color: rgba(255, 255, 255, .55); letter-spacing: .03em; }
.ko-input-box input:focus { border-color: var(--gold); background: rgba(255, 255, 255, .14); }

.ko-input-box button {
    padding: 12px 18px;
    background: var(--wrong);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.ko-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 244px;
    overflow-y: auto;
    /* Solid, not translucent: the list sits over the Skip button and the
       footer, and at 96% opacity their text bled through behind the names. */
    background: #0b0b0b;
    border: 1px solid rgba(255, 255, 255, .5);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .6);
    border-radius: var(--radius-sm);
}

.ko-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 10px;
    font-family: var(--font-body);
    font-size: 16px;
    letter-spacing: normal;
    color: var(--ink);
    text-align: left;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, .15);
    border-radius: 0;
    cursor: pointer;
}

.ko-option img {
    width: 44px;
    height: 34px;
    object-fit: cover;
    object-position: top center;
    border-radius: 6px;
    flex: 0 0 auto;
}

@media (hover: hover) {
    .ko-option:hover { background: rgba(255, 255, 255, .1); }
    .ko-skip:hover { color: var(--ink); border-color: var(--gold); }
}

.ko-skip {
    margin-top: 12px;
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 14px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ink-soft);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.ko-message {
    min-height: 1.3em;
    margin: 10px 0 0;
    font-size: 15px;
    color: var(--ink-soft);
}

/* === PREVIOUS GUESSES ===
   Values taken from the computed styles of Picture mode's guess cards, so
   the two modes' lists look the same: solid red or green card, light
   outline, round face over the name, newest on top. */
.ko-previous {
    margin: 20px auto 0;
    width: min(430px, 100%);
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, .5);
}

.ko-previous__header {
    margin: 20.8px 0 10px;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    letter-spacing: .02em;
    color: #fff;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.ko-previous__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ko-guess-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    color: #fff;
    border: 1px solid rgb(221, 218, 218);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .4);
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.ko-guess-box.is-correct { background-color: rgba(59, 188, 11, .824); }
.ko-guess-box.is-wrong   { background-color: rgb(170, 62, 62); }
/* Picture has no skips; a neutral card keeps them clearly neither. */
.ko-guess-box.is-skip    { background-color: rgb(70, 70, 70); }

.ko-guess-box img,
.ko-guess-box__blank {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 1px solid #fff;
    background-color: #000;
    object-fit: cover;
    object-position: top center;
}

.ko-guess-box__blank {
    display: grid;
    place-items: center;
    font-size: 28px;
    color: rgba(255, 255, 255, .6);
}

.ko-guess-box__name { font-size: 16px; }

.ko-guess-box__level {
    margin-top: -3px;
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
    opacity: .85;
}

/* Picture's pop-in, played on the guess just made. */
.ko-pop { animation: ko-pop-in .25s ease-out; }

@keyframes ko-pop-in {
    0%   { transform: scale(.7); opacity: 0; }
    80%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

/* === RESULT CARD ===
   Built on Classic's victory-card markup. The shell (panel, border, heading
   colour, portrait ring, name) comes from shared/victory.css; the layout
   below is what Classic adds in its own stylesheet, copied from its computed
   values since this page doesn't load that file. */
.ko-result {
    margin-top: 20px;
    /* When scrolled to, clear the fixed bookmark bar (whose height is only
       set while it's showing) instead of landing underneath it. */
    scroll-margin-top: calc(var(--bm-bar-height, 0px) + 14px);
}

.ko-result .victory-header {
    padding: 12px 18px 6px;
    text-align: center;
}

.ko-result h1.is-loss { color: var(--wrong); }

.ko-result .victory-subtitle { text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; }

.ko-result .victory-body {
    display: grid;
    gap: 10px;
    padding: 12px 18px 14px;
}

.ko-result .victory-fighter {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, .22);
    border: 1px solid rgba(255, 255, 255, .10);
}

.ko-result .victory-fighter-text {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.ko-result .victory-fighter-text .muted {
    margin: 0;
    font-size: 13px;
    opacity: .85;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.ko-answer-detail {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--ink-soft);
}

.ko-result .challenge-friend {
    margin: 10px 0 6px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .2px;
    opacity: .95;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.ko-result .challenge-friend::before,
.ko-result .challenge-friend::after {
    content: "";
    display: inline-block;
    width: 28px;
    height: 2px;
    margin: 0 10px;
    vertical-align: middle;
    background: currentColor;
    opacity: .25;
}

.ko-result .victory-actions { display: flex; gap: 10px; }

.ko-result .victory-btn.primary {
    flex: 1;
    margin: 5px 0 0;
    padding: 12px 20px;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .8px;
    color: rgb(16, 37, 15);
    background: var(--correct);
    border: 2px solid var(--correct);
    border-radius: 8px;
    cursor: pointer;
}

/* === TODAY'S RESULTS ===
   A plain distribution: one measure across four outcomes, one series, so
   one colour for every bar (gold, 6.9:1 against the card) and no legend —
   the heading names it. Every bar carries its own percentage, so there are
   no ticks or gridlines, just the baseline the bars grow from. */
.ko-stats {
    margin: 0 0 16px;
    text-align: left;
}

/* Scoped under .ko-result on purpose: victory.css styles every h2 in a
   victory card as a big green heading, and `.victory-card h2` outranks a lone
   class, so this subheading was rendering as loud as "KNOCKOUT!" itself. */
.ko-result .ko-stats__title {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: 17px;
    letter-spacing: .03em;
    color: var(--ink);
    text-align: center;
}

.ko-stats__rows {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Label | plot | value. The value gets its own column so a long bar can
   never run into it or clip it. */
.ko-stat {
    display: grid;
    grid-template-columns: 64px 1fr 40px;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    padding: 0 4px;
}

.ko-stat__label {
    font-size: 14px;
    color: var(--ink-soft);
    white-space: nowrap;
}

.ko-stat__plot {
    display: flex;
    align-items: center;
    height: 100%;
    border-left: 1px solid rgba(255, 255, 255, .18);
}

.ko-stat__bar {
    height: 14px;
    /* square where it leaves the baseline, rounded at the data end */
    border-radius: 0 4px 4px 0;
    background: var(--gold);
}

.ko-stat__value {
    font-size: 14px;
    color: var(--ink);
    text-align: right;
    /* the values stack in a column, so let the digits line up */
    font-variant-numeric: tabular-nums;
}

/* === NO CLIP YET === */
.ko-empty {
    margin: 24px auto 0;
    width: min(420px, 100%);
    padding: 24px 20px;
    background: rgba(30, 30, 30, .88);
    border: 2px solid var(--gold);
    border-radius: var(--radius);
}

.ko-empty h2 { margin: 0 0 8px; font-family: var(--font-display); letter-spacing: .03em; }
.ko-empty p  { margin: 0; color: var(--ink-soft); }
