/* ---------- Games Hall (slice 13): the pad's picker card and the Answer Floor / Dig Duel arena HUD ---------- */
/* Loaded before style.css, so it can use style.css's variables and keyframes (popIn, goSplash, pulse). */

/* The picker: two big picture buttons. */
.modal-games .modal-body { width: min(620px, 94vw); }
.games-card { position: relative; text-align: center; padding: 18px 18px 22px; }
/* style.css loads later and gives every .btn position: relative, so this needs the extra class to stay in the corner. */
.games-card .games-close { position: absolute; top: 12px; right: 12px; }
.games-sign { font-size: 54px; line-height: 1; margin: 2px 0 12px; animation: bob 2.4s ease-in-out infinite; }
.games-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.games-pick { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 10px 12px; border: 4px solid var(--line); border-radius: 20px; background: linear-gradient(180deg, #3a2a7a, #22184e); box-shadow: inset 0 3px 0 rgba(255,255,255,.18), 0 7px 0 var(--line); cursor: pointer; transition: transform .08s; }
.games-pick:active { transform: translateY(4px); box-shadow: inset 0 3px 0 rgba(255,255,255,.18), 0 3px 0 var(--line); }
.games-pick[data-k="duel"] { background: linear-gradient(180deg, #2f6fb8, #1b3f78); }
.games-art { position: relative; width: 132px; height: 132px; border-radius: 16px; border: 3px solid rgba(0,0,0,.45); overflow: hidden; }
.games-art-floor { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 2px; background: #10142a; }
.games-art-floor i { display: block; border-radius: 3px; }
.games-art-floor b { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: var(--display); font-size: 46px; color: #fff; background: rgba(12,16,34,.85); padding: 2px 14px; border-radius: 14px; }
.games-art-duel { display: flex; align-items: center; justify-content: center; gap: 4px; background: linear-gradient(180deg, #e8f4ff, #b8d6f5); font-size: 34px; }
.games-art-duel b { font-family: var(--display); font-size: 40px; color: #1b2a5c; }
.games-name { font-family: var(--display); font-size: 24px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.45); }
.games-go { font-size: 22px; width: 54px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 3px solid var(--line); background: linear-gradient(180deg, var(--green-l), var(--green) 45%, var(--green-d)); box-shadow: 0 4px 0 var(--line); }

/* The arena HUD. Touch controls (z 20) stay above it; everything here sits along the top. */
#arena-hud { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.arena-leave { position: absolute; top: calc(10px + var(--safe-t)); left: calc(10px + var(--safe-l)); font-size: 22px; padding: 6px 12px 8px; }
/* One column along the top: the question (or the duel's boxes), then the pips and the music bar, so a tall card never covers them. */
.arena-head { position: absolute; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(820px, calc(100vw - 150px)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.arena-top { display: flex; gap: 12px; align-items: stretch; width: 100%; justify-content: center; }
.arena-q { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; border-radius: 18px; border: 4px solid var(--line); background: rgba(12,16,30,.86); box-shadow: 0 5px 0 rgba(0,0,0,.35); opacity: 0; }
.playing-round .arena-q { opacity: 1; }
.arena-q.pop { animation: popIn .3s cubic-bezier(.2,1.6,.4,1); }
.arena-pic { display: none; height: 88px; width: auto; max-width: 42%; border-radius: 10px; background: rgba(255,255,255,.06); }
.arena-qtext { font-family: var(--display); font-size: clamp(30px, 5vw, 54px); line-height: 1.05; text-align: center; text-shadow: 0 4px 0 rgba(0,0,0,.5); overflow-wrap: anywhere; }
.arena-qtext.long { font-size: clamp(22px, 3.4vw, 38px); }
.arena-say { flex: none; width: 46px; height: 46px; border-radius: 12px; border: 3px solid var(--line); background: var(--blue); font-size: 22px; cursor: pointer; box-shadow: 0 4px 0 var(--line); }
.arena-score { flex: none; min-width: 96px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 14px; border-radius: 16px; border: 4px solid var(--line); background: rgba(12,16,30,.86); box-shadow: 0 5px 0 rgba(0,0,0,.35); font-size: 24px; }
.arena-score b { font-family: var(--display); font-size: 38px; line-height: 1; }
.arena-pips { display: flex; gap: 8px; opacity: 0; }
.playing-round .arena-pips { opacity: 1; }
.arena-pips i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); background: rgba(255,255,255,.25); }
.arena-pips i.now { background: #fff; box-shadow: 0 0 0 3px var(--gold); }
.arena-pips i.ok { background: var(--green); }
.arena-pips i.miss { background: #8b93ad; }
.arena-music { display: flex; align-items: center; gap: 8px; opacity: 0; }
.playing-round .arena-music { opacity: 1; }
.arena-note { font-size: 28px; animation: bob .5s ease-in-out infinite; }
.arena-bar { width: 200px; height: 16px; border-radius: 9px; border: 3px solid var(--line); background: rgba(12,16,30,.75); overflow: hidden; }
.arena-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff5cc0, #ffd21f, #7cdc2e); transform-origin: left; }
.frozen .arena-note { animation: none; filter: grayscale(1); opacity: .6; }

/* The 8 s lead: how to play, as pictures, with a shrinking bar. */
.arena-lead { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); display: flex; }
.playing-round .arena-lead, .ended .arena-lead { display: none; }
.arena-lead-card { padding: 14px 18px 16px; border-radius: 22px; border: 4px solid var(--line); background: rgba(12,16,30,.88); box-shadow: 0 8px 0 rgba(0,0,0,.35); text-align: center; animation: popIn .32s cubic-bezier(.2,1.5,.4,1); }
.arena-lead-title { font-family: var(--display); font-size: 30px; margin-bottom: 10px; }
.arena-steps { display: flex; align-items: center; justify-content: center; gap: 8px; }
.arena-steps em { font-style: normal; font-size: 22px; opacity: .7; }
.arena-step { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 70px; padding: 8px 8px 6px; border-radius: 14px; background: rgba(255,255,255,.08); }
.arena-step b { font-family: var(--display); font-size: 34px; line-height: 1; white-space: nowrap; }
.arena-step small { font-weight: 900; font-size: 12px; letter-spacing: .5px; opacity: .85; text-transform: uppercase; }
.arena-ring { margin-top: 12px; height: 10px; border-radius: 6px; background: rgba(255,255,255,.15); overflow: hidden; }
.arena-ring i { display: block; height: 100%; background: var(--gold); transform-origin: left; }
.arena-count { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%) scale(0); font-family: var(--display); font-size: clamp(80px, 16vw, 160px); color: #fff; -webkit-text-stroke: 5px rgba(0,0,0,.6); paint-order: stroke fill; opacity: 0; white-space: nowrap; }
.arena-count.go { animation: goSplash .9s ease-out forwards; }

/* Dig Duel: the times-table badge, the clock, ❄️ lives and blocks dug. */
.arena-duel-top { align-items: center; }
.arena-badge { flex: none; width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 26px; color: #3a2400; border: 4px solid var(--line); background: radial-gradient(circle at 35% 30%, #fff3b0, var(--gold) 55%, #c58a00); box-shadow: 0 5px 0 rgba(0,0,0,.35); }
.arena-badge b { font-size: 44px; line-height: .8; }
.arena-clock { flex: none; min-width: 108px; padding: 6px 14px; border-radius: 16px; border: 4px solid var(--line); background: rgba(12,16,30,.86); box-shadow: 0 5px 0 rgba(0,0,0,.35); text-align: center; }
.arena-clock b { font-family: var(--display); font-size: 38px; line-height: 1; }
.arena-clock.low { background: rgba(160,20,40,.9); animation: pulse .5s ease-in-out infinite; }
.arena-lives { flex: none; font-size: 30px; padding: 6px 10px; border-radius: 16px; border: 4px solid var(--line); background: rgba(12,16,30,.86); box-shadow: 0 5px 0 rgba(0,0,0,.35); white-space: nowrap; }
.arena-lives i { font-style: normal; filter: grayscale(1); opacity: .3; }
/* Centred with inset + margin auto (not a translate), because its pop-in animation sets transform (CLAUDE.md gotcha 3). */
.arena-splash { position: absolute; inset: 0 0 20% 0; margin: auto; width: max-content; height: max-content; display: none; align-items: center; gap: 10px; font-size: 64px; padding: 10px 26px; border-radius: 26px; border: 4px solid var(--line); background: rgba(20,60,120,.85); }
.arena-splash b { font-family: var(--display); font-size: 70px; }
.splashed .arena-splash { display: flex; animation: popIn .3s cubic-bezier(.2,1.5,.4,1); }

/* The end screen: team total first, then everyone. */
.arena-end { position: absolute; inset: 0; display: none; place-items: center; padding: 16px; background: rgba(8,10,22,.45); }
.ended .arena-end { display: grid; }
.ended .arena-head, .ended .arena-splash, .ended .arena-leave { display: none; }
.arena-end-panel { width: min(480px, 94vw); text-align: center; animation: popIn .32s cubic-bezier(.2,1.5,.4,1); }
.arena-team { display: flex; flex-direction: column; align-items: center; margin-bottom: 10px; }
.arena-team small { font-weight: 900; letter-spacing: 2px; opacity: .8; }
.arena-team b { font-family: var(--display); font-size: 64px; line-height: 1.05; color: var(--gold); text-shadow: 0 5px 0 rgba(0,0,0,.45); }
.arena-players { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow: auto; }
.arena-players li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: rgba(255,255,255,.07); font-size: 22px; }
.arena-players li.me { background: rgba(255,210,63,.18); box-shadow: inset 0 0 0 3px rgba(255,210,63,.5); }
.arena-crown { width: 30px; }
.arena-who { flex: 1; text-align: left; font-family: var(--display); font-size: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arena-players .arena-lives { border: 0; background: none; box-shadow: none; padding: 0; font-size: 18px; }
.arena-pts { font-family: var(--display); }
.arena-star { width: 30px; }
.arena-end-buttons { display: flex; justify-content: center; gap: 14px; }
.arena-end-buttons .btn { font-size: 30px; padding: 8px 30px 12px; }

/* Phones (≤700 wide or ≤600 tall): smaller pieces, still along the top and clear of the touch controls. */
@media (max-width: 700px), (max-height: 600px) {
  .arena-leave { font-size: 18px; padding: 4px 9px 6px; }
  .arena-head { left: calc(66px + var(--safe-l)); right: calc(10px + var(--safe-r)); width: auto; transform: none; gap: 6px; }
  .arena-top { gap: 8px; }
  .arena-q { padding: 6px 8px; gap: 6px; border-width: 3px; }
  .arena-pic { height: 56px; }
  .arena-qtext { font-size: clamp(24px, 7vw, 34px); }
  .arena-qtext.long { font-size: clamp(18px, 5vw, 26px); }
  .arena-say { width: 38px; height: 38px; font-size: 18px; }
  .arena-score { min-width: 64px; padding: 4px 8px; font-size: 18px; border-width: 3px; }
  .arena-score b { font-size: 28px; }
  .arena-pips { gap: 6px; }
  .arena-pips i { width: 14px; height: 14px; }
  .arena-bar { width: 140px; height: 13px; }
  .arena-note { font-size: 22px; }
  .arena-lead { top: 38%; }
  .arena-lead-title { font-size: 24px; }
  .arena-step { min-width: 54px; padding: 6px 4px 4px; }
  .arena-step b { font-size: 24px; }
  .arena-steps { gap: 4px; }
  .arena-steps em { font-size: 16px; }
  .arena-badge { width: 60px; height: 60px; font-size: 18px; }
  .arena-badge b { font-size: 32px; }
  .arena-clock { min-width: 74px; padding: 4px 8px; border-width: 3px; }
  .arena-clock b { font-size: 26px; }
  .arena-lives { font-size: 20px; padding: 4px 6px; border-width: 3px; }
  .arena-team b { font-size: 48px; }
  .games-art { width: 100px; height: 100px; }
  .games-sign { font-size: 40px; margin-bottom: 8px; }
  .games-name { font-size: 19px; }
}
/* Narrow portrait phones: the duel's four boxes share one row; the question card stays one line high. */
@media (max-width: 430px) {
  .arena-duel-top { gap: 5px; }
  .arena-lives { font-size: 16px; }
  .arena-pic { max-width: 34%; }
  .games-picks { gap: 8px; }
  .games-art { width: 88px; height: 88px; }
  .games-art-floor b, .games-art-duel b { font-size: 30px; }
}
/* Short landscape phones: the lead card moves up and gets smaller. */
@media (max-height: 430px) {
  .arena-lead { top: 44%; }
  .arena-lead-card { padding: 8px 12px 10px; }
  .arena-lead-title { font-size: 20px; margin-bottom: 6px; }
  /* The pips and the music bar move to the sides, so the far row of tiles stays in view. */
  .arena-pic { height: 48px; }
  .arena-pips { position: fixed; top: calc(88px + var(--safe-t)); left: calc(12px + var(--safe-l)); }
  .arena-music { position: fixed; top: calc(88px + var(--safe-t)); right: calc(12px + var(--safe-r)); }
}
