/* ============================================================
   NARUTO CARD GAME SIMULATOR — official orange & graphite style
   ============================================================ */
:root {
  --orange: #f07c14;
  --orange2: #ffa53c;
  --orange-d: #b4540a;
  --ink: #f2efe9;
  --dim: #a7a3a0;
  --gr0: #121217;
  --gr1: #1b1b22;
  --gr2: #26262f;
  --line: rgba(240, 124, 20, .55);
  --red: #e2267c;
  --blue: #1ea0cf;
  --green: #2bb07f;
  --me: #f07c14;
  --opp: #3fb3e0;
  --font: 'Zen Kaku Gothic New', 'Segoe UI', system-ui, sans-serif;
  --display: 'Oswald', 'Bebas Neue', Impact, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--gr0); color: var(--ink); font-family: var(--font); user-select: none; }
button { font-family: inherit; }
#app { position: fixed; inset: 0; overflow: hidden; z-index: 2; }
#app.shake { animation: shake .4s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 20%, 80% { transform: translate(calc(var(--shake) * .4), calc(var(--shake) * -.3)); } 40%, 60% { transform: translate(calc(var(--shake) * -.8), calc(var(--shake) * .5)); } }
#stage { position: absolute; left: 50%; top: 50%; width: 1600px; height: 900px; transform-origin: 50% 50%; overflow: hidden; }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

/* ---------- backdrop: official swirl ---------- */
#backdrop { position: fixed; inset: 0; z-index: 0; background: #d9d6e0 center/cover no-repeat; }
#backdrop::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 30% 50%, rgba(18, 18, 23, .35), rgba(18, 18, 23, .75)); }
body.in-game #backdrop::after { background: rgba(14, 14, 18, .82); }

.screen { position: absolute; inset: 0; display: none; z-index: 5; }
.screen.active { display: block; animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- title ---------- */
/* animated wallpaper */
.t-wall { position: fixed; inset: 0; overflow: hidden; --mx: 0; --my: 0; z-index: 1; display: none; background: #d9d6e0; }
body.on-title .t-wall { display: block; }
.t-swirl { will-change: transform; position: absolute; left: 50%; top: 50%; width: 170vmax; height: 170vmax; margin: -85vmax 0 0 -85vmax; background: center/cover no-repeat; animation: swirlSpin 140s linear infinite; filter: saturate(1.1) brightness(.9); }
@keyframes swirlSpin { to { transform: rotate(360deg); } }
.t-rays { will-change: transform; position: absolute; left: 62%; top: 32%; width: 2400px; height: 2400px; margin: -1200px 0 0 -1200px; background: repeating-conic-gradient(from 0deg, rgba(255, 190, 110, .16) 0deg 4deg, transparent 4deg 14deg); -webkit-mask: radial-gradient(circle, #000 5%, transparent 55%); mask: radial-gradient(circle, #000 5%, transparent 55%); animation: swirlSpin 90s linear infinite reverse; }
.t-streaks i { position: absolute; left: -40%; height: 3px; width: 38%; border-radius: 3px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent); filter: blur(.5px); animation: streak 3.2s linear infinite; opacity: 0; }
.t-streaks i:nth-child(1) { top: 18%; animation-delay: 0s; } .t-streaks i:nth-child(2) { top: 31%; animation-delay: .7s; width: 26%; }
.t-streaks i:nth-child(3) { top: 47%; animation-delay: 1.5s; } .t-streaks i:nth-child(4) { top: 62%; animation-delay: 2.2s; width: 30%; }
.t-streaks i:nth-child(5) { top: 76%; animation-delay: .35s; width: 22%; } .t-streaks i:nth-child(6) { top: 88%; animation-delay: 1.9s; }
.t-streaks i:nth-child(7) { top: 9%; animation-delay: 2.7s; width: 20%; } .t-streaks i:nth-child(8) { top: 54%; animation-delay: 1.1s; width: 34%; }
@keyframes streak { 0% { transform: translateX(0) rotate(-12deg); opacity: 0; } 10% { opacity: 1; } 60% { opacity: .8; } 100% { transform: translateX(420%) rotate(-12deg); opacity: 0; } }
.keyart-wrap { will-change: transform; position: absolute; right: -14vw; top: 50%; margin-top: -18vw; width: 92vw; height: 37.2vw; transform: translate(calc(var(--mx) * -26px), calc(var(--my) * -16px)); transition: transform .25s ease-out; }
.t-wall .keyart { position: absolute; inset: 0; background: center/contain no-repeat; -webkit-mask: linear-gradient(90deg, transparent 30%, #000 52%), linear-gradient(0deg, transparent 0%, #000 14%, #000 86%, transparent 100%); -webkit-mask-composite: source-in; mask: linear-gradient(90deg, transparent 30%, #000 52%) intersect, linear-gradient(0deg, transparent 0%, #000 14%, #000 86%, transparent 100%); animation: keyIn 1.1s cubic-bezier(.2, 1, .3, 1) both, breathe 6s ease-in-out 1.2s infinite; transform-origin: 70% 60%; }
@keyframes breathe { 50% { transform: scale(1.018) translateY(-6px); } }
.rasengan { position: absolute; left: 57%; top: 15.5%; width: 0; height: 0; }
.rasengan::before { content: ''; position: absolute; left: -5vw; top: -5vw; width: 10vw; height: 10vw; border-radius: 50%; background: radial-gradient(circle, rgba(220, 245, 255, .95) 0%, rgba(90, 190, 255, .7) 22%, rgba(40, 120, 255, .25) 45%, transparent 70%); animation: rasPulse 1.4s ease-in-out infinite; will-change: transform, opacity; }
.rasengan b { position: absolute; left: -46px; top: -46px; width: 92px; height: 92px; border-radius: 50%; border: 3px solid transparent; border-top-color: rgba(230, 250, 255, .95); border-left-color: rgba(120, 210, 255, .7); animation: swirlSpin .5s linear infinite; will-change: transform; }
.rasengan b:nth-child(2) { left: -34px; top: -34px; width: 68px; height: 68px; animation-duration: .35s; animation-direction: reverse; }
.rasengan b:nth-child(3) { left: -58px; top: -58px; width: 116px; height: 116px; animation-duration: .8s; opacity: .6; }
@keyframes rasPulse { 50% { transform: scale(1.18); opacity: .8; } }
.blade-glint { position: absolute; left: 60%; top: 2%; width: 26%; height: 5px; transform: rotate(33deg); transform-origin: 0 50%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95), transparent); background-size: 30% 100%; background-repeat: no-repeat; animation: glint 4.5s ease-in-out infinite; }
@keyframes glint { 0%, 70% { background-position: -40% 0; } 100% { background-position: 140% 0; } }
.t-particles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.t-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(14, 14, 18, .82) 0%, rgba(14, 14, 18, .6) 30%, rgba(14, 14, 18, .25) 46%, transparent 62%), radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, .6), transparent 60%); }
#screen-title .logo, #screen-title .menu, #screen-title .footer-note { z-index: 4; }
@keyframes keyIn { from { opacity: 0; transform: translateX(120px) scale(1.05); } }
#screen-title .logo { position: absolute; left: 170px; top: 76px; width: 560px; }
#screen-title .logo img { width: 440px; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .5)); animation: fadeIn 1s .2s both; }
#screen-title .logo .sub { margin-top: 12px; font-family: var(--display); font-size: 22px; letter-spacing: 6px; color: #fff; text-transform: uppercase; text-shadow: 0 2px 8px rgba(0, 0, 0, .7); }
#screen-title .logo .pre { display: inline-block; margin-top: 8px; padding: 4px 12px; background: var(--orange); color: #111; font-weight: 900; letter-spacing: 3px; font-size: 13px; }
.menu { position: absolute; left: 170px; top: 324px; display: flex; flex-direction: column; gap: 10px; width: 380px; z-index: 3; }
.btn { position: relative; cursor: pointer; padding: 13px 22px; font-family: var(--display); font-size: 22px; letter-spacing: 3px; text-transform: uppercase; color: #fff; background: rgba(18, 18, 23, .88); border: 2px solid rgba(255, 255, 255, .15); border-left: 6px solid var(--orange); transition: transform .15s, background .2s, border-color .2s; text-align: left; }
.btn:hover { transform: translateX(8px); background: var(--orange); border-color: var(--orange2); color: #111; }
.btn.primary { background: var(--orange); color: #111; border-color: var(--orange2); }
.btn.primary:hover { background: var(--orange2); }
.btn.small { font-size: 15px; padding: 7px 14px; letter-spacing: 2px; text-align: center; border-left-width: 2px; }
.btn.ghost { background: rgba(18, 18, 23, .6); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.footer-note { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; font-size: 12px; color: rgba(255, 255, 255, .6); z-index: 3; text-shadow: 0 1px 3px #000; }
.panel { background: rgba(18, 18, 23, .92); border: 1px solid rgba(255, 255, 255, .1); border-top: 3px solid var(--orange); box-shadow: 0 16px 40px rgba(0, 0, 0, .55); }
.h-title { font-family: var(--display); font-size: 44px; letter-spacing: 4px; color: #fff; margin: 0; text-transform: uppercase; text-shadow: 0 3px 10px rgba(0, 0, 0, .6); }
.back-btn { position: absolute; left: 30px; top: 26px; z-index: 5; }

/* ---------- setup ---------- */
#screen-setup .wrap { position: absolute; left: 60px; right: 60px; top: 96px; bottom: 40px; display: grid; grid-template-columns: 1fr 380px; gap: 24px; }
.deck-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; overflow-y: auto; padding: 16px; align-content: start; }
.deck-tile { position: relative; height: 300px; overflow: hidden; cursor: pointer; border: 2px solid rgba(255, 255, 255, .1); transition: transform .2s, border-color .2s; background: #111; }
.deck-tile:hover { transform: translateY(-3px); }
.deck-tile .dt-art { position: absolute; inset: 0; background-repeat: no-repeat; }
.deck-tile.sel { border-color: var(--me); box-shadow: 0 0 0 3px var(--me); }
.deck-tile.sel-opp { border-color: var(--opp); box-shadow: 0 0 0 3px var(--opp); }
.deck-tile .dt-shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(12, 12, 16, .95) 85%); }
.deck-tile .dt-info { position: absolute; left: 16px; right: 16px; bottom: 12px; }
.deck-tile .dt-name { font-family: var(--display); font-size: 28px; letter-spacing: 2px; text-transform: uppercase; }
.deck-tile .dt-desc { font-size: 13px; color: #ccc; line-height: 1.35; }
.deck-tile .dt-badge { position: absolute; top: 12px; right: 12px; font-weight: 900; font-size: 12px; padding: 3px 10px; letter-spacing: 2px; color: #111; }
.deck-tile .dt-tag { position: absolute; top: 12px; left: 12px; font-weight: 900; font-size: 11px; padding: 2px 8px; letter-spacing: 2px; background: rgba(0, 0, 0, .7); text-transform: uppercase; }
.setup-side { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 3px; color: var(--dim); margin-bottom: 6px; }
.field input, .field select { width: 100%; padding: 9px 12px; font-size: 17px; font-family: inherit; background: #0c0c10; color: #fff; border: 1px solid #333; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg button { flex: 1; cursor: pointer; padding: 9px 6px; font-family: var(--display); font-size: 15px; letter-spacing: 2px; color: var(--dim); background: #0c0c10; border: 1px solid #333; text-transform: uppercase; }
.seg button.on { background: var(--orange); color: #111; border-color: var(--orange2); }

/* ============================================================
   CARDS (official layout, scalable via --w)
   ============================================================ */
.nc { --w: 150px; --cc: var(--red); position: relative; width: var(--w); height: calc(var(--w) * 1.397); font-size: calc(var(--w) / 12); border-radius: calc(var(--w) * .045); overflow: hidden; flex: none; background: #1a1a1f; box-shadow: 0 .3em .8em rgba(0, 0, 0, .55); color: #111; }
.nc.c-blue { --cc: var(--blue); }
.nc.c-green { --cc: var(--green); }
.nc-art { position: absolute; inset: 0; background-repeat: no-repeat; }
.nc.m-art .nc-art, .nc.m-plain .nc-art { background-size: cover; background-position: 50% 12%; }
.nc.m-plain .nc-art { filter: grayscale(1) contrast(.9) brightness(1.05); opacity: .9; }
.nc.m-plain::before { content: ''; position: absolute; inset: 0; background: var(--cc); mix-blend-mode: multiply; opacity: .55; }
.nc.m-plain { background-color: #e9e8ee; background-size: 260% auto; background-position: center; box-shadow: 0 .3em .8em rgba(0, 0, 0, .55), inset 0 0 0 calc(var(--w) * .03) #fff; }
.nc .pend { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: #1b1b22; line-height: 1.05; }
.nc .pend img { width: 62%; display: block; margin: 0 auto .5em; opacity: .25; }
.nc .pend b { display: block; font-family: var(--display); font-size: 1.35em; letter-spacing: .04em; text-transform: uppercase; padding: 0 .3em; }
.nc .pend small { display: inline-block; margin-top: .4em; font-size: .45em; letter-spacing: .15em; font-weight: 900; color: #fff; background: #1b1b22; padding: .25em .6em; text-transform: uppercase; }
.card-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.statbar { position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%); z-index: 4; display: flex; gap: 1px; white-space: nowrap; font-size: 10px; font-weight: 900; letter-spacing: .5px; box-shadow: 0 2px 6px rgba(0, 0, 0, .7); }
.statbar span { background: #111; color: #aaa; padding: 2px 6px; }
.statbar b { color: #fff; font-size: 12px; margin-left: 2px; }
.statbar span.up b { color: #ffd23a; } .statbar span.dn b { color: #ff7a7a; }
.slot.rested .statbar { transform: translateX(-50%) rotate(-90deg); }
.hand .nc.r-SR::after, #preview .nc.r-SR::after, #modal .nc.r-SR::after, #preview .nc.r-L::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; mix-blend-mode: soft-light; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .85) 45%, transparent 60%); background-size: 300% 300%; animation: sheen 5s ease-in-out infinite; }
@keyframes sheen { 0% { background-position: 100% 0; } 50%, 100% { background-position: -100% 0; } }
/* card backs, rebuilt from the official swirl + logo */
.nback { --w: 150px; position: relative; width: var(--w); height: calc(var(--w) * 1.397); border-radius: calc(var(--w) * .045); overflow: hidden; flex: none; background: #e9e8ee center/260% auto no-repeat; box-shadow: 0 .3em .8em rgba(0, 0, 0, .55), inset 0 0 0 calc(var(--w) * .03) #fff; }
.nback .lg { position: absolute; left: 12%; right: 12%; top: 50%; transform: translateY(-50%) rotate(-8deg); }
.nback .lg img { width: 100%; display: block; }
.nback.leader { background-color: #e2267c; background-blend-mode: multiply; }
.nback.chakra { background-color: #f07c14; background-blend-mode: multiply; }
.nback.summon { background-color: #222; background-blend-mode: multiply; }

/* ============================================================
   GAME BOARD — modeled on the official Gen Con playmat
   ============================================================ */
#screen-game { z-index: 6; }
.gb { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 50%, #26262f 0%, #16161c 70%, #0e0e12 100%); }
.gb .mat-swirl { position: absolute; inset: 0; background: center/cover no-repeat; opacity: .07; filter: grayscale(1); pointer-events: none; }
.zone { position: absolute; border: 2px solid var(--line); border-radius: 14px; }
.zone .zl { position: absolute; font-family: var(--display); font-size: 15px; letter-spacing: 4px; color: rgba(240, 124, 20, .5); text-transform: uppercase; white-space: nowrap; pointer-events: none; }
.zone .zl i { font-style: normal; font-family: var(--font); font-size: 11px; margin-left: 8px; letter-spacing: 1px; }
.zone.center-line { border: none; border-top: 2px dashed rgba(240, 124, 20, .25); border-radius: 0; }
.row { position: absolute; display: flex; gap: 14px; justify-content: center; align-items: center; }
.slot { position: relative; transition: transform .35s cubic-bezier(.3, .8, .3, 1.2); }
.slot.rested { transform: rotate(90deg) scale(.86); }
.side-opp .slot.rested { transform: rotate(-90deg) scale(.86); }
.slot .sick { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); z-index: 5; font-size: 10px; font-weight: 900; letter-spacing: 1px; background: #111; color: var(--dim); padding: 1px 6px; border: 1px solid #444; white-space: nowrap; }
.slot .flag { position: absolute; left: 50%; top: -10px; transform: translateX(-50%); z-index: 5; font-size: 10px; font-weight: 900; letter-spacing: 1px; background: #b3262e; color: #fff; padding: 1px 6px; white-space: nowrap; }
.slot.can-act .nc { box-shadow: 0 0 0 3px var(--orange), 0 0 22px rgba(240, 124, 20, .7); cursor: pointer; }
.slot.targetable { animation: pulse 1s infinite; cursor: crosshair; }
.slot.targetable .nc, .slot.targetable .nback { box-shadow: 0 0 0 4px #ff3b3b, 0 0 26px rgba(255, 60, 60, .9) !important; }
@keyframes pulse { 50% { filter: brightness(1.2); } }
.slot.hidden-sup .nback { cursor: default; }
.slot.can-act .nback { box-shadow: 0 0 0 3px var(--orange), 0 0 22px rgba(240, 124, 20, .8); cursor: pointer; }
.slot .peek { position: absolute; inset: 6px; opacity: .0; transition: opacity .2s; pointer-events: none; }
.slot:hover .peek { opacity: .9; }
.leader-box { position: absolute; width: 176px; }
.leader-box .life { position: absolute; left: -64px; top: 40px; width: 58px; text-align: center; }
.leader-box .life b { display: block; font-family: var(--display); font-size: 54px; line-height: 1; color: #fff; text-shadow: 0 0 14px var(--orange); }
.leader-box .life small { font-weight: 900; letter-spacing: 3px; color: var(--orange); font-size: 12px; }
.leader-box .life.low b { color: #ff5a5a; text-shadow: 0 0 14px #ff2a2a; }
.leader-box .pname { margin-top: 6px; font-family: var(--display); font-size: 20px; letter-spacing: 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader-box.active .pname { color: var(--orange2); }
.chakra-row { position: absolute; display: flex; gap: 6px; }
.chakra-row .ck { transition: transform .4s; transform-style: preserve-3d; }
.chakra-row .ck.down { transform: rotateY(180deg); }
.pile { position: absolute; cursor: pointer; }
.pile .cnt { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); background: #111; padding: 0 10px; font-weight: 900; font-size: 13px; border: 1px solid var(--line); white-space: nowrap; z-index: 3; }
.pile.trash .empty { width: 96px; height: 134px; border: 2px dashed rgba(255, 255, 255, .15); border-radius: 6px; display: grid; place-items: center; font-size: 11px; color: var(--dim); letter-spacing: 2px; }
.hand { position: absolute; left: 250px; right: 280px; bottom: -84px; height: 200px; display: flex; justify-content: center; z-index: 20; pointer-events: none; }
.hand .hc { position: relative; margin: 0 -14px; pointer-events: auto; transform: rotate(var(--r, 0deg)) translateY(var(--ty, 0px)); transform-origin: 50% 130%; }
.hand .hc .lift { transition: transform .22s cubic-bezier(.2, 1.2, .4, 1); transform-origin: 50% 100%; }
.hand .hc:hover { z-index: 50; }
.hand .hc:hover .lift { transform: rotate(calc(var(--r, 0deg) * -1)) translateY(-118px) scale(1.25); }
.hand .hc.can-act .nc { box-shadow: 0 0 0 3px var(--orange), 0 6px 14px rgba(0, 0, 0, .6); cursor: pointer; }
.hand .hc.dim .nc { filter: brightness(.55); }
.opp-hand { position: absolute; left: 50%; top: -96px; transform: translateX(-50%); display: flex; z-index: 3; }
.opp-hand .nback { margin: 0 -22px; }
.center-band { position: absolute; left: 230px; right: 280px; top: 326px; height: 50px; display: flex; align-items: center; justify-content: space-between; z-index: 22; pointer-events: none; }
.turn-chip { pointer-events: auto; font-family: var(--display); font-size: 20px; letter-spacing: 3px; padding: 6px 16px; background: #111; border: 2px solid #333; text-transform: uppercase; }
.turn-chip.mine { border-color: var(--orange); color: var(--orange2); }
.turn-chip.theirs { border-color: var(--opp); color: var(--opp); }
.phase-dots { display: flex; gap: 6px; pointer-events: auto; }
.phase-dots span { font-size: 11px; font-weight: 900; letter-spacing: 2px; padding: 4px 10px; background: #111; color: #555; border: 1px solid #2a2a2a; }
.phase-dots span.on { color: #111; background: var(--orange); border-color: var(--orange2); }
.end-btn { pointer-events: auto; cursor: pointer; font-family: var(--display); font-size: 24px; letter-spacing: 4px; padding: 6px 26px; color: #111; background: var(--orange); border: 2px solid var(--orange2); text-transform: uppercase; box-shadow: 0 4px 0 var(--orange-d); }
.end-btn:hover { background: var(--orange2); }
.end-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--orange-d); }
.end-btn[disabled] { filter: grayscale(1) brightness(.5); pointer-events: none; }
.topbtns { position: absolute; left: 16px; top: 334px; z-index: 26; display: flex; gap: 8px; }
.iconbtn { width: 38px; height: 38px; cursor: pointer; font-size: 16px; background: #111; border: 1px solid #333; color: #fff; display: grid; place-items: center; }
.iconbtn:hover { background: var(--orange); color: #111; }
.prompt { position: absolute; left: 50%; top: 322px; transform: translateX(-50%); z-index: 40; display: none; align-items: center; gap: 14px; padding: 10px 20px; background: #111; border: 2px solid #ff3b3b; font-size: 17px; font-weight: 700; max-width: 900px; box-shadow: 0 10px 30px rgba(0, 0, 0, .7); }
.prompt.show { display: flex; }
.popover { position: absolute; z-index: 65; display: flex; flex-direction: column; gap: 4px; padding: 8px; background: #111; border: 2px solid var(--orange); box-shadow: 0 12px 30px rgba(0, 0, 0, .7); min-width: 230px; }
.popover .pv-title { font-size: 12px; color: var(--orange); letter-spacing: 2px; text-transform: uppercase; padding: 0 4px 4px; font-weight: 900; }
.popover button { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; font-size: 15px; font-weight: 700; color: #fff; padding: 8px 10px; border: 1px solid #333; background: #1d1d24; text-align: left; }
.popover button:hover { background: var(--orange); color: #111; }
.popover button .cost { min-width: 24px; height: 24px; display: grid; place-items: center; background: var(--orange); color: #111; font-weight: 900; font-size: 13px; }
.popover button.cancel { justify-content: center; color: var(--dim); font-size: 13px; }
.logpanel { position: absolute; left: 0; top: 380px; bottom: 210px; width: 360px; z-index: 35; display: flex; flex-direction: column; transform: translateX(-105%); transition: transform .3s ease; }
.logpanel.open { transform: none; }
.logpanel h3 { margin: 0; padding: 8px 14px; font-family: var(--display); letter-spacing: 3px; font-size: 18px; color: var(--orange); }
.logbody { flex: 1; overflow-y: auto; padding: 6px 12px; font-size: 13px; line-height: 1.35; }
.logbody div { padding: 2px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.logbody .dmg, .logbody .ko { color: #ff8a8a; } .logbody .heal { color: #8ae0a0; } .logbody .support { color: #ffb86a; } .logbody .ex { color: #ffd23a; font-weight: 700; } .logbody .chakra { color: #ffa53c; } .logbody .win { color: var(--orange2); font-weight: 900; } .logbody .sys { color: #888; } .logbody .turn { color: #fff; font-weight: 900; margin-top: 6px; }
.toast-log { position: absolute; left: 50%; top: 384px; transform: translateX(-50%); z-index: 24; display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; width: 720px; }
.toast-log div { background: rgba(10, 10, 14, .9); padding: 3px 14px; font-size: 14px; font-weight: 700; animation: toast 3s forwards; border-left: 3px solid var(--orange); }
@keyframes toast { 0% { opacity: 0; } 8% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- preview / modal / overlays ---------- */
#preview { position: fixed; z-index: 95; pointer-events: none; display: none; }
#preview.show { display: flex; gap: 12px; align-items: flex-start; }
#preview .pv-text { width: 330px; padding: 12px 14px; background: rgba(12, 12, 16, .96); border: 1px solid #333; border-top: 3px solid var(--orange); font-size: 14px; line-height: 1.45; }
#preview .pv-text h4 { margin: 0; font-family: var(--display); font-size: 22px; letter-spacing: 1px; }
#preview .pv-text .meta { color: var(--dim); font-size: 12px; margin-bottom: 8px; }
#preview .pv-text .st { display: flex; gap: 10px; margin: 6px 0; font-weight: 900; }
#preview .pv-text .st span { background: #222; padding: 2px 8px; }
#preview .pv-text p { margin: 6px 0; }
#preview .pv-text .conf { margin-top: 8px; font-size: 11px; color: var(--dim); border-top: 1px solid #333; padding-top: 6px; }
.kw { display: inline-block; padding: 0 5px; font-weight: 900; font-size: .85em; background: #333; color: #fff; margin-right: 3px; }
.kw.act, .kw.on { background: #d0312d; } .kw.once { background: #f2c230; color: #111; } .kw.rush { background: #2a8fd6; } .kw.req { background: #000; border: 1px solid #555; } .kw.rec { background: var(--orange); color: #111; } .kw.sup { background: var(--orange); color: #111; } .kw.tim { background: #111; color: var(--orange); border: 1px solid var(--orange); }
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(6, 6, 8, .78); display: none; align-items: center; justify-content: center; }
.modal-back.show { display: flex; animation: fadeIn .2s; }
.modal { min-width: 460px; max-width: 1260px; max-height: 88vh; overflow: auto; padding: 24px 30px; }
.modal h2 { margin: 0 0 6px; font-family: var(--display); letter-spacing: 3px; font-size: 32px; color: var(--orange2); text-transform: uppercase; }
.modal p { margin: 4px 0 14px; font-size: 16px; color: #ddd; }
.modal .cards-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 12px 0 20px; }
.modal .pickable { cursor: pointer; transition: transform .15s; text-align: center; }
.modal .pickable:hover { transform: translateY(-8px); }
.modal .pickable:hover .nc { box-shadow: 0 0 0 3px var(--orange), 0 0 22px rgba(240, 124, 20, .8); }
.modal .pickable .lbl { margin-top: 6px; font-weight: 900; font-size: 14px; color: var(--orange2); }
.modal .row-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.modal .row-btns .btn { text-align: center; }
.cutin { position: fixed; left: 0; right: 0; top: 50%; height: 250px; transform: translateY(-50%); z-index: 75; pointer-events: none; }
.cutin-band { position: absolute; left: -10%; right: -10%; top: 30px; bottom: 30px; background: #111; border-top: 5px solid var(--cut); border-bottom: 5px solid var(--cut); transform: skewY(-4deg) scaleX(0); animation: bandIn .3s cubic-bezier(.2, 1, .3, 1) forwards; overflow: hidden; }
.cutin-lines { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 3px, transparent 3px 46px); animation: speed .22s linear infinite; }
@keyframes speed { to { background-position: -46px 0; } }
@keyframes bandIn { to { transform: skewY(-4deg) scaleX(1); } }
.cutin-portrait { position: absolute; top: 18px; width: 460px; height: 214px; background-repeat: no-repeat; transform: skewY(-4deg); animation: portIn .35s .08s cubic-bezier(.2, 1.2, .4, 1) both; -webkit-mask: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); mask: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
.cutin.left .cutin-portrait { left: 8%; }
.cutin.right .cutin-portrait { right: 8%; animation-name: portInR; }
@keyframes portIn { from { transform: skewY(-4deg) translateX(-160px); opacity: 0; } }
@keyframes portInR { from { transform: skewY(-4deg) translateX(160px); opacity: 0; } }
.cutin-text { position: absolute; top: 50%; transform: translateY(-50%); animation: textIn .35s .12s ease both; }
.cutin.left .cutin-text { left: 42%; }
.cutin.right .cutin-text { right: 42%; text-align: right; }
.cutin-title { font-family: var(--display); font-size: 64px; letter-spacing: 3px; color: #fff; line-height: 1.02; white-space: nowrap; text-transform: uppercase; text-shadow: 0 4px 0 #000; }
.cutin-sub { font-weight: 900; font-size: 18px; letter-spacing: 6px; color: var(--cut); text-transform: uppercase; }
@keyframes textIn { from { opacity: 0; transform: translateY(-50%) translateX(80px); } }
.cutin.out .cutin-band { animation: bandOut .3s forwards; }
.cutin.out .cutin-portrait, .cutin.out .cutin-text { animation: outFade .25s forwards; }
@keyframes bandOut { from { transform: skewY(-4deg) scaleX(1); } to { transform: skewY(-4deg) scaleX(0) translateX(100%); opacity: 0; } }
@keyframes outFade { to { opacity: 0; } }
.phase-banner { position: fixed; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 74; display: flex; justify-content: center; pointer-events: none; }
.pb-scroll { padding: 14px 80px 16px; text-align: center; background: #111; border-top: 4px solid var(--orange); border-bottom: 4px solid var(--orange); box-shadow: 0 20px 50px rgba(0, 0, 0, .7); animation: slideIn .35s cubic-bezier(.2, 1.1, .4, 1) both; transform: skewX(-8deg); }
.pb-text { font-family: var(--display); font-size: 64px; letter-spacing: 8px; line-height: 1.05; text-transform: uppercase; }
.pb-sub { font-size: 15px; font-weight: 900; letter-spacing: 6px; text-transform: uppercase; margin-top: 2px; color: var(--orange2); }
@keyframes slideIn { from { opacity: 0; transform: skewX(-8deg) translateX(-200px); } }
.phase-banner.out .pb-scroll { animation: slideOut .3s forwards; }
@keyframes slideOut { to { opacity: 0; transform: skewX(-8deg) translateX(200px); } }
.phase-banner.red .pb-scroll { border-color: #ff3b3b; } .phase-banner.red .pb-text { color: #ff5a5a; }
.phase-banner.blue .pb-scroll { border-color: var(--opp); } .phase-banner.blue .pb-sub { color: var(--opp); }
.screen-flash { position: fixed; inset: 0; z-index: 72; pointer-events: none; animation: flashOut .4s forwards; mix-blend-mode: screen; }
@keyframes flashOut { from { opacity: .4; } to { opacity: 0; } }
.float-text { position: fixed; z-index: 73; transform: translate(-50%, -50%); font-family: var(--display); font-size: 40px; letter-spacing: 2px; text-shadow: 0 3px 0 #000, 0 0 8px #000; pointer-events: none; animation: floatUp 1.4s forwards; white-space: nowrap; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); } 30% { transform: translate(-50%, -60%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -150%); } }
.handoff { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 20px; background: #111; }
.handoff.show { display: flex; }
.handoff h1 { font-family: var(--display); font-size: 64px; letter-spacing: 6px; margin: 0; color: var(--orange2); text-transform: uppercase; }
.result { position: fixed; inset: 0; z-index: 85; display: none; align-items: center; justify-content: center; flex-direction: column; background: rgba(8, 8, 10, .92); }
.result.show { display: flex; }
.result .r-title { font-family: var(--display); font-size: 120px; letter-spacing: 16px; line-height: 1; text-transform: uppercase; animation: slideIn .6s both; }
.result.win .r-title { color: var(--orange2); text-shadow: 0 0 40px rgba(240, 124, 20, .6); }
.result.lose .r-title { color: #8fa3b8; }
.result .r-card { margin-bottom: 16px; }
.result .r-sub { font-size: 16px; color: #bbb; margin: 8px 0 22px; letter-spacing: 3px; }
.result .row-btns { display: flex; gap: 14px; }
.result .row-btns .btn { text-align: center; }

/* ---------- builder / gallery / rules / settings ---------- */
#screen-builder .wrap, #screen-gallery .wrap { position: absolute; left: 30px; right: 30px; top: 96px; bottom: 24px; display: grid; gap: 18px; }
#screen-builder .wrap { grid-template-columns: 1fr 400px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-bottom: 1px solid #2a2a2a; }
.filters .chip { cursor: pointer; padding: 5px 14px; font-weight: 900; font-size: 13px; background: #0c0c10; border: 1px solid #333; color: var(--dim); letter-spacing: 1px; }
.filters .chip.on { background: var(--orange); color: #111; border-color: var(--orange2); }
.pool { display: flex; flex-direction: column; min-height: 0; }
.pool-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; padding: 16px; align-content: start; justify-items: center; }
.pool-item { position: relative; cursor: pointer; transition: transform .15s; }
.pool-item:hover { transform: translateY(-5px); z-index: 3; }
.pool-item .qty { position: absolute; right: -8px; top: -8px; z-index: 6; min-width: 30px; height: 30px; border-radius: 15px; display: grid; place-items: center; font-weight: 900; background: var(--orange); color: #111; border: 2px solid #fff; }
.pool-item.maxed .nc { filter: brightness(.45); }
.pool-item.sel .nc { box-shadow: 0 0 0 4px var(--orange); }
.decklist { display: flex; flex-direction: column; padding: 14px; min-height: 0; gap: 10px; }
.decklist input { width: 100%; font-family: var(--display); font-size: 22px; letter-spacing: 1px; padding: 6px 10px; background: #0c0c10; border: 1px solid #333; color: #fff; }
.dl-stats { display: flex; justify-content: space-between; font-weight: 700; color: var(--dim); font-size: 14px; }
.dl-stats b { color: #fff; }
.dl-list { flex: 1; overflow-y: auto; }
.dl-row { display: grid; grid-template-columns: 1fr 34px; gap: 8px; align-items: center; padding: 5px 10px; margin-bottom: 3px; cursor: pointer; background: #16161c; border-left: 4px solid var(--cc, #555); font-size: 14px; }
.dl-row:hover { background: #2a1a0c; }
.dl-row small { color: var(--dim); }
.dl-row .q { font-weight: 900; text-align: right; }
.dl-errs { font-size: 13px; color: #ff9a8a; min-height: 18px; }
.dl-ok { color: #8ae0a0; }
.dl-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.dl-btns .btn { flex: 1; font-size: 14px; padding: 7px 8px; text-align: center; letter-spacing: 1px; border-left-width: 2px; }
#screen-rules .wrap { position: absolute; left: 50%; transform: translateX(-50%); top: 96px; bottom: 24px; width: 1120px; overflow-y: auto; padding: 26px 40px; font-size: 16px; line-height: 1.6; }
#screen-rules h3 { font-family: var(--display); letter-spacing: 3px; font-size: 26px; color: var(--orange2); margin: 22px 0 6px; text-transform: uppercase; }
#screen-rules .ph { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0; }
#screen-rules .ph div { padding: 12px; background: #16161c; border-top: 3px solid var(--orange); font-size: 14px; line-height: 1.45; }
#screen-rules .ph b { display: block; font-family: var(--display); letter-spacing: 2px; font-size: 20px; color: #fff; margin-bottom: 4px; text-transform: uppercase; }
#screen-rules table { border-collapse: collapse; margin: 8px 0; width: 100%; }
#screen-rules td { padding: 6px 10px; border-bottom: 1px solid #2a2a2a; vertical-align: top; }
#screen-rules .tag { display: inline-block; font-size: 11px; font-weight: 900; padding: 1px 6px; letter-spacing: 1px; }
.tag.ok { background: #1f6b3a; } .tag.hr { background: #7a4a0c; }
#screen-rules a { color: var(--orange2); }
.settings-list { display: flex; flex-direction: column; gap: 12px; min-width: 620px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; font-size: 16px; }
.set-row small { display: block; color: var(--dim); font-size: 12.5px; }
.set-row select, .set-row input[type=number] { width: 120px; padding: 6px 8px; font-size: 15px; background: #0c0c10; color: #fff; border: 1px solid #333; }
.toggle { width: 54px; height: 28px; border-radius: 14px; background: #333; position: relative; cursor: pointer; border: none; transition: background .2s; flex: none; }
.toggle::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .2s; }
.toggle.on { background: var(--orange); }
.toggle.on::after { left: 29px; }
.settings-list h4 { margin: 10px 0 0; font-family: var(--display); letter-spacing: 3px; color: var(--orange2); font-size: 18px; text-transform: uppercase; }
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: rgba(240, 124, 20, .45); }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, .3); }

/* ============================================================
   AAA SPECTACLE LAYER
   ============================================================ */
.speedlines { will-change: transform; position: fixed; inset: -20%; z-index: 73; pointer-events: none; --sl: #ffffff; background: repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg 3deg, color-mix(in srgb, var(--sl) 55%, transparent) 3deg 3.6deg, transparent 3.6deg 7deg); -webkit-mask: radial-gradient(circle at 50% 50%, transparent 22%, #000 55%); mask: radial-gradient(circle at 50% 50%, transparent 22%, #000 55%); animation: slSpin .25s linear infinite, fadeIn .15s; opacity: .55; }
.speedlines.out { transition: opacity .3s; opacity: 0; }
@keyframes slSpin { to { transform: rotate(7deg); } }
.impact-frame { position: fixed; inset: 0; z-index: 76; pointer-events: none; background: repeating-conic-gradient(from 0deg at var(--x) var(--y), #000 0deg 2.5deg, #fff 2.5deg 6deg); mix-blend-mode: difference; animation: impact .22s steps(3) forwards; }
.impact-frame.strong { background: repeating-conic-gradient(from 0deg at var(--x) var(--y), #000 0deg 1.8deg, #fff 1.8deg 5deg); }
@keyframes impact { 0% { opacity: 1; } 60% { opacity: .8; filter: invert(1); } 100% { opacity: 0; } }
#app.hitstop #layer * { animation-play-state: paused !important; }
.shard { position: fixed; z-index: 66; pointer-events: none; }
.shard > * { width: 100% !important; height: 100% !important; }
.seal { position: fixed; z-index: 58; width: 260px; height: 260px; margin: -130px 0 0 -130px; pointer-events: none; animation: sealIn 1.25s ease-out forwards; }
.seal svg { width: 100%; height: 100%; stroke: #ff9a2a; fill: #ffb347; filter: drop-shadow(0 0 8px #f07c14) drop-shadow(0 0 20px rgba(240, 124, 20, .7)); }
.seal.gold svg { stroke: #ffe27a; fill: #fff1b0; filter: drop-shadow(0 0 10px #ffd23a) drop-shadow(0 0 30px rgba(255, 210, 60, .9)); }
@keyframes sealIn { 0% { transform: scale(.2) rotate(-90deg) rotateX(60deg); opacity: 0; } 25% { opacity: 1; } 70% { transform: scale(1) rotate(40deg) rotateX(60deg); opacity: .9; } 100% { transform: scale(1.25) rotate(80deg) rotateX(60deg); opacity: 0; } }
.pillar { position: fixed; z-index: 59; width: 180px; height: 1400px; margin: -1400px 0 0 -90px; pointer-events: none; --pc: #ffd23a; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--pc) 45%, transparent) 30%, #fff 50%, color-mix(in srgb, var(--pc) 45%, transparent) 70%, transparent); filter: blur(4px); transform-origin: 50% 100%; animation: pillar 1.05s ease-out forwards; mix-blend-mode: screen; }
@keyframes pillar { 0% { transform: scaleX(.05); opacity: 0; } 20% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(.2); opacity: 0; } }
.dmg-num { position: fixed; z-index: 77; transform: translate(-50%, -50%); font-family: var(--display); font-size: 96px; font-weight: 700; letter-spacing: -2px; -webkit-text-stroke: 4px #000; paint-order: stroke fill; text-shadow: 0 6px 0 #000, 0 0 30px rgba(255, 60, 30, .8); pointer-events: none; animation: dmgPop 1.25s cubic-bezier(.2, 1.6, .4, 1) forwards; }
@keyframes dmgPop { 0% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; } 12% { transform: translate(-50%, -50%) scale(.9); opacity: 1; } 22% { transform: translate(-50%, -50%) scale(1.1); } 70% { transform: translate(-50%, -80%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -140%) scale(.9); opacity: 0; } }
.slash { position: fixed; z-index: 74; height: 10px; margin-top: -5px; transform-origin: 0 50%; pointer-events: none; --sc: #fff; background: linear-gradient(90deg, transparent, var(--sc) 30%, #fff 60%, transparent); box-shadow: 0 0 24px var(--sc), 0 0 6px #fff; border-radius: 50%; animation: slash .35s ease-out forwards; }
@keyframes slash { 0% { clip-path: inset(0 100% 0 0); } 40% { clip-path: inset(0 0 0 0); } 100% { clip-path: inset(0 0 0 100%); opacity: .2; } }

/* card depth: tilt + glare */
.tilt .nc::before, #preview .nc::before { content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .2s; background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), rgba(255, 255, 255, .55), transparent 45%); mix-blend-mode: overlay; }
.tilt .nc::before, #preview .nc::before { opacity: 1; }
#preview .nc { transform: perspective(900px) rotateY(var(--ry, 0deg)) rotateX(var(--rx, 0deg)); transition: transform .08s; box-shadow: 0 30px 60px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .15); }
.hand .hc:hover .nc { box-shadow: 0 20px 40px rgba(0, 0, 0, .7), 0 0 0 2px var(--orange), 0 0 30px rgba(240, 124, 20, .45); }
.slot .nc, .leader-box .nc { box-shadow: 0 10px 22px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .08); }

/* board lighting */
.gb::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 60% 45% at 50% var(--spot, 75%), rgba(240, 124, 20, .10), transparent 70%); transition: background .6s; z-index: 1; }
.gb.opp-turn::after { --spot: 25%; background: radial-gradient(ellipse 60% 45% at 50% 25%, rgba(63, 179, 224, .09), transparent 70%); }
.gb .emblem { will-change: transform; position: absolute; left: 775px; top: 349px; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; border: 2px solid rgba(240, 124, 20, .35); background: radial-gradient(circle, rgba(240, 124, 20, .18), transparent 70%); animation: emblemSpin 18s linear infinite; pointer-events: none; }
.gb .emblem::after { content: ''; position: absolute; inset: 14px; border-radius: 50%; border: 6px solid rgba(240, 124, 20, .35); border-right-color: transparent; border-bottom-color: transparent; }
@keyframes emblemSpin { to { transform: rotate(360deg); } }
.zone { box-shadow: inset 0 0 30px rgba(240, 124, 20, .05), 0 0 14px rgba(240, 124, 20, .08); background: linear-gradient(180deg, rgba(255, 255, 255, .015), rgba(0, 0, 0, .12)); }
.gb .vignette { position: absolute; inset: 0; pointer-events: none; z-index: 30; background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, .7) 100%); }
.gb .lowlife { position: absolute; inset: 0; pointer-events: none; z-index: 29; background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(255, 30, 30, .4) 100%); animation: lowPulse 1.2s ease-in-out infinite; display: none; will-change: opacity; }
.gb.danger .lowlife { display: block; }
@keyframes lowPulse { 50% { opacity: .35; } }
.phase-banner .pb-scroll { position: relative; overflow: hidden; }
.phase-banner .pb-scroll::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .25) 50%, transparent 70%); background-size: 250% 100%; animation: bannerSheen .9s ease-out; }
@keyframes bannerSheen { from { background-position: 150% 0; } to { background-position: -100% 0; } }

/* user-supplied live wallpaper (backgrounds/menu.mp4|webm) */
.t-video { position: absolute; left: -4%; top: -4%; width: 108%; height: 108%; object-fit: cover; display: none; transform: translate(calc(var(--mx) * -30px), calc(var(--my) * -20px)) scale(1.02); transition: transform .3s ease-out; }
.t-wall.has-video .t-video { display: block; }
.t-wall.has-video .t-swirl, .t-wall.has-video .t-rays, .t-wall.has-video .keyart-wrap { display: none; }
.t-wall.has-video .t-shade { background: linear-gradient(90deg, rgba(10, 10, 14, .72) 0%, rgba(10, 10, 14, .5) 30%, rgba(10, 10, 14, .2) 46%, transparent 64%), radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, .5), transparent 60%); }
.t-swirl { transform: translate(calc(var(--mx) * 20px), calc(var(--my) * 14px)); }
.click-ripple { position: fixed; z-index: 70; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 3px solid #ffb347; box-shadow: 0 0 20px #f07c14, inset 0 0 12px #f07c14; pointer-events: none; animation: ripple .7s ease-out forwards; }
@keyframes ripple { to { transform: scale(14); opacity: 0; border-width: 1px; } }

/* tutorial coach */
.coach { position: fixed; right: 24px; top: 50%; transform: translateY(-50%); z-index: 79; width: 380px; display: flex; gap: 12px; padding: 14px; background: rgba(12, 12, 16, .96); border: 2px solid var(--orange); box-shadow: 0 16px 40px rgba(0, 0, 0, .7), 0 0 30px rgba(240, 124, 20, .25); animation: coachIn .35s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes coachIn { from { opacity: 0; transform: translateY(-50%) translateX(40px); } }
.coach-ava { flex: none; width: 70px; height: 70px; border-radius: 50%; border: 2px solid var(--orange); background-repeat: no-repeat; }
.coach-body { flex: 1; }
.coach-name { font-family: var(--display); letter-spacing: 3px; color: var(--orange2); font-size: 14px; text-transform: uppercase; }
.coach-text { font-size: 15px; line-height: 1.45; margin: 4px 0 10px; }
.coach-text b { color: #ffd9a8; }
.coach .btn.small { margin-right: 8px; }
.coach-skip { background: none; border: none; color: var(--dim); font-size: 12px; cursor: pointer; text-decoration: underline; }
.coach-focus { outline: 3px solid #ffd23a !important; outline-offset: 6px; border-radius: 8px; animation: coachPulse 1s ease-in-out infinite; }
.hand.coach-focus { outline-offset: -40px; }
@keyframes coachPulse { 50% { outline-color: rgba(255, 210, 60, .25); } }

/* reduced effects mode (Settings) */
body.lowfx .t-rays, body.lowfx .t-streaks, body.lowfx .blade-glint, body.lowfx .gb .emblem, body.lowfx .speedlines, body.lowfx .impact-frame { display: none !important; }
body.lowfx .t-swirl { animation: none; }
body.lowfx .keyart { animation: none !important; }

/* premium VFX */
#stage.chroma { filter: drop-shadow(5px 0 rgba(255, 20, 70, .6)) drop-shadow(-5px 0 rgba(0, 220, 255, .6)); }
.whiteout { position: fixed; inset: 0; z-index: 78; pointer-events: none; background: rgba(255, 255, 255, .92); animation: whiteout .85s ease-out forwards; }
@keyframes whiteout { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
.dmg-num { background: linear-gradient(180deg, #fff6c8 0%, #ffd23a 35%, #ff6a1a 70%, #c2140a 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; -webkit-text-stroke: 3px #1a0400; filter: drop-shadow(0 5px 0 #000) drop-shadow(0 0 18px rgba(255, 90, 30, .8)); text-shadow: none; animation: dmgPop 1.25s cubic-bezier(.2, 1.6, .4, 1) forwards, dmgShake .25s linear 2; }
.dmg-num.heal { background: linear-gradient(180deg, #eafff0, #6aff9a 50%, #0e9a4a); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 5px 0 #000) drop-shadow(0 0 18px rgba(80, 255, 140, .8)); }
@keyframes dmgShake { 25% { margin-left: -4px; } 75% { margin-left: 4px; } }

/* ============ attack clarity ============ */
.atk-overlay { position: fixed; inset: 0; z-index: 57; pointer-events: none; animation: fadeIn .15s; }
.atk-overlay.out { opacity: 0; transition: opacity .2s; }
.atk-overlay svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.atk-overlay .atk-glow { fill: none; stroke: rgba(255, 90, 40, .35); stroke-width: 16; stroke-linecap: round; filter: blur(4px); }
.atk-overlay .atk-line { fill: none; stroke: url(#atkGrad); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 18 10; animation: atkDash .5s linear infinite; }
@keyframes atkDash { to { stroke-dashoffset: -28; } }
.atk-reticle { position: absolute; transform: translate(-50%, -50%); border: 3px solid rgba(255, 50, 40, .9); border-radius: 50%; box-shadow: 0 0 18px rgba(255, 40, 30, .7), inset 0 0 18px rgba(255, 40, 30, .4); animation: reticle 1.6s linear infinite, reticleIn .3s cubic-bezier(.2, 1.5, .4, 1); }
.atk-reticle i { position: absolute; width: 14%; height: 4px; background: #ff3a2a; top: 50%; left: 50%; }
.atk-reticle i:nth-child(1) { transform: translate(-50%, -50%) rotate(0deg) translateX(-360%); }
.atk-reticle i:nth-child(2) { transform: translate(-50%, -50%) rotate(0deg) translateX(360%); }
.atk-reticle i:nth-child(3) { transform: translate(-50%, -50%) rotate(90deg) translateX(-360%); }
.atk-reticle i:nth-child(4) { transform: translate(-50%, -50%) rotate(90deg) translateX(360%); }
@keyframes reticle { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes reticleIn { from { opacity: 0; scale: 2; } }
.atk-chip { position: absolute; transform: translate(-50%, -50%); padding: 6px 14px; background: rgba(12, 12, 16, .94); border: 2px solid #ff5a3a; font-family: var(--display); font-size: 20px; letter-spacing: 1px; color: #fff; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, .6); animation: chipIn .3s cubic-bezier(.2, 1.5, .4, 1); }
.atk-chip b { color: #ffd23a; }
.atk-chip b.ko { color: #ff4a3a; }
.atk-overlay.weak .atk-chip { border-color: #888; }
.atk-overlay.lethal .atk-chip { border-color: #ff2a2a; box-shadow: 0 0 20px rgba(255, 40, 30, .6); }
@keyframes chipIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }
.slot.targeted .nc, .leader-box .slot.targeted .nc { box-shadow: 0 0 0 3px #ff3a2a, 0 0 26px rgba(255, 40, 30, .8) !important; }
.slot.hitflash .nc { animation: hitflash .4s ease-out; }
@keyframes hitflash { 0% { filter: brightness(3) saturate(0); } 25% { filter: brightness(1.6) sepia(1) hue-rotate(-50deg) saturate(6); } 100% { filter: none; } }
.afterimage { position: fixed; z-index: 56; pointer-events: none; opacity: .45; filter: brightness(1.6) saturate(1.4) blur(1px); animation: ghostFade .38s ease-out forwards; }
.afterimage > * { width: 100% !important; }
@keyframes ghostFade { to { opacity: 0; transform: scale(.95); } }
.outcome { position: fixed; z-index: 77; transform: translate(-50%, -50%); pointer-events: none; font-family: var(--display); font-weight: 700; font-size: 44px; letter-spacing: 3px; padding: 2px 18px; white-space: nowrap; background: rgba(10, 10, 14, .85); border-top: 3px solid; border-bottom: 3px solid; animation: outcome 1.45s cubic-bezier(.2, 1.4, .4, 1) forwards; }
.outcome.ko { color: #ff4a3a; border-color: #ff4a3a; text-shadow: 0 0 16px rgba(255, 60, 40, .8); font-size: 54px; }
.outcome.dmg { color: #ffd23a; border-color: #ff6a1a; }
.outcome.blocked { color: #cfd8e8; border-color: #8fa3b8; font-size: 34px; }
@keyframes outcome { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2) skewX(-10deg); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(.95) skewX(-10deg); } 24% { transform: translate(-50%, -50%) scale(1.05) skewX(-10deg); } 75% { opacity: 1; transform: translate(-50%, -70%) skewX(-10deg); } 100% { opacity: 0; transform: translate(-50%, -110%) skewX(-10deg); } }
/* leader life bar (15 segments + draining damage ghost) */
.lifebar { position: absolute; left: 6px; right: 6px; bottom: 26px; height: 16px; z-index: 6; background: rgba(10, 10, 14, .85); border: 2px solid #111; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25), 0 4px 10px rgba(0, 0, 0, .6); overflow: hidden; }
.lifebar .fill, .lifebar .ghost { position: absolute; left: 0; top: 0; bottom: 0; }
.lifebar .ghost { background: #fff; transition: width .6s ease-in .1s; }
.lifebar .fill { background: linear-gradient(180deg, #7dffa8, #22c55e 55%, #0e7a3a); transition: width .25s ease-out; }
.lifebar.low .fill { background: linear-gradient(180deg, #ffb0a0, #ef4444 55%, #8a1010); }
.lifebar::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 15 - 1px), rgba(0, 0, 0, .7) calc(100% / 15 - 1px) calc(100% / 15)); pointer-events: none; }
.lifebar em { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); z-index: 2; font-style: normal; font-weight: 900; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
.lifebar.hurt { animation: lbHurt .5s; }
.lifebar.healed { animation: lbHeal .6s; }
@keyframes lbHurt { 0%, 100% { transform: none; } 20% { transform: translateX(-4px); box-shadow: 0 0 20px #ff2a2a; } 40% { transform: translateX(4px); } 60% { transform: translateX(-2px); } }
@keyframes lbHeal { 30% { box-shadow: 0 0 22px #4ade80; } }
.leader-box { position: absolute; }

/* icons */
.ico { width: 1.05em; height: 1.05em; vertical-align: -0.16em; flex: none; }
.iconbtn .ico { width: 18px; height: 18px; }
.btn .ico { width: .9em; height: .9em; }
.atk-chip .ico { width: 18px; height: 18px; vertical-align: -3px; color: #ff9a6a; }
.prompt .p-lead .ico { color: #ff5a3a; width: 20px; height: 20px; vertical-align: -4px; }
/* response window: compact side panel so the attack arrow stays visible */
.modal-back.resp { background: linear-gradient(90deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .12) 45%, transparent 70%); align-items: center; justify-content: flex-start; padding-left: 3vw; }
.modal-back.resp .modal { min-width: 0; max-width: 520px; padding: 18px 22px; border-top-color: #ff3a2a; animation: respIn .3s cubic-bezier(.2, 1.3, .4, 1); }
.modal-back.resp .modal h2 { font-size: 26px; color: #ff6a4a; }
.modal-back.resp .modal p { font-size: 15px; }
.modal-back.resp .cards-row { justify-content: flex-start; margin: 8px 0 14px; }
.modal-back.resp .cards-row .nc { --w: 140px !important; }
@keyframes respIn { from { opacity: 0; transform: translateX(-60px); } }
.atk-overlay { z-index: 81; }

.slot .flag.rush { background: linear-gradient(90deg, #2a8fd6, #5ac8ff); color: #fff; box-shadow: 0 0 12px rgba(90, 200, 255, .8); animation: rushPulse 1s ease-in-out infinite; }
.slot .flag.rush .ico { width: 11px; height: 11px; vertical-align: -1px; }
@keyframes rushPulse { 50% { box-shadow: 0 0 20px rgba(90, 200, 255, 1); } }

/* EX Characters: gold animated rim, outer glow and tag everywhere */
.nc.ex { filter: drop-shadow(0 0 calc(var(--w) * .06) rgba(255, 200, 60, .85)) drop-shadow(0 0 calc(var(--w) * .02) #fff3b0); animation: exGlow 2.2s ease-in-out infinite; }
@keyframes exGlow { 50% { filter: drop-shadow(0 0 calc(var(--w) * .1) rgba(255, 180, 40, 1)) drop-shadow(0 0 calc(var(--w) * .03) #fff); } }
.hand .hc.dim .nc.ex { filter: brightness(.6) drop-shadow(0 0 8px rgba(255, 200, 60, .7)); animation: none; }
.nc .ex-rim { position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit; padding: calc(var(--w) * .025); background: conic-gradient(from var(--exa, 0deg), #fff3b0, #ffb300, #ff6a00, #ffd23a, #fff3b0, #ffb300, #fff3b0); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: exSpin 3s linear infinite; }
@property --exa { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes exSpin { to { --exa: 360deg; } }
.nc .ex-tag { position: absolute; left: 50%; top: calc(var(--w) * .02); transform: translateX(-50%); z-index: 5; padding: 0 calc(var(--w) * .06); font-family: var(--display); font-weight: 700; font-size: calc(var(--w) * .11); letter-spacing: .08em; color: #3a1a00; background: linear-gradient(180deg, #fff6c8, #ffc23a 55%, #e08a00); border: 1px solid #fff; box-shadow: 0 0 calc(var(--w) * .06) rgba(255, 190, 40, .9); border-radius: 3px; }
body.lowfx .nc.ex { animation: none; }
body.lowfx .nc .ex-rim { animation: none; }
