/* Spark Beasts: a dark arena for a phone held upright. Everything is sized from #app, so it also fits an iframe. */
@font-face { font-family: Bebas; src: url(../assets/fonts/BebasNeue.ttf); font-display: swap; }
@font-face { font-family: Urb; font-weight: 400; src: url(../assets/fonts/Urbanist-400.ttf); font-display: swap; }
@font-face { font-family: Urb; font-weight: 600; src: url(../assets/fonts/Urbanist-600.ttf); font-display: swap; }
@font-face { font-family: Urb; font-weight: 700; src: url(../assets/fonts/Urbanist-700.ttf); font-display: swap; }

:root {
  --gold: #f2c14e; --ink: #eaf4ee; --soft: #a9cbb9; --cream: #fbeac2;
  --sky: #2f7fe8; --land: #2c9c56; --sea: #0b9396; --spell: #7a5af0;
  --bad: #ff5a5f; --good: #5fe3a1;
}
html, body { height: 100%; margin: 0; background: #020d0a; }
body { font-family: Urb, system-ui, sans-serif; color: var(--ink); -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none; touch-action: manipulation; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; }
#app { position: relative; width: 100%; max-width: 520px; height: 100%; height: 100dvh; margin: 0 auto; container-type: size; overflow: hidden;
  background: radial-gradient(120% 70% at 50% 46%, #11503a 0%, #07281d 55%, #03120d 100%); box-shadow: 0 0 60px rgba(0, 0, 0, .8); }
#screen, #fx, #overlay, #arena { position: absolute; inset: 0; }

/* The arena: fog banks drifting at different speeds, a slow rune circle and rising lights. Only transforms move.
   No blur filters or blend modes on the fog: on iPhone Safari wide, blurred, animated layers made the cards above them flicker. */
#arena { overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .8s; }
#app.in-battle #arena { opacity: 1; }
#arena::before { content: ""; position: absolute; inset: 0; background:
  radial-gradient(60% 34% at 50% 47%, rgba(120, 255, 200, .16), transparent 70%),
  linear-gradient(rgba(120, 20, 40, .28), transparent 34%, transparent 66%, rgba(10, 90, 70, .30)); }
#arena::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 90px 30px rgba(0, 0, 0, .65); }
.fog { position: absolute; left: 0; top: -10%; width: 200%; height: 120%; background-repeat: repeat-x; background-size: 50% 100%;
  will-change: transform; animation: drift 44s linear infinite; }
.fog.f1 { background-image: radial-gradient(ellipse 42% 13% at 31% 31%, rgba(190, 255, 230, .50), transparent 72%), radial-gradient(ellipse 46% 11% at 66% 48%, rgba(160, 240, 255, .44), transparent 72%),
  radial-gradient(ellipse 38% 10% at 46% 67%, rgba(200, 255, 225, .42), transparent 72%), radial-gradient(ellipse 30% 8% at 77% 80%, rgba(200, 255, 235, .34), transparent 72%); }
.fog.f2 { animation-duration: 67s; animation-direction: reverse; background-image: radial-gradient(ellipse 52% 14% at 60% 39%, rgba(255, 255, 255, .26), transparent 72%),
  radial-gradient(ellipse 44% 16% at 33% 57%, rgba(140, 225, 255, .34), transparent 72%), radial-gradient(ellipse 36% 11% at 73% 73%, rgba(190, 255, 210, .34), transparent 72%),
  radial-gradient(ellipse 34% 9% at 38% 20%, rgba(255, 190, 200, .22), transparent 72%); }
.fog.f3 { animation-duration: 26s; background-image: radial-gradient(ellipse 30% 7% at 34% 50%, rgba(255, 240, 190, .34), transparent 72%),
  radial-gradient(ellipse 26% 6% at 80% 44%, rgba(255, 255, 255, .26), transparent 72%), radial-gradient(ellipse 22% 5% at 60% 58%, rgba(170, 255, 220, .30), transparent 72%); }
.rune { position: absolute; left: 50%; top: 47%; width: 86cqw; height: 86cqw; margin: -43cqw; border-radius: 50%; border: 2px dashed rgba(242, 193, 78, .16);
  box-shadow: 0 0 0 10px rgba(242, 193, 78, .03), inset 0 0 0 26px rgba(242, 193, 78, .03), inset 0 0 60px rgba(120, 255, 200, .10); transform: scaleY(.42); animation: spin 90s linear infinite; }
.mote { position: absolute; bottom: -10px; width: 5px; height: 5px; border-radius: 50%; background: #d8ffe9; box-shadow: 0 0 8px 2px rgba(160, 255, 210, .8); opacity: 0;
  transform: scale(var(--s)); animation: rise var(--d) linear infinite; }
@keyframes drift { to { transform: translateX(-50%); } }
@keyframes spin { from { transform: scaleY(.42) rotate(0); } to { transform: scaleY(.42) rotate(360deg); } }
@keyframes rise { 0% { transform: translate(0, 0) scale(var(--s)); opacity: 0; } 12% { opacity: .75; } 80% { opacity: .5; } 100% { transform: translate(var(--w), -105cqh) scale(var(--s)); opacity: 0; } }
#screen { z-index: 1; isolation: isolate; }
#fx { pointer-events: none; z-index: 5; overflow: hidden; }
#overlay { z-index: 10; }
#overlay:empty { pointer-events: none; }
.ic { width: 1.15em; height: 1.15em; vertical-align: -.18em; flex: none; }
.soft { color: var(--soft); }

/* ---------------------------------------------------------------- cards (areas measured on the book's frame) */
.t-sky { --t: var(--sky); } .t-land { --t: var(--land); } .t-sea { --t: var(--sea); } .t-spell { --t: var(--spell); }
.card { position: relative; width: 100%; aspect-ratio: 63 / 88; container-type: inline-size; background: #0b4a10; border-radius: 5.5% / 4%;
  overflow: hidden; color: #18202b; box-shadow: 0 2px 8px rgba(0, 0, 0, .55); }
.card > * { position: absolute; box-sizing: border-box; }
.c-win { left: 6.9%; top: 13.4%; width: 86.2%; height: 44.4%; background: #fff center / cover no-repeat; }
.c-frame { left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.c-lv { left: 5.1%; top: 4.6%; width: 11.3%; height: 7.8%; display: grid; place-items: center; font: 400 8.4cqw/1 Bebas; padding-top: .6cqw; }
.c-lv .ic { width: 72%; height: 72%; color: #d99a00; }
.c-type { left: 83.9%; top: 4.6%; width: 11%; height: 7.8%; border-radius: 50%; display: grid; place-items: center; background: var(--t); color: #fff; }
.c-type .ic { width: 66%; height: 66%; }
.c-type.off { background: #b8b2a2; }
.c-name { left: 19.9%; top: 5.2%; width: 60.4%; height: 6%; display: grid; place-items: center; font: 400 6.7cqw/1 Bebas; letter-spacing: .03em;
  white-space: nowrap; text-transform: uppercase; padding-top: .5cqw; }
.c-strip { left: 6%; top: 60.2%; width: 88.3%; height: 3.7%; display: flex; justify-content: space-between; align-items: center; padding: 0 3.4cqw;
  font: 700 2.7cqw/1 Urb; letter-spacing: .12em; text-transform: uppercase; }
.c-text { left: 8.2%; top: 67.4%; width: 83.6%; height: 17.4%; background: var(--cream); display: flex; flex-direction: column; justify-content: center;
  padding: 0 1.5cqw; overflow: hidden; box-shadow: 0 0 1.6cqw 1.2cqw var(--cream); }
.c-text.off > * { opacity: .3; }
.c-text b { display: block; font: 400 5.4cqw/1.1 Bebas; letter-spacing: .03em; color: #1d6b2a; }
.c-text span { display: block; font: 600 3.7cqw/1.22 Urb; }
.c-text em { display: block; font: 400 3.1cqw/1.2 Urb; color: #6a624f; border-top: .3cqw solid #d9c79a; margin-top: 1cqw; padding-top: .8cqw; }
.c-text.two b { font-size: 4.6cqw; } .c-text.two span { font-size: 3.2cqw; line-height: 1.15; }
.t-spell .c-text b { color: #5a3dc8; }
.card.mini .c-text { align-items: center; text-align: center; }
.card.mini .c-text b { font-size: 8cqw; line-height: 1.05; }
.card.mini .c-text.two b { font-size: 7cqw; }
.card.mini .c-strip { font-size: 3cqw; letter-spacing: .06em; }
.c-atk, .c-hp { top: 89.2%; height: 7.1%; width: 26.2%; display: grid; place-items: center; font: 400 9cqw/1 Bebas; padding-top: .8cqw; }
.c-atk { left: 17.1%; } .c-hp { left: 68.5%; }
.c-atk.up { color: #17873a; } .c-hp.hurt { color: #d1242f; }

/* ---------------------------------------------------------------- buttons and panels */
.btn { border: 0; border-radius: 12px; padding: 11px 16px; font: 700 15px/1.2 Urb; color: var(--ink); background: #1c6e50; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.btn:active { transform: translateY(1px); }
.btn.gold { background: linear-gradient(#ffd96f, #e2a62c); color: #3b2700; }
.btn.ghost { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22); box-shadow: none; }
.btn.danger { color: #ffb3b5; }
.btn.small { padding: 9px 12px; font-size: 14px; white-space: nowrap; }
.btn.icon { padding: 8px 9px; } .btn.icon .ic { width: 20px; height: 20px; vertical-align: middle; }
.btn.big { display: block; width: 100%; padding: 13px 18px 12px; text-align: left; border-radius: 16px; }
.btn.big b { display: block; font: 400 28px/1 Bebas; letter-spacing: .04em; }
.btn.big small { display: block; font: 600 13px/1.3 Urb; opacity: .85; margin-top: 2px; }
.btn[disabled] { opacity: .45; }
a.btn { text-decoration: none; display: inline-block; }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.hint { animation: hint .8s ease-in-out infinite alternate; }
@keyframes hint { from { box-shadow: 0 0 0 2px #fff, 0 0 8px 2px var(--gold); } to { box-shadow: 0 0 0 3px #fff, 0 0 22px 9px var(--gold); } }

.ov { position: absolute; inset: 0; background: rgba(2, 12, 9, .84); display: grid; place-items: center; padding: 16px; box-sizing: border-box;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fadein .18s; }
/* An opened card */
.panel.sheet { gap: 9px; padding: 14px; animation: zoomin .2s; border-color: var(--t); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), 0 0 34px -4px var(--t), 0 10px 40px rgba(0, 0, 0, .6); }
.sh-head { display: flex; align-items: center; gap: 10px; }
.sh-head h2 { flex: 1; text-align: left; font-size: 30px; }
.sh-lv { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--cream); color: #18202b; font: 400 26px/1 Bebas; padding-top: 2px; box-sizing: border-box; border: 2px solid var(--gold); }
.sh-lv .ic { width: 22px; height: 22px; color: #d99a00; }
.sh-head .ty { width: 38px; height: 38px; font-size: 22px; vertical-align: 0; flex: none; } .sh-head .ty.off { background: #8f8b80; }
.sh-art { flex: 0 1 auto; min-height: 90px; border-radius: 12px; overflow: hidden; border: 2px solid var(--gold); background: #fff; display: flex; }
.sh-art img { display: block; width: 100%; height: 100%; object-fit: contain; max-height: 34cqh; }
.sh-sub { margin: 0; font-size: 13px; line-height: 1.35; color: var(--soft); text-align: center; }
.sh-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { display: grid; grid-template-columns: auto auto; justify-content: center; align-items: center; column-gap: 6px; padding: 7px 4px 5px; border-radius: 12px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .14); }
.tile .ic { width: 22px; height: 22px; color: var(--gold); }
.tile b { font: 400 30px/1 Bebas; letter-spacing: .02em; } .tile b s { text-decoration: none; font-size: 18px; color: var(--soft); } .tile b u { text-decoration: none; font-size: 18px; color: var(--good); margin-left: 3px; }
.tile small { grid-column: 1 / -1; text-align: center; font: 700 11px/1.2 Urb; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); }
.tile.hurt b { color: #ff8c8f; } .tile.full { border-color: var(--gold); box-shadow: 0 0 10px -2px var(--gold); }
.sh-abil { display: flex; flex-direction: column; gap: 6px; overflow: auto; min-height: 0; }
.sh-abil p { margin: 0; padding: 8px 11px; border-radius: 12px; background: var(--cream); color: #18202b; font: 600 15px/1.35 Urb; }
.sh-abil p b { display: block; font: 400 21px/1 Bebas; letter-spacing: .04em; color: #1d6b2a; margin-bottom: 2px; }
.t-spell .sh-abil p b { color: #5a3dc8; } .sh-abil p.soft { background: rgba(255, 255, 255, .08); color: var(--soft); }
.sh-flavor { margin: 0; text-align: center; font: italic 400 13px/1.3 Urb; color: var(--soft); }
.sh-status { margin: 0; text-align: center; font: 700 14px/1.3 Urb; color: var(--gold); }
.sheet .row .btn .ic { margin-right: 4px; }

/* The book */
.promo { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 380px; box-sizing: border-box; padding: 10px; border-radius: 16px; text-decoration: none; color: var(--ink);
  background: rgba(0, 0, 0, .3); border: 1.5px solid rgba(242, 193, 78, .5); text-align: left; }
.promo img { flex: none; width: 74px; border-radius: 4px; box-shadow: 0 4px 14px rgba(0, 0, 0, .6); transform: rotate(-3deg); }
.promo .ptext { display: flex; flex-direction: column; gap: 3px; min-width: 0; align-items: flex-start; }
.promo small { font: 600 11.5px/1.2 Urb; color: var(--soft); }
.promo b { font: 400 20px/1.02 Bebas; letter-spacing: .03em; }
.promo em { font: 400 12.5px/1.3 Urb; color: var(--soft); }
.promo .btn { margin-top: 4px; padding: 8px 12px; font-size: 14px; }
.promo.big { padding: 12px; gap: 14px; } .promo.big img { width: min(34cqw, 132px); } .promo.big b { font-size: 23px; } .promo.big .btn { font-size: 15px; padding: 10px 14px; }
.title .promo { margin-top: auto; }
.panel { width: 100%; max-width: 420px; max-height: calc(100cqh - 32px); box-sizing: border-box; display: flex; flex-direction: column; gap: 12px; padding: 18px;
  background: linear-gradient(#135039, #0a2c20); border: 1.5px solid rgba(242, 193, 78, .6); border-radius: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
.panel h2, .screen h1 { margin: 0; font: 400 32px/1 Bebas; letter-spacing: .04em; color: var(--gold); text-align: center; }
.panel .body { font-size: 15px; line-height: 1.45; overflow-y: auto; min-height: 0; flex: 1 1 auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
.panel > h2, .panel > .row { flex: none; }
.panel .body p, .panel .body ol { margin: 0 0 9px; } .panel .body ol { padding-left: 20px; } .panel .body li { margin-bottom: 3px; }
.panel .body h3 { font: 400 20px/1 Bebas; letter-spacing: .05em; color: var(--gold); margin: 12px 0 4px; }
.panel .body .abil b { font: 400 17px/1 Bebas; letter-spacing: .04em; color: #9be8bf; margin-right: 4px; }
.panel.result { text-align: center; } .panel.result.won h2 { font-size: 46px; } .panel.result .body p { margin-bottom: 4px; }
.tri { background: rgba(0, 0, 0, .25); border-radius: 12px; padding: 10px 12px; margin-bottom: 9px; line-height: 2; font-weight: 700; }
.ty { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--t); color: #fff; vertical-align: -5px; font-size: 13px; }

/* ---------------------------------------------------------------- menus */
.screen { position: absolute; inset: 0; box-sizing: border-box; }
.title, .learn, .setup { display: flex; flex-direction: column; align-items: center; gap: 12px; overflow: auto;
  padding: max(20px, env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom)); }
.logo { display: flex; align-items: center; font: 400 clamp(46px, 16cqw, 78px)/.9 Bebas; letter-spacing: .03em; margin-top: 2cqh;
  background: linear-gradient(#fff0b0, #e2a528); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .5)); }
.logo .ic { color: var(--gold); width: .62em; height: .8em; margin: 0 .02em .06em; }
.tag { margin: 0; color: var(--soft); font-weight: 600; text-align: center; }
.fan { position: relative; width: 100%; --w: min(33cqw, calc(25cqh * 63 / 88)); height: calc(var(--w) * 88 / 63 + 14px); flex: none; margin: 6px 0; }
.fan > div { position: absolute; width: var(--w); left: calc(50% - var(--w) / 2); top: 10px; }
.fan0 { transform: translateX(-64%) rotate(-9deg); } .fan1 { transform: translateY(-8px); z-index: 2; } .fan2 { transform: translateX(64%) rotate(9deg); }
.btns { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; }
.lead { margin: 0; text-align: center; max-width: 380px; line-height: 1.4; }
.lessons { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 10px; margin: 6px 0; }
.lesson { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 12px 14px; border-radius: 16px;
  background: rgba(255, 255, 255, .07); border: 1.5px solid rgba(255, 255, 255, .16); }
.lesson.next { border-color: var(--gold); background: rgba(242, 193, 78, .15); }
.lesson .num { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #0b3a2a; border: 2px solid var(--gold);
  font: 400 24px/1 Bebas; color: var(--gold); }
.lesson b { display: block; font: 400 22px/1.05 Bebas; letter-spacing: .04em; } .lesson small { font-size: 13px; color: var(--soft); }
.decks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 420px; }
.deckpick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; border-radius: 16px; text-align: center;
  background: rgba(255, 255, 255, .06); border: 2px solid rgba(255, 255, 255, .16); }
.deckpick.on { border-color: var(--gold); background: rgba(242, 193, 78, .16); }
.deckpick b { font: 400 26px/1 Bebas; letter-spacing: .05em; } .deckpick small { font-size: 12px; line-height: 1.3; color: var(--soft); }
.deckpick em { font: 700 12px Urb; color: var(--gold); }
.faces { position: relative; --w: min(19cqw, 92px); width: calc(var(--w) * 2); height: calc(var(--w) * 88 / 63 + 8px); margin-bottom: 4px; }
.face { position: absolute; top: 4px; width: var(--w); left: calc(50% - var(--w) / 2); }
.face.f0 { z-index: 2; } .face.f1 { transform: translateX(-46%) rotate(-7deg); } .face.f2 { transform: translateX(46%) rotate(7deg); }
.seg { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.seg span { margin-right: 4px; color: var(--soft); }
.seg button { border: 1.5px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .06); border-radius: 999px; padding: 8px 16px; font-weight: 700; }
.seg button.on { background: var(--gold); border-color: var(--gold); color: #3b2700; }
.setup .btn.big { max-width: 380px; text-align: center; }

/* ---------------------------------------------------------------- battle */
.battle { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; height: 100%;
  --fw: min(calc((100cqw - 32px) / 3), calc(21cqh * 63 / 88)); --hw: min(27cqw, calc(18.5cqh * 63 / 88)); }
.bar { display: flex; align-items: center; gap: 9px; padding: 6px 10px; min-width: 0; }
.bar.foe { padding-top: max(6px, env(safe-area-inset-top)); background: linear-gradient(rgba(0, 0, 0, .35), transparent); }
.who { flex: 1; min-width: 0; line-height: 1; }
.who b { display: block; font: 400 19px/1 Bebas; letter-spacing: .05em; }
.who small { font-size: 11px; color: var(--soft); white-space: nowrap; }
.iconbtn { width: 38px; height: 38px; flex: none; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .07); display: grid; place-items: center; padding: 0; }
.iconbtn .ic { width: 22px; height: 22px; }
.pips { display: flex; gap: 2px; }
.pips i { width: 20px; height: 20px; color: rgba(255, 255, 255, .16); display: grid; }
.pips i .ic { width: 100%; height: 100%; }
.pips i.on { color: var(--gold); filter: drop-shadow(0 0 4px rgba(242, 193, 78, .8)); }
.pips i.new { animation: pipin .7s; }
.counts { display: flex; gap: 8px; }
.counts span { display: inline-flex; align-items: center; gap: 3px; font: 700 14px Urb; color: var(--soft); }
.counts img { height: 20px; border-radius: 2px; }

.field { display: flex; justify-content: center; gap: 8px; padding: 5px 8px; }
.slot .card { box-shadow: 0 6px 14px rgba(0, 0, 0, .6); }
.slot { position: relative; width: var(--fw); display: flex; flex-direction: column; align-items: center; gap: 3px; }
.field.me .slot { flex-direction: column-reverse; }
.slot .card { transition: box-shadow .15s; }
.sparks { height: 17px; display: flex; gap: 3px; align-items: center; justify-content: center; }
.sparks i { width: 15px; height: 15px; border-radius: 50%; box-sizing: border-box; background: rgba(0, 0, 0, .45); border: 1.5px solid rgba(242, 193, 78, .45); display: grid; place-items: center; color: transparent; }
.sparks i .ic { width: 10px; height: 10px; }
.sparks i.on { background: var(--gold); border-color: #fff3c4; color: #5a3b00; }
.sparks.full i.on { box-shadow: 0 0 6px 1px rgba(242, 193, 78, .9); }
.slot.empty .ph { width: 100%; aspect-ratio: 63 / 88; box-sizing: border-box; border: 1.5px dashed rgba(255, 255, 255, .2); border-radius: 8px; display: grid; place-content: center;
  justify-items: center; gap: 4px; color: rgba(255, 255, 255, .22); font: 400 13px Bebas; letter-spacing: .12em; }
.slot.empty .ph .ic { width: 22px; height: 22px; }
.slot.empty::after { content: ""; height: 17px; }
.slot.sel .card { box-shadow: 0 0 0 3px #fff, 0 0 14px 2px rgba(255, 255, 255, .6); }
.slot.ready .card { box-shadow: 0 0 0 2px var(--gold), 0 0 6px 1px rgba(242, 193, 78, .5); }
/* Pulsing glows live on their own layer and only change opacity: animating the card's box-shadow made iPhone Safari repaint (and flicker) the card art. */
.slot.ready::after, .slot.hint::after, .hcard.hint::after { content: ""; position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 63 / 88; border-radius: 5.5% / 4%; pointer-events: none; z-index: 3;
  box-shadow: 0 0 0 2px var(--gold), 0 0 18px 5px rgba(242, 193, 78, .95); opacity: 0; animation: glow 1s ease-in-out infinite alternate; }
.field.me .slot.ready::after, .field.me .slot.hint::after { top: auto; bottom: 0; }
.slot.hint::after, .hcard.hint::after { box-shadow: 0 0 0 3px #fff, 0 0 22px 9px var(--gold); animation-duration: .8s; }
@keyframes glow { to { opacity: 1; } }
.slot.target.bad .card { box-shadow: 0 0 0 3px var(--bad), 0 0 18px 4px rgba(255, 90, 95, .85); }
.slot.target.good .card { box-shadow: 0 0 0 3px var(--good), 0 0 18px 4px rgba(95, 227, 161, .85); }
.slot.dim { opacity: .42; }
.slot.hint { animation: none; } .slot.hint .card, .hcard.hint .card { box-shadow: 0 0 0 2px #fff, 0 0 8px 2px var(--gold); }
.slot.enter { animation: dropin .35s; }
.slot.ko { animation: koout .6s forwards; }
.slot.sparked .sparks i.on:last-child { animation: pipin .6s; }
.pred { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); background: #c8102e; color: #fff; font: 400 24px/1 Bebas; padding: 5px 9px 2px;
  border-radius: 9px; border: 2px solid #fff; pointer-events: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.field.me .pred { top: 62%; }
.pred.ko { background: #15110a; color: var(--gold); border-color: var(--gold); } .pred.heal { background: #17873a; }
/* Drag and drop */
.hcard, .field.me .slot, .sparkbtn { touch-action: none; }
.dragghost { position: absolute; left: 0; top: 0; margin: 0; pointer-events: none; opacity: .95; transform-origin: 50% 50%; box-shadow: 0 16px 30px rgba(0, 0, 0, .7), 0 0 0 2px var(--gold); will-change: transform; }
.dragging { opacity: .3; }
.field.drop { border-radius: 16px; background: rgba(242, 193, 78, .14); box-shadow: inset 0 0 0 2.5px rgba(242, 193, 78, .85), inset 0 0 26px rgba(242, 193, 78, .35); }
.field.foe.drop { background: rgba(255, 90, 95, .16); box-shadow: inset 0 0 0 2.5px var(--bad), inset 0 0 26px rgba(255, 90, 95, .4); }

.mid { display: flex; align-items: center; gap: 8px; padding: 4px 12px; min-height: 0; overflow: hidden; }
.say { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.32; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
.say b { font: 400 18px/1 Bebas; letter-spacing: .04em; color: var(--gold); margin-right: 5px; }
.say i { font-style: normal; font-weight: 700; color: #9be8bf; }
.say.log { text-align: center; color: var(--soft); font-weight: 600; }
.say.prompt { text-align: center; font-weight: 700; color: #fff; }
.say.guide { background: rgba(242, 193, 78, .15); border: 1.5px solid rgba(242, 193, 78, .6); border-radius: 12px; padding: 7px 10px; -webkit-line-clamp: 5; line-clamp: 5; }
.say.guide b { font: 700 14.5px/1.32 Urb; letter-spacing: 0; color: #fff; margin: 0; }
.acts { display: flex; gap: 6px; flex: none; align-items: center; }
.acts .btn .ic { margin-right: 3px; }

.bar.me { padding: 4px 10px; }
.sparkbtn { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 2px solid rgba(242, 193, 78, .35); background: rgba(0, 0, 0, .35); color: rgba(242, 193, 78, .35);
  display: grid; place-items: center; padding: 0; }
.sparkbtn .ic { width: 24px; height: 24px; }
.sparkbtn.on { background: radial-gradient(#fff0b0, #e2a528); border-color: #fff3c4; color: #5a3b00; box-shadow: 0 0 14px 3px rgba(242, 193, 78, .7); }
.sparkbtn.sel { box-shadow: 0 0 0 3px #fff, 0 0 18px 6px var(--gold); }
.endbtn { min-width: 104px; } .endbtn.armed { background: #b3261e; }

.hand { position: relative; height: calc(var(--hw) * 88 / 63 + 22px + env(safe-area-inset-bottom)); }
.hcard { position: absolute; bottom: calc(8px + env(safe-area-inset-bottom)); width: var(--hw); z-index: calc(var(--i) + 1);
  --step: min(calc(var(--hw) + 6px), calc((100cqw - 16px - var(--hw)) / max(1, var(--n) - 1)));
  left: calc(50% - var(--hw) / 2 + (var(--i) - (var(--n) - 1) / 2) * var(--step)); transition: transform .14s; }
.hcard.can .card { box-shadow: 0 0 0 2px rgba(242, 193, 78, .9), 0 2px 8px rgba(0, 0, 0, .55); }
.hcard.sel { transform: translateY(-14px) scale(1.06); z-index: 30; }
.hcard.sel .card { box-shadow: 0 0 0 3px #fff, 0 0 16px 3px rgba(255, 255, 255, .6); }
.hcard.enter { animation: handin .4s; }
.battle.theirs .hcard, .battle.theirs .bar.me { filter: saturate(.7) brightness(.85); }

/* ---------------------------------------------------------------- effects */
.pop { position: absolute; transform: translate(-50%, -50%); font: 400 38px/1 Bebas; color: #fff; text-align: center; white-space: nowrap;
  text-shadow: 0 2px 0 #000, 0 0 8px #000, 0 0 3px #000; animation: pop 1.3s forwards; }
.pop small { display: block; font: 700 12.5px/1.25 Urb; color: #ffe08a; }
.pop.dmg { color: #ff7b7f; } .pop.dmg.big { font-size: 52px; }
.pt { position: absolute; width: 9px; height: 9px; margin: -4.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 9px 3px var(--c), 0 0 2px 1px #fff; }
.ring { position: absolute; width: 130px; height: 130px; margin: -65px; border-radius: 50%; border: 4px solid var(--c); box-sizing: border-box; box-shadow: 0 0 20px 2px var(--c), inset 0 0 20px 2px var(--c); }
.slash { position: absolute; width: 124px; height: 124px; margin: -62px; filter: drop-shadow(0 0 5px var(--c)) drop-shadow(0 0 2px var(--c)); }
.slash path { fill: none; stroke: #fff; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; animation: slash .34s ease-out forwards; }
.slash path:nth-child(2) { animation-delay: .05s; } .slash path:nth-child(3) { animation-delay: .1s; }
.bolt, .flystar { position: absolute; width: 30px; height: 30px; margin: -15px; color: var(--c); filter: drop-shadow(0 0 7px var(--c)) drop-shadow(0 0 2px #fff); }
.bolt .ic, .flystar .ic { width: 100%; height: 100%; }
.orb { position: absolute; width: 28px; height: 28px; margin: -14px; border-radius: 50%; background: radial-gradient(#fff, var(--c)); box-shadow: 0 0 22px 8px var(--c); } .pop.healpop { color: #7df0b0; } .pop.kopop { color: var(--gold); font-size: 24px; } .pop.note { color: #ffe08a; font-size: 22px; }
.banner { position: absolute; left: 0; right: 0; top: 43%; padding: 12px 0 8px; text-align: center; font: 400 46px/1 Bebas; letter-spacing: .07em; color: #fff;
  text-shadow: 0 3px 12px #000; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, .7), transparent); animation: banner .85s both; }
.banner.mine { color: var(--gold); }
.cast { position: absolute; left: 50%; top: 44%; width: min(48cqw, calc(40cqh * 63 / 88)); transform: translate(-50%, -50%); animation: cast 1s both; }
.coinov { align-content: center; justify-items: center; gap: 14px; text-align: center; perspective: 600px; }
.coinov h2 { font: 400 40px/1 Bebas; letter-spacing: .05em; color: var(--gold); margin: 10px 0 0; }
.coinov p { margin: 0; max-width: 320px; line-height: 1.4; } .coinov .tap { color: var(--soft); font-weight: 700; animation: fadein .4s 1.4s forwards, blink 1.2s 1.8s infinite alternate; }
.coin { width: 130px; height: 130px; position: relative; transform-style: preserve-3d; animation: flip-you 1.3s cubic-bezier(.2, .7, .3, 1) forwards; }
.coin.foe { animation-name: flip-foe; }
.coin .side { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font: 400 27px/1 Bebas; letter-spacing: .05em; -webkit-backface-visibility: hidden; backface-visibility: hidden;
  background: radial-gradient(#fff0b0, #d99a1e); color: #3b2700; border: 5px solid #fff3c4; box-sizing: border-box; box-shadow: 0 6px 20px rgba(0, 0, 0, .6); }
.coin .side.b { transform: rotateY(180deg); background: radial-gradient(#d7deff, #6f80d8); color: #0e1b52; border-color: #eef1ff; }
.reveal { opacity: 0; animation: fadein .4s 1.4s forwards; }

@keyframes flip-you { from { transform: rotateY(0); } to { transform: rotateY(1440deg); } }
@keyframes flip-foe { from { transform: rotateY(0); } to { transform: rotateY(1620deg); } }
@keyframes slash { 0% { stroke-dashoffset: 100; opacity: 1; } 60% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes blink { from { opacity: 1; } to { opacity: .45; } }
@keyframes zoomin { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes dropin { from { transform: scale(1.25); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes handin { from { transform: translateY(60%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes koout { 25% { transform: scale(1.1) rotate(-5deg); filter: brightness(3) saturate(0); } to { transform: scale(.3) rotate(22deg); filter: brightness(4) blur(6px); opacity: 0; } }
@keyframes pipin { 0% { transform: scale(.2); } 60% { transform: scale(1.7); } to { transform: scale(1); } }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 75% { opacity: 1; transform: translate(-50%, -85%) scale(1); } to { opacity: 0; transform: translate(-50%, -110%); } }
@keyframes banner { 0% { opacity: 0; transform: scaleX(.6); } 20%, 75% { opacity: 1; transform: none; } to { opacity: 0; } }
@keyframes cast { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 20%, 75% { opacity: 1; transform: translate(-50%, -50%); } to { opacity: 0; transform: translate(-50%, -60%) scale(1.1); } }

@media (prefers-reduced-motion: reduce) {
  .hint, .slot.ready::after, .slot.hint::after, .hcard.hint::after, .directbtn { animation-duration: 2.4s; }
}

/* ---------------------------------------------------------------- the card maker ("Make your own monster"); classes start with mk */
.btn.mkopen { width: 100%; background: rgba(242, 193, 78, .12); border: 1px solid rgba(242, 193, 78, .55); color: var(--gold); box-shadow: none; }
.btn.mkopen .ic { color: var(--gold); }
.maker { display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom)); gap: 8px; }
.mktop { display: flex; align-items: center; gap: 10px; flex: none; }
.mktop h1 { flex: 1; text-align: left; font-size: min(28px, 7.4cqw); }
.mkcard { flex: none; width: min(40cqw, 26cqh); margin: 0 auto; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .6)); }
.mkcard .card { box-shadow: 0 0 0 1px rgba(242, 193, 78, .3), 0 0 26px -6px rgba(242, 193, 78, .7); }
.mkctl { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y;
  background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .1); border-radius: 16px; padding: 4px 12px 12px; }
.mkctl h3 { margin: 12px 0 6px; font: 400 20px/1 Bebas; letter-spacing: .05em; color: var(--gold); }
.mknote { margin: 6px 0 0; font-size: 13px; line-height: 1.35; color: var(--soft); }
.mkpics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mkpic { aspect-ratio: 16 / 10; border-radius: 9px; border: 2px solid transparent; background: #fff center / cover no-repeat; padding: 0; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.mkpic.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242, 193, 78, .35), 0 0 14px rgba(242, 193, 78, .6); }
.mkname { width: 100%; box-sizing: border-box; padding: 11px 12px; border-radius: 12px; border: 1.5px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .07);
  color: var(--ink); font: 400 22px/1 Bebas; letter-spacing: .05em; text-transform: uppercase; -webkit-user-select: text; user-select: text; outline: none; }
.mkname:focus { border-color: var(--gold); }
.mkname::placeholder { color: rgba(234, 244, 238, .4); text-transform: none; font: 600 15px Urb; letter-spacing: 0; }
.maker .seg { flex-wrap: wrap; margin-top: 6px; }
.maker .seg button { padding: 7px 13px; }
.mktypes button .ic { color: var(--t); } .mktypes button.on .ic { color: #3b2700; }
.mkstats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mkstep { display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 6px 8px; }
.mkstep span { flex: 1; font-weight: 700; font-size: 14px; }
.mkstep b { min-width: 26px; text-align: center; font: 400 26px/1 Bebas; }
.mkstep.atk b { color: #ffb08a; } .mkstep.hp b { color: #ff8a92; }
.mkstep .btn { padding: 6px 11px; font-size: 18px; line-height: 1; }
.mkabils { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.mkabil { text-align: left; border: 1.5px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .05); border-radius: 12px; padding: 7px 9px; }
.mkabil b { display: block; font: 400 18px/1 Bebas; letter-spacing: .04em; color: #9be8bf; }
.mkabil small { display: block; font-size: 11.5px; line-height: 1.25; color: var(--soft); margin-top: 2px; }
.mkabil.on { border-color: var(--gold); background: rgba(242, 193, 78, .14); } .mkabil.on b { color: var(--gold); }
.mkfoot { flex: none; }
.mkfoot .btn.big { text-align: center; }
.mkhint { margin: 0 0 6px; text-align: center; font-size: 13px; color: var(--soft); }
.panel.mkdone { text-align: center; overflow-y: auto; } .panel.mkdone p { margin: 0; }
.mkdonecard { width: min(34cqw, 150px); margin: 0 auto; }
