/*! © 2026 ZENX Network. All rights reserved. Licensed exclusively to ZENX Network.
   ZENX Arena game pages. Builds on site.css tokens (loaded after it by the shell). */

.ak-layout {
  max-width: 1640px; margin: 0 auto; padding: 22px 20px 0; box-sizing: border-box;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start;
}
@media (min-width: 1560px) { .ak-layout { grid-template-columns: 160px minmax(0, 1fr) 320px 160px; } }
.ak-rail { display: none; }
@media (min-width: 1560px) {
  .ak-rail { display: block; position: sticky; top: 86px; width: 160px; height: 600px; border-radius: 14px; overflow: hidden;
    border: 1px dashed var(--zs-line-2); background: var(--zs-ink-2); }
}
.ak-rail .ad-card, .ak-rail a { display: block; width: 100%; height: 100%; }
.ak-rail img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ak-rail-house { display: flex !important; align-items: center; justify-content: center; text-decoration: none !important; overflow: hidden; }
.ak-rail-house span { writing-mode: vertical-rl; white-space: nowrap; color: var(--zs-faint); font: 600 12px/1 var(--zs-body); letter-spacing: .08em;
  animation: akTick 18s linear infinite; }
@keyframes akTick { from { transform: translateY(0); } to { transform: translateY(-50%); } }
.ak-main { min-width: 0; display: grid; gap: 16px; }
.ak-stage {
  position: relative; border-radius: 20px; overflow: hidden; background: var(--zs-ink-2);
  border: 1px solid var(--zs-line); box-shadow: 0 30px 70px -40px rgba(0,0,0,.9);
  display: grid; place-items: center; min-height: 320px;
}
.ak-stage canvas { display: block; max-width: 100%; height: auto; touch-action: none; }
.ak-stage::after { content: ""; position: absolute; inset: 0; background: rgba(6, 7, 20, .55); opacity: 0; pointer-events: none; transition: opacity .25s; }
.ak-stage.is-dim::after { opacity: 1; }
html[data-theme="light"] .ak-stage.is-dim::after { background: rgba(245, 246, 251, .55); }
.ak-banner { min-height: 0; }
.ak-banner:not(:empty) { border-radius: 14px; overflow: hidden; border: 1px solid var(--zs-line); }
.ak-banner img { max-width: 100%; display: block; margin: 0 auto; }

/* setup / lobby / result card over the stage */
.ak-card {
  position: absolute; z-index: 5; width: min(440px, calc(100% - 28px)); box-sizing: border-box;
  background: var(--zs-panel); border: 1px solid var(--zs-line-2); border-radius: 20px; padding: 26px 26px 22px;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.9); animation: akIn .25s ease-out;
}
.ak-card[hidden] { display: none; }
@keyframes akIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.ak-title { font: 600 28px/1.15 var(--zs-head) !important; margin: 0 0 8px !important; color: var(--zs-text); letter-spacing: -.02em; }
.ak-lead { margin: 0 0 18px; color: var(--zs-muted); font-size: 15.5px; line-height: 1.5; }
.ak-field { display: grid; gap: 6px; margin: 0 0 16px; font: 500 14px var(--zs-body); color: var(--zs-text-2); }
.ak-card input {
  height: 44px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--zs-line-2); background: var(--zs-ink-2);
  color: var(--zs-text); font: 500 16px var(--zs-body); width: 100%; box-sizing: border-box; min-width: 0;
}
.ak-card input:focus { border-color: var(--zs-violet); outline: none; }
.ak-card input[readonly] { opacity: .8; }
.ak-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ak-actions .zs-btn:only-child { grid-column: 1 / -1; }
.ak-big { height: 48px !important; font-size: 15.5px !important; }
.ak-note { margin: 14px 0 0; color: var(--zs-muted); font-size: 13.5px; line-height: 1.5; }
.ak-note b { color: var(--zs-text); }
.ak-more { margin-top: 14px; border-top: 1px solid var(--zs-line); padding-top: 12px; }
.ak-more summary { cursor: pointer; color: var(--zs-text-2); font: 600 14.5px var(--zs-body); list-style: none; }
.ak-more summary::-webkit-details-marker { display: none; }
.ak-more summary::after { content: " +"; color: var(--zs-faint); }
.ak-more[open] summary::after { content: " –"; }
.ak-row { display: flex; gap: 8px; margin-top: 10px; }
.ak-row .zs-btn { flex: none; }
.ak-row .zs-btn:only-child { flex: 1; }
.ak-err { min-height: 18px; margin: 10px 0 0; color: var(--zs-bad); font-size: 14px; }
.ak-code { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--zs-ink-2); border: 1px solid var(--zs-line); margin-bottom: 14px; }
.ak-code b { font: 600 26px/1 var(--zs-head); letter-spacing: .12em; color: var(--zs-cyan); }
.ak-seats { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; }
.ak-seats li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; background: var(--zs-panel-2); font-size: 15px; }
.ak-seats li i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.ak-seats li.is-open { color: var(--zs-faint); background: transparent; border: 1px dashed var(--zs-line-2); }
.ak-seats li.is-open i { background: transparent !important; box-shadow: inset 0 0 0 2px var(--zs-line-2); }
.ak-stats { list-style: none; margin: 0 0 4px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ak-stats li { padding: 10px; border-radius: 12px; background: var(--zs-panel-2); display: grid; gap: 2px; }
.ak-stats span { font-size: 12.5px; color: var(--zs-muted); }
.ak-stats b { font: 700 20px var(--zs-body); font-variant-numeric: tabular-nums; }
.ak-ad:empty { display: none; }
.ak-ad { margin-top: 14px; border-radius: 12px; overflow: hidden; }
.ak-ad img { width: 100%; display: block; }

/* countdown */
.ak-count { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none; }
.ak-count span { font: 700 clamp(72px, 14vw, 150px)/1 var(--zs-head); color: #fff;
  text-shadow: 0 0 40px rgba(123, 92, 255, .9), 0 6px 0 rgba(0,0,0,.35); animation: akPop .9s cubic-bezier(.2,1.4,.4,1) both; }
.ak-count span.go { color: var(--zs-cyan); text-shadow: 0 0 40px rgba(47, 216, 240, .9), 0 6px 0 rgba(0,0,0,.35); }
@keyframes akPop { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(.92); opacity: 1; } 40% { transform: scale(1.04); } 80% { opacity: 1; } 100% { transform: scale(.85); opacity: 0; } }

/* side panel */
.ak-side { display: grid; gap: 14px; position: sticky; top: 86px; }
.ak-panel { background: var(--zs-panel); border: 1px solid var(--zs-line); border-radius: 16px; padding: 16px; }
.ak-panel h2 { font: 600 15px/1.2 var(--zs-body) !important; margin: 0 0 10px !important; color: var(--zs-text); display: flex; align-items: center; gap: 8px; }
.ak-panel p, .ak-panel li { color: var(--zs-muted); font-size: 14px; line-height: 1.55; margin: 0; }
.ak-panel ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.ak-panel kbd { font: 600 12px var(--zs-mono); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--zs-line-2); border-bottom-width: 2px; color: var(--zs-text); background: var(--zs-ink-2); }
.ak-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ak-clock { font: 600 26px/1 var(--zs-head); font-variant-numeric: tabular-nums; color: var(--zs-text); }
.ak-clock.is-hurry { color: var(--zs-bad); animation: akPulse .5s ease-in-out infinite; }
@keyframes akPulse { 50% { transform: scale(1.06); } }
.ak-msg { margin-top: 6px !important; min-height: 20px; }
.ak-players { display: grid; gap: 6px; }
.ak-pl { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 12px; background: var(--zs-panel-2); border: 1px solid transparent; font-size: 14.5px; }
.ak-pl.is-me { border-color: color-mix(in srgb, var(--zs-violet) 55%, transparent); }
.ak-pl.is-turn { border-color: var(--zs-cyan); box-shadow: 0 0 0 3px var(--zs-cyan-soft); }
.ak-pl.is-out { opacity: .45; }
.ak-pl i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.ak-pl .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--zs-text); }
.ak-pl .nm small { color: var(--zs-faint); font-size: 12.5px; }
.ak-pl .st { color: var(--zs-muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ak-bar { height: 5px; border-radius: 5px; background: var(--zs-line); overflow: hidden; margin-top: 12px; }
.ak-bar > div { height: 100%; width: 0; background: var(--zs-cyan); transition: width .2s linear; }
.ak-tools { display: flex; gap: 8px; align-items: center; }
.ak-tools .zs-icon { width: auto; padding: 0 12px; gap: 6px; font: 600 13.5px var(--zs-body); display: inline-flex; }
.ak-net { width: 9px; height: 9px; border-radius: 50%; background: var(--zs-faint); flex: none; }
.ak-net.is-on { background: var(--zs-ok); box-shadow: 0 0 0 3px rgba(62,227,154,.18); }
#hudPill { max-width: 100%; }

/* sound popover from audio.js */
.sound-pop { position: fixed; z-index: 990; background: var(--zs-panel); border: 1px solid var(--zs-line-2); border-radius: 14px; padding: 14px; display: grid; gap: 10px; width: 230px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.8); }
.sound-pop.hidden { display: none; }
.sound-pop label { display: grid; gap: 6px; font: 500 13.5px var(--zs-body); color: var(--zs-muted); }
.sound-pop input[type=range] { width: 100%; accent-color: var(--zs-violet); }
.sound-pop .btn { height: 36px; border-radius: 10px; border: 1px solid var(--zs-line-2); background: transparent; color: var(--zs-text); font: 600 13.5px var(--zs-body); cursor: pointer; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 980; }

/* touch controls */
.ak-touch { display: none; justify-content: space-between; align-items: center; gap: 16px; padding: 4px 4px 10px; user-select: none; -webkit-user-select: none; }
.ak-dpad { display: grid; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(3, 58px); gap: 6px; }
.ak-dpad button, .ak-act { border: 1px solid var(--zs-line-2); background: var(--zs-panel-2); color: var(--zs-text); border-radius: 14px; font-size: 20px; touch-action: none; }
.ak-dpad button.is-on, .ak-dpad button:active, .ak-act:active { background: var(--zs-violet); color: #fff; }
.ak-acts { display: flex; gap: 12px; align-items: center; }
.ak-act { width: 84px; height: 84px; border-radius: 50%; font: 700 15px var(--zs-body); }
.ak-act.is-main { background: radial-gradient(circle at 35% 30%, #ff8a9a, #e2364b); border: 0; color: #fff; font-size: 30px; }
@media (hover: none), (max-width: 760px) { .ak-touch.is-enabled { display: flex; } }

@media (max-width: 1000px) {
  .ak-layout { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 0; }
  .ak-side { position: static; }
}
@media (max-width: 560px) { .ak-card { padding: 20px 18px 18px; } .ak-title { font-size: 23px !important; } .ak-actions { grid-template-columns: 1fr; } }

/* Ludo board + 3D dice */
.ak-ludo { position: relative; line-height: 0; }
.ak-ludo canvas { border-radius: 14px; }
/* 3D dice on the Ludo board */
.die3d { position: absolute; z-index: 6; perspective: 520px; cursor: default; --h: 30px; user-select: none; -webkit-user-select: none; }
.die3d .die-toss { position: absolute; inset: 0; transform-style: preserve-3d; }
.die3d .die-toss.toss { animation: toss .65s cubic-bezier(.3,.6,.4,1); }
@keyframes toss { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-55%) scale(1.15); } 70% { transform: translateY(0) scale(.95); } 85% { transform: translateY(-10%) scale(1.02); } 100% { transform: translateY(0) scale(1); } }
.die3d .cube { position: absolute; inset: 0; transform-style: preserve-3d; }
.die3d .face {
  position: absolute; inset: 0; border-radius: 22%; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  padding: 14%; gap: 6%; background: linear-gradient(145deg, #ffffff 0%, #eef0fa 60%, #d9ddf0 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), inset -3px -5px 10px rgba(0,0,0,.08); backface-visibility: hidden;
}
.die3d .face i { border-radius: 50%; place-self: center; width: 78%; height: 78%; }
.die3d .face i.on { background: radial-gradient(circle at 35% 30%, #3a4170, #0b1020 70%); box-shadow: inset 0 1px 1px rgba(255,255,255,.2); }
.die3d .face i.on.red { background: radial-gradient(circle at 35% 30%, #ff7b8b, #c81e3a 70%); width: 110%; height: 110%; }
.die3d .f1 { transform: rotateY(0deg) translateZ(var(--h)); }
.die3d .f6 { transform: rotateY(180deg) translateZ(var(--h)); }
.die3d .f3 { transform: rotateY(90deg) translateZ(var(--h)); }
.die3d .f4 { transform: rotateY(-90deg) translateZ(var(--h)); }
.die3d .f2 { transform: rotateX(90deg) translateZ(var(--h)); }
.die3d .f5 { transform: rotateX(-90deg) translateZ(var(--h)); }
.die3d .die-shadow { position: absolute; left: 10%; right: 10%; bottom: -14%; height: 22%; border-radius: 50%; background: radial-gradient(rgba(0,0,0,.35), transparent 70%); }
.die3d .die-tag { position: absolute; left: 50%; top: 108%; transform: translateX(-50%); font: 700 11px/1 var(--zs-body); letter-spacing: 1.5px; color: #fff; background: rgba(11,16,32,.85); padding: 4px 8px; border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; white-space: nowrap; }
.die3d.ready { cursor: pointer; }
.die3d.ready .die-tag { opacity: 1; animation: bob 1s ease-in-out infinite; }
.die3d.ready .die-toss { filter: drop-shadow(0 0 10px rgba(57,225,198,.9)) drop-shadow(0 0 22px rgba(57,225,198,.5)); animation: breathe 1.1s ease-in-out infinite; }
.die3d.ready:hover .die-toss { filter: drop-shadow(0 0 14px rgba(57,225,198,1)); }
@keyframes breathe { 50% { transform: scale(1.07) rotate(-3deg); } }
@keyframes bob { 50% { transform: translate(-50%, -3px); } }


/* house / sold banner under the game */
.ak-banner .ad-card { display: flex !important; align-items: center; gap: 16px; min-height: 76px; padding: 12px 18px; box-sizing: border-box;
  text-decoration: none !important; background: var(--zs-panel); color: var(--zs-text) !important; }
.ak-banner .ad-card::before { content: "Sponsored"; order: 3; margin-left: auto; font: 500 12px var(--zs-body); color: var(--zs-faint); }
.ak-banner .ad-card img { width: 48px !important; height: 48px; border-radius: 10px; object-fit: cover; margin: 0 !important; color: transparent; overflow: hidden; }
.ak-banner .ad-title { font: 600 16px var(--zs-body); color: var(--zs-text); }
.ak-banner .ad-raw { padding: 8px; text-align: center; }

/* level / wallet pill painted by hud.js (inline styles are overridden here so it matches the site) */
#hudPill { display: inline-flex !important; align-items: center !important; gap: 10px !important; min-height: 44px; padding: 4px 16px 4px 5px !important;
  border-radius: 999px !important; border: 1px solid var(--zs-line-2) !important; background: var(--zs-panel) !important;
  color: var(--zs-text) !important; font: 600 14px/1.25 var(--zs-body) !important; cursor: pointer; box-shadow: none !important; position: static !important; }
#hudPill:empty { display: none !important; }
#hudPill:hover { border-color: var(--zs-violet) !important; }
#hudPill > span:first-child { width: 34px !important; height: 34px !important; border-radius: 50% !important; flex: none;
  background: linear-gradient(135deg, #7b5cff, #2fd8f0) !important; color: #fff !important; display: grid !important; place-items: center !important; font: 700 13px var(--zs-body) !important; }
.ak-tools #hudPill { flex: 1; min-width: 0; }
@media (max-width: 430px) {
  .ak-dpad { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(3, 50px); gap: 5px; }
  .ak-act { width: 70px; height: 70px; }
  .ak-acts { gap: 8px; }
  .ak-touch { gap: 8px; }
}
/* card above everything on the board (incl. the Ludo dice); countdown above the card */
.ak-card { z-index: 8; }
.ak-count { z-index: 9; }
/* phones: while the menu / lobby / result card is open it takes the stage's place instead of covering a tiny board */
@media (max-width: 700px) {
  .ak-stage:has(> .ak-card:not([hidden])) > :not(.ak-card):not(.ak-count) { display: none; }
  .ak-stage:has(> .ak-card:not([hidden])) { display: block; min-height: 0; }
  .ak-stage:has(> .ak-card:not([hidden]))::after { display: none; }
  .ak-card { position: relative; width: 100%; border: 0; border-radius: 0; box-shadow: none; animation: none; }
}
