:root {
  --ink: #2a2135;
  --paper: #fbf3e4;
  --paper2: #f1e2c6;
  --night: #1b1430;
  --night2: #2b2147;
  --gold: #ffcf5a;
  --chips: #2f8cff;
  --mult: #ff4d5e;
  --ember: #ff6a3d;
  --tide: #3db8ff;
  --grove: #6fdc5a;
  --volt: #ffd23d;
  --ok: #6fdc5a;
  --shadow: 0 10px 30px rgba(20, 10, 40, 0.35);
  --card-w: clamp(62px, 7.4vw, 104px);
  --card-h: calc(var(--card-w) * 1.4);
  font-family: 'Fredoka', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  color: var(--paper);
  text-transform: lowercase;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
:where(#ui) > * { pointer-events: auto; }
button { font-family: inherit; text-transform: lowercase; cursor: pointer; touch-action: manipulation; }
.hidden { display: none !important; }

/* ---------- loading / title ---------- */
.title {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 120%, rgba(27, 20, 48, 0.0), rgba(27, 20, 48, 0.55));
  z-index: 20; padding: 16px; text-align: center;
}
.title.loading { background: var(--night); }
.logo {
  font-size: clamp(54px, 11vw, 132px); font-weight: 700; letter-spacing: -2px; line-height: 0.9;
  color: var(--paper);
  text-shadow: 0 4px 0 #c8453b, 0 8px 0 #6e2a52, 0 18px 40px rgba(0, 0, 0, 0.45);
  transform: rotate(-3deg);
  animation: bob 4s ease-in-out infinite;
}
.logo .w { color: var(--gold); }
@keyframes bob { 50% { transform: rotate(-2deg) translateY(-6px); } }
.tagline { margin: 18px 0 26px; font-size: clamp(15px, 2vw, 20px); opacity: 0.92; text-shadow: 0 2px 8px rgba(0,0,0,.5); }
.panel {
  background: rgba(27, 20, 48, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.title .panel { width: min(520px, 100%); }
.row { display: flex; gap: 10px; align-items: center; }
.field {
  flex: 1; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.18); color: var(--paper);
  font: inherit; font-size: 18px; padding: 10px 14px; border-radius: 12px; outline: none; text-transform: lowercase; min-width: 0;
}
.field:focus { border-color: var(--gold); }
.classes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 14px 0; }
.classes button {
  background: rgba(255,255,255,.06); border: 2px solid rgba(255,255,255,.14); color: var(--paper); border-radius: 12px;
  padding: 10px 2px; font-size: 13px; transition: transform .15s, border-color .15s, background .15s;
}
.classes button.on { border-color: var(--gold); background: rgba(255, 207, 90, 0.16); transform: translateY(-2px); }
.classes button .ico { font-size: 22px; display: block; margin-bottom: 4px; }
.colors { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
.colors button { width: 28px; height: 28px; border-radius: 50%; border: 3px solid transparent; padding: 0; }
.colors button.on { border-color: #fff; transform: scale(1.12); }
.btn {
  background: var(--gold); color: var(--ink); border: none; font-weight: 700; font-size: 20px; padding: 12px 22px;
  border-radius: 14px; box-shadow: 0 5px 0 #b8862a, 0 10px 18px rgba(0,0,0,.25); transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b8862a, 0 4px 8px rgba(0,0,0,.25); }
.btn.blue { background: var(--chips); color: white; box-shadow: 0 5px 0 #1b5bb3, 0 10px 18px rgba(0,0,0,.25); }
.btn.red { background: var(--mult); color: white; box-shadow: 0 5px 0 #b3283a, 0 10px 18px rgba(0,0,0,.25); }
.btn.ghost { background: rgba(255,255,255,.1); color: var(--paper); box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.btn:disabled { filter: grayscale(.8) brightness(.7); cursor: not-allowed; }
.btn.small { font-size: 15px; padding: 8px 14px; border-radius: 11px; }
.howto { margin-top: 14px; font-size: 14px; opacity: 0.8; line-height: 1.5; }
.howto b { color: var(--gold); font-weight: 600; }
.progress { width: min(320px, 80vw); height: 10px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; margin-top: 18px; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--ember), var(--volt), var(--grove), var(--tide)); transition: width .3s; }
.loadmsg { margin-top: 10px; font-size: 14px; opacity: .75; }
.credit { position: fixed; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 12px; opacity: .55; }
.credit a { color: inherit; }

/* ---------- hud ---------- */
.hud-tl { position: fixed; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; background: rgba(27, 20, 48, 0.72); backdrop-filter: blur(6px);
  border-radius: 12px; padding: 6px 12px; font-weight: 600; font-size: 15px; box-shadow: 0 4px 14px rgba(0,0,0,.2);
  border: 1.5px solid rgba(255,255,255,.1);
}
.hpbar { width: 150px; height: 12px; border-radius: 7px; background: rgba(0,0,0,.35); overflow: hidden; position: relative; }
.hpbar > div { height: 100%; background: linear-gradient(90deg, #ff4d5e, #ff8a5e); border-radius: 7px; transition: width .4s; }
.hpbar.foe > div { background: linear-gradient(90deg, #6fdc5a, #b6f06a); }
.hpbar .shield { position: absolute; top: 0; left: 0; height: 100%; background: rgba(160, 220, 255, .75); border-radius: 7px; }
.gold { color: var(--gold); }
.hud-tr { position: fixed; top: 14px; right: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.minimap { width: 170px; height: 170px; border-radius: 50%; border: 3px solid rgba(255,255,255,.3); box-shadow: var(--shadow); display: block; background: #14507f; }
.hud-br { position: fixed; bottom: 14px; right: 14px; display: flex; gap: 8px; }
.iconbtn {
  background: rgba(27, 20, 48, 0.78); color: var(--paper); border: 1.5px solid rgba(255,255,255,.14); border-radius: 12px;
  padding: 8px 12px; font-size: 14px; font-weight: 600; backdrop-filter: blur(6px);
}
.iconbtn:hover { border-color: var(--gold); }
.iconbtn kbd { font-family: 'JetBrains Mono', monospace; font-size: 11px; opacity: .6; margin-left: 4px; }
.prompt {
  pointer-events: none; position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: rgba(27, 20, 48, 0.85);
  padding: 10px 18px; border-radius: 14px; font-weight: 600; font-size: 16px; box-shadow: var(--shadow); white-space: nowrap;
  border: 2px solid rgba(255, 207, 90, .5); animation: pop .2s ease-out;
}
.prompt kbd { background: var(--gold); color: var(--ink); border-radius: 6px; padding: 1px 7px; margin-right: 6px; font-family: 'JetBrains Mono', monospace; }
@keyframes pop { from { transform: translateX(-50%) scale(.85); opacity: 0; } }
.toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: rgba(27, 20, 48, 0.88); padding: 8px 16px; border-radius: 12px; font-weight: 600; animation: toast 3.2s forwards; box-shadow: var(--shadow); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }
.labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.label {
  position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-weight: 600; font-size: 13px;
  text-shadow: 0 1px 3px rgba(0,0,0,.8), 0 0 8px rgba(0,0,0,.4); text-align: center;
}
.label .lv { font-size: 11px; opacity: .85; }
.label .bubble { display: block; background: var(--paper); color: var(--ink); text-shadow: none; padding: 5px 10px; border-radius: 12px; margin-bottom: 4px; max-width: 220px; white-space: normal; font-weight: 500; }
.label.creature { font-size: 12px; }
.label .bang { color: var(--mult); font-size: 20px; font-weight: 700; display: block; animation: bob 0.6s infinite; }
.chat { position: fixed; left: 14px; bottom: 14px; width: min(340px, 60vw); pointer-events: none; }
.chat .log { display: flex; flex-direction: column; gap: 3px; font-size: 14px; margin-bottom: 6px; max-height: 160px; overflow: hidden; justify-content: flex-end; }
.chat .log div { background: rgba(27, 20, 48, .55); padding: 3px 9px; border-radius: 9px; align-self: flex-start; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.chat .log b { font-weight: 600; }
.chat input { pointer-events: auto; width: 100%; }
.joystick { position: fixed; width: 110px; height: 110px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); background: rgba(27,20,48,.25); pointer-events: none; transform: translate(-50%, -50%); }
.joystick div { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: rgba(255,255,255,.65); }
.mobile-btns { position: fixed; right: 16px; bottom: 80px; display: flex; flex-direction: column; gap: 10px; }
.mobile-btns button { width: 64px; height: 64px; border-radius: 50%; background: rgba(27,20,48,.6); color: var(--paper); border: 2px solid rgba(255,255,255,.3); font-weight: 700; font-size: 14px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 10, 30, 0.55); display: flex; align-items: center; justify-content: center; z-index: 12; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(880px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal h2 { margin: 0 0 4px; font-size: 30px; }
.modal h3 { margin: 18px 0 8px; font-size: 17px; opacity: .8; font-weight: 600; }
.modal .sub { opacity: .75; margin-bottom: 14px; }
.modal .close { float: right; }
.choices { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }
.choice { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 170px; text-align: center; }
.choice .desc { font-size: 14px; opacity: .85; min-height: 38px; }
.choice .card { --card-w: 112px; }
.grid { display: flex; flex-wrap: wrap; gap: 8px; }
.grid .card { --card-w: 72px; }
.levels { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 14px; font-size: 14px; }
.levels .c { color: var(--chips); font-weight: 600; } .levels .m { color: var(--mult); font-weight: 600; }

/* ---------- cards ---------- */
.card {
  width: var(--card-w); height: var(--card-h); position: relative; border-radius: calc(var(--card-w) * 0.1);
  transition: transform .18s cubic-bezier(.2,.9,.3,1.3), filter .2s, box-shadow .2s; flex: none;
  transform-style: preserve-3d; cursor: pointer; --el: var(--ember); --tilt-x: 0deg; --tilt-y: 0deg;
}
.card.el-ember { --el: var(--ember); --el-dark: #7a1f0c; }
.card.el-tide { --el: var(--tide); --el-dark: #0b3a66; }
.card.el-grove { --el: var(--grove); --el-dark: #1d5a1a; }
.card.el-volt { --el: var(--volt); --el-dark: #6b5200; }
.card .face {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  background: linear-gradient(160deg, var(--paper) 0%, var(--paper2) 100%);
  border: calc(var(--card-w) * 0.035) solid var(--el-dark);
  box-shadow: 0 6px 14px rgba(20, 10, 40, .35), inset 0 0 0 calc(var(--card-w) * 0.03) var(--el);
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  color: var(--el-dark);
}
.card .rank { position: absolute; top: 4%; left: 8%; font-weight: 700; font-size: calc(var(--card-w) * 0.3); line-height: 1; }
.card .rank.br { top: auto; left: auto; bottom: 4%; right: 8%; transform: rotate(180deg); }
.card .pip { position: absolute; top: 28%; left: 7%; width: 22%; }
.card .art { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); width: 52%; filter: drop-shadow(0 3px 0 rgba(0,0,0,.12)); }
.card svg { display: block; width: 100%; height: auto; fill: var(--el); stroke: var(--el-dark); stroke-width: 1.2; }
.card.creature .face { background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--el) 55%, white) 0%, var(--el) 55%, var(--el-dark) 120%); color: white; }
.card.creature .rank { color: white; text-shadow: 0 2px 0 var(--el-dark); }
.card.creature .portrait { position: absolute; left: 6%; right: 6%; top: 12%; height: 56%; background-size: contain; background-position: center; background-repeat: no-repeat; filter: drop-shadow(0 4px 4px rgba(0,0,0,.3)); }
.card.creature .cname { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; font-weight: 700; font-size: calc(var(--card-w) * 0.12); text-shadow: 0 2px 0 var(--el-dark); }
.card.creature .rank.br { display: none; }
.card.creature .portrait { top: 14%; height: 62%; }
.card.creature .pip { top: 5%; right: 7%; left: auto; width: 18%; }
.card.creature .pip svg { fill: white; stroke: none; }
.card .enh { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; mix-blend-mode: overlay; }
.card.enh-foil .enh { background: linear-gradient(115deg, transparent 20%, rgba(120, 200, 255, .7) 35%, rgba(255, 120, 230, .6) 50%, rgba(255, 240, 120, .6) 65%, transparent 80%); background-size: 250% 250%; animation: foil 3s linear infinite; mix-blend-mode: color-dodge; opacity: .65; }
.card.enh-holo .enh { background: repeating-linear-gradient(45deg, rgba(255,255,255,.0) 0 6px, rgba(255,255,255,.35) 6px 8px); mix-blend-mode: soft-light; }
.card.enh-holo .face { box-shadow: 0 6px 14px rgba(20, 10, 40, .35), inset 0 0 0 calc(var(--card-w) * 0.03) var(--mult); }
.card.enh-prism .face { border-image: linear-gradient(135deg, #ff6a3d, #ffd23d, #6fdc5a, #3db8ff, #c77dff) 1; }
.card.enh-prism .enh { background: conic-gradient(from 0deg, rgba(255,0,0,.25), rgba(255,255,0,.25), rgba(0,255,0,.25), rgba(0,255,255,.25), rgba(0,0,255,.25), rgba(255,0,255,.25), rgba(255,0,0,.25)); animation: spin 6s linear infinite; mix-blend-mode: color; }
.card.enh-gilded .face { border-color: #b8862a; box-shadow: 0 6px 14px rgba(20, 10, 40, .35), inset 0 0 0 calc(var(--card-w) * 0.03) var(--gold), inset 0 0 18px rgba(255, 207, 90, .6); }
@keyframes foil { to { background-position: 250% 250%; } }
@keyframes spin { to { filter: hue-rotate(360deg); } }
.card .tag { position: absolute; top: 4%; right: 6%; font-size: calc(var(--card-w) * 0.1); font-weight: 700; background: var(--ink); color: var(--paper); padding: 1px 5px; border-radius: 6px; }
.card.locked { filter: grayscale(1) brightness(.7); cursor: not-allowed; }
.card.locked::after { content: '🔒'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(var(--card-w) * .35); }
.card:hover .face { box-shadow: 0 12px 24px rgba(20, 10, 40, .45), inset 0 0 0 calc(var(--card-w) * 0.03) var(--el); }

/* ---------- battle ---------- */
.battle { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.battle > * { pointer-events: auto; }
.battle .enemy {
  position: fixed; top: 14px; left: 14px; width: min(320px, 46vw); padding: 12px 14px;
}
.battle .enemy .nm { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.battle .enemy .lvl { font-size: 13px; opacity: .7; font-weight: 500; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 9px; color: var(--ink); }
.badge svg { width: 12px; height: 12px; fill: currentColor; }
.battle .enemy .hpbar { width: 100%; height: 16px; margin: 8px 0 4px; }
.battle .enemy .hpnum { font-size: 13px; opacity: .85; display: flex; justify-content: space-between; }
.intent { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 77, 94, .16); border: 1.5px solid rgba(255, 77, 94, .45); font-size: 14px; }
.intent b { color: #ff8a95; }
.matchup { margin-top: 6px; font-size: 12.5px; opacity: .85; }
.scorebox { position: fixed; left: 14px; top: 50%; transform: translateY(-50%); width: min(230px, 34vw); padding: 14px; text-align: center; }
.scorebox .hand { font-size: 19px; font-weight: 700; min-height: 26px; }
.scorebox .hand .lv { font-size: 12px; opacity: .7; }
.cxm { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 0; font-weight: 700; font-size: 26px; font-family: 'JetBrains Mono', monospace; }
.cxm .c, .cxm .m { min-width: 74px; padding: 6px 8px; border-radius: 10px; transition: transform .1s; }
.cxm .c { background: var(--chips); box-shadow: 0 4px 0 #1b5bb3; }
.cxm .m { background: var(--mult); box-shadow: 0 4px 0 #b3283a; }
.cxm .bump { transform: scale(1.18); }
.scorebox .total { font-family: 'JetBrains Mono', monospace; font-size: 34px; font-weight: 700; color: var(--gold); min-height: 42px; text-shadow: 0 3px 0 rgba(0,0,0,.3); }
.scorebox .meta { font-size: 13px; opacity: .75; margin-top: 6px; }
.charms { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.charm {
  width: clamp(48px, 5.4vw, 70px); height: clamp(48px, 5.4vw, 70px); border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #3d2f63, #241a3e); border: 2px solid rgba(255, 207, 90, .5); position: relative; font-size: clamp(22px, 2.6vw, 32px);
  box-shadow: 0 6px 14px rgba(0,0,0,.3); transition: transform .15s; cursor: help;
}
.charm.r2 { border-color: #7fd0ff; } .charm.r3 { border-color: #ff8af0; box-shadow: 0 0 18px rgba(255, 138, 240, .4); }
.charm.empty { opacity: .25; border-style: dashed; }
.charm.fire { animation: jiggle .35s; }
@keyframes jiggle { 30% { transform: scale(1.25) rotate(-8deg); } 60% { transform: scale(1.1) rotate(6deg); } }
.tip {
  position: fixed; z-index: 30; background: var(--paper); color: var(--ink); padding: 10px 12px; border-radius: 12px; font-size: 14px; max-width: 240px;
  box-shadow: var(--shadow); pointer-events: none;
}
.tip b { display: block; font-size: 16px; }
.tip .r { font-size: 11px; opacity: .6; }
.handwrap { position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; padding-bottom: 26px; background: linear-gradient(to top, rgba(27,20,48,.75), rgba(27,20,48,0)); }
.table { display: flex; gap: 10px; min-height: calc(var(--card-h) + 10px); align-items: center; justify-content: center; margin-bottom: 10px; }
.hand-row { display: flex; justify-content: center; align-items: flex-start; height: calc(var(--card-h) + 20px); padding-top: 4px; }
.hand-row .card { margin: 0 calc(var(--card-w) * -0.08); }
.hand-row .card.sel { transform: translateY(-28px) rotate(0deg) !important; }
.hand-row .card.sel .face { box-shadow: 0 14px 26px rgba(20,10,40,.5), 0 0 0 3px var(--gold), inset 0 0 0 calc(var(--card-w) * 0.03) var(--el); }
.table .card.pop { animation: cardpop .32s; }
.table .card.dim { filter: brightness(.55) saturate(.6); transform: scale(.92); }
@keyframes cardpop { 40% { transform: scale(1.18) rotate(-4deg); } }
.float {
  position: fixed; font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 22px; pointer-events: none; z-index: 8;
  text-shadow: 0 2px 0 rgba(0,0,0,.4); animation: floatup 0.9s forwards; transform: translate(-50%, -50%);
}
.float.chips { color: #7fbfff; } .float.mult { color: #ff8a95; } .float.xmult { color: #ff5a6e; font-size: 26px; } .float.heal { color: var(--ok); } .float.gold { color: var(--gold); }
.float.dmg { font-size: 44px; color: #fff; text-shadow: 0 3px 0 #b3283a, 0 0 18px rgba(255, 77, 94, .8); animation: floatbig 1.3s forwards; }
.float.hurt { font-size: 34px; color: #ff6a78; text-shadow: 0 3px 0 #40101a; animation: floatbig 1.2s forwards; }
@keyframes floatup { to { transform: translate(-50%, -150%); opacity: 0; } }
@keyframes floatbig { 0% { transform: translate(-50%, -50%) scale(.4); } 20% { transform: translate(-50%, -80%) scale(1.25); } 100% { transform: translate(-50%, -190%) scale(1); opacity: 0; } }
.actions { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; justify-content: center; }
.actions .info { font-size: 13px; opacity: .8; min-width: 90px; text-align: center; }
.youbar { position: fixed; left: 14px; bottom: 14px; padding: 10px 12px; }
.youbar .hpbar { width: 170px; }
.deckcount { position: fixed; right: 14px; bottom: 14px; padding: 10px 12px; font-size: 14px; text-align: right; }
.banner {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); font-size: clamp(40px, 8vw, 86px); font-weight: 700; pointer-events: none; z-index: 9;
  text-shadow: 0 5px 0 #6e2a52, 0 14px 30px rgba(0,0,0,.5); animation: banner 1.6s forwards; white-space: nowrap;
}
@keyframes banner { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-8deg); opacity: 0; } 15% { transform: translate(-50%, -50%) scale(1.1) rotate(-3deg); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1) rotate(-3deg); } }
.duelbar { position: fixed; top: 14px; left: 14px; width: min(340px, 48vw); padding: 12px 14px; }
.duelbar .vs { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 16px; }
.duelbar .sc { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--gold); text-align: right; }

@media (max-width: 700px) {
  :root { --card-w: clamp(44px, 12.4vw, 80px); }
  .minimap { width: 96px; height: 96px; }
  .hud-tr .chip { font-size: 12px; padding: 4px 8px; }
  .chip { font-size: 13px; padding: 5px 9px; }
  .hpbar { width: 90px; }
  .toasts { top: 150px; width: 90vw; }
  .toast { text-align: center; }
  .iconbtn { font-size: 12px; padding: 6px 9px; }
  .iconbtn kbd { display: none; }
  .actions { gap: 8px; }
  .actions .btn { font-size: 15px; padding: 8px 12px; }
  .actions .info { display: none; }
  .battle .charms { top: 196px; }
  .charm { width: 40px; height: 40px; font-size: 20px; border-radius: 10px; }
  .battle .enemy .nm { font-size: 17px; }
  .intent { font-size: 12.5px; }
  .scorebox { top: 120px; transform: none; left: auto; right: 10px; width: 150px; padding: 10px; }
  .cxm { font-size: 18px; } .cxm .c, .cxm .m { min-width: 48px; }
  .scorebox .total { font-size: 24px; min-height: 30px; }
  .charms { top: auto; bottom: calc(var(--card-h) * 2 + 120px); }
  .battle .enemy { padding: 10px; }
  .youbar, .deckcount { display: none; }
  .hud-br { bottom: auto; right: auto; left: 14px; top: 140px; flex-wrap: wrap; max-width: 70vw; }
  .prompt { bottom: 190px; white-space: normal; text-align: center; width: max-content; max-width: 86vw; }
  .chat { bottom: 190px; }
}
@media (max-height: 760px) {
  .title { justify-content: flex-start; overflow-y: auto; padding-top: 20px; }
  .logo { font-size: clamp(44px, 9vh, 90px); }
  .tagline { margin: 10px 0 14px; }
  .howto { font-size: 12.5px; }
  .credit { position: static; margin-top: 12px; }
}

body.in-battle .mobile-btns, body.in-battle .joystick { display: none; }

.xpbar { width: 70px; height: 7px; border-radius: 4px; background: rgba(0,0,0,.35); overflow: hidden; }
.xpbar > div { height: 100%; background: linear-gradient(90deg, #5fb8ff, #8fd8ff); transition: width .4s; }
.hud-tl .row { gap: 8px; }
.zonebanner { position: fixed; top: 18%; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; z-index: 6; animation: zoneb 4.2s forwards; }
.zonebanner .zn { font-size: clamp(34px, 6vw, 64px); font-weight: 700; color: var(--paper); text-shadow: 0 4px 0 rgba(27,20,48,.6), 0 10px 30px rgba(0,0,0,.5); }
.zonebanner .zl { font-size: clamp(14px, 1.8vw, 18px); opacity: .9; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
@keyframes zoneb { 0% { opacity: 0; transform: translate(-50%, 10px); } 12% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }
.worldmap { display: flex; justify-content: center; }
.worldmap canvas { width: min(78vh, 100%); height: auto; aspect-ratio: 1; border-radius: 14px; border: 2px solid rgba(255,255,255,.15); background: #14507f; }

@media (pointer: coarse) { .hud-br [data-b=mount] { display: none; } }
