/* Who Wants to Be a Millionaire — 3D. Deep blue/violet studio palette,
   glowing lozenge panels, amber selection, pulsing green reveals. */

@font-face {
  font-family: "Oswald";
  src: url("../fonts/oswald-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Oswald";
  src: url("../fonts/oswald-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Oswald";
  src: url("../fonts/oswald-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --blue-950: #030312;
  --blue-900: #060826;
  --blue-800: #0b1040;
  --blue-700: #142060;
  --blue-500: #2a4bff;
  --violet: #6a2bff;
  --amber: #ffb41e;
  --amber-hot: #ffd34d;
  --green: #19d860;
  --red: #ff2e4d;
  --ink: #eef1ff;
  --lozenge-bg: linear-gradient(180deg, rgba(8,12,48,.96), rgba(3,4,22,.96));
  --lozenge-border: #3d5bff;
  --font: "Oswald", "Arial Narrow", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--blue-950); }
body { font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.hidden { display: none !important; }

/* ---------- generic buttons ---------- */
.btn {
  font-family: var(--font); cursor: pointer; border: 0; border-radius: 999px;
  padding: .7em 1.6em; font-size: 1rem; letter-spacing: .06em; text-transform: uppercase;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: scale(.96); }
.btn-amber {
  background: linear-gradient(180deg, var(--amber-hot), var(--amber));
  color: #221300; font-weight: 600;
  box-shadow: 0 0 18px rgba(255,180,30,.45), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-amber:hover { box-shadow: 0 0 30px rgba(255,180,30,.75); transform: translateY(-1px); }
.btn-ghost {
  background: rgba(42,75,255,.14); color: var(--ink);
  border: 1px solid rgba(90,120,255,.5);
}
.btn-ghost:hover { background: rgba(42,75,255,.3); }
.btn.big { font-size: 1.25rem; padding: .9em 2.2em; }

.icon-btn {
  pointer-events: auto; cursor: pointer; font-size: 1.05rem;
  background: rgba(6,8,38,.8); color: var(--ink);
  border: 1px solid rgba(90,120,255,.4); border-radius: 10px;
  padding: .35em .6em; font-family: var(--font);
}
.icon-btn:hover { background: rgba(20,32,96,.9); }

/* ---------- persistent controls ---------- */
#controls {
  position: absolute; top: .6rem; left: .9rem; z-index: 70;
  display: flex; gap: .5rem; align-items: center;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .6rem .9rem;
  background: linear-gradient(180deg, rgba(3,3,18,.85), rgba(3,3,18,0));
  z-index: 20;
}
#hud .hud-left { min-width: 10rem; }
.hud-left, .hud-right { display: flex; align-items: center; gap: .5rem; }
.hud-centre { text-align: center; line-height: 1.15; }
#qnum { display: block; font-weight: 600; letter-spacing: .12em; font-size: .95rem; color: #aebcff; text-transform: uppercase; }
#stake { display: block; font-size: .85rem; color: var(--amber-hot); letter-spacing: .05em; }
#winnings {
  font-size: 1.35rem; font-weight: 600; color: var(--amber-hot);
  text-shadow: 0 0 14px rgba(255,180,30,.6); min-width: 4.5ch; text-align: right;
}
.walk-btn {
  cursor: pointer; font-family: var(--font); letter-spacing: .05em;
  background: rgba(255,180,30,.12); color: var(--amber-hot);
  border: 1px solid rgba(255,180,30,.55); border-radius: 999px;
  padding: .45em 1em; font-size: .85rem; text-transform: uppercase;
  transition: background .15s;
}
.walk-btn:hover { background: rgba(255,180,30,.28); }
.walk-btn.disabled { opacity: .35; pointer-events: none; }

/* ---------- ladder ---------- */
#btn-ladder {
  display: none; position: absolute; right: .7rem; top: 4.2rem; z-index: 25;
  font-size: 1.2rem; padding: .4em .55em; border-radius: 10px; cursor: pointer;
  background: rgba(6,8,38,.85); color: var(--ink); border: 1px solid rgba(90,120,255,.4);
}
#ladder {
  position: absolute; top: 4rem; right: .8rem; z-index: 15;
  background: rgba(4,6,28,.82); border: 1px solid rgba(70,100,255,.35);
  border-radius: 14px; padding: .6rem .8rem; backdrop-filter: blur(6px);
  box-shadow: 0 0 24px rgba(20,40,180,.35);
}
#ladder h2 { font-size: .75rem; letter-spacing: .3em; color: #8fa2ff; text-align: center; margin-bottom: .35rem; font-weight: 500; }
#ladder ol { list-style: none; max-height: min(66vh, 560px); overflow: hidden; }
#ladder li {
  display: flex; gap: .6rem; justify-content: space-between;
  font-size: .82rem; padding: .06rem .4rem; border-radius: 6px;
  color: #aab6f5; letter-spacing: .04em;
}
#ladder li .rungs { color: #5f70c9; width: 2ch; text-align: right; }
#ladder li.safe { color: #ffffff; font-weight: 600; }
#ladder li.safe .amt { text-shadow: 0 0 8px rgba(255,255,255,.5); }
#ladder li.banked { color: #4d5aa8; }
#ladder li.current {
  background: linear-gradient(90deg, rgba(255,180,30,.9), rgba(255,140,10,.9));
  color: #221300; font-weight: 600;
  box-shadow: 0 0 16px rgba(255,170,20,.55);
}
#ladder li.current .rungs { color: #4a2c00; }

/* ---------- play area ---------- */
#play-area {
  position: absolute; left: 50%; bottom: 1.2rem; transform: translateX(-50%);
  width: min(860px, 94vw); z-index: 12;
  display: flex; flex-direction: column; gap: .55rem; align-items: center;
}

#lifelines { display: flex; gap: .6rem; margin-bottom: .1rem; }
.lifeline {
  cursor: pointer; font-family: var(--font); font-weight: 600; letter-spacing: .05em;
  min-width: 64px; padding: .5em .9em; font-size: 1.05rem; color: var(--ink);
  background: radial-gradient(circle at 50% 30%, rgba(80,110,255,.55), rgba(10,16,60,.95));
  border: 2px solid var(--lozenge-border); border-radius: 999px;
  box-shadow: 0 0 14px rgba(60,90,255,.4), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .15s, box-shadow .15s, opacity .3s;
}
.lifeline:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 0 22px rgba(80,110,255,.7); }
.lifeline.used { opacity: .35; text-decoration: line-through; filter: grayscale(.8); }
.lifeline:disabled { cursor: default; }

.lozenge {
  position: relative; width: 100%;
  background: var(--lozenge-bg);
  border: 2px solid var(--lozenge-border); border-radius: 999px;
  box-shadow: 0 0 20px rgba(50,80,255,.35), inset 0 0 24px rgba(20,40,160,.5), inset 0 1px 0 rgba(255,255,255,.18);
  text-align: center;
}
#question-panel { padding: .85em 2em; font-size: clamp(1rem, 2.4vw, 1.35rem); font-weight: 500; min-height: 3.2em; letter-spacing: .02em; opacity: 0; transition: opacity .4s; }
#question-panel.lit { opacity: 1; }
#question-text { text-shadow: 0 0 12px rgba(120,150,255,.45); }

#answers {
  width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: .55rem .8rem;
}
.answer {
  cursor: pointer; display: flex; align-items: baseline; gap: .5em;
  padding: .65em 1.4em; font-family: var(--font); font-size: clamp(.95rem, 2.2vw, 1.2rem);
  color: var(--ink); text-align: left;
  background: var(--lozenge-bg);
  border: 2px solid var(--lozenge-border); border-radius: 999px;
  box-shadow: 0 0 14px rgba(50,80,255,.3), inset 0 0 18px rgba(20,40,160,.45), inset 0 1px 0 rgba(255,255,255,.15);
  opacity: 0; transform: translateY(14px);
  transition: opacity .45s ease, transform .45s ease, background .2s, border-color .2s, box-shadow .2s;
  pointer-events: none;
}
.answer.revealed { opacity: 1; transform: none; pointer-events: auto; }
.answer .ans-letter { color: var(--amber); font-weight: 600; letter-spacing: .05em; }
.answer.revealed:hover { border-color: #7f95ff; box-shadow: 0 0 22px rgba(80,110,255,.6); }
.answer.selected {
  background: linear-gradient(180deg, #ffcf5e, #f59d0a);
  border-color: #ffe9b0; color: #221300;
  box-shadow: 0 0 26px rgba(255,180,30,.8), inset 0 1px 0 rgba(255,255,255,.6);
}
.answer.selected .ans-letter { color: #7a4a00; }
.answer.correct {
  background: linear-gradient(180deg, #4be884, #0fa84a);
  border-color: #b8ffd2; color: #03210f;
  animation: pulse-green .55s ease-in-out infinite alternate;
  box-shadow: 0 0 30px rgba(30,220,110,.85);
}
.answer.correct .ans-letter { color: #065522; }
.answer.wrong {
  background: linear-gradient(180deg, #ff6a7e, #d40f33);
  border-color: #ffc3cc; color: #2a020a;
  box-shadow: 0 0 26px rgba(255,46,77,.8);
}
.answer.wrong .ans-letter { color: #5e0413; }
.answer.removed { opacity: .12; pointer-events: none; filter: grayscale(1); }
@keyframes pulse-green {
  from { box-shadow: 0 0 14px rgba(30,220,110,.55); }
  to { box-shadow: 0 0 36px rgba(30,220,110,1); }
}

/* ---------- modals / overlays ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2,3,14,.72); backdrop-filter: blur(4px);
}
.modal-card {
  width: min(560px, 92vw);
  background: var(--lozenge-bg); border: 2px solid var(--lozenge-border);
  border-radius: 22px; padding: 1.6rem 1.8rem; text-align: center;
  box-shadow: 0 0 40px rgba(50,80,255,.45);
}
.modal-card h3 { letter-spacing: .08em; margin-bottom: .7rem; color: var(--amber-hot); }
.modal-card p { font-size: 1.1rem; line-height: 1.45; color: #d6ddff; }
.final-q { font-size: 1.8rem; margin: .6rem 0 .2rem; text-shadow: 0 0 16px rgba(255,180,30,.6); }
.modal-actions { display: flex; gap: .7rem; justify-content: center; margin-top: 1.1rem; flex-wrap: wrap; }

.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  background: radial-gradient(ellipse at 50% 65%, rgba(4,6,30,.42), rgba(2,2,12,.88));
}

/* phone a friend */
.phone-timer { display: flex; align-items: center; gap: .5rem; justify-content: center; margin-bottom: .9rem; font-size: 1.1rem; color: var(--amber-hot); }
.phone-timer-bar { height: 8px; width: 100%; max-width: 240px; background: linear-gradient(90deg, var(--amber), var(--red)); border-radius: 4px; transition: width 1s linear; order: -1; flex-basis: 180px; }
.phone-timer { flex-wrap: wrap; }
.phone-lines { text-align: left; min-height: 8.5em; font-size: 1.02rem; line-height: 1.5; }
.phone-lines p { margin-bottom: .45em; color: #cdd6ff; }

/* ask the audience */
.audience-note { margin-bottom: 1rem; color: #aebcff; font-style: italic; }
.bars { display: flex; flex-direction: column; gap: .55rem; }
.bar-row { display: grid; grid-template-columns: 2ch 1fr 4ch; align-items: center; gap: .6rem; }
.bar-letter { color: var(--amber); font-weight: 600; font-size: 1.1rem; }
.bar-track { height: 20px; background: rgba(10,16,60,.9); border: 1px solid rgba(90,120,255,.4); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #3d5bff, #8faaff); box-shadow: 0 0 12px rgba(90,120,255,.8); transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.bar-pct { font-size: 1rem; color: #d6ddff; text-align: right; }

/* rules beat */
.rules-card {
  width: min(600px, 92vw); text-align: left;
  background: var(--lozenge-bg); border: 2px solid var(--lozenge-border);
  border-radius: 22px; padding: 2rem 2.2rem;
  box-shadow: 0 0 44px rgba(50,80,255,.5);
}
.rules-card h2 { color: var(--amber-hot); letter-spacing: .06em; margin-bottom: .9rem; text-align: center; }
.rules-card ul { list-style: none; margin-bottom: 1.4rem; }
.rules-card li { padding: .35rem 0 .35rem 1.6rem; position: relative; font-size: 1.05rem; color: #d6ddff; }
.rules-card li::before { content: "◆"; position: absolute; left: .2rem; color: var(--blue-500); font-size: .8em; top: .55em; }
.rules-card .btn { display: block; margin: 0 auto; }

/* outcome */
.outcome-card { text-align: center; width: min(620px, 92vw); }
#outcome-title { font-size: clamp(2rem, 6vw, 3.4rem); letter-spacing: .08em; color: var(--amber-hot); text-shadow: 0 0 30px rgba(255,180,30,.7); margin-bottom: .6rem; }
#outcome-sub { font-size: 1.1rem; color: #cdd6ff; max-width: 46ch; margin: 0 auto 1.2rem; line-height: 1.5; }
.cheque {
  margin: 0 auto 1.6rem; width: min(420px, 84vw);
  background: linear-gradient(135deg, #f4f6ff, #cdd6f4);
  color: #10163a; border-radius: 10px; padding: 1rem 1.4rem;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.6), 0 0 30px rgba(255,255,255,.12);
  transform: rotate(-1.5deg);
  font-family: Georgia, serif;
}
.cheque-label { font-size: .8rem; letter-spacing: .35em; color: #5a648e; }
#outcome-amount { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 700; color: #10163a; }

/* toast */
#toast {
  position: fixed; top: 5rem; left: 50%; transform: translateX(-50%); z-index: 45;
  background: rgba(4,6,28,.92); border: 1px solid rgba(90,120,255,.5);
  padding: .7em 1.4em; border-radius: 999px; font-size: 1rem; color: #d6ddff;
  box-shadow: 0 0 20px rgba(50,80,255,.4);
}

/* ---------- title screen ---------- */
#title-screen { z-index: 60; text-align: center; }
.game-title { font-weight: 600; letter-spacing: .14em; line-height: 1.05; }
.game-title span { display: block; font-size: clamp(1.1rem, 3.4vw, 1.8rem); color: #aebcff; letter-spacing: .34em; }
.game-title em {
  display: block; font-style: normal;
  font-size: clamp(2.6rem, 9vw, 5.2rem);
  background: linear-gradient(180deg, #fff, var(--amber-hot) 55%, #c47d00);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(255,180,30,.35);
  margin: .1em 0 .3em;
}
.tagline { color: #aebcff; letter-spacing: .1em; margin-bottom: 1.6rem; font-size: clamp(.9rem, 2.4vw, 1.1rem); }
.hint { margin-top: 1.2rem; color: #5f70c9; font-size: .85rem; letter-spacing: .06em; }

.title-rings { position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%); z-index: -1; }
.title-rings i {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  border-radius: 50%; border: 2px solid rgba(80,110,255,.5);
  animation: ring-pulse 3.6s ease-in-out infinite;
}
.title-rings i:nth-child(1) { width: 320px; height: 320px; }
.title-rings i:nth-child(2) { width: 470px; height: 470px; animation-delay: .7s; border-color: rgba(120,80,255,.35); }
.title-rings i:nth-child(3) { width: 640px; height: 640px; animation-delay: 1.4s; border-color: rgba(80,110,255,.18); }
@keyframes ring-pulse {
  0%, 100% { box-shadow: 0 0 18px rgba(80,110,255,.25); opacity: .55; }
  50% { box-shadow: 0 0 60px rgba(120,140,255,.6); opacity: 1; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  #ladder { display: none; }
  #ladder.open { display: block; top: 4.6rem; right: .7rem; max-height: 70vh; overflow: auto; }
  #btn-ladder { display: block; }
}
@media (max-width: 640px) {
  #answers { grid-template-columns: 1fr; }
  #play-area { bottom: .6rem; gap: .4rem; }
  .answer { padding: .8em 1.2em; }
  #hud { flex-wrap: wrap; }
  .hud-centre { order: 3; width: 100%; }
  #winnings { font-size: 1.1rem; }
  .walk-btn { font-size: .75rem; }
  #toast { top: auto; bottom: 42%; width: max-content; max-width: 90vw; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .title-rings i { animation: none; }
  .answer.correct { animation: none; }
  .answer { transition: opacity .2s, background .2s; transform: none; }
}
