/* Match cinematics (cine.js) and the full-screen arena layout. Loaded after hud.css. */
.cine { position: fixed; inset: 0; pointer-events: none; font-family: var(--hud); }

/* letterbox bars */
.cine.lb { z-index: 66; }
.cine.lb i { position: absolute; left: 0; right: 0; height: 10vh; background: #000; transition: transform .7s cubic-bezier(.7,0,.2,1); box-shadow: 0 0 40px #000; }
.cine.lb i:first-child { top: 0; transform: translateY(-101%); }
.cine.lb i:last-child { bottom: 0; transform: translateY(101%); }
.cine.lb.on i { transform: none; }

/* versus splash */
.cine.vs { z-index: 64; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; align-content: center; gap: 22px 3vw; padding: 0 6vw;
  background: radial-gradient(70% 50% at 50% 50%, rgba(2,6,10,.55), rgba(2,4,7,.85)); }
.vs .side { display: grid; gap: 4px; }
.vs .side small { font: 600 13px var(--hud); letter-spacing: .3em; text-transform: uppercase; color: var(--dim); }
.vs .side b { font: 700 clamp(30px, 6vw, 76px)/.95 var(--hud); text-transform: uppercase; letter-spacing: .02em; color: var(--fc); text-shadow: 0 0 34px var(--fc); }
.vs .me { text-align: right; animation: vsL .9s cubic-bezier(.2,.8,.2,1) both; }
.vs .op { text-align: left; animation: vsR .9s cubic-bezier(.2,.8,.2,1) both; }
.vs .x { font: 700 clamp(40px, 8vw, 110px)/1 var(--hud); color: #fff; text-shadow: 0 0 30px #18BFFF, 0 0 80px #18BFFF; animation: vsX .7s .25s cubic-bezier(.2,1.4,.3,1) both; }
.vs .sub { grid-column: 1 / -1; text-align: center; font: 600 14px var(--hud); letter-spacing: .32em; text-transform: uppercase; color: var(--soft); animation: fadeUp .6s .7s both; }
@keyframes vsL { from { transform: translateX(-40vw); opacity: 0; } }
@keyframes vsR { from { transform: translateX(40vw); opacity: 0; } }
@keyframes vsX { from { transform: scale(3); opacity: 0; filter: blur(8px); } }
@keyframes fadeUp { from { transform: translateY(14px); opacity: 0; } }

/* turn card */
.cine.turn { z-index: 55; display: grid; place-items: center; }
.cine.turn div { display: grid; justify-items: center; padding: 30px 90px; background: radial-gradient(closest-side, rgba(3,7,11,.82), transparent); animation: turnIn 1.25s ease-out both; position: relative; }
.cine.turn div::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, #72DCFF, transparent); animation: sweep 1.25s ease-out both; z-index: -1; }
.cine.turn small { font: 600 14px var(--hud); letter-spacing: .5em; text-transform: uppercase; color: var(--soft); }
.cine.turn b { font: 700 clamp(80px, 14vw, 150px)/.9 var(--hud); background: linear-gradient(180deg, #fff, #8fd8ff 60%, #2aa9e0); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 24px rgba(24,191,255,.6)); }
.cine.turn span { font: 600 13px var(--hud); letter-spacing: .24em; text-transform: uppercase; color: var(--dim); }
@keyframes turnIn { 0% { opacity: 0; transform: scale(1.4); filter: blur(6px); } 22% { opacity: 1; transform: scale(1); filter: none; } 78% { opacity: 1; } 100% { opacity: 0; transform: scale(.96); } }
@keyframes sweep { from { transform: scaleX(0); } 40% { transform: scaleX(1); } to { opacity: 0; } }

/* hero moment */
.cine.hero { z-index: 60; display: grid; place-items: center; background: radial-gradient(60% 60% at 50% 45%, color-mix(in srgb, var(--hc) 14%, rgba(2,4,7,.6)), rgba(2,4,7,.9)); animation: heroBg .4s ease-out both; }
@keyframes heroBg { from { background-color: transparent; opacity: 0; } }
.hero .hcard { width: min(340px, 70vw, calc(64vh * 63 / 88)); filter: drop-shadow(0 0 40px color-mix(in srgb, var(--hc) 60%, transparent)); }
.hero .ring { position: absolute; width: min(70vh, 90vw); aspect-ratio: 1; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--hc) 60%, transparent);
  box-shadow: 0 0 60px -10px var(--hc), inset 0 0 60px -20px var(--hc); animation: ring 1.6s cubic-bezier(.2,.8,.2,1) both; }
.hero.t-sable .ring { border-width: 2px; animation-duration: 2.4s; }
@keyframes ring { from { transform: scale(.2); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
.hero .lower3 { position: absolute; left: max(16px, 6vw); bottom: calc(10vh + 22px); display: grid; gap: 2px; max-width: min(520px, 88vw); padding: 10px 18px 12px; border-left: 3px solid var(--hc);
  background: linear-gradient(90deg, rgba(3,7,11,.9), rgba(3,7,11,0)); animation: l3 .6s .35s cubic-bezier(.2,.8,.2,1) both; }
.lower3 small { font: 600 12px var(--hud); letter-spacing: .3em; text-transform: uppercase; color: var(--hc); }
.lower3 b { font: 700 clamp(26px, 4vw, 44px)/1 var(--hud); text-transform: uppercase; color: #fff; text-shadow: 0 0 20px color-mix(in srgb, var(--hc) 70%, transparent); }
.lower3 span { font: 400 14px/1.35 var(--sans); color: var(--dim); }
@keyframes l3 { from { transform: translateX(-30px); opacity: 0; } }

/* zone verdict stamps */
.plate { position: relative; overflow: visible; }
.stamp { position: absolute; left: 50%; top: 50%; z-index: 5; padding: 2px 12px; font: 700 26px/1.1 var(--hud); letter-spacing: .14em; text-transform: uppercase;
  border: 3px solid currentColor; background: rgba(3,7,11,.85); transform: translate(-50%, -50%) rotate(-9deg); animation: stamp .35s cubic-bezier(.2,1.6,.4,1) both; }
.stamp.m { color: #72DCFF; text-shadow: 0 0 14px #18BFFF; box-shadow: 0 0 24px -4px #18BFFF; }
.stamp.e { color: #FF7A59; text-shadow: 0 0 14px #FF7A59; box-shadow: 0 0 24px -4px #FF7A59; }
.stamp.x { color: #c9d6de; }
@keyframes stamp { from { transform: translate(-50%, -50%) rotate(-9deg) scale(2.6); opacity: 0; } }

/* ending title */
.cine.end { z-index: 62; display: grid; place-items: center; }
.cine.end div { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 0 16px; animation: endIn 1.2s cubic-bezier(.2,.8,.2,1) both; }
.cine.end small { font: 600 14px var(--hud); letter-spacing: .4em; text-transform: uppercase; color: var(--soft); }
.cine.end b { font: 700 clamp(44px, 9vw, 120px)/.95 var(--hud); text-transform: uppercase; background: linear-gradient(180deg, #fff, #9fe3ff 55%, #2aa9e0); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px rgba(24,191,255,.7)); }
.cine.end.lost b { background-image: linear-gradient(180deg, #fff, #ffb39f 55%, #d8532f); filter: drop-shadow(0 0 30px rgba(255,122,89,.6)); }
@keyframes endIn { from { opacity: 0; transform: scale(1.3); letter-spacing: .3em; filter: blur(10px); } }
body.ending .game { opacity: .12; filter: blur(2px); transition: opacity 1.2s, filter 1.2s; }

/* ---------- arena: the match fills the screen, the web header goes away ---------- */
body.arena > .bar { display: none; }
.ahud { position: fixed; z-index: 25; top: 0; left: 0; right: 0; display: none; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px; background: linear-gradient(180deg, rgba(2,5,8,.85), transparent); pointer-events: none; }
body.arena .ahud { display: flex; }
.ahud > * { pointer-events: auto; }
.ahud .who { font: 700 14px var(--hud); letter-spacing: .2em; text-transform: uppercase; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ahud .who b { color: #FF7A59; }
.ahud .pips { display: flex; align-items: center; gap: 6px; font: 700 13px var(--hud); letter-spacing: .2em; text-transform: uppercase; color: var(--soft); }
.ahud .pips i { width: 16px; height: 18px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: #1d3242; }
.ahud .pips i.done { background: #2a6b88; }
.ahud .pips i.now { background: #18BFFF; box-shadow: 0 0 10px #18BFFF; animation: pip 1.6s ease-in-out infinite; }
@keyframes pip { 50% { filter: brightness(1.6); } }
.ahud .tools { display: flex; gap: 6px; }
/* no perspective on .game: it would become the containing block of the fixed hand dock. The board carries its own. */
body.arena .game { max-width: min(720px, calc(100dvh - 320px)); padding-top: 52px; }
body.arena .board { transform-origin: 50% 100%; }
body.arena .toast { top: 58px; }
body.arena .coach { top: calc(56px + env(safe-area-inset-top, 0px)); }
@media (max-width: 700px) {
  .ahud .who { display: none; }
  .ahud .pips span { display: none; }
  .ahud .pips i { width: 12px; height: 14px; }
  .ahud { padding-left: 10px; padding-right: 10px; }
  .ahud .tools { gap: 4px; }
  .ahud .pips { gap: 4px; }
  .ahud .iconbtn { white-space: nowrap; font-size: 10.5px !important; padding: 5px 7px !important; letter-spacing: .04em !important; }
  body.arena .board { transform: none; }
}
/* phones held sideways: the board on the left, sized to the screen height, the hand dock as a side panel on the right */
@media (orientation: landscape) and (max-height: 560px) {
  body.arena { --bw: clamp(280px, 48vw, 400px); }
  body.arena .ahud { min-height: 0; padding-top: 4px; padding-bottom: 4px; padding-left: 10px; padding-right: 10px; }
  body.arena .ahud .who { display: none; }
  body.arena .ahud .pips span { display: none; }
  body.arena .ahud .iconbtn { white-space: nowrap; font-size: 10.5px !important; padding: 5px 7px !important; letter-spacing: .04em !important; }
  /* the board lays out at --bw and is scaled by --bz (set by fitBoard in app.js) so it fits the height */
  body.arena .game { max-width: none; width: var(--bw); margin: 0 0 0 max(10px, env(safe-area-inset-left, 0px)); padding: 44px 0 0; height: 100dvh; overflow: hidden; box-sizing: border-box; }
  body.arena #board { transform: scale(var(--bz, 1)); transform-origin: 0 0; }
  body.arena .handbar { left: auto; top: 40px; right: 0; bottom: 0; width: calc(100vw - var(--bw) * var(--bz, 1) - max(10px, env(safe-area-inset-left, 0px)) - 12px); border-top: 0; border-left: 1px solid var(--edge, #12202c);
    padding: 8px max(10px, env(safe-area-inset-right, 0px)) 8px 10px; overflow-y: auto; align-content: start; gap: 6px; box-shadow: -20px 0 40px -24px #18BFFF; }
  body.arena .handbar > * { max-width: none; }
  body.arena .handbar .detail { max-height: 34dvh; overflow-y: auto; }
  body.arena .toast { top: 48px; }
}
/* phones: the arena HUD buttons scroll sideways instead of running off the screen */
@media (max-width: 700px), (orientation: landscape) and (max-height: 560px) {
  .ahud .tools { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .ahud .tools::-webkit-scrollbar { display: none; }
  .ahud .tools > * { flex: none; }
}
/* sideways: the guide sits in the empty bottom of the dock panel, not over the card text */
@media (orientation: landscape) and (max-height: 560px) {
  body.arena .coach { top: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: auto; right: max(10px, env(safe-area-inset-right, 0px)); transform: none;
    width: calc(100vw - var(--bw) * var(--bz, 1) - max(10px, env(safe-area-inset-left, 0px)) - 32px); padding: 8px 10px; }
  body.arena .coach p { font-size: 12.5px; }
}
@media (orientation: landscape) and (max-height: 560px) {
  /* while the guide is up, the dock keeps room under its buttons so Reveal stays tappable */
  body.arena:has(.coach) .handbar { padding-bottom: calc(var(--coach-h, 96px) + 16px); }
}

/* the turn clock of a server match (app.js): calm, a thin ring and the seconds; amber in the last ten seconds */
.aclock { display: inline-flex; align-items: center; gap: 6px; font: 700 13px var(--hud); letter-spacing: .12em; color: var(--soft); white-space: nowrap; }
.aclock[hidden] { display: none; }
.aclock i { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(#72DCFF calc(var(--k, 1) * 360deg), rgba(114,220,255,.16) 0);
  -webkit-mask: radial-gradient(closest-side, transparent 60%, #000 64%); mask: radial-gradient(closest-side, transparent 60%, #000 64%); }
.aclock.low { color: #F6C77A; }
.aclock.low i { background: conic-gradient(#F6C77A calc(var(--k, 1) * 360deg), rgba(246,199,122,.16) 0); }
@media (max-width: 700px), (orientation: landscape) and (max-height: 560px) { .aclock { font-size: 11px; gap: 4px; } .aclock i { width: 14px; height: 14px; } }
/* short phones held upright: the card text in the dock is clamped to about three lines, so selecting a card does not
   grow the dock over the board (at 360x640 it covered the lower half, your own slots); a tap shows all of it */
@media (orientation: portrait) and (max-height: 760px) {
  body.arena .handbar .detail { max-height: 84px; overflow: hidden; position: relative; cursor: pointer; }
  body.arena .handbar .detail.open { max-height: 38vh; overflow-y: auto; }
  body.arena .handbar .detail:not(.open)::after { content: "Tap for more"; position: absolute; right: 0; bottom: 0; padding: 2px 8px 2px 28px;
    font: 600 12px var(--hud, system-ui); letter-spacing: .06em; color: #9fe6ff; background: linear-gradient(90deg, transparent, rgba(5,7,10,.96) 35%); pointer-events: none; }
}
