/* Dojo Duel: page-specific styles on top of ../arcade-common/pz.css */
body[data-tod="day"] { --accent: #d6342b; --accent2: #e07b00; --glow: rgba(214, 52, 43, .25); }
body[data-tod="night"] { --accent: #ff5a4a; --accent2: #ffae3b; --accent-ink: #1a0c08; }
body[data-tod="night"] .btn:not(.alt):not(.ghost), body[data-tod="night"] .seg button[aria-checked="true"], body[data-tod="night"] .chips button[aria-checked="true"] { color: #1a0c08; }
.col { display: grid; gap: 16px; min-width: 0; }
.menu-grid > * { min-width: 0; }
.hero-cv { width: 100%; aspect-ratio: 16 / 9; display: block; border-radius: 14px; margin: 12px 0 2px; background: var(--card2); border: 1px solid var(--line); }
.fine { color: var(--muted); font-size: .84rem; margin-top: 10px; line-height: 1.5; }
.touchpick { margin-top: 10px; }
#modeHint { margin: 8px 2px 4px; min-height: 2.8em; }

/* fighter picker */
.fighters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fcard { border: 2px solid var(--line); background: var(--card2); border-radius: 14px; padding: 6px 4px 8px; text-align: center; display: grid; justify-items: center; gap: 2px; min-width: 0; min-height: 44px; color: var(--ink); }
.fcard canvas { width: 100%; max-width: 74px; aspect-ratio: 74 / 96; display: block; }
.fcard b { font-size: .86rem; line-height: 1.1; }
.fcard small { color: var(--muted); font-size: .66rem; line-height: 1.15; min-height: 2.3em; }
.fcard[aria-checked="true"] { border-color: transparent; background: linear-gradient(160deg, var(--accent), var(--accent2)); box-shadow: 0 6px 18px var(--glow); }
.fcard[aria-checked="true"] b, .fcard[aria-checked="true"] small { color: #fff; }
body[data-tod="night"] .fcard[aria-checked="true"] b, body[data-tod="night"] .fcard[aria-checked="true"] small { color: #1a0c08; }
.fstats { display: grid; gap: 3px; width: 100%; margin-top: 2px; }
.fstats i { display: block; height: 4px; border-radius: 3px; background: rgba(120, 130, 160, .3); overflow: hidden; }
.fstats i::after { content: ""; display: block; height: 100%; width: calc(var(--v) * 20%); background: currentColor; border-radius: 3px; color: var(--accent); }
.fcard[aria-checked="true"] .fstats i { background: rgba(255, 255, 255, .35); }
.fcard[aria-checked="true"] .fstats i::after { color: #fff; }
body[data-tod="night"] .fcard[aria-checked="true"] .fstats i { background: rgba(0, 0, 0, .25); }
body[data-tod="night"] .fcard[aria-checked="true"] .fstats i::after { color: #1a0c08; }
.fdetail { margin-top: 6px; font-size: .8rem; color: var(--muted); min-height: 2.4em; }
@media (max-width: 420px) { .fcard small { display: none; } .fcard b { font-size: .8rem; } }

/* how to play */
.keys { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .86rem; }
.keys th, .keys td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
.keys th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
kbd { font: inherit; font-weight: 800; font-size: .78rem; background: var(--card2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 7px; padding: 1px 7px; white-space: nowrap; }
.how { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.how li { display: flex; gap: 12px; align-items: flex-start; font-size: .9rem; line-height: 1.45; }
.how .pi { flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 1.2rem; }
.seg button, .chips button, .tabs button { min-height: 44px; }

/* ===== play screen ===== */
body[data-screen="play"] { overflow: hidden; position: fixed; inset: 0; width: 100%; overscroll-behavior: none; }
body[data-screen="play"] .top, body[data-screen="play"] main > #scMenu { display: none; }
.play { position: fixed; inset: 0; z-index: 20; margin: 0; background: #07091a; display: flex; flex-direction: column; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.stagewrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hud { position: relative; z-index: 4; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left)); pointer-events: none; color: #fff; }
.hud > * { pointer-events: none; }
.hud .hbtns { pointer-events: auto; display: flex; gap: 6px; }
.hudbtn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35); background: rgba(10, 14, 40, .6); color: #fff; font-size: 1.05rem; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: auto; }
.hudbtn[aria-pressed="false"] { opacity: .55; }
.hbar { display: grid; gap: 3px; min-width: 0; }
.hbar.p1 { justify-items: end; }
.hname { display: flex; align-items: center; gap: 8px; font-size: .86rem; text-shadow: 0 1px 4px #000; min-width: 0; }
.hname b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar.p1 .hname { flex-direction: row-reverse; }
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; background: transparent; box-shadow: 0 1px 3px #000; }
.pips i.on { background: #ffd24a; border-color: #ffd24a; }
.hp { position: relative; height: 18px; width: 100%; border-radius: 6px; background: rgba(0, 0, 0, .55); border: 2px solid rgba(255, 255, 255, .85); overflow: hidden; transform: skewX(-12deg); box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.hbar.p1 .hp { transform: skewX(12deg); }
.hp i { position: absolute; top: 0; bottom: 0; left: 0; display: block; }
.hbar.p1 .hp i { left: auto; right: 0; }
.hp .fill { width: 100%; background: linear-gradient(180deg, #7df06b, #25b83a); transition: width .08s linear; }
.hp .fill.mid { background: linear-gradient(180deg, #ffe45a, #f0a500); }
.hp .fill.low { background: linear-gradient(180deg, #ff8a7a, #e0261a); }
.hp .lag { width: 100%; background: #fff; opacity: .85; transition: width .5s .35s; }
.mt { position: relative; height: 10px; width: 62%; border-radius: 5px; background: rgba(0, 0, 0, .5); border: 1.5px solid rgba(255, 255, 255, .7); overflow: hidden; }
.hbar.p1 .mt { margin-left: auto; }
.mt i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #4db8ff, #7a5cff); transition: width .12s; }
.hbar.p1 .mt i { inset: 0 0 0 auto; }
.mt span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 7px; font-weight: 800; letter-spacing: .1em; color: #fff; text-shadow: 0 0 3px #000; opacity: .0; }
.mt.ready { border-color: #ffd24a; box-shadow: 0 0 10px #ffd24a; } .mt.ready span { opacity: 1; } .mt.ready i { background: linear-gradient(90deg, #ffd24a, #ff7a2b); }
.htime { text-align: center; line-height: 1; padding-top: 2px; }
.htime b { display: block; font-size: clamp(1.7rem, 7vw, 2.4rem); font-weight: 800; text-shadow: 0 2px 8px #000; font-variant-numeric: tabular-nums; min-width: 2.2ch; }
.htime b.low { color: #ff6a5a; animation: pulse .5s infinite alternate; }
.htime small { font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; opacity: .85; text-shadow: 0 1px 3px #000; }
@keyframes pulse { to { transform: scale(1.14); } }
@media (max-width: 460px) { .hud { gap: 5px; } .hname { font-size: .74rem; } .hp { height: 15px; } .hudbtn { width: 40px; height: 40px; } }

.banner { position: absolute; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; font-weight: 800; letter-spacing: .04em; font-size: clamp(2.2rem, 11vw, 5rem); line-height: 1; color: #fff; text-shadow: 0 4px 0 rgba(0, 0, 0, .55), 0 0 28px rgba(255, 170, 60, .65); opacity: 0; transform: scale(.6); }
.banner.on { animation: bn var(--d, 1.2s) cubic-bezier(.2, 1.4, .4, 1) forwards; }
.banner.ko { color: #ff5a4a; font-size: clamp(3.4rem, 18vw, 8rem); text-shadow: 0 5px 0 #4a0d0a, 0 0 36px rgba(255, 60, 40, .8); }
.banner.win { color: #ffd24a; }
@keyframes bn { 0% { opacity: 0; transform: scale(.5); } 14% { opacity: 1; transform: scale(1.12); } 24% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.06); } }
.banner.stay.on { animation: bnStay .5s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes bnStay { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: scale(1); } }

/* training panel */
.train { position: absolute; left: 50%; top: 4px; transform: translateX(-50%); z-index: 3; display: grid; gap: 6px; justify-items: center; padding: 8px 10px; border-radius: 14px; background: rgba(8, 12, 36, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); color: #fff; max-width: calc(100% - 16px); }
.train[hidden] { display: none; }
.tstats { display: grid; grid-template-columns: repeat(5, auto); gap: 6px 14px; }
.tstats div { text-align: center; }
.tstats span { display: block; font-size: .56rem; text-transform: uppercase; letter-spacing: .06em; opacity: .8; }
.tstats b { font-size: 1rem; font-variant-numeric: tabular-nums; }
.tbtns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.tbtns button { min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .1); color: #fff; font-weight: 700; font-size: .78rem; }
.tbtns button[aria-pressed="true"] { background: #ffd24a; color: #1a1030; border-color: transparent; }
@media (max-height: 520px) { .train { top: 58px; padding: 4px 8px; gap: 3px; } .tstats b { font-size: .86rem; } }

/* touch controls */
.controls { position: relative; flex: 0 0 auto; z-index: 5; display: none; }
.play[data-touch="on"] .controls { display: block; }
.play[data-touch="on"][data-layout="split"] .stagewrap { flex: 0 0 auto; height: clamp(240px, 100vw, 52vh); }
.play[data-touch="on"][data-layout="split"] .controls { flex: 1 1 auto; min-height: 210px; }
.play[data-layout="full"] .controls { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.play[data-layout="full"] .stagewrap { position: absolute; inset: 0; }
.play[data-layout="full"] .hud { position: absolute; left: 0; right: 0; top: 0; }
.pad { position: absolute; width: 168px; height: 168px; touch-action: none; border-radius: 50%; background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05) 70%); border: 2px solid rgba(255, 255, 255, .35); pointer-events: auto; }
.pad::before { content: ""; position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px; border-radius: 50%; background: rgba(255, 255, 255, .22); border: 2px solid rgba(255, 255, 255, .4); transform: translate(var(--kx, 0px), var(--ky, 0px)); transition: transform .06s; }
.pad i { position: absolute; font-style: normal; font-size: 20px; color: rgba(255, 255, 255, .8); font-weight: 800; width: 56px; height: 56px; display: grid; place-items: center; }
.pad i.u { left: 56px; top: 0; } .pad i.d { left: 56px; bottom: 0; } .pad i.l { left: 0; top: 56px; } .pad i.r { right: 0; top: 56px; }
.pad i.on { color: #ffd24a; text-shadow: 0 0 10px #ffd24a; }
.act { position: absolute; width: 60px; height: 60px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .6); background: rgba(20, 24, 60, .55); color: #fff; font-weight: 800; font-size: .74rem; display: grid; place-items: center; pointer-events: auto; touch-action: none; letter-spacing: .02em; padding: 0; line-height: 1.05; text-align: center; }
.act b { display: block; font-size: 1.2rem; line-height: 1; margin-bottom: 1px; }
.act.on { background: rgba(255, 210, 74, .85); color: #1a1030; border-color: #fff; transform: scale(.94); }
.act.k1 { background: rgba(214, 52, 43, .5); } .act.k2 { background: rgba(224, 123, 0, .5); } .act.k3 { background: rgba(122, 92, 255, .55); } .act.k4 { background: rgba(31, 165, 154, .5); }
.act.k1.on, .act.k2.on, .act.k3.on, .act.k4.on { background: rgba(255, 210, 74, .9); }
.act.dim { opacity: .45; }
/* portrait split layout: one player, pad on the left, buttons on the right */
.play[data-layout="split"] .pad[data-p="0"] { left: max(14px, env(safe-area-inset-left)); bottom: max(22px, env(safe-area-inset-bottom)); }
.play[data-layout="split"] .act[data-p="0"][data-b="P"] { right: 84px; bottom: 120px; }
.play[data-layout="split"] .act[data-p="0"][data-b="K"] { right: 14px; bottom: 150px; }
.play[data-layout="split"] .act[data-p="0"][data-b="S"] { right: 14px; bottom: 80px; }
.play[data-layout="split"] .act[data-p="0"][data-b="B"] { right: 88px; bottom: 44px; }
.play[data-layout^="split"] .controls { background: radial-gradient(500px 220px at 50% 0, rgba(255, 90, 70, .16), transparent 70%), linear-gradient(180deg, #121a44, #070a1c); border-top: 2px solid rgba(255, 255, 255, .16); }
/* portrait, two players on one phone (fallback): P2 on the top row, P1 on the bottom row */
.play[data-touch="on"][data-layout="split2"] .stagewrap { flex: 0 0 auto; height: clamp(200px, 62vw, 34vh); }
.play[data-touch="on"][data-layout="split2"] .controls { flex: 1 1 auto; min-height: 292px; }
.play[data-layout="split2"] .pad { width: 128px; height: 128px; left: 14px; }
.play[data-layout="split2"] .pad i { width: 43px; height: 43px; font-size: 15px; } .play[data-layout="split2"] .pad i.u, .play[data-layout="split2"] .pad i.d { left: 43px; } .play[data-layout="split2"] .pad i.l, .play[data-layout="split2"] .pad i.r { top: 43px; }
.play[data-layout="split2"] .pad::before { width: 40px; height: 40px; margin: -20px; }
.play[data-layout="split2"] .act { width: 56px; height: 56px; font-size: .62rem; } .play[data-layout="split2"] .act b { font-size: 1.05rem; }
.play[data-layout="split2"] .pad[data-p="1"] { top: 10px; } .play[data-layout="split2"] .pad[data-p="0"] { bottom: 14px; }
.play[data-layout="split2"] .act[data-p="1"][data-b="P"] { right: 70px; top: 14px; } .play[data-layout="split2"] .act[data-p="1"][data-b="K"] { right: 10px; top: 14px; } .play[data-layout="split2"] .act[data-p="1"][data-b="S"] { right: 10px; top: 76px; } .play[data-layout="split2"] .act[data-p="1"][data-b="B"] { right: 70px; top: 76px; }
.play[data-layout="split2"] .act[data-p="0"][data-b="P"] { right: 70px; bottom: 76px; } .play[data-layout="split2"] .act[data-p="0"][data-b="K"] { right: 10px; bottom: 76px; } .play[data-layout="split2"] .act[data-p="0"][data-b="S"] { right: 10px; bottom: 14px; } .play[data-layout="split2"] .act[data-p="0"][data-b="B"] { right: 70px; bottom: 14px; }

/* landscape full-bleed: P1 on the left half, P2 (if any) on the right half */
.play[data-layout="full"] .pad[data-p="0"] { left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); }
.play[data-layout="full"] .act[data-p="0"][data-b="P"] { left: calc(max(14px, env(safe-area-inset-left)) + 190px); bottom: 84px; }
.play[data-layout="full"] .act[data-p="0"][data-b="K"] { left: calc(max(14px, env(safe-area-inset-left)) + 256px); bottom: 56px; }
.play[data-layout="full"] .act[data-p="0"][data-b="S"] { left: calc(max(14px, env(safe-area-inset-left)) + 256px); bottom: 124px; }
.play[data-layout="full"] .act[data-p="0"][data-b="B"] { left: calc(max(14px, env(safe-area-inset-left)) + 190px); bottom: 14px; }
.play[data-layout="full"][data-mode="two"] .pad[data-p="1"] { right: calc(max(14px, env(safe-area-inset-right)) + 190px); bottom: max(14px, env(safe-area-inset-bottom)); }
.play[data-layout="full"][data-mode="two"] .act[data-p="1"][data-b="P"] { right: calc(max(14px, env(safe-area-inset-right)) + 126px); bottom: 84px; }
.play[data-layout="full"][data-mode="two"] .act[data-p="1"][data-b="K"] { right: calc(max(14px, env(safe-area-inset-right)) + 60px); bottom: 56px; }
.play[data-layout="full"][data-mode="two"] .act[data-p="1"][data-b="S"] { right: calc(max(14px, env(safe-area-inset-right)) + 60px); bottom: 124px; }
.play[data-layout="full"][data-mode="two"] .act[data-p="1"][data-b="B"] { right: calc(max(14px, env(safe-area-inset-right)) + 126px); bottom: 14px; }
/* single player in landscape: buttons on the right, pad on the left */
.play[data-layout="full"]:not([data-mode="two"]) .act[data-p="0"][data-b="P"] { left: auto; right: calc(max(14px, env(safe-area-inset-right)) + 70px); bottom: 84px; }
.play[data-layout="full"]:not([data-mode="two"]) .act[data-p="0"][data-b="K"] { left: auto; right: max(14px, env(safe-area-inset-right)); bottom: 56px; }
.play[data-layout="full"]:not([data-mode="two"]) .act[data-p="0"][data-b="S"] { left: auto; right: max(14px, env(safe-area-inset-right)); bottom: 124px; }
.play[data-layout="full"]:not([data-mode="two"]) .act[data-p="0"][data-b="B"] { left: auto; right: calc(max(14px, env(safe-area-inset-right)) + 70px); bottom: 14px; }
@media (max-height: 420px) { .pad { width: 150px; height: 150px; } .pad i { width: 50px; height: 50px; } .pad i.u, .pad i.d { left: 50px; } .pad i.l, .pad i.r { top: 50px; } }
.play[data-layout="full"][data-touch="on"] .stagewrap { bottom: 0; }

.rotate { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; background: rgba(5, 8, 25, .86); }
.rotate[hidden] { display: none; }
.rotate .card { width: min(380px, 100%); text-align: center; }
.rotate .big { font-size: 3rem; line-height: 1; }
.rotate .btn { margin: 8px 4px 0; }

/* pause card */
.overlay .card .hint b { color: var(--ink); }
.overlay .row .btn { flex: 1 1 140px; }
.overlay .btn.go { margin-top: 0; width: auto; }
.mres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px; }
.mres div { background: var(--card2); border-radius: 12px; padding: 8px 4px; min-width: 0; }
.mres b { display: block; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.mres span { display: block; color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.overlay > .card { display: flex; flex-direction: column; overflow: hidden; padding: 16px; }
.overlay .ovbody { overflow-y: auto; min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
.overlay .big, .overlay h2, .overlay .row { flex: none; }
@media (max-height: 520px) { .overlay .big { display: none; } .overlay h2 { font-size: 1.3rem; margin-top: 0; } .overlay .row { margin-top: 10px; flex-wrap: nowrap; } .overlay .row .btn { flex: 1 1 0; padding: 8px 6px; font-size: .9rem; } }
@media (prefers-reduced-motion: reduce) { .banner.on { animation-duration: .01s; opacity: 1; transform: none; } .htime b.low { animation: none; } }
