/* WHO SAID THAT? -- case-file redesign
   Materials: kraft folder desk, typewritten dossier sheet, a chat screenshot
   taped in as evidence, highlighter for the tells, rubber stamps for verdicts. */

:root {
    color-scheme: light;

    --desk: #c7b48c;          /* kraft folder the whole file sits on */
    --sheet: #f7f2e6;         /* dossier paper */
    --panel: #ebe3cf;         /* inset blocks on the sheet */
    --chatbg: #ffffff;        /* the screenshot itself */
    --ink: #1a150e;
    --ink-soft: #6f6450;
    --hl: #ffd60a;            /* highlighter */
    --stamp: #c81d11;         /* rubber-stamp red */
    --good: #1d7a44;          /* rubber-stamp green */
    --tape: rgba(255, 255, 255, 0.5);
    --line: 2.5px;

    --display: "Anton", "Arial Black", "Helvetica Neue", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --chat: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background-color: var(--desk);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23n)' opacity='0.07'/></svg>");
    color: var(--ink);
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

mark {
    color: inherit;
    background: transparent;
}

kbd {
    font-family: inherit;
    font-size: 0.9em;
    padding: 0 4px;
    margin: 0 1px;
    border: 1.5px solid var(--ink-soft);
    border-bottom-width: 2.5px;
}

/* ---------------------------------------------------------------- case file */

.case-file {
    max-width: 740px;
    margin: 0 auto;
    padding: 0 18px 56px;
}

/* ----------------------------------------------------------------- masthead */

.masthead {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 -18px 40px;
    padding: 16px 18px 14px;
    background: var(--ink);
    color: var(--sheet);
    border-bottom: 4px solid var(--hl);
}

.brand {
    min-width: 0;
}

.kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 10px;
    letter-spacing: 0.24em;
    opacity: 0.65;
}

.dot {
    width: 9px;
    height: 9px;
    background: var(--hl);
}

.logo {
    margin: 0;
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(24px, 5vw, 34px);
    letter-spacing: 0.015em;
    line-height: 1.05;
    text-transform: uppercase;
}

.logo-accent {
    color: var(--ink);
    background: var(--hl);
    padding: 0 0.14em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.score {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
}

.score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 64px;
    padding: 6px 8px 7px;
    border: 2px solid var(--sheet);
}

.score-box-solved {
    border-color: var(--hl);
}

.score-box-solved .score-num {
    color: var(--hl);
}

.score-label {
    font-size: 9px;
    letter-spacing: 0.22em;
    opacity: 0.65;
}

.score-num {
    font-family: var(--display);
    font-weight: 400;
    font-size: 21px;
    line-height: 1.15;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------- stage */

.stage {
    min-height: 0;
}

/* the dossier sheet */

.card {
    position: relative;
    background: var(--sheet);
    border: var(--line) solid var(--ink);
    box-shadow: 9px 9px 0 rgba(26, 21, 14, 0.32);
    padding: 24px 22px 22px;
    animation: pop 0.18s steps(2) both;
}

@keyframes pop {
    from {
        transform: translateY(6px);
        opacity: 0;
    }
}

/* ----------------------------------------------------- folder tab / exhibit */

.exhibit {
    position: absolute;
    top: 0;
    left: 16px;
    transform: translateY(-100%);
    margin: 0;
    padding: 7px 14px 6px;
    background: var(--sheet);
    border: var(--line) solid var(--ink);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--ink-soft);
    white-space: nowrap;
}

.exhibit b {
    color: var(--ink);
    font-weight: 600;
    background: var(--hl);
    padding: 1px 5px;
}

/* ----------------------------------------------------------------- prompt */

.prompt-line {
    display: flex;
    gap: 12px;
    align-items: baseline;
    margin: 0 0 24px;
    padding: 10px 12px;
    background: var(--panel);
    border-left: 7px solid var(--ink);
}

.prompt-text {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.45;
}

/* ----------------------------------------- the evidence: a taped screenshot */

.bubble {
    position: relative;
    border: var(--line) solid var(--ink);
    box-shadow: 6px 6px 0 rgba(26, 21, 14, 0.85);
    background: var(--chatbg);
    transform: rotate(-0.5deg);
    margin: 0 2px;
}

/* two strips of tape holding the screenshot in the file */

.bubble::before,
.bubble::after {
    content: "";
    position: absolute;
    z-index: 2;
    width: 84px;
    height: 24px;
    top: -13px;
    background: var(--tape);
    border: 1px solid rgba(26, 21, 14, 0.14);
    box-shadow: 0 1px 2px rgba(26, 21, 14, 0.1);
    pointer-events: none;
}

.bubble::before {
    left: -22px;
    transform: rotate(-37deg);
}

.bubble::after {
    right: -22px;
    transform: rotate(37deg);
}

.bubble-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: var(--ink);
    color: var(--sheet);
}

.avatar {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display);
    font-size: 17px;
    background: var(--hl);
    color: var(--ink);
}

.sender {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--display);
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0.06em;
}

.redact {
    display: inline-block;
    width: 96px;
    max-width: 38vw;
    height: 13px;
    background: var(--sheet);
    opacity: 0.85;
}

.badge {
    flex-shrink: 0;
    font-size: 9px;
    letter-spacing: 0.16em;
    padding: 3px 6px;
    border: 1.5px solid var(--hl);
    color: var(--hl);
}

/* the message itself reads like a real chat app, not like the dossier */

.bubble-body {
    padding: 17px 18px 20px;
    font-family: var(--chat);
    font-size: 15px;
    line-height: 1.65;
    letter-spacing: 0.002em;
}

.bubble-body b {
    font-weight: 700;
}

/* the tells: invisible until the case is revealed, then a highlighter
   sweeps across them one by one */

.bubble-body .tell {
    background-image: linear-gradient(100deg, var(--hl), var(--hl));
    background-repeat: no-repeat;
    background-size: 0% 100%;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    padding: 1px 2px;
    margin: -1px -2px;
    transition: background-size 0.35s ease-out;
}

.card.revealed .tell {
    background-size: 100% 100%;
}

.card.revealed .tell:nth-of-type(1) { transition-delay: 0.04s; }
.card.revealed .tell:nth-of-type(2) { transition-delay: 0.12s; }
.card.revealed .tell:nth-of-type(3) { transition-delay: 0.2s; }
.card.revealed .tell:nth-of-type(4) { transition-delay: 0.28s; }
.card.revealed .tell:nth-of-type(5) { transition-delay: 0.36s; }
.card.revealed .tell:nth-of-type(6) { transition-delay: 0.44s; }

/* ------------------------------------------------------------ rubber stamp */

.stamp {
    position: absolute;
    z-index: 3;
    right: 12px;
    bottom: 12px;
    pointer-events: none;
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(21px, 5.6vw, 28px);
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--stamp);
    border: 2.5px solid var(--stamp);
    outline: 2.5px solid var(--stamp);
    outline-offset: 3px;
    padding: 6px 14px 7px;
    transform: rotate(-7deg);
    opacity: 0.92;
    mix-blend-mode: multiply;
    animation: slam 0.28s cubic-bezier(0.2, 1.3, 0.4, 1) 0.12s backwards;
}

.stamp.is-good {
    color: var(--good);
    border-color: var(--good);
    outline-color: var(--good);
}

@keyframes slam {
    from {
        transform: rotate(-7deg) scale(2.3);
        opacity: 0;
    }
    65% {
        transform: rotate(-7deg) scale(0.96);
        opacity: 0.92;
    }
}

/* -------------------------------------------------------------------- ask */

.ask {
    margin: 26px 0 12px;
    font-family: var(--display);
    font-weight: 400;
    font-size: 19px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* --------------------------------------------------------------- suspects */

.suspects {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.suspect {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px 14px;
    text-align: left;
    background: var(--sheet);
    border: var(--line) solid var(--ink);
    box-shadow: 4px 4px 0 var(--ink);
    transition: none;
}

.suspect:hover:not(:disabled) {
    background: var(--ink);
    color: var(--sheet);
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--ink);
}

.suspect:focus-visible {
    outline: var(--line) solid var(--ink);
    outline-offset: 3px;
}

/* mugshot placard number */

.suspect-no {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-family: var(--display);
    font-weight: 400;
    font-size: 16px;
    border: 2px solid currentColor;
    font-variant-numeric: tabular-nums;
}

.suspect-name {
    font-family: var(--display);
    font-weight: 400;
    font-size: 17px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.suspect-mark {
    font-family: var(--display);
    font-size: 19px;
    opacity: 0;
}

.suspect:disabled {
    cursor: default;
}

.suspect.is-correct {
    background: var(--good);
    color: #fff;
    border-color: var(--ink);
    box-shadow: 4px 4px 0 var(--ink);
    transform: none;
}

.suspect.is-correct .suspect-mark {
    opacity: 1;
}

.suspect.is-wrong {
    background: var(--stamp);
    color: #fff;
    border-color: var(--ink);
    transform: none;
    box-shadow: 4px 4px 0 var(--ink);
}

.suspect.is-wrong .suspect-name {
    text-decoration: line-through;
    text-decoration-thickness: 2.5px;
}

.suspect.is-wrong .suspect-mark {
    opacity: 1;
}

.suspect.is-mute {
    opacity: 0.4;
    box-shadow: none;
    transform: none;
}

/* ------------------------------------------------------------------- hint */

.hint {
    margin: 12px 2px 0;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

@media (pointer: coarse) {
    .hint {
        display: none;
    }
}

/* once the verdict lands, clear the lineup so NEXT CASE is reachable without scrolling */
.card.revealed .ask,
.card.revealed .suspects,
.card.revealed .hint {
    display: none;
}

/* ---------------------------------------------------------------- verdict */

.verdict {
    margin-top: 20px;
    padding: 16px;
    border: var(--line) solid var(--ink);
    background: var(--ink);
    color: var(--sheet);
    box-shadow: 6px 6px 0 var(--hl);
    animation: pop 0.18s steps(2) 0.18s backwards;
}

.verdict[hidden] {
    display: none;
}

.verdict-line {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

.verdict-line b {
    font-family: var(--display);
    font-weight: 400;
    font-size: 15px;
    letter-spacing: 0.05em;
    color: var(--hl);
}

.flag {
    display: inline-block;
    margin-right: 8px;
    font-size: 9px;
    letter-spacing: 0.16em;
    padding: 2px 6px;
    background: var(--hl);
    color: var(--ink);
}

.verdict-tells {
    margin: 12px 0 0;
    font-size: 13px;
    line-height: 1.65;
    opacity: 0.92;
}

.verdict-tells .flag {
    background: transparent;
    color: var(--hl);
    border: 1.5px solid var(--hl);
}

/* ------------------------------------------------------------------- next */

.next {
    margin-top: 16px;
    width: 100%;
    padding: 13px;
    font-family: var(--display);
    font-weight: 400;
    font-size: 18px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--hl);
    color: var(--ink);
    border: var(--line) solid var(--ink);
    box-shadow: 5px 5px 0 var(--ink);
    transition: none;
}

.next:hover {
    transform: translate(2px, 2px);
    box-shadow: 3px 3px 0 var(--ink);
}

.next:active {
    transform: translate(5px, 5px);
    box-shadow: 0 0 0 var(--ink);
}

.next:focus-visible {
    outline: var(--line) solid var(--ink);
    outline-offset: 3px;
}

.verdict .next:focus-visible {
    outline-color: var(--sheet);
}

/* ------------------------------------------------------------ end screen */

.verdict-screen {
    text-align: center;
    padding: 38px 24px 28px;
}

.stamp-final {
    position: static;
    display: inline-block;
    transform: rotate(-5deg);
    margin: 4px 0 22px;
    font-size: clamp(26px, 7vw, 38px);
    animation-delay: 0.25s;
}

.rank-score {
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.24em;
    color: var(--ink-soft);
}

.rank-score b {
    font-family: var(--display);
    font-weight: 400;
    font-size: 28px;
    letter-spacing: 0.04em;
    color: var(--ink);
    padding: 0 6px;
}

.rank {
    margin: 18px 0 0;
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(34px, 8vw, 58px);
    line-height: 1.04;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.rank .hl {
    background: var(--hl);
    padding: 0 12px 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.rank-flavor {
    margin: 18px auto 0;
    max-width: 46ch;
    font-size: 14px;
    line-height: 1.65;
}

.meter {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin: 24px 0 4px;
}

.meter-cell {
    width: 28px;
    height: 15px;
    border: 2px solid var(--ink);
    background: var(--sheet);
}

.meter-cell.on {
    background: var(--hl);
    box-shadow: inset 0 0 0 2px var(--sheet);
}

.verdict-screen .next {
    margin-top: 28px;
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 540px) {
    .masthead {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 34px;
    }

    .score {
        justify-content: flex-start;
    }

    .card {
        padding: 20px 14px 18px;
    }

    .exhibit {
        left: 10px;
        padding: 6px 10px 5px;
        letter-spacing: 0.14em;
    }

    .suspect {
        grid-template-columns: 34px 1fr auto;
        gap: 10px;
    }

    .suspect-name {
        font-size: 15px;
    }

    .bubble::before {
        left: -12px;
    }

    .bubble::after {
        right: -12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .card,
    .verdict,
    .stamp {
        animation: none;
    }

    .suspect,
    .next,
    .bubble-body .tell {
        transition: none;
    }

    .card.revealed .tell {
        transition-delay: 0s;
    }
}
