:root {
    --ink: #f6f0e4;
    --muted: #bdb5a5;
    --red: #d64a3a;
    --green: #48a868;
    --gold: #d8aa48;
    --line: #343942;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: radial-gradient(circle at 50% -20%, #3c3022 0, #18191c 38%, #0d0f12 100%);
    font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

button, select { font: inherit; }
.app { max-width: 1080px; margin: auto; padding: 24px; }
.top { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.eyebrow { color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.title { margin: .2rem 0; font: 700 clamp(2rem, 5vw, 4rem)/.95 Georgia, serif; }
.subtitle, .hint { color: var(--muted); }

.score { display: flex; gap: 18px; padding: 13px 18px; border: 1px solid var(--line); border-radius: 16px; background: #111318cc; text-align: center; }
.score strong { display: block; font-size: 1.45rem; }
.score span { display: block; color: var(--muted); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.button, select { padding: 10px 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #20242b; cursor: pointer; }
.button:hover, .button:focus, select:focus { border-color: var(--gold); outline: none; }
.button.primary { border-color: var(--gold); color: #17130b; background: var(--gold); font-weight: 800; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.progress { height: 5px; margin-bottom: 18px; overflow: hidden; border-radius: 9px; background: #292d34; }
.progress i { display: block; width: 0; height: 100%; background: var(--gold); transition: width .3s; }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .65fr); gap: 22px; }
.card, .side { border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(145deg, #20242b, #121419); box-shadow: 0 24px 70px #0008; }
.card { display: flex; min-height: 610px; overflow: hidden; flex-direction: column; }
.portrait { position: relative; display: flex; height: 420px; align-items: center; justify-content: center; background: #0b0c0f; }
.portrait img { width: 100%; height: 100%; object-fit: contain; }
.gallery-arrow { position: absolute; z-index: 2; top: 50%; width: 42px; height: 42px; padding: 0; border: 1px solid #ffffff55; border-radius: 50%; color: white; background: #080a0cbb; font-size: 1.5rem; cursor: pointer; transform: translateY(-50%); }
.gallery-arrow:hover, .gallery-arrow:focus { border-color: var(--gold); outline: none; }
.gallery-arrow.previous { left: 12px; }
.gallery-arrow.next { right: 12px; }
.gallery-dots { position: absolute; z-index: 2; bottom: 12px; left: 50%; display: flex; gap: 7px; padding: 7px 9px; border-radius: 999px; background: #080a0caa; transform: translateX(-50%); }
.gallery-dot { width: 9px; height: 9px; padding: 0; border: 1px solid #fff9; border-radius: 50%; background: transparent; cursor: pointer; }
.gallery-dot.active { border-color: var(--gold); background: var(--gold); }
.gallery-count { position: absolute; right: 14px; top: 14px; padding: 7px 11px; border-radius: 999px; background: #080a0dcc; font-size: .8rem; }
.fallback { color: #555; font: 700 5rem Georgia, serif; }
.counter { position: absolute; top: 14px; left: 14px; padding: 7px 11px; border-radius: 999px; background: #080a0dcc; font-size: .8rem; }
.card-body { display: flex; flex: 1; flex-direction: column; justify-content: center; padding: 22px; }
.prompt { margin-bottom: 9px; color: var(--muted); font-size: .78rem; letter-spacing: .15em; text-transform: uppercase; }
.answer { margin: 0 0 16px; font: 700 clamp(1.65rem, 4vw, 2.7rem) Georgia, serif; }
.answer.hidden { filter: blur(13px); user-select: none; }
.bio { max-width: 68ch; margin: 0 0 18px; color: #d2ccbf; }
.bio[hidden], .films[hidden] { display: none; }
.films { margin-bottom: 18px; }
.films > strong { display: block; margin-bottom: 7px; color: var(--gold); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }
.film-list { display: flex; flex-wrap: wrap; gap: 6px; }
.film-list a { padding: 5px 9px; border: 1px solid #3d424b; border-radius: 999px; color: #e1dbcf; background: #292d34; font-size: .78rem; text-decoration: none; }
.film-list a:hover, .film-list a:focus { border-color: var(--gold); color: white; outline: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.actions:empty { display: none; }
.feedback { min-height: 24px; margin-bottom: 10px; font-weight: 700; }
.feedback.good { color: #72d58f; }
.feedback.bad { color: #ff8174; }
.side { padding: 20px; }
.side h2 { margin: 0 0 6px; font: 700 1.35rem Georgia, serif; }
.choices { display: grid; gap: 10px; margin-top: 15px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 9px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #191c21; text-align: left; cursor: pointer; }
.choice:hover { border-color: var(--gold); }
.choice img { width: 68px; height: 68px; border-radius: 9px; background: #090a0c; object-fit: cover; }
.choice.correct { border-color: var(--green); background: #183321; }
.choice.wrong { border-color: var(--red); background: #3b1d1b; }
.choice:disabled { cursor: default; }
.missed { display: grid; max-height: 330px; margin-top: 16px; gap: 8px; overflow: auto; }
.missed div { padding: 8px 10px; border-radius: 8px; background: #111318; }
.source-note { margin-top: 22px; color: #918b80; font-size: .78rem; }
.source-note a { color: #cbb982; }

@media (max-width: 760px) {
    .app { padding: 16px; }
    .top { align-items: flex-start; flex-direction: column; }
    .score { width: 100%; justify-content: space-around; }
    .stage { grid-template-columns: 1fr; }
    .card { min-height: 0; }
}

@media (max-width: 600px) {
    .app { padding: 14px 14px 92px; }
    .title { font-size: 2.35rem; }
    .subtitle { font-size: .88rem; }
    .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
    .toolbar select { grid-column: 1 / -1; width: 100%; }
    .portrait { height: 52vh; min-height: 280px; max-height: 410px; }
    .gallery-arrow { width: 38px; height: 38px; }
    .card-body { padding: 17px; justify-content: flex-start; }
    .answer { font-size: 1.8rem; }
    .bio { font-size: .92rem; line-height: 1.55; }
    .side { padding: 16px; }
    .choices { grid-template-columns: 1fr 1fr; }
    .choice { display: block; padding: 7px; font-size: .78rem; }
    .choice img { display: block; width: 100%; height: 120px; margin-bottom: 7px; }
    .actions .button { flex: 1; }
    .actions:not(:empty) { position: fixed; z-index: 20; right: 12px; bottom: 12px; left: 12px; padding: 8px; margin: 0; border: 1px solid var(--line); border-radius: 13px; background: #15181def; box-shadow: 0 8px 22px #000b; backdrop-filter: blur(8px); }
}

@media (max-width: 350px) {
    .app { padding: 10px; }
    .choices { grid-template-columns: 1fr; }
    .choice { display: flex; font-size: .88rem; }
    .choice img { width: 74px; height: 74px; margin: 0; }
    .portrait { min-height: 245px; }
}
