/* Rubik font (assets/fonts/rubik.woff2), shipped under its licence:

Copyright 2015 The Rubik Project Authors (https://github.com/googlefonts/rubik)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded, 
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
*/

/* =========================================================================
   Element Rag UI: flat ink panels with cut corners, one warm accent,
   solid high-contrast buttons, square element tiles and glossy skill
   badges. Rubik throughout.
   ========================================================================= */

@font-face { font-family: 'Rubik'; src: url('../assets/fonts/rubik.woff2') format('woff2'); font-weight: 500 900; font-display: swap; }

/* Register theme colours so the browser can interpolate them instead of snapping. */
@property --acc {
  syntax: '<color>';
  inherits: true;
  initial-value: #ffc933;
}
@property --acc-hi {
  syntax: '<color>';
  inherits: true;
  initial-value: #ffd95e;
}

:root {
  transition: --acc 240ms ease-in-out, --acc-hi 240ms ease-in-out;
  --ink: #0c0e15;
  --ink-2: #161a25;
  --ink-3: #222737;
  --ink-4: #2e3447;
  --panel: rgba(13, 15, 23, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6f7fb;
  --muted: #a4abbf;
  --acc: #ffc933;
  --acc-hi: #ffd95e;
  --acc-ink: #1a1404;
  --red: #ff4f5e;
  --green: #45e08a;
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --cut-s: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
  --cut-m: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  --cut-l: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  --ui: 1;
}

@media (prefers-reduced-motion: reduce) {
  :root { transition: none; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--text); font-family: var(--font); font-weight: 600; }
body { user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
canvas#stage { position: fixed; inset: 0; display: block; }
body.playing canvas#stage { cursor: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
button:focus-visible { outline: 3px solid var(--acc); outline-offset: -3px; }
b, h1, h2, h3, h4, p { margin: 0; font-weight: inherit; }
.hidden { display: none !important; }
.ic { display: inline-flex; width: 1.2em; height: 1.2em; flex: none; }
.ic svg, .eicon { width: 100%; height: 100%; display: block; }
.eicon { width: 1.2em; height: 1.2em; }
.ic.gem { color: #6fe7ff; }
.ic.star { color: var(--acc); }

/* --------------------------------------------------------------- basics */
.btn {
  position: relative; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 48px; padding: 8px 22px; max-width: 100%; clip-path: var(--cut-m);
  background: var(--ink-3); color: var(--text); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-weight: 800; font-size: 16px; line-height: 1.1; letter-spacing: 0.04em; text-transform: uppercase;
  transition: background 0.12s, transform 0.08s, filter 0.12s;
}
.btn:hover { background: var(--ink-4); filter: drop-shadow(0 0 7px color-mix(in srgb, var(--acc) 30%, transparent)); }
.btn:active { transform: translateY(1px) scale(0.98); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--acc) 22%, transparent)); }
.btn b { white-space: nowrap; }
.btn small { font-weight: 600; font-size: 12px; letter-spacing: 0.03em; color: var(--muted); white-space: nowrap; }
.btn.primary { background: var(--acc); color: var(--acc-ink); }
.btn.primary:hover { background: var(--acc-hi); }
.btn.primary small { color: rgba(26, 20, 4, 0.72); }
.btn.big { min-height: 62px; font-size: 26px; }
.btn.small { min-height: 38px; padding: 6px 16px; font-size: 13px; clip-path: var(--cut-s); }
.btn.danger { background: #3a1820; color: #ffb3bb; }
.btn.danger:hover { background: #4d1f29; }
.btn[disabled] { opacity: 0.5; cursor: default; }

.round { width: 44px; height: 44px; display: grid; place-items: center; flex: none; clip-path: var(--cut-s); background: var(--ink-3); color: var(--text); transition: background 0.12s; }
.round:hover { background: var(--ink-4); filter: drop-shadow(0 0 7px color-mix(in srgb, var(--acc) 30%, transparent)); }
.round .ic { width: 20px; height: 20px; }

.pill { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 10px; clip-path: var(--cut-s); background: var(--panel); font-weight: 800; font-size: 15px; letter-spacing: 0.03em; white-space: nowrap; }
.pill .ic { width: 18px; height: 18px; }
.pill.user { cursor: pointer; font-size: 13px; }
.pill.user img { width: 22px; height: 22px; border-radius: 4px; }

.card { background: var(--panel); clip-path: var(--cut-l); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* square element tile (class kept as .hex) */
.hex {
  --c: #ddd; --d: color-mix(in srgb, var(--c) 45%, #000);
  position: relative; width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 9px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 34%, var(--ink-2)), color-mix(in srgb, var(--c) 12%, var(--ink)));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--c);
}
.hex .eicon { width: 58%; height: 58%; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35)); }
.hex.locked { --c: #737a90; }
.hex.locked .eicon { opacity: 0.55; }

/* glossy skill badge (codex moves, skill bar, touch buttons) */
.move-ic, .sk-icon, .orb-icon {
  display: grid; place-items: center; flex: none; border-radius: 11px; color: #0d1018;
  background: radial-gradient(120% 90% at 30% 15%, rgba(255, 255, 255, 0.5), transparent 55%), linear-gradient(160deg, var(--c, #fff) 20%, var(--d, #777));
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.35);
}
.move-ic svg, .sk-icon svg, .orb-icon svg { width: 60%; height: 60%; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35)); }
.move-ic .ic { width: 60%; height: 60%; }
.move-ic .ic svg { width: 100%; height: 100%; }

kbd { display: inline-block; font-family: var(--font); font-weight: 800; font-size: 11px; line-height: 1; padding: 4px 6px; border-radius: 4px; background: #e9ecf4; color: #141824; box-shadow: inset 0 -2px 0 #9ba3b8; white-space: nowrap; }

/* -------------------------------------------------------------- screens */
.screen { position: fixed; inset: 0; z-index: 10; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; padding: calc(14px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.screen:not(#home) { background: linear-gradient(180deg, rgba(10, 12, 18, 0.84), rgba(10, 12, 18, 0.94)); }
.bar { display: flex; align-items: center; gap: 12px; max-width: 1100px; margin: 0 auto 14px; }
.bar h2 { margin-right: auto; font-weight: 900; font-size: 24px; letter-spacing: 0.03em; }

/* ----------------------------------------------------------------- home */
#home { padding: 0; }
.home-panel {
  position: absolute; left: 0; top: 0; bottom: 0;
  /* Keep the menu's usable width stable, but carry its dark backdrop much farther into the arena. */
  isolation: isolate;
  width: min(calc(470px + var(--safe-l)), 78vw);
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
  padding: calc(20px + var(--safe-t)) 34px calc(20px + var(--safe-b)) calc(34px + var(--safe-l));
  background: rgba(9, 11, 17, 0.97);
}
.home-panel::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 100%;
  width: clamp(225px, 36vw, 620px);
  pointer-events: none; z-index: -1;
  background: linear-gradient(90deg,
    rgba(9, 11, 17, 0.97) 0%,
    rgba(9, 11, 17, 0.88) 24%,
    rgba(9, 11, 17, 0.64) 52%,
    rgba(9, 11, 17, 0.28) 78%,
    rgba(9, 11, 17, 0) 100%);
}
.title { display: flex; flex-direction: column; align-items: flex-start; line-height: 0.92; font-weight: 900; letter-spacing: -0.01em; }
.title .t1 { font-size: 54px; color: #fff; }
.title .t2 { margin-top: 6px; padding: 2px 14px 4px; font-size: 50px; color: var(--acc-ink); background: var(--acc); clip-path: var(--cut-m); transform: skewX(-8deg); transform-origin: left bottom; }
.home-menu { display: flex; flex-direction: column; gap: 8px; }
.home-menu .btn { width: 100%; }
.home-menu > .btn { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 8px 18px; text-align: left; }
.home-menu > .btn > .ic { width: 26px; height: 26px; }
.home-menu > .btn.big > .ic { width: 30px; height: 30px; }
.btn .bt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; min-width: 0; padding: 8px 6px; font-size: 13px; }
.btn.tile { min-height: 66px; gap: 5px; }
.btn.tile .ic { width: 24px; height: 24px; color: var(--acc); }
.btn .note { position: absolute; top: 7px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--ink-3); }
.loadout-card { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.loadout-card .lbl { font-weight: 800; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }
.loadout-card .row { display: flex; gap: 8px; align-items: center; }
.loadout-card .row .btn { margin-left: auto; }
.corner { position: absolute; top: calc(14px + var(--safe-t)); display: flex; align-items: center; gap: 8px; }
.corner.tr { right: calc(16px + var(--safe-r)); }
.corner.tl { left: calc(16px + var(--safe-l)); }

/* ------------------------------------------------------------------ map */
.seg { flex: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; padding: 3px; clip-path: var(--cut-s); background: var(--panel); min-width: 0; }
.seg button { font-weight: 800; font-size: 12px; letter-spacing: 0.04em; color: var(--muted); padding: 8px 12px; border-radius: 4px; white-space: nowrap; transition: background 0.12s, color 0.12s; }
.seg button:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.seg button.active { background: var(--c, var(--acc)); color: #0f121a; }
.seg button.locked { opacity: 0.5; }
.seg .ic { width: 11px; height: 11px; vertical-align: -1px; margin-left: 4px; }
.realm-head { max-width: 1100px; margin: 6px auto 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; text-align: center; }
.realm-head h3 { width: 100%; font-weight: 900; font-size: clamp(24px, 3.4vw, 38px); letter-spacing: 0.02em; color: #fff; text-shadow: 0 3px 14px rgba(0, 0, 0, 0.5); }
.realm-head .tag { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; clip-path: var(--cut-s); background: var(--panel); font-weight: 800; font-size: 12px; letter-spacing: 0.04em; }
.realm-head .hex { width: 28px; height: 28px; border-radius: 6px; }
.stage-grid { max-width: 1100px; margin: clamp(14px, 3.5vh, 34px) auto 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: clamp(6px, 1.2vw, 12px); }
.stage-grid.nine { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.stage-card {
  --c: var(--acc); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px 6px 12px; min-width: 0;
  clip-path: var(--cut-m); background: var(--ink-2); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3); transition: transform 0.12s, background 0.12s;
}
.stage-card:not(.locked):hover { background: var(--ink-3); transform: translateY(-2px); }
.stage-card .n { font-weight: 900; font-size: clamp(24px, 3vw, 36px); line-height: 1; }
.stage-card .n .ic { width: 1em; height: 1em; }
.stage-card .stars { display: flex; gap: 2px; }
.stage-card .stars .ic { width: 14px; height: 14px; color: #3b4258; }
.stage-card .stars .ic.on { color: var(--acc); }
.stage-card small { font-weight: 700; font-size: 11px; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stage-card.current {
  isolation: isolate;
  background: transparent;
  box-shadow: none;
}
.stage-card.current::before,
.stage-card.current::after {
  content: "";
  position: absolute;
  pointer-events: none;
  clip-path: var(--cut-m);
}
.stage-card.current::before {
  inset: 0;
  background: var(--c);
  z-index: -2;
}
.stage-card.current::after {
  inset: 2px;
  background: color-mix(in srgb, var(--c) 22%, var(--ink-2));
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3);
  z-index: -1;
}
.stage-card.boss { background: linear-gradient(180deg, #4a1822, #2a1018); }
.stage-card.boss .n { color: #ff8d98; }
.stage-card.locked { opacity: 0.45; cursor: not-allowed; }
.stage-card.zero { background: color-mix(in srgb, var(--c) 16%, var(--ink-2)); }
.stage-card.zero .zero-ic { width: 18px; height: 18px; color: var(--c); }
.stage-card .reward { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 5px; }

/* ---------------------------------------------------------------- codex */
.codex-detail { padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cd-head { display: flex; align-items: center; gap: 14px; }
.cd-head .hex { width: 64px; height: 64px; border-radius: 12px; }
.cd-head h3 { font-weight: 900; font-size: clamp(24px, 3vw, 32px); color: var(--c); letter-spacing: 0.02em; }
.cd-head p { color: var(--muted); font-size: 15px; font-weight: 500; margin-top: 2px; }
.moves { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.move { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.045); min-width: 0; }
.move-top { display: flex; align-items: center; gap: 10px; }
.move-ic { width: 46px; height: 46px; }
.move h4 { font-weight: 800; font-size: 14px; letter-spacing: 0.03em; }
.move .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.move .tags span { font-weight: 800; font-size: 11px; padding: 3px 6px; border-radius: 4px; background: var(--ink-4); color: var(--muted); }
.move .tags .melee { background: #4f1d29; color: #ffb3bb; }
.move .tags .ranged { background: #1c3256; color: #a9c9ff; }
.move p { color: var(--muted); font-size: 14px; font-weight: 500; line-height: 1.35; }
.move .meta { margin-top: auto; display: flex; gap: 10px; align-items: center; font-weight: 800; font-size: 12px; }
.move .meta kbd { margin-left: auto; }
.buy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); }
.buy-row p { color: var(--muted); font-size: 14px; font-weight: 500; }
.buy-row .btn { flex-direction: row; gap: 8px; min-height: 42px; }
.buy-row .btn .ic { width: 16px; height: 16px; }
.combos { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.combos h4 { font-weight: 800; font-size: 12px; letter-spacing: 0.12em; color: var(--muted); }
.combo-card { display: flex; align-items: center; gap: 14px; padding: 8px 12px 8px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.045); }
.combo-card .pair { display: flex; align-items: center; gap: 4px; flex: none; }
.combo-card .pair .hex { width: 30px; height: 30px; border-radius: 6px; }
.combo-card .plus, .combo-card .or { font-weight: 900; font-size: 16px; color: var(--muted); }
.combo-card .or { font-size: 12px; }
.combo-card b { font-weight: 800; font-size: 13px; letter-spacing: 0.04em; color: var(--acc); }
.combo-card p { font-size: 12px; font-weight: 500; color: var(--muted); line-height: 1.35; }

/* ---------------------------------------------------------------- forge */
.forge { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.up { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.up-top { display: flex; align-items: center; gap: 12px; }
.up-ic { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; flex: none; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 40%, var(--ink-2)), color-mix(in srgb, var(--c) 14%, var(--ink))); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, transparent); color: var(--c); }
.up-ic .ic { width: 24px; height: 24px; }
.up h4 { font-weight: 800; font-size: 15px; letter-spacing: 0.03em; }
.up p { color: var(--muted); font-size: 14px; font-weight: 500; }
.meter { display: flex; gap: 3px; }
.meter i { flex: 1; height: 6px; border-radius: 2px; background: var(--ink-4); }
.meter i.on { background: var(--c); }
.up .btn { width: 100%; min-height: 42px; font-size: 14px; flex-direction: row; gap: 8px; }
.up .btn .ic { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#hud button { pointer-events: auto; }
.stage-chip { position: absolute; top: calc(12px + var(--safe-t)); left: calc(14px + var(--safe-l)); display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; clip-path: var(--cut-m); background: var(--panel); max-width: 44vw; }
.chip-emblem { --c: #fff; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; flex: none; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 34%, var(--ink-2)), color-mix(in srgb, var(--c) 12%, var(--ink))); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, transparent); color: var(--c); }
.chip-emblem .eicon { width: 58%; height: 58%; }
.chip-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.chip-body b { font-weight: 900; font-size: 14px; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-sub { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 11px; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
.dots { display: flex; gap: 3px; }
.dots i { width: 14px; height: 5px; border-radius: 2px; background: var(--ink-4); }
.dots i.done { background: var(--green); }
.dots i.now { background: var(--acc); }
.bossbar { position: absolute; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(440px, 42vw); display: flex; flex-direction: column; align-items: center; gap: 5px; }
.boss-top { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: clamp(14px, 1.8vw, 18px); letter-spacing: 0.04em; white-space: nowrap; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); }
.boss-top .chip-emblem { width: 28px; height: 28px; border-radius: 6px; }
.boss-track { width: 100%; height: 14px; clip-path: var(--cut-s); background: rgba(8, 10, 16, 0.92); overflow: hidden; padding: 3px; }
/* the fill is cut on the same diagonal, so the dark frame runs all the way round the corners */
.boss-fill { height: 100%; width: 100%; background: linear-gradient(180deg, #ff6b78, #e2303f); clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px); transition: width 0.15s; }
.bossbar small { font-weight: 800; font-size: 11px; letter-spacing: 0.06em; color: #d6dbe8; white-space: nowrap; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7); }
.hud-right { position: absolute; top: calc(12px + var(--safe-t)); right: calc(14px + var(--safe-r)); display: flex; gap: 8px; align-items: center; }
.hud-right .round { background: var(--panel); }

.combo { position: absolute; left: calc(14px + var(--safe-l)); top: calc(70px + var(--safe-t)); display: flex; align-items: baseline; gap: 8px; padding: 3px 14px 5px; clip-path: var(--cut-s); background: var(--panel); font-weight: 900; }
.combo b { font-size: 28px; line-height: 1; color: var(--acc); }
.combo span { font-size: 12px; letter-spacing: 0.12em; color: var(--text); }
.combo.pop b { animation: comboPop 0.18s ease; }
@keyframes comboPop { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }
.banner { position: absolute; top: 26%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 92vw; pointer-events: none; }
.banner span { display: block; padding: 8px 40px 10px; clip-path: polygon(18px 0, 100% 0, calc(100% - 18px) 100%, 0 100%); background: var(--panel); text-align: center; font-weight: 900; font-size: clamp(24px, 4vw, 46px); letter-spacing: 0.04em; color: #fff; animation: bannerIn 1.8s ease forwards; }
.banner.boss span { color: #fff; background: rgba(150, 24, 42, 0.92); }
@keyframes bannerIn { 0% { opacity: 0; transform: translateX(-24px); } 14% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(24px); } }

/* element dock */
.dock { position: absolute; left: calc(14px + var(--safe-l)); bottom: calc(14px + var(--safe-b)); display: flex; gap: 6px; align-items: flex-end; padding: 6px; clip-path: var(--cut-m); background: var(--panel); }
.dock-slot { position: relative; pointer-events: auto; cursor: pointer; transition: opacity 0.12s; }
.dock-slot .hex { width: 46px; height: 46px; }
.dock-slot:not(.on) { opacity: 0.6; }
.dock-slot.on .hex { background: linear-gradient(160deg, color-mix(in srgb, var(--c) 60%, var(--ink-2)), color-mix(in srgb, var(--c) 25%, var(--ink))); box-shadow: inset 0 0 0 2px var(--c), 0 0 12px color-mix(in srgb, var(--c) 45%, transparent); color: #fff; }
.dock-slot kbd { position: absolute; bottom: 2px; right: 2px; padding: 2px 4px; font-size: 11px; }

/* desktop skill bar */
.skillbar { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 8px; }
.skill { --c: #fff; --p: 0; position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; clip-path: var(--cut-m); background: var(--panel); min-width: 180px; }
.sk-icon { position: relative; width: 44px; height: 44px; transition: filter 0.15s; }
.sk-name { flex: 1; font-weight: 800; font-size: 13px; letter-spacing: 0.04em; color: #fff; white-space: nowrap; }
.skill kbd { font-size: 12px; padding: 5px 8px; }
.sk-cd { position: absolute; left: 6px; top: 6px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 11px; font-weight: 900; font-size: 17px; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9); pointer-events: none; }
.skill.cooling .sk-cd { background: conic-gradient(rgba(8, 10, 16, 0.72) calc(var(--p) * 360deg), transparent 0); }
.skill.cooling .sk-icon { filter: grayscale(0.85) brightness(0.65); }
.skill.cooling .sk-name, .skill.cooling kbd { opacity: 0.55; }
.skill.ready-flash { animation: readyFlash 0.45s ease; }
@keyframes readyFlash { 0% { filter: brightness(1.8); } 100% { filter: none; } }
body:not(.touch) .abilities { display: none; }
body.touch .skillbar { display: none; }

/* touch buttons */
.abilities { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); display: flex; align-items: flex-end; gap: 12px; }
.orb { --c: #fff; --p: 0; position: relative; width: 73px; height: 73px; border-radius: 50%; display: grid; place-items: center; background: rgba(10, 12, 18, 0.72); color: #0d1018; touch-action: none; }
.orb:active { transform: scale(0.94); }
.orb-main { width: 92px; height: 92px; }
.orb .ring { position: absolute; inset: -3px; border-radius: 50%; background: conic-gradient(var(--c) calc((1 - var(--p)) * 360deg), rgba(255, 255, 255, 0.12) 0); -webkit-mask: radial-gradient(circle, transparent 63%, #000 65%); mask: radial-gradient(circle, transparent 63%, #000 65%); }
.orb-icon { width: 64%; height: 64%; border-radius: 50%; }
.orb.cooling .orb-icon { filter: grayscale(0.85) brightness(0.55); }
.orb .cd-num { position: absolute; font-weight: 900; font-size: 20px; color: #fff; text-shadow: 0 1px 5px rgba(0, 0, 0, 0.9); }
.orb kbd { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); }
.orb.ready-flash { animation: orbFlash 0.45s ease; }
@keyframes orbFlash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 75%, transparent); } 100% { box-shadow: 0 0 0 16px transparent; } }
.orb-jump { display: none; --c: #fff; }
.orb-jump .orb-icon {
  background: none; box-shadow: none; color: #fff;
  display: grid; place-items: center;
}
.orb-jump .ic {
  width: 100%; height: 100%;
  display: grid; place-items: center;
}
.orb-jump .ic svg {
  width: 82%; height: 82%;
  display: block;
  overflow: visible;
}
.orb-jump .ic svg path { stroke-width: 4 !important; }
.joy { position: absolute; left: 0; bottom: 0; width: 44%; height: 62%; display: none; pointer-events: auto; touch-action: none; }
.joy-base, .joy-knob { position: absolute; border-radius: 50%; display: none; pointer-events: none; }
.joy-base { width: 120px; height: 120px; margin: -60px 0 0 -60px; background: rgba(10, 12, 18, 0.38); border: 2px solid rgba(255, 255, 255, 0.28); }
.joy-knob { width: 54px; height: 54px; margin: -27px 0 0 -27px; background: var(--acc); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.joy.on .joy-base, .joy.on .joy-knob { display: block; }
.coach { position: absolute; left: 50%; top: 20%; transform: translateX(-50%); max-width: 92vw; }
.coach p { padding: 10px 20px; clip-path: var(--cut-s); background: var(--panel); font-weight: 700; font-size: 13px; text-align: center; line-height: 1.5; }

body.touch { --ob: clamp(59px, 14.85vh, 84px); --om: clamp(88px, 23.1vh, 128px); --og: clamp(8px, 2.2vh, 14px); --hx: clamp(32px, 8vh, 42px); --joy: clamp(96px, 26vh, 140px); }
body.touch .orb-jump { display: grid; }
body.touch kbd { display: none; }
body.touch .joy { display: block; }
body.touch .abilities { display: block; right: calc(14px + var(--safe-r)); bottom: calc(14px + var(--safe-b)); width: calc(var(--om) + var(--og) + var(--ob)); height: calc(var(--om) + var(--og) + var(--ob)); pointer-events: none; }
body.touch .orb { position: absolute; width: var(--ob); height: var(--ob); pointer-events: auto; }
body.touch .orb-main { right: 0; bottom: 0; width: var(--om); height: var(--om); }
body.touch .orb-jump { right: calc(var(--om) + var(--og)); bottom: 0; }
body.touch .orb-p1 { right: calc(var(--om) * 0.8 + var(--og)); bottom: calc(var(--om) * 0.8 + var(--og)); }
body.touch .orb-p2 { right: calc((var(--om) - var(--ob)) / 2); bottom: calc(var(--om) + var(--og)); }
body.touch .orb .cd-num { font-size: calc(var(--ob) * 0.34); }
body.touch .dock { left: auto; bottom: auto; right: calc(14px + var(--safe-r)); top: calc(64px + var(--safe-t)); padding: 10px; gap: 6px; }
body.touch .dock-slot .hex { width: var(--hx); height: var(--hx); border-radius: 7px; }
body.touch .joy:not(.on) .joy-base, body.touch .joy:not(.on) .joy-knob { display: block; left: calc(30px + var(--joy) / 2 + var(--safe-l)); top: calc(100% - 26px - var(--joy) / 2 - var(--safe-b)); opacity: 0.5; }
body.touch .joy-base { width: var(--joy); height: var(--joy); margin: calc(var(--joy) / -2) 0 0 calc(var(--joy) / -2); }
body.touch .joy-knob { width: calc(var(--joy) * 0.45); height: calc(var(--joy) * 0.45); margin: calc(var(--joy) * -0.225) 0 0 calc(var(--joy) * -0.225); }
body.touch .combo { padding: 2px 10px 3px; gap: 5px; }
body.touch .combo b { font-size: 18px; }
body.touch .combo span { font-size: 11px; }

/* ---------------------------------------------------------------- modal */
.modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: calc(10px + var(--safe-t)) 10px calc(10px + var(--safe-b)); background: rgba(6, 8, 12, 0.62); animation: fade 0.16s ease; }
.sheet { position: relative; width: min(500px, 100%); max-height: calc((100dvh - 20px - var(--safe-t) - var(--safe-b)) / var(--ui)); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 22px 24px; clip-path: var(--cut-l); background: #121620; box-shadow: inset 0 3px 0 var(--acc); display: flex; flex-direction: column; gap: 14px; animation: pop 0.2s ease; }
.sheet.wide { width: min(760px, 100%); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { font-weight: 900; font-size: clamp(22px, 3vw, 30px); letter-spacing: 0.03em; text-align: center; }
.sheet h2.win { color: var(--acc); }
.sheet h2.lose { color: #ff8a94; }
.sheet .sub { text-align: center; font-weight: 800; font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }
.sheet .tip { text-align: center; font-size: 15px; font-weight: 500; color: var(--muted); line-height: 1.35; }
.sheet .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.sheet .actions .btn { flex: 1 1 120px; max-width: 230px; }
.big-stars { display: flex; justify-content: center; gap: 6px; }
.big-stars .ic { width: 46px; height: 46px; color: #2f3549; transform: scale(0.4); opacity: 0; animation: starIn 0.4s ease forwards; }
.big-stars .ic:nth-child(2) { animation-delay: 0.15s; }
.big-stars .ic:nth-child(3) { animation-delay: 0.3s; }
.big-stars .ic.on { color: var(--acc); }
@keyframes starIn { to { transform: scale(1); opacity: 1; } }
.stat-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stat-tiles div { background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 10px 4px; text-align: center; }
.stat-tiles b { display: block; font-weight: 900; font-size: 22px; }
.stat-tiles small { font-weight: 800; font-size: 11px; letter-spacing: 0.06em; color: var(--muted); }
.payout { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px; font-weight: 900; font-size: 22px; }
.payout .ic { width: 22px; height: 22px; color: #6fe7ff; }
.payout small { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; color: var(--muted); }
.unlock { --c: #fff; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 8px; background: color-mix(in srgb, var(--c) 12%, transparent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 45%, transparent); }
.unlock .hex { width: 54px; height: 54px; border-radius: 10px; }
.unlock small { font-weight: 800; font-size: 11px; letter-spacing: 0.06em; color: var(--c); }
.unlock b { display: block; font-weight: 900; font-size: 19px; }
.unlock p { color: var(--muted); font-size: 14px; font-weight: 500; }
/* rewarded-ad offers: the same button as any other choice, with a small AD tag.
   On result screens they share the top row with the main action; menu buttons go below. */
/* PC: one 2-column grid so both rows line up exactly on every edge */
body:not(.touch) .sheet .result-actions.has-offers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
body:not(.touch) .sheet .result-actions.has-offers .act-row { display: contents; }
body:not(.touch) .sheet .result-actions.has-offers .btn { width: 100%; max-width: none; min-width: 0; }
body:not(.touch) .sheet .result-actions.has-offers .act-row > .btn:only-child { grid-column: 1 / -1; }
.result-actions .act-row { display: flex; gap: 8px; justify-content: center; width: 100%; }
.sheet .result-actions .act-row .btn { flex: 1 1 0; min-width: 0; }
.btn.rw-offer { flex-direction: row; gap: 8px; padding-left: 14px; padding-right: 14px; background: #2c2a4a; white-space: nowrap; }
.btn.rw-offer:hover { background: #38355d; }
.btn.rw-offer b { font-size: 15px; letter-spacing: 0.03em; }
.rw-mark { display: inline-flex; align-items: center; flex: none; color: inherit; line-height: 1; }
/* nudged up: uppercase labels sit above the line box's centre, so a centred arrow read as low */
.rw-mark .ic { width: 20px; height: 20px; display: block; transform: translateY(-1px); }
.rw-mark .ic svg { display: block; }
.btn.small .rw-mark .ic { width: 18px; height: 18px; }
.rw-note { flex: none; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* loadout editor */
.lo-slots { display: flex; justify-content: center; gap: 14px; }
.lo-slot {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: inherit; font: inherit; cursor: pointer;
  transition: transform 0.12s, filter 0.12s;
}
.lo-slot:not(:disabled):hover { transform: translateY(-2px); filter: brightness(1.08); }
.lo-slot:disabled { cursor: default; opacity: 1; }
.lo-slot .hex, .lo-slot .empty { width: 64px; height: 64px; border-radius: 12px; }
.lo-slot .empty { display: block; background: var(--ink-3); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08); }
.lo-slot small { font-weight: 800; font-size: 11px; letter-spacing: 0.04em; color: var(--muted); }
.hint { text-align: center; font-size: 13px; font-weight: 500; color: var(--muted); }

/* settings / pause */
.toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); font-weight: 800; font-size: 12px; letter-spacing: 0.04em; text-align: left; min-width: 0; }
.toggle:hover { background: rgba(255, 255, 255, 0.08); }
.toggle .sw { width: 42px; height: 22px; border-radius: 4px; background: var(--ink-4); position: relative; flex: none; transition: background 0.12s; }
.toggle .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 3px; background: #c6ccdc; transition: transform 0.12s; }
.toggle.on .sw { background: var(--green); }
.toggle.on .sw::after { transform: translateX(20px); background: #fff; }
.keys { display: grid; grid-template-columns: max-content max-content; width: fit-content; max-width: 100%; margin-inline: auto; gap: 6px 12px; align-items: center; font-size: 14px; font-weight: 500; color: var(--muted); }
.keys > span:nth-child(odd) { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.pause-stack { display: flex; flex-direction: column; gap: 8px; width: min(300px, 100%); margin: 0 auto; }
.pause-stack .btn { width: 100%; }
.sheet.pause { width: min(380px, 100%); }
.link-btn { align-self: center; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: underline; padding: 4px 8px; }
.link-btn:hover { color: #fff; }
.legal { display: flex; flex-direction: column; gap: 10px; font-size: 13px; font-weight: 500; line-height: 1.45; color: var(--text); }
.legal a { color: var(--acc); }

/* --------------------------------------------------------------- toasts */
#toasts { position: fixed; top: calc(76px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 40; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; max-width: 92vw; }
.toast { padding: 8px 18px; clip-path: var(--cut-s); background: rgba(18, 22, 32, 0.96); box-shadow: inset 3px 0 0 var(--acc); font-weight: 800; font-size: 13px; letter-spacing: 0.04em; text-align: center; animation: fade 0.2s ease, toastOut 0.4s ease 2.2s forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

#rotate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--ink); text-align: center; padding: 24px; }
#rotate > div { display: flex; flex-direction: column; align-items: center; gap: 16px; }
#rotate .ic { width: 60px; height: 60px; color: var(--acc); animation: tilt 2.2s ease-in-out infinite; }
#rotate p { font-weight: 900; font-size: 16px; letter-spacing: 0.04em; }
@keyframes tilt { 50% { transform: rotate(-90deg); } }
.cg-banner { position: absolute; right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); width: 300px; height: 250px; display: none; }

/* ------------------------------------------------------------- tutorial */
.tut { position: absolute; top: calc(66px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 22px 14px; clip-path: var(--cut-l); background: var(--panel); min-width: min(300px, 80vw); max-width: 92vw; pointer-events: none; transition: transform 0.2s, background 0.2s; }
.tut.ok { background: rgba(20, 60, 40, 0.9); transform: translateX(-50%) scale(1.04); }
.tut .tut-dots { align-self: flex-start; margin-top: 4px; }
.tut-dots { display: flex; gap: 4px; }
.tut-dots i { width: 10px; height: 5px; border-radius: 2px; background: rgba(255, 255, 255, 0.22); transition: background 0.2s, width 0.2s; }
.tut-dots i.cur { width: 22px; background: #fff; }
.tut-dots i.on { background: var(--green); }
.tut-vis { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; color: #fff; }
.cap { display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 10px; border-radius: 8px; background: #eef0f6; color: #141824; font-weight: 900; font-size: 20px; box-shadow: 0 5px 0 #9aa2b6; animation: capPress 1.2s ease-in-out infinite; }
.cap.wide { min-width: 140px; font-size: 16px; }
.cap + .cap { animation-delay: 0.6s; }
@keyframes capPress { 0%, 60%, 100% { transform: none; box-shadow: 0 5px 0 #9aa2b6; } 30% { transform: translateY(4px); box-shadow: 0 1px 0 #9aa2b6; } }
.tut-vis .mouse { width: 34px; height: 46px; animation: capPress 1.2s ease-in-out infinite; }
.tut-vis .goal { width: 120px; height: 55px; }
.tut-vis .joyv { width: 72px; height: 50px; }
.tut-vis .joyv .k { animation: joySlide 1.6s ease-in-out infinite; }
@keyframes joySlide { 0%, 100% { transform: translateX(-9px); } 50% { transform: translateX(9px); } }
.tut-btn { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; border: 3px solid var(--acc); color: var(--acc); }
.tut-btn svg { width: 26px; height: 26px; }
.tut-btn.go { background: var(--green); border-color: var(--green); color: #06210f; }
.tut-label { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: clamp(16px, 2.1vw, 21px); letter-spacing: 0.04em; color: #fff; text-align: center; white-space: nowrap; }
.tut-label span:empty { display: none; }
.tut-label span { padding: 3px 9px; border-radius: 4px; background: var(--acc); color: var(--acc-ink); font-size: 13px; }
.tut.done .tut-label b { color: var(--green); }
.tut-skip { position: absolute; top: 8px; right: 10px; display: flex; align-items: center; gap: 2px; padding: 4px 6px 4px 10px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); font-weight: 800; font-size: 11px; letter-spacing: 0.04em; color: #d4d9e6; pointer-events: auto; }
.tut-skip:hover { color: #fff; background: rgba(255, 255, 255, 0.18); }
.tut-skip .ic { width: 14px; height: 14px; }
.tut-focus.orb { animation: tutPulse 1.1s ease-in-out infinite; }
.tut-focus.joy .joy-base { opacity: 1 !important; border-color: var(--acc); animation: tutPulse 1.1s ease-in-out infinite; }
@keyframes tutPulse { 0% { box-shadow: 0 0 0 0 rgba(255, 201, 51, 0.75); } 70% { box-shadow: 0 0 0 18px rgba(255, 201, 51, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 201, 51, 0); } }

/* ------------------------------------------------------ large-screen scale */
.screen > *, .modal .sheet, #toasts, #hud > :not(.joy) { zoom: var(--ui); }

/* ----------------------------------------------------------- responsive */
@media (max-height: 560px) {
  .btn { min-height: 40px; padding: 6px 14px; font-size: 13px; }
  .btn.big { min-height: 50px; font-size: 21px; }
  .btn.tile { min-height: 52px; gap: 3px; }
  .btn.tile .ic { width: 20px; height: 20px; }
  .home-panel { width: calc(310px + var(--safe-l)); gap: 10px; padding: calc(10px + var(--safe-t)) 22px calc(10px + var(--safe-b)) calc(20px + var(--safe-l)); }
  .title .t1 { font-size: 38px; }
  .title .t2 { font-size: 34px; margin-top: 4px; padding: 1px 10px 3px; }
  .home-menu { gap: 6px; }
  .home-menu > .btn > .ic { width: 22px; height: 22px; }
  .home-menu > .btn.big > .ic { width: 24px; height: 24px; }
  .loadout-card { gap: 5px; }
  .loadout-card .hex { width: 36px; height: 36px; border-radius: 7px; }
  .pill { height: 34px; font-size: 13px; }
  .round { width: 38px; height: 38px; }
  .bar { margin-bottom: 8px; }
  .stage-grid { margin-top: 10px; }
  .stage-card { padding: 10px 4px 8px; gap: 4px; }
  .stage-card .n { font-size: 20px; }
  .stage-card small { font-size: 11px; letter-spacing: 0.02em; }
  .realm-head { gap: 6px 10px; }
  .realm-head h3 { font-size: 20px; }
  .codex-detail { padding: 12px 14px; gap: 8px; }
  .cd-head .hex { width: 46px; height: 46px; border-radius: 9px; }
  .cd-head p { font-size: 13px; }
  .move { padding: 8px; gap: 5px; }
  .move-ic { width: 36px; height: 36px; border-radius: 9px; }
  .move h4 { font-size: 12px; }
  .move p { font-size: 12px; }
  .combo-card { padding: 6px 10px 6px 6px; gap: 10px; }
  .combo-card .pair .hex { width: 26px; height: 26px; }
  .combo-card p { font-size: 11px; }
  .forge { gap: 8px; }
  .up { padding: 10px; gap: 6px; }
  .up-ic { width: 34px; height: 34px; }
  .up p { font-size: 12px; }
  .up .btn { min-height: 34px; }
  .sheet { padding: 14px 18px; gap: 9px; }
  .sheet.wide .hint { display: none; }
  .big-stars .ic { width: 32px; height: 32px; }
  .stat-tiles div { padding: 5px 4px; }
  .stat-tiles b { font-size: 17px; }
  .payout { font-size: 18px; }
  .unlock { padding: 6px 10px; }
  .unlock .hex { width: 40px; height: 40px; }
  .unlock p { display: none; }
  .lo-slots { gap: 10px; }
  .lo-slot .hex, .lo-slot .empty { width: 50px; height: 50px; }
  body.touch .keys { display: none; }
  .orb { width: 62px; height: 62px; }
  .orb-main { width: 77px; height: 77px; }
  .dock-slot .hex { width: 40px; height: 40px; }
  .skill { min-width: 150px; gap: 8px; }
  .sk-icon, .sk-cd { width: 36px; height: 36px; border-radius: 9px; }
  .sk-name { font-size: 11px; }
  .stage-chip { padding: 4px 12px 4px 4px; }
  .chip-emblem { width: 30px; height: 30px; }
  .combo { top: calc(56px + var(--safe-t)); padding: 2px 12px 4px; }
  .combo b { font-size: 22px; }
  .combo span { font-size: 11px; }
  .tut { top: calc(54px + var(--safe-t)); padding: 8px 18px 10px; gap: 7px; }
  .cap { min-width: 38px; height: 38px; font-size: 17px; }
  .cap.wide { min-width: 110px; font-size: 14px; }
  .tut-vis { min-height: 40px; }
  .tut-vis .mouse { width: 28px; height: 38px; }
  .tut-vis .goal { width: 96px; height: 44px; }
  .tut-btn { width: 42px; height: 42px; }
}
@media (max-height: 560px) and (min-width: 600px) {
  .sheet.result { width: min(760px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-flow: row dense; column-gap: 18px; align-content: start; }
  .sheet.result > h2 { grid-column: 1 / -1; }
  .sheet.result > .big-stars, .sheet.result > .sub, .sheet.result > .stat-tiles, .sheet.result > .payout { grid-column: 1; }
  .sheet.result > .unlock, .sheet.result > .unlock ~ .sub, .sheet.result > .tip, .sheet.result > .actions { grid-column: 2; }
  .sheet.result > .actions { align-self: end; }
}
@media (max-width: 600px) {
  .seg button { font-size: 11px; padding: 6px 8px; }
  .forge { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-grid.nine { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .home-panel { width: 100%; background: rgba(9, 11, 17, 0.82); }
  .home-panel::after { display: none; }
}

/* ----------------------------------------------- fill the space on big screens */
@media (min-height: 561px) {
  .home-panel { gap: 22px; }
  .title .t1 { font-size: 62px; }
  .title .t2 { font-size: 56px; }
  .home-menu { gap: 10px; }
  .home-menu .btn.big { min-height: 74px; font-size: 30px; }
  .home-menu > .btn:not(.big) { min-height: 58px; font-size: 18px; }
  .btn.tile { min-height: 80px; font-size: 14px; }
  .btn.tile .ic { width: 28px; height: 28px; }
  .loadout-card .hex { width: 50px; height: 50px; }
  .stage-card { aspect-ratio: 4 / 5; }
}


/* realm tabs: one scrolling row on narrow screens */
@media (max-width: 900px) {
  .seg { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: none; }
}

/* Soft theme-coloured response for secondary controls too. */
.toggle:hover, .seg button:hover, .pill.user:hover, .tut-skip:hover { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--acc) 24%, transparent)); }
button, .btn { transition: background-color 0.14s ease, color 0.14s ease, transform 0.08s ease, filter 0.14s ease; }
@media (prefers-reduced-motion: reduce) { button, .btn { transition: none; } }

/* Clearly visible moving outline trace on Play hover/focus. */
#btnPlay { isolation: isolate; }
#btnPlay > .ic,
#btnPlay > .bt { position: relative; z-index: 2; }
#btnPlay .play-trace {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
#btnPlay .play-trace .trace-halo {
  fill: none;
  stroke: var(--acc, #ffc933);
  stroke-width: 1.25;
  stroke-linecap: butt;
  stroke-linejoin: bevel;
  stroke-dasharray: 185 815;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 1px #080b12) drop-shadow(0 0 2px var(--acc, #ffc933));
}
#btnPlay .play-trace .trace-line {
  fill: none;
  stroke: var(--acc, #ffc933);
  stroke-width: 0.6;
  stroke-linecap: butt;
  stroke-linejoin: bevel;
  stroke-dasharray: 185 815;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 0.75px #080b12);
}
#btnPlay:hover .play-trace,
#btnPlay:focus-visible .play-trace { opacity: 1; }
#btnPlay:hover .play-trace .trace-halo,
#btnPlay:hover .play-trace .trace-line,
#btnPlay:focus-visible .play-trace .trace-halo,
#btnPlay:focus-visible .play-trace .trace-line {
  animation: playTraceTravel 2.45s linear infinite;
}
@keyframes playTraceTravel {
  to { stroke-dashoffset: -1000; }
}
@media (prefers-reduced-motion: reduce) {
  #btnPlay .play-trace .trace-halo,
  #btnPlay .play-trace .trace-line { animation: none !important; }
}

/* Ability orbs: +10% sizing and a calm, staggered vertical float. */
.orb {
  animation: orbFloat 3.4s ease-in-out infinite;
  will-change: transform;
}
.orb-p1 { animation-delay: -0.7s; }
.orb-p2 { animation-delay: -1.5s; }
.orb-main { animation-delay: -2.2s; }
.orb-jump { animation-delay: -1.1s; }
@keyframes orbFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.orb:active { animation-play-state: paused; transform: translateY(0) scale(0.94); }
.orb.ready-flash { animation: orbFloat 3.4s ease-in-out infinite, orbFlash 0.45s ease; }
@media (prefers-reduced-motion: reduce) {
  .orb, .orb.ready-flash { animation: none !important; }
}


/* ------------------------------------------------------ touch result layouts
   Keep the result content and its actions in explicit regions. This avoids
   CSS grid auto-placement scattering level text when no unlock card exists. */
body.touch .sheet.result {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100dvh - 20px - var(--safe-t) - var(--safe-b));
  padding: clamp(12px, 2.2vh, 20px) clamp(14px, 2.4vw, 22px);
  gap: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(150px, 0.8fr);
  grid-template-areas: "heading heading" "content actions";
  align-content: center;
  align-items: center;
}
body.touch .sheet.result > h2 { grid-area: heading; min-width: 0; line-height: 1.05; }
body.touch .sheet.result > .result-content {
  grid-area: content;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-self: center;
  gap: 10px;
}
body.touch .sheet.result > .result-actions {
  grid-area: actions;
  min-width: 0;
  align-self: center;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
}
body.touch .sheet.result > .result-actions .btn {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 44px;
  flex: 0 0 auto;
}
body.touch .sheet.result .big-stars .ic { width: clamp(28px, 5vh, 40px); height: clamp(28px, 5vh, 40px); }
body.touch .sheet.result .stat-tiles { gap: 5px; }
body.touch .sheet.result .stat-tiles div { min-width: 0; padding: 7px 3px; }
body.touch .sheet.result .stat-tiles b { font-size: clamp(17px, 3.2vh, 22px); }
body.touch .sheet.result .stat-tiles small { font-size: 11px; }
body.touch .sheet.result .payout { gap: 4px 7px; font-size: clamp(16px, 3vh, 21px); }
body.touch .sheet.result .payout small { font-size: 11px; text-align: center; }
body.touch .sheet.result .unlock { gap: 8px; padding: 8px; min-width: 0; }
body.touch .sheet.result .unlock .hex { width: 38px; height: 38px; }
body.touch .sheet.result .unlock b { font-size: 15px; }
body.touch .sheet.result .unlock small { font-size: 11px; }
body.touch .sheet.result .unlock p { font-size: 11px; line-height: 1.2; }
body.touch .sheet.result .tip { font-size: 12px; }
/* landscape phone: actions are a narrow column, so the offer row stacks and the menu row pairs up */
body.touch .sheet.result > .result-actions .act-row { gap: 8px; max-width: none; }
body.touch .sheet.result > .result-actions .act-main { flex-direction: column; }
body.touch .sheet.result > .result-actions .act-row .btn { flex: 1 1 0; }
body.touch .sheet.result > .result-actions .act-main .btn { flex: 0 0 auto; }

@media (max-width: 600px), (orientation: portrait) and (max-width: 900px) {
  body.touch .sheet.result {
    width: min(500px, calc(100vw - 20px));
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "heading" "content" "actions";
    align-content: start;
    align-items: stretch;
    gap: 9px;
    padding: 12px 14px;
  }
  body.touch .sheet.result > .result-content { gap: 8px; }
  body.touch .sheet.result > .result-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
  }
  body.touch .sheet.result > .result-actions .btn { min-height: 42px; padding: 7px 8px; font-size: 12px; }
  body.touch .sheet.result > .result-actions #rNext,
  body.touch .sheet.result > .result-actions #rRetry.primary { grid-column: 1 / -1; }
  body.touch .sheet.result > .result-actions.has-offers { display: flex; flex-direction: column; }
  body.touch .sheet.result > .result-actions .act-main { flex-direction: row; }
  body.touch .sheet.result > .result-actions .act-main .btn { flex: 1 1 0; }
  body.touch .sheet.result .big-stars .ic { width: 30px; height: 30px; }
  body.touch .sheet.result .stat-tiles b { font-size: 18px; }
  body.touch .sheet.result .unlock p { display: none; }
}


/* ---------------------------------------------------- mobile stage selection
   Desktop stage selection keeps its existing wide grid. On phones, keep realm
   tabs in one swipeable row and present the nine stages in a tidy 3x3 grid. */
@media (max-width: 600px) {
  #map {
    padding: calc(10px + var(--safe-t)) calc(10px + var(--safe-r)) calc(12px + var(--safe-b)) calc(10px + var(--safe-l));
  }
  #map .bar {
    gap: 7px;
    margin-bottom: 12px;
    align-items: center;
  }
  #map .bar > .round {
    width: 38px;
    height: 38px;
  }
  #map .bar > .seg {
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
    touch-action: pan-x;
  }
  #map .bar > .seg::-webkit-scrollbar { display: none; }
  #map .bar > .seg button {
    flex: 0 0 auto;
    padding: 7px 9px;
    font-size: 11px;
  }
  #map .bar > .btn.small {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 11px;
    white-space: nowrap;
  }
  #map .realm-head {
    margin-top: 4px;
    gap: 6px;
  }
  #map .realm-head h3 {
    font-size: clamp(20px, 6vw, 27px);
    line-height: 1.05;
    margin-bottom: 2px;
  }
  #map .realm-head .tag {
    gap: 5px;
    padding: 4px 7px 4px 4px;
    font-size: 11px;
  }
  #map .realm-head .hex { width: 22px; height: 22px; }
  #map .stage-grid,
  #map .stage-grid.nine {
    width: 100%;
    max-width: 430px;
    margin: 14px auto 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  #map .stage-card {
    min-height: 0;
    aspect-ratio: 1 / 0.88;
    gap: 5px;
    padding: 9px 4px 7px;
  }
  #map .stage-card .n { font-size: clamp(25px, 7vw, 32px); }
  #map .stage-card .stars { gap: 1px; }
  #map .stage-card .stars .ic { width: clamp(10px, 3vw, 13px); height: clamp(10px, 3vw, 13px); }
  #map .stage-card small { display: block; font-size: 11px; line-height: 1; }
  #map .stage-card .reward { top: 4px; right: 4px; width: 19px; height: 19px; border-radius: 4px; }
  #map .stage-card.zero .zero-ic { width: 16px; height: 16px; }
}

/* Give the reward a clear visual separation from the result stat tiles on touch screens. */
body.touch .sheet.result .payout {
  margin-top: 8px;
}


/* Result screens: tighten the heading transition and give the gem payout its own breathing room. */
.sheet.result {
  gap: 8px;
}
.sheet.result > h2 {
  align-self: center;
  width: 100%;
  text-align: center;
}
.sheet.result > .result-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sheet.result .payout {
  margin-top: 14px;
}
body.touch .sheet.result {
  gap: 8px;
}
body.touch .sheet.result > .result-content {
  gap: 8px;
}
body.touch .sheet.result .payout {
  margin-top: 14px;
}

@media (min-width: 1000px) { .sheet.wide { width: min(900px, 100%); } }


/* ------------------------------------------------ mobile controls: thumb arc
   Jump, power 1 and power 2 sit on one even arc around the big attack button,
   and the element dock rides just above that arc, inside thumb reach. */
body.touch { --arc: calc(var(--om) / 2 + var(--og) + var(--ob) / 2); }
body.touch .orb-jump { right: calc(var(--om) + var(--og)); bottom: calc((var(--om) - var(--ob)) / 2); }
body.touch .orb-p1 { right: calc(var(--om) / 2 + var(--arc) * 0.707 - var(--ob) / 2); bottom: calc(var(--om) / 2 + var(--arc) * 0.707 - var(--ob) / 2); }
body.touch .orb-p2 { right: calc((var(--om) - var(--ob)) / 2); bottom: calc(var(--om) + var(--og)); }
body.touch .orb { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
body.touch .orb-jump .orb-icon { width: 46%; height: 46%; }
body.touch .dock { top: auto; right: calc(14px + var(--safe-r)); bottom: calc(14px + var(--safe-b) + var(--om) + var(--og) + var(--ob) + 12px); padding: 5px; gap: 5px; }
body.touch .dock-slot .hex { width: var(--hx); height: var(--hx); }
/* power cooldown numbers read clearly over the badge */
body.touch .orb.cooling .cd-num { background: rgba(8, 10, 16, 0.55); border-radius: 50%; width: 64%; height: 64%; display: grid; place-items: center; }

/* ------------------------------------------------------- element preview */
.cd-head > div { flex: 1; min-width: 0; }
.preview-btn { flex: none; flex-direction: row; gap: 6px; align-self: center; }
.preview-btn .ic { width: 14px; height: 14px; }
.preview-bar { --c: #fff; position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); z-index: 20; zoom: var(--ui);
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 10px; max-width: calc(100vw - 24px); clip-path: var(--cut-m); background: rgba(13, 15, 23, 0.92); box-shadow: inset 0 3px 0 var(--c); animation: fade 0.2s ease; }
.pv-head { display: flex; align-items: center; gap: 10px; flex: none; }
.pv-head .hex { width: 44px; height: 44px; }
.pv-head small { display: block; font-weight: 800; font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }
.pv-head b { display: block; font-weight: 900; font-size: 18px; letter-spacing: 0.03em; color: var(--c); white-space: nowrap; }
.pv-moves { display: flex; gap: 6px; min-width: 0; }
.pv-move { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); opacity: 0.55; transition: opacity 0.15s, background 0.15s, box-shadow 0.15s; min-width: 0; }
.pv-move .move-ic { width: 34px; height: 34px; border-radius: 8px; }
.pv-move b { display: block; font-weight: 800; font-size: 12px; letter-spacing: 0.03em; white-space: nowrap; }
.pv-move small { display: block; font-weight: 700; font-size: 11px; color: var(--muted); white-space: nowrap; }
.pv-move.on { opacity: 1; background: color-mix(in srgb, var(--c) 18%, transparent); box-shadow: inset 0 0 0 2px var(--c); }
@media (max-width: 760px), (max-height: 560px) {
  .preview-bar { gap: 8px; padding: 7px 8px 7px 7px; bottom: calc(10px + var(--safe-b)); }
  .pv-head .hex { width: 36px; height: 36px; }
  .pv-head b { font-size: 15px; }
  .pv-move { padding: 4px 7px 4px 4px; gap: 6px; }
  .pv-move .move-ic { width: 28px; height: 28px; }
  .pv-move small { display: none; }
  .pv-move b { font-size: 11px; }
}
@media (max-width: 600px) { .pv-head > div { display: none; } }

/* ------------------------------------------------ HUD: roomier panels */
.stage-chip { padding: 8px 18px 8px 8px; gap: 12px; }
.dock { padding: 9px; gap: 7px; }
@media (max-height: 560px) { .stage-chip { padding: 6px 15px 6px 6px; } }

/* mobile: element dock sits top right beside pause; buttons 5% smaller */
body.touch { --ob: clamp(56px, 14.1vh, 80px); --om: clamp(84px, 21.95vh, 122px); }
body.touch .dock { top: calc(12px + var(--safe-t)); bottom: auto; right: calc(14px + var(--safe-r) + 44px + 8px); padding: 7px; gap: 6px; }
@media (max-height: 560px) { body.touch .dock { right: calc(14px + var(--safe-r) + 38px + 8px); } }

/* ------------------------------------------------ Tempo: Encore rhythm game */
#rhythm { position: fixed; inset: 0; z-index: 4; display: none; touch-action: none; }
#rhythm.on { display: block; }
#rhythm canvas { width: 100%; height: 100%; display: block; }
/* only the pause button stays while the lanes are up */
body.rhythm #hud > :not(.hud-right) { display: none !important; }
body.rhythm canvas#stage { cursor: default; }

/* eight realms: the tab strip stays on one row and scrolls if it must */
.seg { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; padding: 8px 10px; font-size: 11px; }
.seg button { letter-spacing: 0.02em; padding: 8px 9px; }

/* stage chip: no empty gap before the subtitle when there are no wave dots */
.dots:empty { display: none; }

/* stage labels on small screens: keep them, drop the word STAGE so 1-1 always fits */
@media (max-width: 900px), (max-height: 560px) { .stage-card small .st-word { display: none; } }

/* loadout slots: equal widths so the gaps match whatever the names are */
.lo-slots { display: grid; grid-template-columns: repeat(3, 116px); justify-content: center; gap: 10px; }
.lo-slot { min-width: 0; }
.lo-slot small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-height: 560px) { .lo-slots { grid-template-columns: repeat(3, 104px); gap: 8px; } }

/* scroll prompt (touch): a small pill pinned to the bottom of the scrolling area */
.scroll-hint { position: sticky; bottom: 6px; left: 0; align-self: center; margin: 8px auto 0; width: max-content; display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(13, 15, 23, 0.92); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 0 0 1.5px var(--acc); color: var(--acc); font-weight: 800; font-size: 11px; letter-spacing: 0.08em; pointer-events: none; z-index: 5; animation: hintIn 0.3s ease; transition: opacity 0.35s; }
.scroll-hint svg { width: 14px; height: 14px; animation: hintBob 0.9s ease-in-out infinite; }
.scroll-hint.gone { opacity: 0; }
@keyframes hintIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes hintBob { 50% { transform: translateY(3px); } }
.screen .scroll-hint { grid-column: 1 / -1; }

/* loadout sheet: a back arrow pinned to the top-left corner on touch screens (same as DONE) */
.sheet-back { display: none; }
body.touch .sheet-back { display: grid; position: sticky; top: 0; align-self: flex-start; z-index: 3; margin-bottom: -44px; width: 40px; height: 40px; background: var(--ink-3); }
@media (max-height: 560px) { body.touch .sheet-back { margin-bottom: -38px; width: 36px; height: 36px; } }

/* realm tabs: centred when they fit, still scroll from the first tab when they don't */
.seg > :first-child { margin-left: auto; }
.seg > :last-child { margin-right: auto; }

/* loadout slot labels: room for the full line height so nothing is clipped; tighter slots on PC */
.lo-slot small { line-height: 1.35; padding-bottom: 1px; }
body:not(.touch) .lo-slots { grid-template-columns: repeat(3, 100px); gap: 6px; }

/* loadout header: title, back arrow and chosen slots pin together, so the title is never cut by scrolling */
.lo-head { position: sticky; top: -22px; z-index: 2; margin: -22px -24px 0; padding: 18px 24px 10px; background: #121620; box-shadow: 0 8px 12px -10px rgba(0, 0, 0, 0.6), inset 0 3px 0 var(--acc); display: flex; flex-direction: column; gap: 10px; }
.lo-head h2 { line-height: 1.15; }
body.touch .lo-head .sheet-back { position: absolute; top: 14px; left: 18px; margin: 0; }
@media (max-height: 560px) { .lo-head { top: -14px; margin: -14px -18px 0; padding: 12px 18px 8px; gap: 6px; } body.touch .lo-head .sheet-back { top: 10px; left: 14px; } }
/* PC: the three chosen slots sit closer together */
body:not(.touch) .lo-slots { grid-template-columns: repeat(3, 88px); gap: 4px; }

/* touch controls: more room between the thumb buttons and between element tiles */
body.touch { --og: clamp(13px, 3.6vh, 20px); }
body.touch .dock { gap: 8px; }
/* a little more room again between the thumb buttons */
body.touch { --og: clamp(18px, 4.8vh, 26px); }
/* fan the arc a little wider (jump at -6 deg, power 2 at 96 deg) so the outer buttons are as far apart as they are from attack */
body.touch .orb-jump { right: calc(var(--om) / 2 + var(--arc) * 0.9945 - var(--ob) / 2); bottom: calc(var(--om) / 2 - var(--arc) * 0.1045 - var(--ob) / 2); }
body.touch .orb-p2 { right: calc(var(--om) / 2 - var(--arc) * 0.1045 - var(--ob) / 2); bottom: calc(var(--om) / 2 + var(--arc) * 0.9945 - var(--ob) / 2); }

/* =========================================================================
   Element browser (Elements screen + loadout picker): search, filter chips
   with live counts, and a dense auto-filling tile grid that scrolls on its
   own. Sized for 100+ elements without long pages or tiny text.
   ========================================================================= */
input { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; touch-action: manipulation; }
.el-tools { display: flex; flex-direction: column; gap: 8px; flex: none; }
.search { position: relative; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 12px; clip-path: var(--cut-s); background: var(--ink-2); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.07); transition: box-shadow 0.12s; }
.search:focus-within { box-shadow: inset 0 0 0 2px var(--acc); }
.search > .ic { width: 16px; height: 16px; color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-weight: 700; font-size: 14px; letter-spacing: 0.02em; }
.search input::placeholder { color: #6f7790; font-weight: 600; }
.search input::-webkit-search-cancel-button { display: none; }
.search .clear { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; color: var(--muted); }
.search .clear:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.search .clear .ic { width: 12px; height: 12px; }
.tool-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.chips { display: flex; gap: 2px; padding: 3px; background: var(--ink-2); clip-path: var(--cut-s); min-width: 0; }
.chips.show { flex: 1 0 auto; }
.chips.show .chip { flex: 1 0 auto; justify-content: center; }
.chips.tail { flex: 1 1 auto; }
.chips.tail .chip { flex: 1 0 auto; justify-content: center; }
.cd-btns .btn, .cd-btns .preview-btn { align-self: stretch; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px; border-radius: 4px; font-weight: 800; font-size: 11px; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; transition: background 0.12s, color 0.12s; }
.chip:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.chip.on { background: var(--acc); color: var(--acc-ink); }
.chip i { font-style: normal; font-size: 10px; min-width: 18px; padding: 2px 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); text-align: center; }
.chip.on i { background: rgba(0, 0, 0, 0.16); }
.chip .ic { width: 13px; height: 13px; }

.el-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 6px; align-content: start; scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent; }
.et { --c: #ddd; position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 4px 9px; min-width: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04); transition: background 0.12s, transform 0.1s, box-shadow 0.12s; }
.et:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.et:active { transform: scale(0.97); }
.et .hex { width: 44px; height: 44px; border-radius: 9px; }
.et b { max-width: 100%; font-weight: 800; font-size: 11px; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.et.locked b { color: var(--muted); }
.et-cost { display: inline-flex; align-items: center; gap: 3px; margin-top: -2px; font-style: normal; font-weight: 800; font-size: 10px; color: #cdf4ff; line-height: 1; }
.et-cost .ic { width: 11px; height: 11px; }
.et-cost.ev { color: #ffd98a; }
.et-lock, .et-slot { position: absolute; top: 5px; left: 5px; height: 18px; min-width: 18px; display: grid; place-items: center; border-radius: 4px; font-style: normal; }
.et-lock { background: rgba(0, 0, 0, 0.45); color: #9aa2b8; }
.et-lock .ic { width: 10px; height: 10px; }
.et-slot { padding: 0 4px; background: var(--c); color: #10131c; font-weight: 900; font-size: 11px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.et-ev { position: absolute; top: 5px; right: 5px; width: 14px; height: 14px; background: linear-gradient(135deg, #ffe7a0, #ff9d2e); clip-path: polygon(50% 0, 63% 37%, 100% 50%, 63% 63%, 50% 100%, 37% 63%, 0 50%, 37% 37%); filter: drop-shadow(0 0 4px rgba(255, 180, 60, 0.7)); }
.et.event { background: linear-gradient(180deg, rgba(255, 180, 60, 0.09), rgba(255, 255, 255, 0.03)); }
.et.on { background: color-mix(in srgb, var(--c) 18%, transparent); box-shadow: inset 0 0 0 2px var(--c); }
.et-divider { grid-column: 1 / -1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 10px 2px 2px; margin-top: 4px; border-top: 1px solid var(--line); }
.et-divider span { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 11px; letter-spacing: 0.1em; color: var(--muted); }
.et-divider .ic { width: 12px; height: 12px; }
.et-divider small { font-size: 11px; font-weight: 500; color: #7a829a; }
.et-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 10px; color: var(--muted); text-align: center; }
.et-empty .ic { width: 28px; height: 28px; opacity: 0.6; }
.et-empty b { font-weight: 900; font-size: 14px; letter-spacing: 0.08em; color: var(--text); }
.et-empty small { font-size: 12px; font-weight: 500; }

/* Elements screen: browser on the left, details on the right; both scroll on their own */
#codex { display: flex; flex-direction: column; overflow: hidden; --barh: 58px; }
#codex .bar { flex: none; width: 100%; max-width: 1180px; }
.codex { width: 100%; max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(290px, 400px) minmax(0, 1fr); gap: 12px;
  height: calc((100dvh - 30px - var(--safe-t) - var(--safe-b)) / var(--ui) - var(--barh)); min-height: 0; }
.codex-browse { display: flex; flex-direction: column; gap: 10px; padding: 12px; min-height: 0; }
.codex-browse .el-grid { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 2px 6px 8px 2px; margin-right: -6px; }
.codex-detail { overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; min-height: 0; container-type: inline-size; scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent; }
.cd-head { align-items: flex-start; }
.cd-title { flex: 1; min-width: 0; }
.cd-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0 4px; }
.cd-tags span { font-weight: 800; font-size: 10px; letter-spacing: 0.06em; padding: 3px 6px; border-radius: 4px; background: var(--ink-4); color: var(--muted); }
.cd-tags .melee { background: #4f1d29; color: #ffb3bb; }
.cd-tags .ranged { background: #1c3256; color: #a9c9ff; }
.cd-tags .evt { background: linear-gradient(90deg, #6b4410, #4a2c08); color: #ffd98a; }
.cd-tags .eq { background: color-mix(in srgb, var(--c) 25%, var(--ink-3)); color: var(--text); }
.cd-btns { display: flex; flex-direction: column; gap: 6px; flex: none; }
.cd-btns .btn { flex-direction: row; gap: 6px; min-width: 112px; }
.cd-btns .btn .ic { width: 14px; height: 14px; }
.buy-row.ev { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ec) 55%, transparent); background: color-mix(in srgb, var(--ec) 9%, rgba(255, 255, 255, 0.03)); }
.buy-row.ev > .ic { width: 26px; height: 26px; }
.buy-row.ev p b { color: var(--text); font-weight: 800; }
.combo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 6px; }
@container (max-width: 560px) {
  .moves { grid-template-columns: 1fr; }
  .move { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .move-top { flex: 1 1 100%; }
  .cd-head { flex-wrap: wrap; }
  .cd-head > .cd-title { flex: 1 1 150px; }
  .cd-head > .cd-btns { flex: 1 1 100%; flex-direction: row; }
  .cd-btns .btn { flex: 1; }
  .buy-row { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .codex { grid-template-columns: 1fr; grid-template-rows: minmax(0, 45%) minmax(0, 1fr); }
}
@media (max-height: 560px) {
  #codex { --barh: 46px; }
  .codex-browse { padding: 8px; gap: 7px; }
  .search { height: 34px; }
  .search input { font-size: 13px; }
  .chip { height: 26px; padding: 0 7px; font-size: 10px; }
  .el-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 5px; }
  .et { padding: 8px 3px 6px; gap: 4px; }
  .et .hex { width: 36px; height: 36px; border-radius: 8px; }
  .et b { font-size: 10px; }
}

/* loadout picker: header, tools and DONE stay put, only the grid scrolls */
.sheet.loadout { width: min(880px, 100%); overflow: hidden; gap: 10px; }
.sheet.loadout .lo-head { position: relative; top: 0; }
.sheet.loadout .lo-grid { flex: 1 1 auto; min-height: 110px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; margin: 0 -6px; padding: 2px 6px 6px; }
.lo-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.lo-foot .hint { text-align: left; }
.lo-foot .btn { flex: none; min-width: 170px; }
.lo-slot { position: relative; }
.lo-slot .x { position: absolute; top: -4px; right: 8px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--ink-4); color: var(--text); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); font-style: normal; opacity: 0; transition: opacity 0.12s; }
.lo-slot .x .ic { width: 9px; height: 9px; }
.lo-slot:hover .x, body.touch .lo-slot .x { opacity: 1; }
body:not(.touch) .lo-slot .x { right: 10px; }
.el-tools.compact { flex-direction: row; flex-wrap: wrap; align-items: center; }
.el-tools.compact .search { flex: 1 1 220px; }
.el-tools.compact .tool-chips { flex: 2 1 420px; }
@media (max-height: 560px) {
  .chip i { display: none; }
  .sheet.loadout .lo-head { flex-direction: row; align-items: center; justify-content: center; gap: 18px; }
  .sheet.loadout .lo-head h2 { font-size: 20px; }
  .sheet.loadout .lo-slot .hex, .sheet.loadout .lo-slot .empty { width: 40px; height: 40px; border-radius: 9px; }
  .sheet.loadout .lo-slot { gap: 3px; }
  .lo-foot { padding-top: 7px; }
  .lo-foot .hint { display: none; }
  .lo-foot .btn { flex: 1; }
}

/* =========================================================================
   Home: Arena + Endless side by side, and the live rail (event, quests, rank)
   ========================================================================= */
.home-menu .btn-row.duo .btn.mode { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 8px 14px; text-align: left; min-height: 58px; font-size: 16px; }
.home-menu .btn-row.duo .btn.mode > .ic { width: 24px; height: 24px; color: var(--acc); }
.btn.mode.arena { background: linear-gradient(100deg, color-mix(in srgb, var(--acc) 24%, var(--ink-3)), var(--ink-3) 75%); }
.btn.mode.arena:hover { background: linear-gradient(100deg, color-mix(in srgb, var(--acc) 32%, var(--ink-4)), var(--ink-4) 75%); }
@media (min-height: 561px) { .home-menu .btn-row.duo .btn.mode { min-height: 64px; font-size: 18px; } }

.live-rail { position: absolute; top: calc(14px + var(--safe-t) + 46px); right: calc(16px + var(--safe-r)); display: flex; gap: 8px; justify-content: flex-end; }
.rail-card { --c: var(--acc); position: relative; display: flex; align-items: center; gap: 9px; padding: 6px 14px 6px 6px; text-align: left; clip-path: var(--cut-s);
  background: linear-gradient(100deg, color-mix(in srgb, var(--c) 20%, rgba(13, 15, 23, 0.94)), rgba(13, 15, 23, 0.92) 75%); box-shadow: inset 0 -2px 0 var(--c);
  transition: transform 0.12s, filter 0.12s; animation: railIn 0.35s ease both; }
.rail-card:nth-child(2) { animation-delay: 0.05s; }
.rail-card:nth-child(3) { animation-delay: 0.1s; }
@keyframes railIn { from { opacity: 0; transform: translateY(-8px); } }
.rail-card:hover { transform: translateY(1px); filter: brightness(1.12) drop-shadow(0 0 8px color-mix(in srgb, var(--c) 35%, transparent)); }
.rail-card .hex, .rc-ic { width: 34px; height: 34px; border-radius: 7px; }
.rail-card .tier-badge.sm { width: 31px; height: 34px; }
.rc-ic { flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 18%, var(--ink-2)); color: var(--c); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent); }
.rc-ic .ic { width: 18px; height: 18px; }
.rc-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rc-t small { display: flex; align-items: center; gap: 5px; font-weight: 800; font-size: 9px; letter-spacing: 0.12em; color: var(--c); white-space: nowrap; }
.rc-t small b { color: var(--text); font-weight: 800; }
.rc-t > b { font-weight: 900; font-size: 13px; letter-spacing: 0.03em; white-space: nowrap; }
.rail-card .badge { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; display: grid; place-items: center; background: var(--green); color: #06210f; font-style: normal; font-weight: 900; font-size: 10px; animation: badgePulse 1.8s ease-in-out infinite; }
@keyframes badgePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(69, 224, 138, 0.55); } 60% { box-shadow: 0 0 0 6px rgba(69, 224, 138, 0); } }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: liveDot 1.6s ease-in-out infinite; }
@keyframes liveDot { 50% { opacity: 0.35; } }
.tier-badge { width: 44px; height: 48px; flex: none; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45)); }
.tier-badge.sm { width: 40px; height: 44px; }
.tier-badge.md { width: 52px; height: 56px; }
.tier-badge.lg { width: 64px; height: 70px; }
.tier-badge.xl { width: 104px; height: 112px; }
@media (max-height: 560px) { .live-rail { top: calc(14px + var(--safe-t) + 42px); gap: 6px; } }
@media (max-width: 1000px) {
  .rc-t small { display: none; }
  .rail-card { padding: 5px 10px 5px 5px; gap: 7px; }
  .rail-card .hex, .rc-ic, .rail-card .tier-badge.sm { width: 28px; height: 28px; }
  .rc-t > b { font-size: 11px; }
}
@media (max-width: 600px) {
  .live-rail { top: auto; bottom: calc(10px + var(--safe-b)); left: 12px; right: 12px; z-index: 2; }
  .rail-card { flex: 1; min-width: 0; }
  .rc-t > b { font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
}

/* =========================================================================
   Live hub: Event · Quests · Ranks
   ========================================================================= */
#hub .bar { max-width: 1180px; }
.hub-tabs { flex: 0 1 auto; margin: 0 auto; }
.seg.hub-tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; font-size: 13px; letter-spacing: 0.05em; }
.hub-tabs .ic { width: 15px; height: 15px; margin: 0; vertical-align: 0; }
.hub-tabs .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3); }
.hub-body { max-width: 1180px; margin: 0 auto; }
.hub-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px; align-items: start; animation: fade 0.2s ease; }
.hub-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-head h4 { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-size: 13px; letter-spacing: 0.1em; }
.panel-head h4 .ic { width: 16px; height: 16px; color: var(--acc); }
.panel-head small { font-weight: 800; font-size: 11px; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; }
.panel-head small b { color: var(--text); }
.panel > .btn { align-self: stretch; }
.fine { font-size: 12px; font-weight: 500; line-height: 1.45; color: var(--muted); }
.fine.center { text-align: center; }
.ic[data-icon="token"] { color: #ffc24a; }
.btn.primary .ic[data-icon="token"] { color: #8a5a00; }
.btn.primary .ic.gem { color: inherit; }

/* quests */
.quest-list { display: flex; flex-direction: column; gap: 6px; }
.quest, .bonus, .shop-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.045); transition: background 0.15s, box-shadow 0.15s; }
.quest .hex { width: 38px; height: 38px; border-radius: 8px; }
.q-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--ink-3); color: var(--acc); }
.q-ic .ic { width: 19px; height: 19px; }
.q-ic.gift { color: #ffd76a; }
.q-ic.gemc { color: #6fe7ff; }
.q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.q-body > b { font-weight: 800; font-size: 13px; letter-spacing: 0.02em; line-height: 1.25; }
.q-body > small { font-weight: 700; font-size: 11px; color: var(--muted); }
.q-bar, .bar-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.q-bar i, .bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--acc), var(--acc-hi)); transition: width 0.5s ease; }
.quest.done .q-bar i { background: var(--green); }
.quest.done:not(.claimed) { background: color-mix(in srgb, var(--green) 9%, rgba(255, 255, 255, 0.03)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--green) 55%, transparent); }
.quest.claimed { opacity: 0.5; }
.q-rw, .rw { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; font-size: 13px; white-space: nowrap; }
.rw .ic { width: 15px; height: 15px; }
.btn.claim { flex: none; flex-direction: row; gap: 8px; min-width: 104px; }
.btn.claim .rw { font-size: 12px; }
.q-done { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: #06210f; }
.q-done .ic { width: 16px; height: 16px; }
.bonus { margin-top: 2px; background: linear-gradient(100deg, rgba(255, 215, 106, 0.08), rgba(255, 255, 255, 0.03)); }
.bonus.ready { box-shadow: inset 0 0 0 1.5px var(--acc); background: color-mix(in srgb, var(--acc) 12%, rgba(255, 255, 255, 0.03)); }
.bonus.claimed { opacity: 0.55; }
.pips { display: flex; gap: 4px; }
.pips i { width: 26px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); }
.pips i.on { background: var(--acc); }

/* event */
.event-tab .ev-hero { align-self: start; }
.ev-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  background: #0f121b; box-shadow: inset 0 3px 0 var(--ec); backdrop-filter: none; -webkit-backdrop-filter: none; }
.ev-hero > .ev-info { background: linear-gradient(135deg, #151a26, #0f121b 70%); }
.ev-art { position: relative; display: grid; place-items: center; min-height: 260px; overflow: hidden; background: #0c0f18; isolation: isolate; }
.ev-art > .ev-glow { position: absolute; left: 50%; top: 46%; width: 300px; height: 300px; transform: translate(-50%, -50%); border-radius: 50%; z-index: -1; animation: evPulse 3.2s ease-in-out infinite; }
@keyframes evPulse { 50% { transform: translate(-50%, -50%) scale(1.12); opacity: 0.8; } }
.ev-art > .ev-grid { position: absolute; left: -60%; right: -60%; bottom: 0; height: 75%; z-index: -1; background-size: 34px 34px; transform: perspective(220px) rotateX(52deg); transform-origin: 50% 100%;
  -webkit-mask: linear-gradient(transparent 5%, #000 60%); mask: linear-gradient(transparent 5%, #000 60%); animation: evGrid 2.4s linear infinite; opacity: 0.9; }
@keyframes evGrid { to { background-position: 0 34px; } }
.ev-art > .ev-floor { position: absolute; left: 50%; bottom: 18%; width: 150px; height: 18px; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), transparent); z-index: -1; animation: evFloor 4s ease-in-out infinite; }
@keyframes evFloor { 50% { transform: translateX(-50%) scale(0.85); opacity: 0.7; } }
.hex.ev-hex { width: 128px; height: 128px; border-radius: 26px; animation: floaty 4s ease-in-out infinite;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 60px color-mix(in srgb, var(--c) 50%, transparent), 0 18px 30px rgba(0, 0, 0, 0.45); }
@keyframes floaty { 50% { transform: translateY(-8px); } }
.ev-info { position: relative; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.kicker { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 7px; font-weight: 800; font-size: 11px; letter-spacing: 0.1em; color: var(--ec); }
.kicker b { color: var(--text); }
.ev-info h3 { font-weight: 900; font-size: clamp(26px, 3.2vw, 40px); line-height: 1; letter-spacing: 0.01em; }
.ev-tag { color: var(--muted); font-size: 14px; font-weight: 500; line-height: 1.4; }
.ev-el > small { font-weight: 800; font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.ev-el > b { display: block; font-weight: 900; font-size: 18px; letter-spacing: 0.04em; color: var(--ec); margin: 1px 0 6px; }
.ev-moves { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ev-move { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.25); min-width: 0; }
.ev-move .move-ic { width: 34px; height: 34px; border-radius: 9px; margin-bottom: 2px; }
.ev-move small { font-weight: 800; font-size: 9px; letter-spacing: 0.1em; color: var(--muted); }
.ev-move b { font-weight: 800; font-size: 11px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tok-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.tok-bal { display: inline-flex; align-items: baseline; gap: 6px; }
.tok-bal .ic { width: 20px; height: 20px; align-self: center; }
.tok-bal b { font-weight: 900; font-size: 22px; }
.tok-bal small { font-weight: 800; font-size: 11px; letter-spacing: 0.06em; color: var(--muted); }
.owned { display: inline-flex; align-items: center; gap: 5px; font-weight: 900; font-size: 12px; letter-spacing: 0.06em; color: var(--green); }
.owned .ic { width: 14px; height: 14px; }
.ev-progress .bar-track { height: 9px; border-radius: 5px; }
.ev-progress .bar-track i { background: linear-gradient(90deg, #ffc24a, var(--ec)); box-shadow: 0 0 12px color-mix(in srgb, var(--ec) 60%, transparent); }
.ev-cta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ev-cta .btn { flex: 1 1 140px; flex-direction: row; gap: 8px; }
.ev-cta .btn .ic { width: 17px; height: 17px; }
.shop-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop-row b { font-weight: 800; font-size: 13px; letter-spacing: 0.03em; }
.shop-row small { font-size: 11px; color: var(--muted); font-weight: 600; }
.shop-row .btn { flex: none; flex-direction: row; gap: 6px; }
.shop-row .btn .ic { width: 15px; height: 15px; }
.upcoming { display: flex; flex-direction: column; gap: 6px; }
.up-ev { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 7px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.up-ev .hex { width: 36px; height: 36px; border-radius: 8px; }
.up-ev b { display: block; font-weight: 800; font-size: 13px; letter-spacing: 0.03em; }
.up-ev small { font-weight: 700; font-size: 11px; color: var(--muted); }
.up-ev small b { display: inline; font-size: inherit; color: var(--text); }

/* ranks */
.rank-hero { --tc: var(--acc); position: relative; overflow: hidden; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px 18px; align-items: center; padding: 18px 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 22%, #0f121b), #0e1119 65%); box-shadow: inset 0 3px 0 var(--tc); }
.rank-hero .tier-badge.xl { filter: drop-shadow(0 0 22px color-mix(in srgb, var(--tc) 55%, transparent)) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
.rk-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rk-info > small { font-weight: 800; font-size: 11px; letter-spacing: 0.12em; color: var(--tc); }
.rk-info h3 { font-weight: 900; font-size: clamp(26px, 3.2vw, 36px); line-height: 1; }
.trophies { display: flex; align-items: baseline; gap: 6px; }
.trophies .ic { width: 20px; height: 20px; color: var(--acc); align-self: center; }
.trophies b { font-weight: 900; font-size: 22px; }
.trophies small { font-weight: 800; font-size: 11px; letter-spacing: 0.06em; color: var(--muted); }
.rk-info .bar-track { height: 8px; border-radius: 4px; }
.rk-info .bar-track i { background: linear-gradient(90deg, var(--tc), #fff); }
.to-next { font-weight: 800; font-size: 11px; letter-spacing: 0.06em; color: var(--muted); }
.rk-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.rk-stats div, .records div { background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 9px 6px; text-align: center; min-width: 0; }
.rk-stats b, .records b { display: block; font-weight: 900; font-size: 19px; }
.rk-stats small, .records small { display: block; font-weight: 800; font-size: 10px; letter-spacing: 0.07em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-hero > .btn { grid-column: 1 / -1; flex-direction: row; gap: 8px; }
.rank-hero > .btn .ic { width: 18px; height: 18px; }
.records { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.records .ic { display: block; width: 16px; height: 16px; margin: 0 auto 3px; color: var(--acc); }
.ladder { display: flex; flex-direction: column; gap: 4px; }
.rung { --tc: #fff; display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); opacity: 0.5; }
.rung.reached { opacity: 1; }
.rung.here { opacity: 1; background: color-mix(in srgb, var(--tc) 14%, transparent); box-shadow: inset 0 0 0 1.5px var(--tc); }
.rung > div { flex: 1; min-width: 0; }
.rung b { display: block; font-weight: 900; font-size: 13px; letter-spacing: 0.05em; color: var(--tc); }
.rung small { font-weight: 700; font-size: 11px; color: var(--muted); }
.rung .tier-badge.sm { width: 30px; height: 33px; }
.rung .you { font-weight: 900; font-size: 10px; letter-spacing: 0.1em; padding: 3px 7px; border-radius: 4px; background: var(--tc); color: #10131c; }
.rung .rw { min-width: 64px; justify-content: flex-end; font-size: 12px; }
.rung .rw .ok { width: 14px; height: 14px; color: var(--green); }

@media (max-width: 1100px) {
  .ev-hero { grid-template-columns: 1fr; }
  .ev-art { min-height: 150px; }
  .hex.ev-hex { width: 92px; height: 92px; border-radius: 20px; }
  .ev-info { padding: 4px 18px 18px; }
}
@media (max-width: 700px) and (orientation: portrait) {
  .hub-grid { grid-template-columns: 1fr; }
  .seg.hub-tabs button { padding: 8px 10px; font-size: 11px; }
}
@media (max-height: 560px) {
  .hub-grid, .hub-col { gap: 8px; }
  .panel { padding: 10px 12px; gap: 7px; }
  .quest, .bonus, .shop-row { padding: 6px 8px; gap: 9px; }
  .q-ic, .quest .hex { width: 32px; height: 32px; }
  .q-body > b { font-size: 12px; }
  .ev-art { min-height: 110px; }
  .hex.ev-hex { width: 72px; height: 72px; border-radius: 16px; }
  .ev-info { gap: 7px; }
  .ev-info h3 { font-size: 24px; }
  .ev-tag { font-size: 12px; }
  .rank-hero { padding: 12px 14px; gap: 10px 14px; }
  .tier-badge.xl { width: 74px; height: 80px; }
  .rk-stats b, .records b { font-size: 16px; }
  .rung { padding: 4px 10px 4px 6px; }
}

/* =========================================================================
   Arena: matchmaking, versus and results
   ========================================================================= */
.sheet.arena { width: min(560px, 100%); }
.sheet.arena h2 { display: flex; align-items: center; justify-content: center; gap: 10px; }
.sheet.arena h2 .ic { width: 26px; height: 26px; color: var(--acc); }
.mm-card { --tc: var(--acc); display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "b r" "lo lo"; gap: 10px 14px; align-items: center; padding: 14px; border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 18%, #151a26), #131722); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.mm-card > .tier-badge { grid-area: b; }
.mm-rank { grid-area: r; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mm-rank small, .mm-lo small { font-weight: 800; font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.mm-rank b { font-weight: 900; font-size: 24px; line-height: 1.1; color: var(--tc); }
.mm-rank span { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 13px; }
.mm-rank .ic { width: 15px; height: 15px; color: var(--acc); }
.mm-lo { grid-area: lo; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.mm-lo > div { display: flex; align-items: center; gap: 6px; }
.mm-lo .hex { width: 36px; height: 36px; border-radius: 8px; }
.mm-lo .btn { margin-left: 6px; }
.mm-stakes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mm-stakes > div { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.045); }
.mm-stakes small { font-weight: 900; font-size: 11px; letter-spacing: 0.1em; width: 38px; }
.mm-stakes .win small { color: var(--green); }
.mm-stakes .loss small { color: #ff8a94; }
.mm-stakes b { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; font-size: 12px; }
.mm-stakes .ic { width: 13px; height: 13px; }
.mm-stakes .ic[data-icon="trophy"] { color: var(--acc); }
.mm-status { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); animation: fade 0.2s ease; }
.mm-status b { display: block; font-weight: 900; font-size: 14px; letter-spacing: 0.06em; }
.mm-status small { font-weight: 800; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mm-status.found b { color: var(--acc); }
.radar { position: relative; flex: none; width: 56px; height: 56px; display: grid; place-items: center; }
.radar > .ic { position: relative; z-index: 1; width: 22px; height: 22px; color: var(--acc); }
.radar i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--acc); opacity: 0; animation: radar 1.8s ease-out infinite; }
.radar i:nth-child(2) { animation-delay: 0.6s; }
.radar i:nth-child(3) { animation-delay: 1.2s; }
@keyframes radar { from { transform: scale(0.3); opacity: 0.9; } to { transform: scale(1.25); opacity: 0; } }
.mm-status.found .radar i { animation: none; }
.mm-status.found .radar { animation: pop 0.3s ease; }

.sheet.versus { width: min(820px, 100%); padding: 26px 24px 20px; background: radial-gradient(120% 120% at 50% 0%, #1c2236, #0f121b); gap: 18px; }
.vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; animation: vsIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.vs-side.you { --from: -60px; }
.vs-side.rival { --from: 60px; animation-delay: 0.1s; }
@keyframes vsIn { from { transform: translateX(var(--from)); opacity: 0; } }
.hex.vs-hex { width: 104px; height: 104px; border-radius: 22px; margin-bottom: 4px;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 70%, transparent), 0 0 40px color-mix(in srgb, var(--c) 45%, transparent), 0 14px 24px rgba(0, 0, 0, 0.45); }
.vs-side > small { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 4px; background: var(--ink-3); font-weight: 900; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }
.vs-side.rival > small { background: #3a1e2a; color: #ffb3bb; }
.vs-side > small .ic { width: 13px; height: 13px; }
.vs-side > b { max-width: 100%; font-weight: 900; font-size: clamp(18px, 2.6vw, 26px); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vs-side > span { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 12px; color: var(--muted); }
.vs-side > span .ic { width: 13px; height: 13px; color: var(--acc); }
.vs-lo { display: flex; align-items: center; gap: 5px; min-height: 32px; }
.vs-lo .hex { width: 30px; height: 30px; border-radius: 7px; }
.vs-lo em { font-style: normal; font-weight: 900; font-size: 12px; letter-spacing: 0.08em; color: var(--c); }
.vs-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vs-mid b { font-weight: 900; font-style: italic; font-size: clamp(44px, 7vw, 72px); line-height: 1; color: var(--acc); text-shadow: 0 4px 0 rgba(0, 0, 0, 0.4), 0 0 30px color-mix(in srgb, var(--acc) 50%, transparent); animation: vsPop 0.5s 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.4) both; }
@keyframes vsPop { from { transform: scale(2.2); opacity: 0; } }
.vs-mid small { font-weight: 800; font-size: 10px; letter-spacing: 0.14em; color: var(--muted); }
.vs-count { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.vs-count b { font-weight: 900; font-size: 34px; line-height: 1; }
.vs-count b.tick { animation: countTick 0.5s ease; }
@keyframes countTick { from { transform: scale(1.6); opacity: 0.3; } }
.vs-count small { font-weight: 800; font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }
@media (max-height: 560px) {
  .sheet.versus { padding: 16px; gap: 10px; }
  .hex.vs-hex { width: 70px; height: 70px; border-radius: 16px; }
  .mm-card { padding: 10px; }
  .mm-card > .tier-badge.lg { width: 50px; height: 55px; }
  .mm-rank b { font-size: 19px; }
}

.trophy-delta { --tc: var(--acc); display: flex; align-items: center; justify-content: center; gap: 12px; }
.trophy-delta b { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 30px; line-height: 1; }
.trophy-delta b .ic { width: 24px; height: 24px; color: var(--acc); }
.trophy-delta.gain b { color: var(--green); }
.trophy-delta.drop b { color: #ff8a94; }
.trophy-delta small { display: block; margin-top: 3px; font-weight: 800; font-size: 11px; letter-spacing: 0.06em; color: var(--muted); }
.payout .tok { display: inline-flex; align-items: center; gap: 5px; }
.payout .tok .ic { color: #ffc24a; }
.unlock .tier-badge { flex: none; }

@media (prefers-reduced-motion: reduce) {
  .ev-art > *, .hex.ev-hex, .rail-card .badge, .live-dot, .radar i { animation: none; }
}

/* Arena sheet: icon and label side by side on its buttons */
#mmActions .btn, .sheet.arena .actions .btn { flex-direction: row; gap: 8px; }
#mmActions .btn .ic { width: 18px; height: 18px; }
/* compact home column: the PVP tag tucks into the corner without covering the title */
@media (max-height: 560px) {
  .home-menu .btn-row.duo .btn.mode { min-height: 48px; padding: 6px 10px; gap: 8px; font-size: 14px; }
  .home-menu .btn-row.duo .btn.mode > .ic { width: 20px; height: 20px; }
  }
.btn.mode .bt { min-width: 0; }
.btn.mode .bt small { overflow: hidden; text-overflow: ellipsis; }

/* hub header: tabs truly centred whatever sits left and right of them */
#hub .bar { display: grid; grid-template-columns: 1fr auto 1fr; }
#hub .bar > :first-child { justify-self: start; }
#hub .bar > :last-child { justify-self: end; }
#hub .bar .hub-tabs { margin: 0; overflow: visible; }
.hub-tabs > button, .seg.hub-tabs > :first-child, .seg.hub-tabs > :last-child { margin: 0; }
.hub-tabs .dot.hidden { display: none; }
/* no event running */
.hub-empty { max-width: 520px; margin: 40px auto 0; padding: 34px 28px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.hub-empty > .ic { width: 40px; height: 40px; color: var(--muted); opacity: 0.8; }
.hub-empty h3 { font-weight: 900; font-size: 22px; letter-spacing: 0.06em; }
.hub-empty p { font-size: 14px; font-weight: 500; line-height: 1.45; color: var(--muted); }

/* live cards: a small row in the bottom-right corner, clear of the fighters */
.live-rail { top: auto; bottom: calc(14px + var(--safe-b)); right: calc(16px + var(--safe-r)); gap: 6px; }
.rail-card { padding: 4px 11px 4px 4px; gap: 7px; }
.rail-card .hex, .rail-card .rc-ic { width: 26px; height: 26px; border-radius: 6px; }
.rail-card .rc-ic .ic { width: 14px; height: 14px; }
.rail-card .tier-badge.sm { width: 24px; height: 26px; }
.rc-t small { font-size: 8px; letter-spacing: 0.1em; }
.rc-t > b { font-size: 11px; }
@media (max-height: 560px) { .live-rail { top: auto; bottom: calc(10px + var(--safe-b)); } }
@media (max-width: 1000px) { .rail-card .hex, .rail-card .rc-ic, .rail-card .tier-badge.sm { width: 24px; height: 24px; } .rc-t > b { font-size: 10px; } }
@media (max-width: 600px) { .live-rail { left: auto; right: 12px; } .rail-card { flex: none; } }

/* "something to claim": a small dot in the theme colour (your first element) */
.rail-card .badge { top: 4px; right: 4px; width: 7px; height: 7px; min-width: 0; padding: 0; border-radius: 50%; background: var(--acc); box-shadow: 0 0 0 2px rgba(13, 15, 23, 0.9), 0 0 6px var(--acc); animation: none; }
.hub-tabs .dot { width: 6px; height: 6px; background: var(--acc); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); }
.seg.hub-tabs button.active .dot { background: var(--acc-ink); }
.btn .note { width: 7px; height: 7px; background: var(--acc); }

/* versus: an upright, skewed VS sits on the true centre line */
.vs-mid b { font-style: normal; transform: skewX(-10deg); }
.vs { grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr); }
.rail-card:has(.badge) { padding-right: 17px; }

/* =========================================================================
   Hub tabs end on one straight line: both columns stretch to the same
   height and the last card in each column fills what is left.
   ========================================================================= */
.hub-grid { align-items: stretch; }
.hub-grid > .hub-col > :last-child { flex: 1 1 auto; }
.event-tab .ev-hero { align-self: stretch; }
.quests-tab { grid-template-columns: minmax(0, 760px); justify-content: center; }

/* arena tiers: one horizontal strip */
.tier-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.tier-cell { --tc: #fff; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 2px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.035); opacity: 0.5; text-align: center; min-width: 0; }
.tier-cell.reached { opacity: 1; }
.tier-cell.here { opacity: 1; background: color-mix(in srgb, var(--tc) 14%, transparent); box-shadow: inset 0 0 0 1.5px var(--tc); }
.tier-cell .tier-badge.sm { width: 30px; height: 33px; margin-bottom: 3px; }
.tier-cell b { font-weight: 900; font-size: 10px; letter-spacing: 0.05em; color: var(--tc); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tier-cell small { font-weight: 700; font-size: 10px; color: var(--muted); }
.tier-cell .rw { font-size: 10px; gap: 2px; }
.tier-cell .rw .ic { width: 11px; height: 11px; }
.tier-cell .you { position: absolute; top: -7px; left: 50%; transform: translateX(-50%); font-weight: 900; font-size: 9px; letter-spacing: 0.1em; padding: 2px 6px; border-radius: 4px; background: var(--tc); color: #10131c; }
.ranks-tab .ladder .rung .you { margin-left: auto; }

/* live leaderboard */
.lb-live { display: inline-flex; align-items: center; gap: 6px; color: var(--red) !important; }
.lb { display: flex; flex-direction: column; gap: 4px; }
.lb-row { --tc: #fff; display: grid; grid-template-columns: 46px 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); animation: fade 0.25s ease; }
.lb-row .hex { width: 32px; height: 32px; border-radius: 7px; }
.lb-rank { display: flex; align-items: center; justify-content: center; gap: 3px; font-weight: 900; font-size: 15px; color: var(--muted); }
.lb-rank .ic { width: 14px; height: 14px; }
.lb-row.top1 .lb-rank { color: #ffcf4a; } .lb-row.top2 .lb-rank { color: #cfd8e6; } .lb-row.top3 .lb-rank { color: #d9925e; }
.lb-row.top1 { background: linear-gradient(90deg, rgba(255, 207, 74, 0.14), rgba(255, 255, 255, 0.03) 60%); }
.lb-name { display: flex; flex-direction: column; min-width: 0; }
.lb-name b { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name em { font-style: normal; font-weight: 900; font-size: 9px; letter-spacing: 0.1em; padding: 2px 5px; border-radius: 3px; background: var(--acc); color: var(--acc-ink); }
.lb-name small { font-weight: 800; font-size: 10px; letter-spacing: 0.06em; color: var(--tc); }
.lb-tro { display: inline-flex; align-items: center; gap: 5px; font-weight: 900; font-size: 14px; font-variant-numeric: tabular-nums; }
.lb-tro .ic { width: 14px; height: 14px; color: var(--acc); }
.lb-row.you { background: color-mix(in srgb, var(--acc) 14%, transparent); box-shadow: inset 0 0 0 1.5px var(--acc); }
.lb-gap { display: flex; justify-content: center; gap: 5px; padding: 3px 0; }
.lb-gap i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); opacity: 0.6; }
@media (max-height: 560px) {
  .lb-row { padding: 4px 10px 4px 6px; grid-template-columns: 38px 26px minmax(0, 1fr) auto; }
  .lb-row .hex { width: 26px; height: 26px; }
  .tier-cell { padding: 10px 2px 6px; }
  .tier-cell .tier-badge.sm { width: 24px; height: 26px; }
}

/* live chips (home, bottom right): slim, airy, small glyphs, hairline frame */
.live-rail { gap: 8px; }
.rail-card { --c: var(--acc); height: 46px; padding: 0 18px 0 14px; gap: 11px; clip-path: var(--cut-s); border-radius: 0;
  background: rgba(12, 14, 21, 0.86); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background 0.15s, box-shadow 0.15s, transform 0.12s; }
.rail-card::after { content: ''; position: absolute; left: 14px; right: 18px; bottom: 0; height: 2px; border-radius: 2px; background: var(--c); opacity: 0.55; transition: opacity 0.15s; }
.rail-card:hover { transform: translateY(-1px); filter: none; background: rgba(22, 25, 36, 0.92); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); }
.rail-card:hover::after { opacity: 1; }
.rc-gl { flex: none; width: 18px; height: 18px; display: grid; place-items: center; color: var(--c); }
.rc-gl svg, .rc-gl .ic { width: 18px; height: 18px; }
.rc-gl .tier-badge.sm { width: 17px; height: 19px; filter: none; }
.rc-t { gap: 2px; }
.rc-t small { font-size: 8.5px; letter-spacing: 0.14em; color: var(--muted); }
.rc-t small b { color: var(--c); }
.rc-t > b { font-size: 12px; letter-spacing: 0.05em; }
.rail-card .live-dot { width: 5px; height: 5px; }
.rail-card .badge { top: 7px; right: 7px; }
.rail-card:has(.badge) { padding-right: 22px; }
@media (max-width: 1000px) {
  .rail-card { height: 38px; padding: 0 14px 0 11px; gap: 9px; }
  .rc-gl, .rc-gl svg, .rc-gl .ic { width: 15px; height: 15px; }
  .rc-gl .tier-badge.sm { width: 14px; height: 16px; }
  .rc-t > b { font-size: 10.5px; }
}

/* =========================================================================
   Arena versus: full screen, split by element colour, VS on the exact centre
   ========================================================================= */
#versus { position: fixed; inset: 0; z-index: 40; overflow: hidden; background: #0a0c13; animation: fade 0.25s ease; }
.vs-half { position: absolute; top: 0; bottom: 0; width: 58%;
  background: radial-gradient(70% 60% at 50% 50%, color-mix(in srgb, var(--c) 30%, transparent), transparent 70%), linear-gradient(180deg, #121624, #0a0c13); }
.vs-half.you { left: 0; clip-path: polygon(0 0, 100% 0, 82% 100%, 0 100%); animation: vsHalfL 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.vs-half.rival { right: 0; clip-path: polygon(18% 0, 100% 0, 100% 100%, 0 100%); animation: vsHalfR 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
@keyframes vsHalfL { from { transform: translateX(-60%); } }
@keyframes vsHalfR { from { transform: translateX(60%); } }
.vs-seam { position: absolute; left: 50%; top: -10%; bottom: -10%; width: 4px; transform: translateX(-50%) skewX(-9deg); background: linear-gradient(180deg, transparent, var(--acc), transparent); box-shadow: 0 0 24px var(--acc); opacity: 0.8; }
.vs-stage { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 240px minmax(0, 1fr); align-items: center; justify-items: center; zoom: var(--ui); }
#versus .vs-side { width: 100%; max-width: 420px; padding: 0 16px; }
#versus .hex.vs-hex { width: 128px; height: 128px; border-radius: 26px; }
#versus .vs-side > b { font-size: clamp(22px, 3vw, 34px); }
#versus .vs-lo .hex { width: 36px; height: 36px; border-radius: 8px; }
#versus .vs-mid { gap: 10px; }
#versus .vs-mid b { font-size: clamp(60px, 9vw, 104px); }
#versus .vs-count { margin-top: 18px; }
#versus .vs-count b { font-size: 42px; }
@media (max-height: 560px) {
  #versus .hex.vs-hex { width: 84px; height: 84px; border-radius: 18px; }
  .vs-stage { grid-template-columns: minmax(0, 1fr) 160px minmax(0, 1fr); }
  #versus .vs-mid b { font-size: 56px; }
  #versus .vs-count { margin-top: 6px; }
}

/* bar transition into the fight: bars drop in from the top, then lift away */
#bars { position: fixed; inset: 0; z-index: 70; pointer-events: none; display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); }
#bars i { position: relative; background: linear-gradient(180deg, #161b2a, #0b0e16 80%); transform: translateY(-102%); }
#bars i::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--acc); box-shadow: 0 0 12px var(--acc); }
#bars.in { pointer-events: auto; }
#bars.in i { animation: barDown 0.42s cubic-bezier(0.65, 0, 0.35, 1) both; animation-delay: calc(var(--i) * 38ms); }
#bars.out i { transform: none; animation: barUp 0.46s cubic-bezier(0.65, 0, 0.35, 1) both; animation-delay: calc(var(--i) * 38ms); }
@keyframes barDown { from { transform: translateY(-102%); } to { transform: none; } }
@keyframes barUp { from { transform: none; } to { transform: translateY(-102%); } }

/* opponent emblem crossfades when they swap element */
.chip-emblem, #bossEmblem { transition: opacity 0.16s ease, transform 0.16s ease; }
.chip-emblem.em-out, #bossEmblem.em-out { opacity: 0; transform: scale(0.75); }

/* result: the gem payout sits evenly between the stat tiles and the buttons */
.sheet.result .payout, body.touch .sheet.result .payout { margin: 4px 0; }

/* home chips, a size smaller with the same look */
.live-rail { gap: 6px; }
.rail-card { height: 38px; padding: 0 14px 0 11px; gap: 9px; }
.rail-card::after { left: 11px; right: 14px; }
.rc-gl, .rc-gl svg, .rc-gl .ic { width: 15px; height: 15px; }
.rc-gl .tier-badge.sm { width: 14px; height: 16px; }
.rc-t small { font-size: 7.5px; }
.rc-t > b { font-size: 10.5px; }
.rail-card .badge { top: 5px; right: 5px; width: 6px; height: 6px; }
.rail-card:has(.badge) { padding-right: 18px; }
@media (max-width: 1000px) {
  .rail-card { height: 33px; padding: 0 11px 0 9px; gap: 7px; }
  .rc-gl, .rc-gl svg, .rc-gl .ic { width: 13px; height: 13px; }
  .rc-gl .tier-badge.sm { width: 12px; height: 14px; }
  .rc-t > b { font-size: 9.5px; }
}

/* leaderboard rows (CrazyGames, real entries only) */
.lb-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
.vs-seam { opacity: 0.35; -webkit-mask: linear-gradient(180deg, #000 30%, transparent 42%, transparent 64%, #000 76%); mask: linear-gradient(180deg, #000 30%, transparent 42%, transparent 64%, #000 76%); }

/* versus: the emblem tile is a centred grid (the rank-line rule must not reach it) */
.vs-side > .hex { display: grid; place-items: center; }
/* slower bars, no coloured edge */
#bars i::after { display: none; }
#bars i { box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05); }
#bars.in i { animation-duration: 0.7s; animation-delay: calc(var(--i) * 70ms); }
#bars.out i { animation-duration: 0.75s; animation-delay: calc(var(--i) * 70ms); }

/* loadout: shorter on PC, DONE alone on the right, greyed when nothing is equipped */
body:not(.touch) .sheet.loadout { max-height: min(calc((100dvh - 20px - var(--safe-t) - var(--safe-b)) / var(--ui)), 600px); }
.lo-foot { justify-content: flex-end; }
.btn.is-off, .btn.primary.is-off { background: var(--ink-4); color: var(--muted); filter: none; box-shadow: none; }
body.touch .lo-slot .x { display: none; }

/* scroll bars take the theme colour (your first element) */
* { scrollbar-color: color-mix(in srgb, var(--acc) 80%, transparent) transparent; }
.el-grid, .codex-detail, .sheet { scrollbar-color: color-mix(in srgb, var(--acc) 80%, transparent) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--acc); border-radius: 4px; }

/* home chips on touch screens: small square icon buttons, same frame and accent */
body.touch .live-rail { gap: 6px; }
body.touch .rail-card, body.touch .rail-card:has(.badge) { width: 34px; height: 34px; padding: 0; gap: 0; justify-content: center; flex: none; }
body.touch .rail-card .rc-t { display: none; }
body.touch .rail-card::after { left: 8px; right: 8px; }
body.touch .rc-gl, body.touch .rc-gl svg, body.touch .rc-gl .ic { width: 15px; height: 15px; }
body.touch .rc-gl .tier-badge.sm { width: 14px; height: 16px; }
body.touch .rail-card .badge { top: 3px; right: 3px; width: 5px; height: 5px; }
@media (max-width: 600px) { body.touch .live-rail { left: auto; } }

/* element select on touch screens: a narrower sheet */
body.touch .sheet.loadout { width: min(560px, 100%); }
body.touch .sheet.loadout .lo-head { gap: 12px; }
.round.is-off { background: var(--ink-4); color: var(--muted); }
body.touch .sheet.loadout .lo-head { padding-left: 64px; justify-content: flex-start; }
body.touch .sheet.loadout .lo-head h2 { font-size: 18px; white-space: nowrap; }
body.touch .sheet.loadout .lo-slots { grid-template-columns: repeat(3, 84px); gap: 6px; margin-left: auto; }
/* touch: title and slots sit together as one compact, centred group */
body.touch .sheet.loadout .lo-head { justify-content: center; padding-left: 64px; padding-right: 64px; gap: 22px; }
body.touch .sheet.loadout .lo-slots { margin-left: 0; grid-template-columns: repeat(3, 66px); gap: 4px; }
/* home chips: no accent underline */
.rail-card::after { display: none; }

/* ad banner slot (CrazyGames, desktop home only); sized and placed from JS */
.ad-slot { position: fixed; z-index: 11; overflow: hidden; pointer-events: auto; }
.btn.claim + .btn.claim { margin-left: 6px; }
@media (max-width: 900px) { .btn.rw-offer { padding-left: 10px; padding-right: 10px; gap: 7px; } .btn.rw-offer b { font-size: 14px; } }
/* mobile: the main action (RETRY / NEXT / AGAIN) comes first, the ad offer after it */
body.touch .sheet.result > .result-actions .act-main .btn.primary { order: -1; }
/* ad tag on a yellow (primary) button, e.g. TRY ONCE in the element shop */
.btn.primary.rw-offer { background: var(--acc); }
.trial-lbl { font-style: normal; color: var(--acc); }

/* CrazyGames 320x50 banner: menus keep a strip free at the bottom for it */
/* Stages: realm tabs always fit the frame, no sideways scrolling (two rows of four) */
#map .bar > .seg#realmTabs { display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: center; gap: 4px; flex-wrap: nowrap; overflow: hidden; touch-action: auto; max-width: 720px; margin: 0 auto; }
#map .bar > .seg#realmTabs > button { margin: 0; }
#realmTabs .tab-page { display: flex; justify-content: center; gap: 4px; min-width: 0; }
#realmTabs .tab-page > button { flex: 0 0 calc(25% - 3px); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 6px; font-size: 11px; text-align: center; margin: 0; }
#realmTabs .tab-page > button small { font-weight: 900; font-size: 10px; opacity: 0.55; margin-right: 6px; }
#realmTabs .tab-page > button.active small { opacity: 0.7; }
#realmTabs .tab-view { position: relative; min-width: 0; overflow: hidden; }
#realmTabs .tab-page.ghost { position: absolute; inset: 0; pointer-events: none; }
#realmTabs .tab-arrow { display: grid; place-items: center; width: 34px; height: 32px; padding: 0; margin: 0; border-radius: 4px; color: var(--text); background: rgba(255, 255, 255, 0.06); }
#realmTabs .tab-arrow:hover:not(:disabled) { background: color-mix(in srgb, var(--acc) 30%, transparent); }
#realmTabs .tab-arrow:disabled { opacity: 0.25; cursor: default; }
#realmTabs .tab-arrow .ic { width: 15px; height: 15px; margin: 0; }
#realmTabs .tab-arrow.next .ic { transform: scaleX(-1); }
/* Elements detail: on shorter frames everything fits without a scrollbar */
@media (max-height: 760px) {
  #codexDetail .cd-head .hex { width: 46px; height: 46px; }
  #codexDetail .cd-head h3 { font-size: 24px; }
  #codexDetail .cd-head p { font-size: 12.5px; line-height: 1.3; }
  #codexDetail .cd-tags { margin: 3px 0 2px; }
  #codexDetail .moves { gap: 5px; }
  #codexDetail .move { padding: 6px 8px; gap: 3px 8px; }
  #codexDetail .move-top { gap: 8px; }
  #codexDetail .move h4 { font-size: 12px; }
  #codexDetail .move .tags { margin-top: 2px; }
  #codexDetail .move .tags span { font-size: 9.5px; padding: 2px 5px; }
  #codexDetail .move p { font-size: 11.5px; line-height: 1.3; }
  #codexDetail .move .meta { font-size: 11px; }
  #codexDetail .combos { gap: 4px; }
  #codexDetail .combo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
  #codexDetail .combo-card { padding: 4px 8px 4px 4px; gap: 8px; }
  #codexDetail .combo-card .pair .hex { width: 22px; height: 22px; border-radius: 5px; }
  #codexDetail .combo-card p { display: none; }
  #codexDetail .combo-card b { font-size: 11px; }
}
@media (max-height: 760px) {
  #codexDetail { padding: 10px 12px; gap: 6px; }
  #codexDetail .move-ic { width: 30px; height: 30px; }
  #codexDetail .cd-btns .btn { min-height: 32px; padding: 4px 10px; }
}
@media (max-height: 640px) {
  /* short frames: the three moves sit side by side, and the unlock row is one line */
  #codexDetail .moves { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #codexDetail .move { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  #codexDetail .move-top { flex: none; }
  #codexDetail .move-ic { width: 26px; height: 26px; }
  #codexDetail .move .tags { display: none; }
  #codexDetail .cd-head p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #codexDetail .buy-row { flex-wrap: nowrap; padding: 6px 8px; gap: 8px; }
  #codexDetail .buy-row p { font-size: 12px; line-height: 1.3; }
  #codexDetail .buy-row .btn { min-height: 34px; padding: 4px 10px; white-space: nowrap; }
}
@media (max-height: 640px) {
  #codexDetail .move p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  #codexDetail .move .meta { margin-top: 2px; }
  #codexDetail .combo-card .pair .or, #codexDetail .combo-card .pair .or + .hex { display: none; }
  #codexDetail .combo-card { padding: 3px 8px 3px 3px; min-width: 0; }
  #codexDetail .combo-card > div:last-child { min-width: 0; }
  #codexDetail .combo-card b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #codexDetail .combo-card .plus { font-size: 12px; }
  #codexDetail .combo-card .pair .hex { width: 20px; height: 20px; }
  #codexDetail .combo-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  #codexDetail .cd-btns .btn { min-height: 28px; }
  #codexDetail .moves { gap: 4px; }
}
@media (max-height: 640px) {
  #codexDetail .cd-head .hex { width: 40px; height: 40px; }
  #codexDetail .cd-head h3 { font-size: 22px; line-height: 1.1; }
  #codexDetail .combos h4 { font-size: 10.5px; }
  #codexDetail { gap: 5px; padding: 8px 10px; }
}
/* combo cards never push the detail pane sideways */
.codex-detail { overflow-x: hidden; }
.combo-card { min-width: 0; }
.combo-card > div:last-child { min-width: 0; flex: 1; }
.combo-card .pair { flex-wrap: nowrap; flex: none; }
.combo-card .alts { display: inline-flex; align-items: center; }
.combo-card .alts.many > .hex { box-shadow: 0 0 0 2px #1a1f2c; }
.combo-card .alts.many > .hex + .hex { margin-left: -9px; }

/* Event tab: fits the game frame without a scrollbar on shorter frames */
@media (max-height: 760px) {
  .event-tab .ev-art { min-height: 0; height: clamp(84px, 19vh, 150px); }
  .event-tab .hex.ev-hex { width: clamp(56px, 12vh, 92px); height: clamp(56px, 12vh, 92px); border-radius: 16px; }
  .event-tab .ev-art > .ev-glow { width: 200px; height: 200px; }
  .event-tab .ev-info { padding: 8px 16px 14px; gap: 7px; }
  .event-tab .ev-info h3 { font-size: clamp(22px, 2.6vw, 32px); }
  .event-tab .ev-tag { font-size: 12.5px; line-height: 1.35; }
  .event-tab .ev-el > b { margin-bottom: 4px; font-size: 16px; }
  .event-tab .ev-move { flex-direction: row; align-items: center; gap: 7px; padding: 5px 7px; }
  .event-tab .ev-move .move-ic { width: 26px; height: 26px; margin: 0; flex: none; }
  .event-tab .ev-cta .btn { min-height: 40px; }
}
@media (max-height: 520px) {
  .event-tab .ev-art { height: 70px; }
  .event-tab .hex.ev-hex { width: 50px; height: 50px; border-radius: 12px; }
  .event-tab .ev-tag { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .event-tab .ev-info { gap: 5px; }
  .event-tab .ev-cta .btn { min-height: 34px; }
}
@media (max-height: 760px) {
  .event-tab .ev-hero { align-content: start; }
  .event-tab .ev-move > small { display: none; }
  .event-tab .ev-move > b { font-size: 11px; line-height: 1.15; white-space: normal; overflow: visible; }
}
@media (max-height: 520px) {
  .event-tab .hub-col > .card > p.fine { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 11px; }
  .event-tab .quest { padding: 5px 8px; }
}
@media (max-height: 520px) {
  .event-tab .panel, .event-tab .hub-col > .card { gap: 5px; padding-top: 8px; padding-bottom: 8px; }
  .event-tab .quest { padding: 4px 8px; gap: 8px; }
  .event-tab .q-ic { width: 28px; height: 28px; }
  .event-tab .shop-row { padding: 4px 8px; }
}
@media (max-height: 520px) {
  .event-tab .hub-col { gap: 6px; }
  .event-tab .hub-col > .card > p.fine { -webkit-line-clamp: 1; }
}
/* landscape phones */
@media (max-height: 420px) {
  .event-tab .ev-art { height: 52px; }
  .event-tab .hex.ev-hex { width: 40px; height: 40px; border-radius: 10px; }
  .event-tab .ev-tag { display: none; }
  .event-tab .ev-info { padding: 6px 12px 10px; gap: 4px; }
  .event-tab .ev-info h3 { font-size: 20px; }
  .event-tab .ev-cta .btn { min-height: 32px; }
  .event-tab .q-ic { width: 26px; height: 26px; }
}
@media (max-height: 420px) {
  #hub { padding-top: calc(6px + var(--safe-t)); padding-bottom: calc(6px + var(--safe-b)); }
  #hub .bar { margin-bottom: 6px; }
  .event-tab .quest { padding: 3px 8px; }
  .event-tab .q-body > b { font-size: 11.5px; }
  .event-tab .ev-el > b { font-size: 14px; margin-bottom: 2px; }
  .event-tab .ev-move { padding: 4px 6px; }
  .event-tab .ev-move .move-ic { width: 22px; height: 22px; }
}
@media (max-height: 380px) {
  .event-tab .ev-art { display: none; }
  .event-tab .ev-el > small { display: none; }
  .event-tab .ev-info { padding-top: 10px; }
  .event-tab .hub-col > .card > p.fine { display: none; }
  .event-tab .panel h4, .event-tab .panel-head { margin-bottom: 0; }
}

/* ---------------------------------------------------- CrazyGames 320x50 banner
   One fixed spot that never moves: bottom-centre on computers, top-centre on touch
   devices. No background of its own. It sits above menus and pop-ups, and while it shows
   (body.banner-on) every screen and pop-up keeps that strip free. */
.ad-slot { position: fixed; z-index: 40; width: 320px; height: 50px; left: calc(50% - 160px); top: auto; bottom: calc(6px + var(--safe-b)); background: none; overflow: hidden; pointer-events: auto; }
body.touch .ad-slot { top: calc(4px + var(--safe-t)); bottom: auto; }

/* computers: keep the bottom strip free */
body.banner-on:not(.touch) .screen:not(#home) { padding-bottom: calc(62px + var(--safe-b)); }
body.banner-on:not(.touch) #home .home-panel { padding-bottom: calc(66px + var(--safe-b)); }
body.banner-on:not(.touch) #home .live-rail { bottom: calc(66px + var(--safe-b)); }
body.banner-on:not(.touch) .modal { padding-bottom: calc(66px + var(--safe-b)); }
body.banner-on:not(.touch) .modal .sheet { max-height: calc((100dvh - 76px - var(--safe-t) - var(--safe-b)) / var(--ui)); }

/* touch devices: keep the top strip free */
body.banner-on.touch .screen:not(#home) { padding-top: calc(60px + var(--safe-t)); }
body.banner-on.touch #home .corner.tr { top: calc(60px + var(--safe-t)); }
body.banner-on.touch .modal { padding-top: calc(62px + var(--safe-t)); }
body.banner-on.touch .modal .sheet { max-height: calc((100dvh - 72px - var(--safe-t) - var(--safe-b)) / var(--ui)); }

/* menus that scale down a little to fit the frame instead of scrolling (see fitScreen) */
#map > *, #forge > *, #hub > * { zoom: calc(var(--ui) * var(--fit, 1)); }
body.banner-on .sheet.loadout .lo-grid { min-height: 56px; }
@media (max-height: 520px) {
  body.banner-on .modal .sheet { padding-top: 14px; padding-bottom: 14px; gap: 10px; }
}
@media (max-height: 520px) {
  body.banner-on .modal .keys { gap: 2px 12px; font-size: 13px; }
  body.banner-on .modal .sheet h2 { font-size: 22px; }
}
@media (max-height: 380px) {
  body.banner-on .modal .sheet { padding-top: 10px; padding-bottom: 10px; gap: 6px; }
  body.banner-on .sheet.loadout .lo-grid { min-height: 44px; }
}
#codexDetail > * { zoom: var(--fit, 1); }

/* ---------------------------------------------------------------- title card
   ELEMENT: one element per letter (see js/titlefx.js). The letters slam in once on
   load, then flare in their element's colours whenever the surge passes over them.
   RAG: the accent tag punches in last and flashes when the surge dives into it. */
.title { position: relative; z-index: 4; }
.title .t1 { display: inline-flex; }
.title .t1 i { display: inline-block; font-style: normal; transform-origin: 50% 85%;
  transition: color 0.6s ease, text-shadow 0.6s ease, -webkit-text-stroke-color 0.6s ease;
  animation: tLetterIn 0.72s cubic-bezier(.2, 1.35, .4, 1) calc(0.15s + var(--i) * 0.11s) backwards; }
@keyframes tLetterIn {
  0% { opacity: 0; transform: translateY(-70px) scale(1.7) rotate(-14deg); filter: blur(8px); }
  55% { opacity: 1; filter: blur(0); }
  100% { transform: none; }
}
.title .t1 i.lit {
  color: color-mix(in srgb, var(--ec) 55%, white);
  text-shadow: 0 0 6px var(--ec), 0 0 22px var(--ed), 0 0 44px color-mix(in srgb, var(--ed) 60%, transparent);
  transition: color 0.06s, text-shadow 0.06s;
}
.title .t2 { animation: tTagIn 0.8s cubic-bezier(.2, 1.3, .35, 1) 1.15s backwards; transition: filter 0.5s ease; }
@keyframes tTagIn {
  0% { opacity: 0; transform: skewX(-8deg) translateX(-140px) scaleX(1.6); filter: blur(6px) brightness(2.2); }
  50% { opacity: 1; filter: blur(0) brightness(1.6); }
  100% { transform: skewX(-8deg); }
}
.title .t2.hit { animation: tTagHit 0.6s ease-out; }
@keyframes tTagHit {
  0% { filter: brightness(2.6) saturate(0.4) drop-shadow(0 0 18px #fff); }
  100% { filter: none; }
}
.title.settled .t1 i, .title.settled .t2:not(.hit) { animation: none; }
/* hold the title back until the game has loaded (the SDK and fonts can take a few seconds):
   the slam-in and its canvas effects then start together, once */
body:not(.ui-ready) .title .t1 i, body:not(.ui-ready) .title .t2 { animation: none; opacity: 0; }
#titleFx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .title .t1 i, .title .t2 { animation: none; } #titleFx { display: none; } }

/* ---------------------------------------------------------------- the Shop */
#codex .bar { flex-wrap: nowrap; }
#codex .bar h2 { flex: none; }
.shop-tabs { flex: 0 1 auto; margin: 0 auto 0 8px; }
.shop-tabs button { display: inline-flex; align-items: center; gap: 6px; }
.shop-tabs button .ic { width: 13px; height: 13px; }
.shop-tabs button b { font-weight: 800; }
@media (max-width: 900px) { .shop-tabs button b { display: none; } .shop-tabs button .ic { width: 16px; height: 16px; } }
.shop { width: 100%; max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: 12px;
  height: calc((100dvh - 30px - var(--safe-t) - var(--safe-b)) / var(--ui) - var(--barh)); min-height: 0; }
.shop.hidden { display: none; }
.shop-browse { padding: 12px; min-height: 0; display: flex; }
.shop-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; align-content: start; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 2px 6px 6px 2px; scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent; }
.shop-grid.items { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.sh-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 6px 9px; border-radius: 8px; background: rgba(255, 255, 255, 0.045); box-shadow: inset 0 0 0 1.5px transparent; transition: background 0.12s, box-shadow 0.12s, transform 0.12s; min-width: 0; }
.sh-card:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); }
.sh-card.on { box-shadow: inset 0 0 0 2px var(--acc); background: color-mix(in srgb, var(--acc) 10%, rgba(255, 255, 255, 0.04)); }
.sh-card.event { background: linear-gradient(180deg, rgba(127, 224, 255, 0.1), rgba(226, 57, 75, 0.06)); }
.sh-card b { font-weight: 800; font-size: 10.5px; letter-spacing: 0.04em; text-align: center; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sh-thumb { width: 76px; height: 76px; }
.sh-flag { position: absolute; top: 6px; right: 6px; color: #7fe0ff; }
.sh-flag .ic { width: 14px; height: 14px; }
.sh-st { display: inline-flex; align-items: center; gap: 3px; font-weight: 900; font-size: 11px; color: var(--muted); }
.sh-st .ic { width: 12px; height: 12px; }
.sh-st.price.can { color: var(--text); }
.sh-st.owned { color: var(--muted); letter-spacing: 0.06em; font-size: 10px; }
.sh-st.worn { color: var(--green, #7ee081); letter-spacing: 0.06em; font-size: 10px; }
.sh-st.ev { color: #7fe0ff; }
.sh-item-ic { display: block; width: 58px; height: 58px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); }
.sh-item-ic canvas { display: block; width: 100%; height: 100%; }
.sh-item-ic.big { width: 170px; height: 170px; border-radius: 24px; border: 0; background: none; }
.sd-slots .slot canvas { width: 18px; height: 18px; flex: none; }
.sh-count { position: absolute; top: 6px; right: 8px; font-weight: 900; font-size: 12px; }
.sh-armed { position: absolute; top: 6px; left: 6px; font-weight: 900; font-size: 9px; letter-spacing: 0.08em; padding: 2px 6px; border-radius: 4px; background: var(--acc); color: #10131c; }
.sh-card.armed { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 70%, transparent); }
.shop-detail { display: flex; flex-direction: column; gap: 12px; padding: 16px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.sd-preview { flex: 1 1 200px; min-height: 160px; border-radius: 10px; background: radial-gradient(60% 70% at 50% 75%, color-mix(in srgb, var(--acc) 18%, transparent), transparent), linear-gradient(180deg, #171c2c, #0e1119); display: flex; }
.sd-preview canvas { width: 100%; height: 100%; min-height: 160px; }
.sd-item { flex: 1 1 180px; min-height: 150px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(180deg, #171c2c, #0e1119); }
.sd-body { display: flex; flex-direction: column; gap: 8px; }
.sd-body .kicker { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 10px; letter-spacing: 0.14em; color: var(--muted); }
.sd-body .kicker .ic { width: 12px; height: 12px; color: #7fe0ff; }
.sd-body h3 { font-weight: 900; font-size: 26px; letter-spacing: 0.02em; line-height: 1; }
.sd-body p { color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.sd-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.sd-btns .btn { flex: 1 1 140px; flex-direction: row; gap: 7px; }
.sd-btns .btn .ic { width: 15px; height: 15px; }
.sd-own { font-weight: 800; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); }
.sd-own b { color: var(--text); font-size: 15px; }
.sd-slots small { font-weight: 800; font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.sd-slots > div { display: flex; gap: 6px; margin-top: 5px; }
.sd-slots .slot { flex: 1; display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 6px; background: color-mix(in srgb, var(--c, #888) 18%, rgba(255, 255, 255, 0.04)); font-weight: 800; font-size: 10.5px; }
.sd-slots .slot .ic { width: 14px; height: 14px; color: var(--c); }
.sd-slots .slot.empty { color: var(--muted); background: rgba(255, 255, 255, 0.04); justify-content: center; }
.ic.tok { color: #7fe0ff; }
@media (max-width: 760px), (max-height: 520px) {
  .shop { grid-template-columns: minmax(0, 1fr) minmax(230px, 0.85fr); gap: 8px; }
  .sh-thumb { width: 58px; height: 58px; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
  .shop-detail { padding: 10px; gap: 8px; }
  .sd-body h3 { font-size: 20px; }
  .sd-body p { font-size: 12px; }
  .sd-preview, .sd-item { flex-basis: 120px; min-height: 110px; }
  .sd-preview canvas { min-height: 110px; }
  .sh-item-ic.big { width: 110px; height: 110px; }
}

/* ------------------------------------------------------------- Winterfest */
#mapEvent { flex-direction: row; gap: 6px; color: #bfefff; background: linear-gradient(135deg, #1d3a6e, #2a1f4a); box-shadow: inset 0 0 0 1.5px rgba(127, 224, 255, 0.45); white-space: nowrap; }
#mapEvent .ic { width: 14px; height: 14px; color: #7fe0ff; }
#mapEvent.on { background: linear-gradient(135deg, #7fe0ff, #c9f2ff); color: #0d1730; }
#mapEvent.on .ic { color: #0d1730; }
body.touch #mapEvent b { display: none; }
#mapEvent:not(.hidden) { animation: wfPulse 2.4s ease-in-out infinite; }
#mapEvent.on { animation: none; }
@keyframes wfPulse { 0%, 100% { box-shadow: inset 0 0 0 1.5px rgba(127, 224, 255, 0.45); } 50% { box-shadow: inset 0 0 0 1.5px rgba(127, 224, 255, 0.9), 0 0 16px rgba(127, 224, 255, 0.35); } }
.realm-head .wf-title { display: inline-flex; align-items: center; gap: 10px; color: #dff6ff; }
.realm-head .wf-title .ic { width: 26px; height: 26px; color: #7fe0ff; }
.stage-grid.winter { grid-template-columns: repeat(10, minmax(0, 1fr)); max-width: 1180px; row-gap: clamp(8px, 1.4vw, 14px); }
@media (max-width: 760px) { .stage-grid.winter { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; } }
.stage-card.wf { padding: 10px 3px 26px; gap: 4px; aspect-ratio: auto; min-height: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 10%, var(--ink-2)), var(--ink-2)); }
.stage-card.wf .n { font-size: clamp(18px, 2.2vw, 26px); }
.stage-card.wf .n .ic { width: 20px; height: 20px; }
.stage-card.wf .stars .ic { width: 10px; height: 10px; }
.stage-card.wf .wf-mode { position: absolute; left: 3px; right: 3px; bottom: 5px; display: inline-flex; align-items: center; justify-content: center; gap: 3px; color: var(--c); overflow: hidden; }
.stage-card.wf .wf-mode .ic { width: 11px; height: 11px; flex: none; }
.stage-card.wf .wf-mode b { font-weight: 900; font-size: 7.5px; letter-spacing: 0.05em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-card.wf .wf-hat { position: absolute; top: 2px; right: 2px; opacity: 0.95; }
.stage-card.wf .wf-hat.got { opacity: 0.45; }
.stage-card.wf.milestone { box-shadow: inset 0 0 0 1.5px rgba(255, 211, 77, 0.55), inset 0 -3px 0 rgba(0, 0, 0, 0.3); }
.stage-card.wf .wf-new { position: absolute; top: 3px; left: 3px; font-weight: 900; font-size: 7.5px; letter-spacing: 0.08em; padding: 2px 4px; border-radius: 3px; background: #7fe0ff; color: #0d1730; }
.stage-card.wf .wf-tw { position: absolute; top: 4px; left: 4px; color: var(--muted); }
.stage-card.wf .wf-new ~ .wf-tw { display: none; }
.stage-card.wf .wf-tw .ic { width: 11px; height: 11px; }
@media (max-width: 760px), (max-height: 520px) { .stage-card.wf .wf-mode b { display: none; } .stage-card.wf { padding-bottom: 20px; } .stage-card.wf .wf-hat canvas { width: 22px !important; height: 22px !important; } }
.hat-thumb { display: block; }
.sw { display: inline-block; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 55%, white), var(--c)); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2); }
/* how-to cards */
.sheet.wf-card { width: min(520px, 100%); text-align: center; align-items: center; background: linear-gradient(180deg, #14244a, #121620 60%); box-shadow: inset 0 3px 0 #7fe0ff; }
.wf-card-ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: radial-gradient(circle at 35% 30%, #c9f2ff, #4fb6e0); color: #0d1730; box-shadow: 0 8px 26px rgba(127, 224, 255, 0.35); }
.wf-card-ic .ic { width: 36px; height: 36px; }
.wf-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.wf-modes > div { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: #7fe0ff; }
.wf-modes .ic { width: 22px; height: 22px; }
.wf-modes b { font-weight: 900; font-size: 9.5px; letter-spacing: 0.06em; color: var(--text); }
.wf-next { color: var(--muted); font-size: 13px; }
.wf-next b { color: #ffd34d; }
.wf-prizes { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.wf-prizes .sw { width: 26px; height: 26px; }
.wf-unlock .hat-thumb { flex: none; }
.wf-unlock .btn { margin-left: auto; flex: none; }
/* HUD: the snowman is in danger */
.stage-chip.wf-urgent #chipSub { color: #ff8a8a; animation: wfBlink 0.8s steps(2) infinite; }
@keyframes wfBlink { 50% { opacity: 0.45; } }
/* hub: the Winterfest tab */
.wf-art { min-height: 200px; background: radial-gradient(60% 55% at 50% 50%, rgba(127, 224, 255, 0.28), transparent 72%), linear-gradient(180deg, #0b1636, #1d3a6e 70%, #6d8fc4); }
.wf-art .wf-snow { position: absolute; inset: 0; background-image: radial-gradient(2px 2px at 20% 30%, #fff, transparent), radial-gradient(2px 2px at 70% 20%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 70%, #fff, transparent), radial-gradient(2px 2px at 85% 60%, #fff, transparent), radial-gradient(1.5px 1.5px at 10% 80%, #fff, transparent), radial-gradient(2px 2px at 55% 45%, #fff, transparent); background-size: 220px 220px; animation: wfSnow 9s linear infinite; opacity: 0.85; }
@keyframes wfSnow { to { background-position: 40px 220px; } }
.wf-art .wf-glow { position: absolute; left: 50%; top: 50%; width: 240px; height: 240px; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(127, 224, 255, 0.45), rgba(226, 57, 75, 0.12) 60%, transparent); animation: evPulse 3.2s ease-in-out infinite; }
.wf-art .wf-emblem { position: relative; display: grid; place-items: center; width: 110px; height: 110px; border-radius: 28px; background: radial-gradient(circle at 35% 30%, #ffffff, #bfe6ff 60%, #7fb8e0); color: #12244a; box-shadow: 0 10px 40px rgba(127, 224, 255, 0.4), inset 0 -6px 0 rgba(0, 0, 0, 0.12); animation: floaty 4s ease-in-out infinite; }
.wf-art .wf-emblem .ic { width: 64px; height: 64px; }
.wf-tab .ev-info h3 { color: #dff6ff; }
.wf-milestones { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.wf-ms { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); }
.wf-ms small { font-weight: 800; font-size: 8.5px; letter-spacing: 0.1em; color: var(--muted); }
.wf-ms b { font-weight: 900; font-size: 9px; text-align: center; letter-spacing: 0.03em; }
.wf-ms .q-done { position: absolute; top: 4px; right: 4px; }
.wf-ms.got { box-shadow: inset 0 0 0 1.5px rgba(126, 224, 129, 0.5); }
.wf-shop { display: flex; flex-direction: column; gap: 6px; }
.wf-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.045); }
.wf-item > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wf-item b { font-weight: 800; font-size: 12px; letter-spacing: 0.03em; }
.wf-item small { font-weight: 700; font-size: 9.5px; letter-spacing: 0.1em; color: var(--muted); }
.wf-item .btn { flex-direction: row; gap: 5px; }
.wf-item .btn .ic, .tok-rw .ic, .tok-bal .ic { color: #7fe0ff; }
.wf-item.owned { opacity: 0.6; }
.tok-rw { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; }
.tok-rw .ic { width: 14px; height: 14px; }
@media (max-height: 760px) { .wf-art { min-height: 0; height: clamp(84px, 19vh, 160px); } .wf-art .wf-emblem { width: 70px; height: 70px; border-radius: 18px; } .wf-art .wf-emblem .ic { width: 40px; height: 40px; } .wf-ms { padding: 4px 2px; } .wf-ms b { font-size: 8px; } }

/* ---------------------------------------------- Winterfest chapter screen
   Same language as the campaign screens: dark cut-corner panels, clean type, thin
   accent lines. Ice blue is the event accent; each mode has a quiet colour of its own. */
#map:has(.winter-v2) { --wf: #8fd3ff; }
#map:has(.winter-v2) .realm-head { max-width: 1180px; width: 100%; display: block; margin-top: 4px; }
.wf-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 6px 2px 0; }
.wf-kicker { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 10.5px; letter-spacing: 0.16em; color: var(--wf); }
.wf-kicker b { color: var(--text); font-weight: 900; }
.wf-brand h3 { font-weight: 900; font-size: clamp(28px, 3.4vw, 40px); line-height: 1; letter-spacing: 0.03em; margin: 4px 0 2px; color: #fff; }
.wf-brand p { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.wf-stats { display: flex; gap: 22px; }
.wf-stats > div { display: flex; flex-direction: column; align-items: flex-end; }
.wf-stats b { font-weight: 900; font-size: 24px; line-height: 1; }
.wf-stats b small { font-size: 13px; color: var(--muted); font-weight: 800; }
.wf-stats span { font-weight: 800; font-size: 9.5px; letter-spacing: 0.16em; color: var(--muted); margin-top: 3px; }
.stage-grid.winter-v2 { display: flex; flex-direction: column; gap: 10px; max-width: 1180px; margin-top: 12px; grid-template-columns: none; }
/* rewards */
.wf-track { display: flex; align-items: center; gap: 18px; padding: 12px 16px; }
.wf-track-l { flex: none; font-weight: 800; font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.wf-rail { position: relative; flex: 1; height: 44px; margin-right: 70px; }
.wf-bar { position: absolute; left: 0; right: 0; top: 50%; height: 3px; transform: translateY(-50%); border-radius: 2px; background: rgba(255, 255, 255, 0.08); }
.wf-bar i { display: block; height: 100%; border-radius: 2px; background: var(--wf); box-shadow: 0 0 10px color-mix(in srgb, var(--wf) 60%, transparent); }
.wf-reward { position: absolute; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; clip-path: var(--cut-s); background: #161b29; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.wf-reward .pic { display: block; width: 34px; height: 34px; border-radius: 4px; overflow: hidden; background: #0f131d; opacity: 0.55; }
.wf-reward .txt { display: flex; flex-direction: column; white-space: nowrap; }
.wf-reward b { font-weight: 800; font-size: 10px; letter-spacing: 0.06em; }
.wf-reward small { font-weight: 700; font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.wf-reward.got { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wf) 70%, transparent); }
.wf-reward.got .pic { opacity: 1; }
.wf-reward.got small { color: var(--wf); }
/* stage grid */
.wf-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 320px); gap: 10px; }
.wf-board { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.wf-tiles { flex: 1; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 8px; }
.wf-tile { --c: var(--wf); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 2px 10px; min-width: 0;
  clip-path: var(--cut-m); background: var(--ink-2); box-shadow: inset 0 3px 0 color-mix(in srgb, var(--c) 75%, transparent), inset 0 -3px 0 rgba(0, 0, 0, 0.3); transition: background 0.12s, transform 0.12s; }
.wf-tile:hover { background: var(--ink-3); transform: translateY(-2px); }
.wf-tile .no { font-weight: 900; font-size: clamp(18px, 2vw, 26px); line-height: 1; }
.wf-tile .no .ic { width: 20px; height: 20px; }
.wf-tile.boss .no { color: var(--c); }
.wf-tile .md { color: var(--c); line-height: 0; }
.wf-tile .md .ic { width: 13px; height: 13px; }
.wf-tile .st { display: flex; gap: 2px; }
.wf-tile .st i { width: 8px; height: 8px; clip-path: polygon(50% 0, 63% 36%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 37% 36%); background: rgba(255, 255, 255, 0.14); }
.wf-tile .st i.on { background: #ffd34d; }
.wf-tile .rw { position: absolute; top: 7px; right: 6px; color: #ffd34d; line-height: 0; }
.wf-tile .rw .ic { width: 11px; height: 11px; }
.wf-tile .rw.got { color: var(--muted); }
.wf-tile.locked { box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.06), inset 0 -3px 0 rgba(0, 0, 0, 0.3); }
.wf-tile.locked .no, .wf-tile.locked .md, .wf-tile.locked .st { opacity: 0.32; }
.wf-tile.locked:hover { transform: none; background: var(--ink-2); }
.wf-tile .dt { position: absolute; left: 0; right: 0; bottom: 5px; text-align: center; font-size: 9px; font-weight: 800; letter-spacing: 0.08em; color: #8fd3ff; }
.wf-tile.dated .st { visibility: hidden; }
.wf-tile.done { background: color-mix(in srgb, var(--c) 8%, var(--ink-2)); }
.wf-tile.current { background: color-mix(in srgb, var(--wf) 14%, var(--ink-2)); box-shadow: inset 0 0 0 1.5px var(--wf), inset 0 3px 0 var(--c), 0 0 18px color-mix(in srgb, var(--wf) 25%, transparent); }
.wf-tile.sel { background: var(--ink-3); box-shadow: inset 0 0 0 2px #ffffff, inset 0 3px 0 var(--c); }
.wf-legend { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.wf-legend span { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.wf-legend i { width: 14px; height: 3px; border-radius: 2px; background: var(--c); }
.wf-legend .rwk .ic { width: 11px; height: 11px; color: #ffd34d; }
/* detail */
.wf-detail { --c: var(--wf); display: flex; flex-direction: column; gap: 12px; padding: 16px; box-shadow: inset 0 3px 0 var(--c); }
.wfd-top { display: flex; align-items: center; gap: 12px; }
.wfd-ic { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, #121620); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent); }
.wfd-ic .ic { width: 24px; height: 24px; }
.wfd-top small { font-weight: 800; font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.wfd-top h3 { font-weight: 900; font-size: 22px; line-height: 1.05; letter-spacing: 0.02em; }
.wfd-body { display: flex; flex-direction: column; border-top: 1px solid var(--line, rgba(255, 255, 255, 0.08)); }
.wfd-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line, rgba(255, 255, 255, 0.08)); }
.wfd-row .k { font-weight: 800; font-size: 9.5px; letter-spacing: 0.14em; color: var(--muted); }
.wfd-row .v { font-size: 12.5px; font-weight: 600; line-height: 1.35; color: var(--text); }
.wfd-row .v b { font-weight: 800; color: #b7a6ff; }
.wfd-row .v.stars { display: flex; gap: 2px; }
.wfd-row .v.stars .ic { width: 15px; height: 15px; color: rgba(255, 255, 255, 0.16); }
.wfd-row .v.stars .ic.on { color: #ffd34d; }
.wfd-row .v.rw { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wfd-row .v.rw b { color: var(--text); font-weight: 900; }
.wfd-row .v.rw > .ic { width: 14px; height: 14px; }
.wfd-row .hatrw { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; padding: 2px 8px 2px 2px; border-radius: 4px; background: rgba(255, 211, 77, 0.1); color: #ffd34d; font-weight: 800; font-size: 11px; }
.wfd-row .hatrw canvas { border-radius: 3px; background: #0f131d; }
.wfd-row .hatrw.got { color: var(--muted); background: rgba(255, 255, 255, 0.05); }
.wf-detail .btn.wfd-play { margin-top: auto; flex-direction: row; gap: 9px; min-height: 48px; font-size: 17px; background: var(--wf); color: #0b1424; }
.wfd-play .ic { width: 16px; height: 16px; }
.wf-detail .btn.wfd-play:disabled { background: rgba(255, 255, 255, 0.07); color: var(--muted); font-size: 13px; }
@media (max-height: 640px) {
  .wf-brand h3 { font-size: 28px; } .wf-brand p { display: none; }
  .wf-stats b { font-size: 20px; }
  .wf-track { padding: 8px 12px; } .wf-rail { height: 38px; }
  .wf-board { padding: 10px; gap: 8px; } .wf-tiles { gap: 6px; } .wf-tile { padding: 9px 2px 8px; gap: 4px; }
  .wf-detail { padding: 12px; gap: 8px; } .wfd-row { padding: 6px 0; } .wfd-top h3 { font-size: 19px; } .wfd-ic { width: 40px; height: 40px; }
  .wfd-play { min-height: 42px; font-size: 15px; }
}
@media (max-width: 760px), (max-height: 430px) {
  .wf-main { grid-template-columns: minmax(0, 1fr) minmax(210px, 250px); gap: 8px; }
  .wf-track-l, .wf-legend, .wf-reward .txt { display: none; }
  .wf-rail { margin-right: 18px; }
  .wf-reward { padding: 3px; }
  .wf-tile .md { display: none; }
  .wf-tile .rw { top: 4px; right: 3px; }
  .wfd-row { grid-template-columns: 52px minmax(0, 1fr); }
  .wfd-row .v { font-size: 11px; }
}

/* ------------------------------------------------ outlines on cut corners
   .ol draws a hairline around a clip-path panel, including along the two cut
   diagonals (an inset box-shadow alone can't follow them). --ocut matches the cut:
   6px (--cut-s), 10px (--cut-m) or 16px (--cut-l, used by .card). */
.ol { position: relative; --ocut: 10px; --olc: rgba(160, 200, 255, 0.16); }
.card.ol { --ocut: 16px; }
.wf-reward.ol, .wfh-rw.ol { --ocut: 6px; }
.ol::before, .ol::after { content: ''; position: absolute; width: calc(var(--ocut) * 1.4142 + 1px); height: 2px; background: var(--olc); pointer-events: none; z-index: 3; }
.ol::before { left: 0; top: calc(var(--ocut) - 1px); transform-origin: 0 50%; transform: rotate(-45deg); }
.ol::after { right: 0; bottom: calc(var(--ocut) - 1px); transform-origin: 100% 50%; transform: rotate(-45deg); }
/* the straight edges, kept alongside each element's own accent shadows */
.wf-track.ol, .wf-board.ol { box-shadow: inset 0 0 0 1px var(--olc); }
.wf-detail.ol { box-shadow: inset 0 0 0 1px var(--olc), inset 0 3px 0 var(--c); }
.wf-reward.ol { box-shadow: inset 0 0 0 1px var(--olc); }
.wf-reward.ol.got { --olc: color-mix(in srgb, var(--wf) 70%, transparent); }
.wf-tile.ol { box-shadow: inset 0 0 0 1px var(--olc), inset 0 3px 0 color-mix(in srgb, var(--c) 75%, transparent); }
.wf-tile.ol.locked { box-shadow: inset 0 0 0 1px rgba(160, 200, 255, 0.08), inset 0 3px 0 rgba(255, 255, 255, 0.06); --olc: rgba(160, 200, 255, 0.08); }
.wf-tile.ol.current { --olc: var(--wf); box-shadow: inset 0 0 0 1.5px var(--wf), inset 0 3px 0 var(--c), 0 0 18px color-mix(in srgb, var(--wf) 25%, transparent); }
.wf-tile.ol.sel { --olc: #ffffff; box-shadow: inset 0 0 0 2px #ffffff, inset 0 3px 0 var(--c); }
.wf-tile.ol.sel::before, .wf-tile.ol.sel::after, .wf-tile.ol.current::before, .wf-tile.ol.current::after { height: 3px; }

/* ------------------------------------------------ hub: the Winterfest tab */
.wfh { align-items: stretch; }
.wfh-left { display: flex; }
.wfh-hero { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 0 0 16px; clip-path: var(--cut-l); background: var(--panel); box-shadow: inset 0 0 0 1px var(--olc); --ocut: 16px; overflow: hidden; }
.wfh-banner { position: relative; height: 150px; flex: none; display: flex; align-items: flex-end; padding: 0 18px 14px; overflow: hidden;
  background: radial-gradient(70% 90% at 80% 10%, rgba(143, 211, 255, 0.28), transparent 60%), linear-gradient(160deg, #0d1a3d 0%, #142a5c 55%, #1d3a6e 100%); border-bottom: 1px solid rgba(160, 200, 255, 0.16); }
.wfh-banner .aur { position: absolute; left: -10%; right: -10%; top: 18%; height: 60px; background: linear-gradient(90deg, transparent, rgba(126, 255, 200, 0.18), rgba(143, 211, 255, 0.22), rgba(183, 166, 255, 0.16), transparent); filter: blur(14px); transform: rotate(-6deg); animation: wfhAur 9s ease-in-out infinite alternate; }
@keyframes wfhAur { to { transform: rotate(-3deg) translateX(6%); opacity: 0.7; } }
.wfh-banner .mark { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: rgba(191, 238, 255, 0.85); filter: drop-shadow(0 0 18px rgba(143, 211, 255, 0.45)); }
.wfh-banner .mark .ic { width: 96px; height: 96px; }
.wfh-banner .ttl { position: relative; }
.wfh-banner small { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 10.5px; letter-spacing: 0.16em; color: #8fd3ff; }
.wfh-banner small b { color: #fff; font-weight: 900; }
.wfh-banner h3 { font-weight: 900; font-size: clamp(30px, 3.6vw, 44px); line-height: 1; letter-spacing: 0.03em; color: #fff; margin-top: 4px; }
.wfh-tag { padding: 0 18px; font-size: 13px; font-weight: 500; line-height: 1.45; color: var(--muted); }
.wfh-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.wfh-stats > div { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px; }
.wfh-stats > div + div { border-left: 1px solid var(--line); }
.wfh-stats b { display: inline-flex; align-items: center; gap: 5px; font-weight: 900; font-size: 22px; line-height: 1; }
.wfh-stats b small { font-size: 12px; color: var(--muted); }
.wfh-stats b.tk .ic { width: 16px; height: 16px; color: #8fd3ff; }
.wfh-stats span { font-weight: 800; font-size: 9px; letter-spacing: 0.14em; color: var(--muted); }
.wfh-sec { padding: 0 18px; font-weight: 800; font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.wfh-rws { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 18px; }
.wfh-rw { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; clip-path: var(--cut-s); background: #161b29; box-shadow: inset 0 0 0 1px var(--olc); }
.wfh-rw .pic { flex: none; width: 40px; height: 40px; border-radius: 4px; overflow: hidden; background: #0f131d; opacity: 0.55; }
.wfh-rw b { display: block; font-weight: 800; font-size: 11px; letter-spacing: 0.04em; }
.wfh-rw small { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 9.5px; letter-spacing: 0.1em; color: var(--muted); }
.wfh-rw small .ic { width: 10px; height: 10px; }
.wfh-rw.got { --olc: rgba(143, 211, 255, 0.6); background: color-mix(in srgb, #8fd3ff 8%, #161b29); }
.wfh-rw.got .pic { opacity: 1; }
.wfh-rw.got small { color: #8fd3ff; }
.wfh-play { margin: auto 18px 0; flex-direction: row; gap: 9px; min-height: 50px; font-size: 18px; }
.wfh .btn.primary.wfh-play { background: #8fd3ff; color: #0b1424; }
.wfh-play .ic { width: 16px; height: 16px; }
.wfh-panel { box-shadow: inset 0 0 0 1px var(--olc); }
.wfh-shop { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wfh-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 6px 8px; clip-path: var(--cut-m); background: #161b29; box-shadow: inset 0 0 0 1px var(--olc); text-align: center; }
.wfh-item .pv { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 6px; overflow: hidden; background: #0f131d; margin-bottom: 3px; }
.wfh-item .pv .sw { width: 32px; height: 32px; }
.wfh-item > b { font-weight: 800; font-size: 10.5px; letter-spacing: 0.04em; line-height: 1.15; }
.wfh-item > small { font-weight: 700; font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.wfh-item .btn { margin-top: 4px; flex-direction: row; gap: 4px; min-height: 28px; width: 100%; }
.wfh-item .btn .ic { width: 12px; height: 12px; }
.wfh-item .own { margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; min-height: 28px; font-weight: 800; font-size: 10px; letter-spacing: 0.1em; color: #8fd3ff; }
.wfh-item .own .ic { width: 11px; height: 11px; }
.wfh-item.owned { --olc: rgba(143, 211, 255, 0.4); }
.wfh .quest { box-shadow: inset 0 0 0 1px rgba(160, 200, 255, 0.08); }
@media (max-height: 640px) {
  .wfh-banner { height: 104px; } .wfh-banner .mark .ic { width: 64px; height: 64px; } .wfh-banner h3 { font-size: 30px; }
  .wfh-hero { gap: 10px; } .wfh-tag { display: none; }
  .wfh-stats > div { padding: 7px 4px; } .wfh-stats b { font-size: 18px; }
  .wfh-rw { padding: 6px 8px 6px 6px; } .wfh-rw .pic { width: 34px; height: 34px; }
  .wfh-play { min-height: 42px; font-size: 15px; }
  .wfh-item { padding: 7px 5px 6px; } .wfh-item .pv { width: 40px; height: 40px; }
}
@media (max-width: 700px) and (orientation: portrait) { .wfh-shop { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wf-reward.ol { position: absolute; }
.wfh-item > b { color: var(--text); }
.wfh-modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 0 18px; }
.wfh-modes > span { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 4px 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.035); box-shadow: inset 0 2px 0 color-mix(in srgb, var(--c) 70%, transparent); color: var(--c); }
.wfh-modes .ic { width: 16px; height: 16px; }
.wfh-modes b { font-weight: 800; font-size: 8.5px; letter-spacing: 0.08em; color: var(--muted); text-align: center; }
@media (max-height: 700px) { .wfh-msec, .wfh-modes { display: none; } }
@media (max-height: 430px) {
  .wfh-banner { height: 76px; padding-bottom: 10px; } .wfh-banner h3 { font-size: 26px; } .wfh-banner .mark .ic { width: 48px; height: 48px; }
  .wfh-hero { gap: 8px; padding-bottom: 10px; }
  .wfh-sec { display: none; }
  .wfh-rws { gap: 5px; } .wfh-rw { padding: 4px 6px 4px 4px; gap: 7px; } .wfh-rw .pic { width: 28px; height: 28px; } .wfh-rw b { font-size: 9.5px; }
  .wfh-play { min-height: 38px; font-size: 14px; }
  .wfh-item { padding: 5px 4px; gap: 1px; } .wfh-item .pv { width: 32px; height: 32px; margin-bottom: 1px; } .wfh-item .pv .sw { width: 22px; height: 22px; } .wfh-item small { display: none; }
  .wfh-item .btn, .wfh-item .own { min-height: 24px; margin-top: 2px; }
  .wfh .quest { padding-top: 4px; padding-bottom: 4px; }
  /* phones in landscape: keep the whole event on one screen with less shrinking */
  .wfh-tag, .wfh .fine { display: none; }
  .wfh-stats > div { padding: 6px 4px; gap: 1px; }
  .wfh-shop { gap: 6px; }
  .wfh-item { display: grid; grid-template-columns: 30px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 7px; align-items: center; text-align: left; padding: 5px 6px; }
  .wfh-item .pv { grid-row: 1 / 3; width: 30px; height: 30px; margin: 0; }
  .wfh-item > b { font-size: 9px; line-height: 1.05; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .wfh-item .btn, .wfh-item .own { min-height: 22px; margin-top: 2px; justify-content: center; }
}
/* rewarded-ad mark: just the video icon, no badge behind it */
.rw-mark { width: 20px; height: 20px; justify-content: center; background: none; box-shadow: none; }
.rw-mark .ic { width: 18px; height: 18px; transform: none; }
.btn.small .rw-mark { width: 17px; height: 17px; }
.btn.small .rw-mark .ic { width: 16px; height: 16px; }
/* rewarded-ad badge: centred on the label's capitals (it sat a little low) */
.btn.rw-offer { align-items: center; }
.rw-mark { position: relative; top: -1.5px; }
.btn.small .rw-mark { top: -1px; }

/* Arena seasons */
.season-chip { display: inline-flex; align-items: center; gap: 6px; align-self: center; padding: 5px 10px; clip-path: var(--cut-s); background: rgba(255, 207, 74, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 207, 74, 0.35); font-weight: 800; font-size: 10px; letter-spacing: 0.12em; color: #ffcf4a; }
.season-chip .ic { width: 12px; height: 12px; }
.season-chip i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.season-chip b { color: var(--text); font-weight: 900; }
.season-chip.ol { --ocut: 6px; --olc: rgba(255, 207, 74, 0.35); }
.rk-info .season-chip { margin-bottom: 6px; }
.sheet.season { width: min(460px, 100%); text-align: center; align-items: stretch; }
.ssn-top { padding: 18px 12px 16px; clip-path: var(--cut-m); background: radial-gradient(80% 120% at 50% 0%, color-mix(in srgb, var(--tc) 30%, transparent), transparent 70%), #161b29; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc) 45%, transparent); }
.ssn-top small { font-weight: 800; font-size: 11px; letter-spacing: 0.18em; color: var(--muted); }
.ssn-top h2 { font-size: 34px; color: var(--tc); margin: 4px 0; }
.ssn-top p { color: var(--muted); font-size: 12px; }
.ssn-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ssn-stats > div { display: flex; flex-direction: column; gap: 3px; padding: 10px 4px; }
.ssn-stats > div + div { border-left: 1px solid var(--line); }
.ssn-stats b { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-weight: 900; font-size: 17px; }
.ssn-stats b .ic { width: 15px; height: 15px; }
.ssn-stats small { font-weight: 800; font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.ssn-stats .rw b { color: #8fd3ff; }

/* CrazyGames profile */
.sheet.profile { width: min(820px, 100%); gap: 14px; padding: 0 0 18px; }
.pf-head { position: relative; display: flex; align-items: center; gap: 16px; padding: 20px 22px 18px; background: radial-gradient(70% 140% at 0% 0%, color-mix(in srgb, var(--tc) 28%, transparent), transparent 65%), linear-gradient(180deg, #1a2032, #121620); border-bottom: 1px solid var(--line); }
.pf-ava { flex: none; display: grid; place-items: center; width: 72px; height: 72px; clip-path: var(--cut-m); overflow: hidden; background: color-mix(in srgb, var(--acc) 30%, #1b2030); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--tc) 70%, transparent); }
.pf-ava img { width: 100%; height: 100%; object-fit: cover; }
.pf-ava b { font-weight: 900; font-size: 34px; color: #fff; }
.pf-id { min-width: 0; flex: 1; text-align: left; }
.pf-id small { font-weight: 800; font-size: 10px; letter-spacing: 0.18em; color: var(--muted); }
.pf-id h2 { text-align: left; font-size: 30px; line-height: 1.05; margin: 2px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf-tags > b { font-weight: 900; font-size: 13px; letter-spacing: 0.06em; color: var(--tc); }
.pf-x { position: absolute; top: 14px; right: 14px; }
.pf-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 14px; padding: 0 20px; }
.pf-hero { position: relative; display: flex; flex-direction: column; clip-path: var(--cut-m); background: radial-gradient(70% 60% at 50% 70%, color-mix(in srgb, var(--acc) 22%, transparent), transparent), linear-gradient(180deg, #171c2c, #0e1119); box-shadow: inset 0 0 0 1px var(--olc); }
.pf-hero canvas { flex: 1; width: 100%; min-height: 220px; }
.pf-lo { display: flex; justify-content: center; gap: 5px; padding: 0 0 12px; }
.pf-lo .hex { width: 34px; height: 34px; }
.pf-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pf-arena { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; align-items: center; padding: 14px 16px; clip-path: var(--cut-m); background: radial-gradient(60% 120% at 0% 50%, color-mix(in srgb, var(--tc) 20%, transparent), transparent 70%), #161b29; box-shadow: inset 0 0 0 1px var(--olc); text-align: left; }
.pf-elo small { font-weight: 800; font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.pf-elo b { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 36px; line-height: 1; color: #fff; margin: 3px 0; }
.pf-elo b .ic { width: 26px; height: 26px; color: var(--tc); }
.pf-elo span { font-weight: 800; font-size: 11px; letter-spacing: 0.08em; color: var(--tc); }
.pf-ar { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); padding-top: 8px; }
.pf-ar > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pf-ar > div + div { border-left: 1px solid var(--line); }
.pf-ar b { font-weight: 900; font-size: 16px; }
.pf-ar small { font-weight: 800; font-size: 8.5px; letter-spacing: 0.12em; color: var(--muted); }
.pf-hist { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.pf-hist span { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.05); font-weight: 800; font-size: 10px; color: var(--muted); }
.pf-hist b { color: var(--text); }
.pf-sec { font-weight: 800; font-size: 10px; letter-spacing: 0.16em; color: var(--muted); text-align: left; }
.pf-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pf-stats > div { --ocut: 6px; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 9px; align-items: center; padding: 8px 10px; clip-path: var(--cut-s); background: #161b29; box-shadow: inset 0 0 0 1px var(--olc); text-align: left; }
.pf-stats .ic { grid-row: 1 / 3; width: 18px; height: 18px; color: var(--acc); }
.pf-stats b { font-weight: 900; font-size: 16px; line-height: 1.1; }
.pf-stats small { font-weight: 800; font-size: 8.5px; letter-spacing: 0.12em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px), (max-height: 520px) {
  .sheet.profile { gap: 10px; padding-bottom: 12px; }
  .pf-head { padding: 12px 14px; gap: 12px; } .pf-ava { width: 52px; height: 52px; } .pf-id h2 { font-size: 22px; margin-bottom: 4px; }
  .pf-body { grid-template-columns: 130px minmax(0, 1fr); padding: 0 12px; gap: 10px; }
  .pf-hero canvas { min-height: 140px; } .pf-lo .hex { width: 26px; height: 26px; }
  .pf-arena { padding: 10px 12px; } .pf-elo b { font-size: 26px; }
  .pf-ar b { font-size: 13px; } .pf-stats > div { padding: 6px 8px; } .pf-stats b { font-size: 13px; }
}

/* phones: the Elements detail scrolls at full size, with readable text and tap-sized buttons */
body.touch #codexDetail { --fit: 1; padding: 10px 12px 14px; gap: 8px; }
body.touch #codexDetail > * { zoom: 1; }
body.touch #codexDetail .cd-head h3 { font-size: 22px; }
body.touch #codexDetail .cd-head p { font-size: 12.5px; display: block; -webkit-line-clamp: unset; }
body.touch #codexDetail .cd-tags span { font-size: 10px; padding: 3px 6px; }
body.touch #codexDetail .cd-btns .btn, body.touch #codexDetail .buy-row .btn { min-height: 36px; font-size: 13px; }
body.touch #codexDetail .buy-row p { font-size: 12px; }
body.touch #codexDetail .moves { grid-template-columns: 1fr; gap: 6px; }
body.touch #codexDetail .move { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 10px; }
body.touch #codexDetail .move-top { flex: 1 1 100%; }
body.touch #codexDetail .move-ic { width: 30px; height: 30px; }
body.touch #codexDetail .move h4 { font-size: 13px; }
body.touch #codexDetail .move .tags { display: flex; }
body.touch #codexDetail .move .tags span { font-size: 10px; }
body.touch #codexDetail .move p { font-size: 12px; display: block; -webkit-line-clamp: unset; }
body.touch #codexDetail .move .meta { font-size: 11.5px; }
body.touch #codexDetail .combo-card b { font-size: 11px; }
body.touch #codexDetail .combo-card .pair .hex { width: 24px; height: 24px; }
body.touch #codexDetail .combos h4 { font-size: 10.5px; }
body.touch .codex .el-grid .et b { font-size: 10px; }
@media (max-height: 430px) {
  .sheet.profile { gap: 8px; }
  .pf-head { padding: 8px 12px; } .pf-ava { width: 42px; height: 42px; } .pf-ava b { font-size: 22px; } .pf-id small { display: none; } .pf-id h2 { font-size: 19px; margin: 0 0 3px; }
  .pf-body { grid-template-columns: minmax(0, 1fr); }
  .pf-hero { display: none; }
  .pf-arena { gap: 4px 12px; padding: 8px 12px; } .pf-elo b { font-size: 24px; } .pf-elo small { font-size: 9px; }
  .pf-ar { padding-top: 5px; } .pf-sec { display: none; }
  .pf-stats { gap: 4px; } .pf-stats > div { padding: 5px 8px; } .pf-stats .ic { width: 15px; height: 15px; }
}

/* narrow phones in landscape: stack each shop item (swatch, name, price) so names fit the card width */
@media (max-width: 700px) and (max-height: 430px) and (orientation: landscape) {
  .wfh-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 4px 4px 5px; }
  .wfh-item .pv { width: 22px; height: 22px; } .wfh-item .pv .sw { width: 16px; height: 16px; }
  .wfh-item > b { font-size: 8.5px; letter-spacing: 0; }
  .wfh-item .btn, .wfh-item .own { min-height: 20px; width: 100%; }
  .wfh-panel:last-child .panel-head small { display: none; }
  .wfh .quest .q-ic { width: 28px; height: 28px; }
}

/* narrow phones in landscape: the Ranks tab keeps two columns, so its small labels get room */
@media (max-width: 700px) and (max-height: 430px) and (orientation: landscape) {
  .tier-cell { padding: 10px 1px 6px; }
  .tier-cell b { font-size: 8px; letter-spacing: 0; }
  .tier-cell .tier-badge.sm { width: 24px; height: 27px; }
  .tier-cell small, .tier-cell .rw { font-size: 8.5px; }
  .records small, .rk-stats small { font-size: 8.5px; letter-spacing: 0.02em; white-space: normal; line-height: 1.1; }
}

/* event hero on short screens: the art fills whatever height the card has spare
   (instead of being hidden and leaving an empty card), and shrinks away when there is none */
@media (max-width: 1100px) and (max-height: 760px) {
  .event-tab .ev-hero { grid-template-rows: minmax(0, 1fr) auto; align-content: stretch; }
  .event-tab .ev-art { height: auto; min-height: 70px; }
}
@media (max-width: 1100px) and (max-height: 520px) { .event-tab .ev-art { min-height: 52px; } }
@media (max-width: 1100px) and (max-height: 380px) { .event-tab .ev-art { display: grid; min-height: 0; } }
