/* =====================================================================
   AUTO-BATTLER — interface layer
   Every glyph uses Monobloco. Colours: charcoal / steel / cyan holo /
   purple-magenta neon / brass-copper-amber steam / red for warnings.
   ===================================================================== */

@font-face {
  font-family: "Monobloco";
  src: url("../../assets/fonts/Monobloco.otf") format("opentype");
  font-display: block;
}

:root {
  --bg: #07080c;
  --ink: #e6eef6;
  --ink-dim: #93a6b8;
  --ink-mute: #5b6b7c;
  --cyan: #3ff0ff;
  --cyan-soft: rgba(63, 240, 255, 0.42);
  --cyan-hot: rgba(170, 250, 255, 0.95);
  --purple: #9b4dff;
  --magenta: #ff3fb4;
  --brass: #c8963e;
  --brass-hi: #e6c06e;
  --copper: #b8643a;
  --amber: #ffa23a;
  --red: #ff3b3b;
  --panel: rgba(7, 11, 17, 0.78);
  --panel-edge: rgba(150, 190, 215, 0.12);
  --gang: #3ff0ff;
  --font: "Monobloco", monospace;
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-ui: 460ms;
  --gut: clamp(16px, 2.4vw, 40px);
  --pad-t: max(var(--gut), env(safe-area-inset-top));
  --pad-r: max(var(--gut), env(safe-area-inset-right));
  --pad-b: max(var(--gut), env(safe-area-inset-bottom));
  --pad-l: max(var(--gut), env(safe-area-inset-left));
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input { font-family: var(--font); }

#app { position: fixed; inset: 0; overflow: hidden; }
#game { position: absolute; inset: 0; }
#game canvas { display: block; }

/* soft cinematic vignette shared by every view (no scanlines: the image stays clean) */
#app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 80% at 50% 46%, transparent 62%, rgba(2, 3, 6, 0.45) 100%);
}

#ui { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#ui.is-busy * { pointer-events: none !important; }

/* ------------------------------------------------------------ screens */
.screen {
  position: absolute;
  inset: 0;
  display: grid;
  padding: var(--pad-t) var(--pad-r) var(--pad-b) var(--pad-l);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t-ui) var(--ease), visibility 0s linear var(--t-ui);
}
.screen.is-active { opacity: 1; visibility: visible; transition: opacity var(--t-ui) var(--ease), visibility 0s; }

[data-enter] {
  opacity: 0;
  transform: translate(var(--ex, 0px), var(--ey, 14px));
  filter: blur(4px);
  transition:
    opacity 0.5s var(--ease) calc(var(--d, 0) * 0.25ms),
    transform 0.5s var(--ease) calc(var(--d, 0) * 0.25ms),
    filter 0.5s var(--ease) calc(var(--d, 0) * 0.25ms);
}
.is-active [data-enter] {
  opacity: 1;
  transform: none;
  filter: none;
  transition:
    opacity 0.6s var(--ease-out) calc(var(--d, 0) * 1ms),
    transform 0.8s var(--ease-out) calc(var(--d, 0) * 1ms),
    filter 0.6s var(--ease-out) calc(var(--d, 0) * 1ms);
}

.kicker { color: var(--cyan); letter-spacing: 0.28em; font-size: 11px; }

/* =========================================================== FX language */
.fx { position: relative; isolation: isolate; }
.fx::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 0 38%, rgba(63, 240, 255, 0.06) 42%, rgba(190, 252, 255, 0.5) 50%, rgba(63, 240, 255, 0.06) 58%, transparent 62%);
  transform: translateX(-130%);
}
.fx.fx-zap::after { animation: fx-sweep 0.55s var(--ease) forwards; }
.fx.fx-fire::after { animation: fx-sweep 0.4s var(--ease) forwards; }
@keyframes fx-sweep { from { transform: translateX(-130%); } to { transform: translateX(130%); } }

.fx-zap { animation: fx-flare 0.6s var(--ease-out); }
@keyframes fx-flare {
  0% { --flare: 1; filter: brightness(1.55) saturate(1.2); }
  100% { filter: none; }
}
.fx-fire { animation: fx-press 0.46s var(--ease-out); }
@keyframes fx-press {
  0% { transform: scale(1); filter: brightness(2.3) saturate(1.3); }
  22% { transform: scale(0.965) translateY(1px); filter: brightness(1.9); }
  60% { transform: scale(1.012); filter: brightness(1.25); }
  100% { transform: none; filter: none; }
}

.fx-zap .glitch-text, .fx-fire .glitch-text { animation: fx-glitch 0.42s steps(2, end); }
@keyframes fx-glitch {
  0% { text-shadow: -2px 0 var(--magenta), 2px 0 var(--cyan); transform: translateX(2px); clip-path: inset(0 0 45% 0); }
  25% { text-shadow: 2px 0 var(--magenta), -2px 0 var(--cyan); transform: translateX(-2px); clip-path: inset(40% 0 0 0); }
  50% { text-shadow: -1px 0 var(--magenta), 1px 0 var(--cyan); transform: translateX(1px); clip-path: none; }
  100% { text-shadow: none; transform: none; }
}

.fx-bolt {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  overflow: visible;
}
.fx-bolt.is-on { opacity: 1; }
.fx-bolt polyline { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.fx-bolt__core { stroke: #f2feff; stroke-width: 1.6; stroke-dasharray: 22 100; stroke-dashoffset: 22; }
.fx-bolt__glow { stroke: var(--cyan); stroke-width: 5; opacity: 0.55; filter: blur(2px); stroke-dasharray: 26 100; stroke-dashoffset: 26; }
.fx-bolt__ghost { stroke: var(--cyan); stroke-width: 1; opacity: 0; }
.fx-bolt.is-on .fx-bolt__core { animation: bolt-run 0.5s linear forwards; }
.fx-bolt.is-on .fx-bolt__glow { animation: bolt-run 0.5s linear forwards; }
.fx-bolt.is-on .fx-bolt__ghost { animation: bolt-ghost 0.5s steps(3) forwards; }
@keyframes bolt-run { to { stroke-dashoffset: -100; } }
@keyframes bolt-ghost { 0% { opacity: 0; } 30% { opacity: 0.6; } 60% { opacity: 0.15; } 100% { opacity: 0; } }

#fx-layer { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.spark {
  position: fixed;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px 2px rgba(63, 240, 255, 0.9);
  opacity: 0;
  animation: spark 0.5s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}
@keyframes spark {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); }
}

/* ============================================================== TITLE */
.menu-title { grid-area: title; justify-self: start; align-self: start; pointer-events: none; }
.title {
  position: relative;
  margin: 0;
  font-weight: 400;
  font-size: clamp(34px, 6.4vw, 104px);
  line-height: 0.92;
  letter-spacing: 0.035em;
  white-space: nowrap;
}
.title__main {
  display: block;
  background: linear-gradient(180deg, #f6fafc 0%, #cbd6e1 40%, #6a7a8c 52%, #9fb0c0 66%, #eef4f9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.7)) drop-shadow(0 0 22px rgba(63, 240, 255, 0.2));
}
.title__dash {
  background: linear-gradient(180deg, #ffe7ad, #c8963e 55%, #6a4a1a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 10px rgba(255, 170, 60, 0.75));
}
.title__energy {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0 44%, rgba(63, 240, 255, 0) 45%, rgba(190, 252, 255, 0.95) 50%, rgba(63, 240, 255, 0) 55%, transparent 56%);
  background-size: 320% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  mix-blend-mode: screen;
  animation: title-energy 7s var(--ease) infinite;
}
@keyframes title-energy { 0% { background-position: 130% 0; } 38%, 100% { background-position: -30% 0; } }
.title::before, .title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.title::before { color: var(--cyan); animation: title-glitch-a 9s steps(1) infinite; }
.title::after { color: var(--magenta); animation: title-glitch-b 9s steps(1) infinite; }
@keyframes title-glitch-a {
  0%, 91%, 93.5%, 100% { opacity: 0; transform: none; }
  91.5% { opacity: 0.7; transform: translate(-4px, 0); clip-path: inset(10% 0 62% 0); }
  92.5% { opacity: 0.5; transform: translate(3px, 0); clip-path: inset(58% 0 18% 0); }
}
@keyframes title-glitch-b {
  0%, 91.2%, 93.8%, 100% { opacity: 0; transform: none; }
  91.8% { opacity: 0.55; transform: translate(4px, 0); clip-path: inset(40% 0 35% 0); }
  93% { opacity: 0.4; transform: translate(-2px, 0); clip-path: inset(75% 0 4% 0); }
}
.title__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: clamp(8px, 1.2vh, 14px);
  font-size: clamp(10px, 0.8vw, 12px);
  letter-spacing: 0.24em;
  color: var(--ink-dim);
}
.title__rule {
  width: clamp(40px, 6vw, 96px);
  height: 2px;
  background: linear-gradient(90deg, var(--brass-hi), var(--brass) 60%, transparent);
  box-shadow: 0 0 8px rgba(255, 170, 60, 0.5);
}
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--cyan); }
.status__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: status 1.8s ease-in-out infinite;
}
@keyframes status { 50% { opacity: 0.25; } }

/* ========================================================= NAV ARROWS */
.nav-arrow {
  --cut: 22px;
  --line: rgba(63, 240, 255, 0.62);
  --hot: rgba(170, 250, 255, 0.95);
  display: flex;
  align-items: center;
  gap: clamp(10px, 1vw, 16px);
  min-height: clamp(84px, 11vh, 120px);
  padding: 14px 28px 14px 18px;
  border: 0;
  --b: 1.5px;
  --fill: linear-gradient(90deg, rgba(6, 10, 16, 0.66), rgba(8, 16, 24, 0.4));
  color: var(--ink);
  background: var(--fill);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  transition: color 0.25s;
}
/* chip edge: a chamfered ring (evenodd polygon) so the inside stays see-through */
.nav-arrow::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--line);
  transition: background 0.25s var(--ease);
}
.nav-arrow--left {
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
  margin-left: calc(-1 * var(--pad-l));
  padding-left: calc(var(--pad-l) + 4px);
}
.nav-arrow--right {
  clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
  margin-right: calc(-1 * var(--pad-r));
  padding: 14px calc(var(--pad-r) + 4px) 14px 28px;
}
.nav-arrow--right { --fill: linear-gradient(270deg, rgba(6, 10, 16, 0.66), rgba(8, 16, 24, 0.4)); }
.nav-arrow--left::before {
  clip-path: polygon(evenodd,
    0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 0,
    var(--b) var(--b), var(--b) calc(100% - var(--b)), calc(100% - var(--cut) - 0.6px) calc(100% - var(--b)), calc(100% - var(--b)) calc(100% - var(--cut) - 0.6px), calc(100% - var(--b)) calc(var(--cut) + 0.6px), calc(100% - var(--cut) - 0.6px) var(--b), var(--b) var(--b));
}
.nav-arrow--right::before {
  clip-path: polygon(evenodd,
    var(--cut) 0, 100% 0, 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut), var(--cut) 0,
    calc(var(--cut) + 0.6px) var(--b), var(--b) calc(var(--cut) + 0.6px), var(--b) calc(100% - var(--cut) - 0.6px), calc(var(--cut) + 0.6px) calc(100% - var(--b)), calc(100% - var(--b)) calc(100% - var(--b)), calc(100% - var(--b)) var(--b), calc(var(--cut) + 0.6px) var(--b));
}
.nav-arrow__label, .nav-arrow__sub, .play-btn__label { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); }
.nav-arrow > *:not(.fx-bolt) { position: relative; z-index: 1; }
.nav-arrow__icon { width: clamp(22px, 1.9vw, 30px); height: auto; flex: none; transition: transform 0.3s var(--ease-out); }
.nav-arrow__icon polyline { fill: none; stroke: var(--cyan); stroke-width: 3; stroke-linejoin: miter; filter: drop-shadow(0 0 4px rgba(63, 240, 255, 0.7)); }
.nav-arrow__icon .dim { stroke-width: 2; opacity: 0.4; }
.nav-arrow__text { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.nav-arrow--right .nav-arrow__text { text-align: right; }
.nav-arrow__label { font-size: clamp(15px, 1.35vw, 22px); letter-spacing: 0.3em; white-space: nowrap; }
.nav-arrow__sub { font-size: clamp(9px, 0.65vw, 11px); letter-spacing: 0.22em; color: var(--ink-mute); white-space: nowrap; }
.nav-arrow__bracket {
  position: absolute !important;
  top: 18%;
  bottom: 18%;
  width: 4px;
  background: repeating-linear-gradient(180deg, var(--brass-hi) 0 6px, #5a4020 6px 9px);
  box-shadow: 0 0 6px rgba(255, 170, 60, 0.35);
}
.nav-arrow--left .nav-arrow__bracket { left: 0; }
.nav-arrow--right .nav-arrow__bracket { right: 0; }
.nav-arrow.fx-zap, .nav-arrow:focus-visible { --line: var(--hot); --fill: linear-gradient(90deg, rgba(14, 60, 72, 0.72), rgba(8, 30, 40, 0.5)); outline: none; }
.nav-arrow.fx-zap .nav-arrow__label, .nav-arrow:focus-visible .nav-arrow__label { color: #fff; text-shadow: 0 0 10px var(--cyan); }
.nav-arrow--left.fx-zap .nav-arrow__icon { transform: translateX(-4px); }
.nav-arrow--right.fx-zap .nav-arrow__icon { transform: translateX(4px); }
@media (hover: hover) {
  .nav-arrow:hover { --line: rgba(120, 245, 255, 0.85); --fill: linear-gradient(90deg, rgba(12, 48, 60, 0.7), rgba(8, 26, 36, 0.48)); }
  .nav-arrow:hover .nav-arrow__label { color: #fff; }
  .nav-arrow--left:hover .nav-arrow__icon { transform: translateX(-4px); }
  .nav-arrow--right:hover .nav-arrow__icon { transform: translateX(4px); }
}

/* ---- steampunk variant: brass chip, turning gears, steam instead of lightning */
.nav-arrow--steam {
  --line: rgba(222, 170, 80, 0.75);
  --hot: rgba(255, 214, 150, 0.95);
  color: #f6ead2;
}
.nav-arrow--steam { --fill: linear-gradient(90deg, rgba(40, 24, 12, 0.4), rgba(30, 17, 8, 0.68)); }
.nav-arrow--steam.nav-arrow--left { --fill: linear-gradient(90deg, rgba(30, 17, 8, 0.68), rgba(40, 24, 12, 0.4)); }
.nav-arrow--steam::after { display: none; }
.nav-arrow--steam .nav-arrow__icon polyline { stroke: var(--brass-hi); filter: drop-shadow(0 0 4px rgba(255, 170, 60, 0.6)); }
.nav-arrow--steam .nav-arrow__sub { color: rgba(230, 192, 110, 0.75); }
.nav-arrow--steam .nav-arrow__label { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 12px rgba(255, 170, 60, 0.35); }
.nav-arrow--steam .nav-arrow__bracket { background: repeating-linear-gradient(180deg, #d98a52 0 6px, #4a2410 6px 9px); }
.nav-gears { position: absolute !important; inset: 0; pointer-events: none; overflow: hidden; clip-path: inherit; z-index: 0 !important; }
.nav-gears > span {
  position: absolute;
  transform: rotate(var(--turn, 0deg));
  transition: transform 0.9s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.nav-gears__big { width: 64px; height: 64px; bottom: -26px; }
.nav-gears__small { width: 34px; height: 34px; bottom: 14px; transform: rotate(calc(var(--turn, 0deg) * -1.6)) !important; }
.nav-arrow--right .nav-gears__big { left: 4px; }
.nav-arrow--right .nav-gears__small { left: 52px; }
.nav-arrow--left .nav-gears__big { right: 4px; }
.nav-arrow--left .nav-gears__small { right: 52px; }
.nav-gear { width: 100%; height: 100%; display: block; animation: gear-idle 18s linear infinite; }
.nav-gears__small .nav-gear { animation-direction: reverse; animation-duration: 11s; }
.nav-gear polygon { fill: rgba(200, 150, 62, 0.16); stroke: rgba(230, 192, 110, 0.55); stroke-width: 1.2; }
.nav-gear circle { fill: none; stroke: rgba(230, 192, 110, 0.45); stroke-width: 1.2; }
.nav-gear .hub { fill: rgba(230, 192, 110, 0.6); stroke: none; }
@keyframes gear-idle { to { transform: rotate(360deg); } }
.nav-arrow__rivets { position: absolute !important; inset: 6px 10px; pointer-events: none; }
.nav-arrow__rivets i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe7ad, #8a6430); }
.nav-arrow__rivets i:nth-child(1) { left: 14px; top: 0; }
.nav-arrow__rivets i:nth-child(2) { right: 14px; top: 0; }
.nav-arrow__rivets i:nth-child(3) { left: 14px; bottom: 0; }
.nav-arrow__rivets i:nth-child(4) { right: 14px; bottom: 0; }
.nav-arrow--steam.fx-zap { animation: none; }
.nav-arrow--steam.fx-steam, .nav-arrow--steam:focus-visible { --line: var(--hot); --fill: linear-gradient(90deg, rgba(80, 48, 20, 0.6), rgba(110, 64, 24, 0.72)); outline: none; animation: steam-flare 0.7s var(--ease-out); }
.nav-arrow--steam.fx-steam .nav-arrow__label, .nav-arrow--steam:focus-visible .nav-arrow__label { color: #fff8ea; text-shadow: 0 0 12px rgba(255, 170, 60, 0.9); }
.nav-arrow--steam.fx-steam .nav-gear polygon { fill: rgba(230, 192, 110, 0.35); stroke: #ffe7ad; }
@keyframes steam-flare { 0% { filter: brightness(1.45) sepia(0.2); } 100% { filter: none; } }
@media (hover: hover) {
  .nav-arrow--steam:hover { --line: rgba(240, 190, 110, 0.9); --fill: linear-gradient(90deg, rgba(64, 38, 16, 0.55), rgba(90, 52, 20, 0.7)); }
  .nav-arrow--steam:hover .nav-arrow__label { color: #fff8ea; }
}

.puff {
  position: fixed;
  width: var(--s, 22px);
  height: var(--s, 22px);
  margin: calc(var(--s, 22px) / -2) 0 0 calc(var(--s, 22px) / -2);
  border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, rgba(255, 255, 255, 0.85), rgba(225, 230, 238, 0.45) 45%, rgba(210, 216, 226, 0) 72%);
  filter: blur(1.5px);
  opacity: 0;
  animation: puff 0.95s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes puff {
  0% { opacity: 0.9; transform: translate(0, 0) scale(0.25); }
  60% { opacity: 0.45; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.5); }
}

/* ============================================================== MENU */
.screen--menu {
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto 1fr auto auto;
  grid-template-areas:
    "title title title"
    "left . right"
    "play play play"
    "shards shards shards";
  row-gap: clamp(10px, 2vh, 26px);
}
.menu-nav { display: contents; }
.screen--menu .nav-arrow--left { grid-area: left; align-self: center; }
.screen--menu .nav-arrow--right { grid-area: right; align-self: center; }

.play-zone { grid-area: play; justify-self: center; pointer-events: none; }
/* JOUER: fusion chip — cyberpunk left half (circuits, lightning), steampunk right half (brass, gears, steam) */
.play-wrap { filter: drop-shadow(-14px 0 18px rgba(63, 240, 255, 0.26)) drop-shadow(14px 0 18px rgba(255, 160, 60, 0.22)); }
.play-btn {
  --cut: 20px;
  --b: 1.5px;
  --line: linear-gradient(90deg, rgba(63, 240, 255, 0.9), rgba(63, 240, 255, 0.85) 40%, rgba(230, 180, 90, 0.85) 60%, rgba(222, 170, 80, 0.9));
  --hot: linear-gradient(90deg, rgba(200, 252, 255, 1), rgba(170, 250, 255, 1) 40%, rgba(255, 220, 160, 1) 60%, rgba(255, 214, 150, 1));
  --fill:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%),
    linear-gradient(100deg, rgba(5, 26, 34, 0.7) 0%, rgba(6, 22, 30, 0.6) 47%, rgba(46, 27, 12, 0.6) 53%, rgba(38, 21, 9, 0.72) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(260px, 25vw, 400px);
  height: clamp(66px, 9vh, 92px);
  padding: 0 clamp(30px, 3vw, 52px);
  border: 0;
  color: var(--ink);
  background: var(--fill);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.play-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--line);
  clip-path: polygon(evenodd,
    var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut), var(--cut) 0,
    calc(var(--cut) + 0.6px) var(--b), var(--b) calc(var(--cut) + 0.6px), var(--b) calc(100% - var(--cut) - 0.6px), calc(var(--cut) + 0.6px) calc(100% - var(--b)), calc(100% - var(--cut) - 0.6px) calc(100% - var(--b)), calc(100% - var(--b)) calc(100% - var(--cut) - 0.6px), calc(100% - var(--b)) calc(var(--cut) + 0.6px), calc(100% - var(--cut) - 0.6px) var(--b), calc(var(--cut) + 0.6px) var(--b));
}
.play-btn > *:not(.fx-bolt) { position: relative; z-index: 1; }
.play-btn > .fx-bolt { width: 54%; right: auto; }
.play-btn__label {
  font-size: clamp(28px, 2.7vw, 44px);
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  background: linear-gradient(90deg, #c9fbff 0%, #f4fdff 45%, #fff3dc 55%, #ffd894 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9)) drop-shadow(-6px 0 10px rgba(63, 240, 255, 0.35)) drop-shadow(6px 0 10px rgba(255, 170, 60, 0.3));
}
/* cyber half: circuit traces */
.play-btn__circuit { position: absolute !important; left: 16px; top: 0; bottom: 0; width: 34%; pointer-events: none; opacity: 0.75; }
.play-btn__circuit svg { width: 100%; height: 100%; display: block; }
.play-btn__circuit polyline { fill: none; stroke: rgba(63, 240, 255, 0.55); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-dasharray: 6 4; animation: circuit 2.4s linear infinite; }
.play-btn__circuit circle { fill: rgba(160, 250, 255, 0.9); }
@keyframes circuit { to { stroke-dashoffset: -40; } }
/* steam half: brass gears + rivets */
.play-btn__gears { position: absolute !important; inset: 0; pointer-events: none; overflow: hidden; }
.play-btn__gear { position: absolute; transform: rotate(var(--turn, 0deg)); transition: transform 0.9s cubic-bezier(0.3, 1.5, 0.5, 1); }
.play-btn__gear--a { width: 62px; height: 62px; right: 22px; bottom: -28px; }
.play-btn__gear--b { width: 34px; height: 34px; right: 72px; bottom: -14px; transform: rotate(calc(var(--turn, 0deg) * -1.7)); }
.play-btn__gear--b .nav-gear { animation-direction: reverse; animation-duration: 11s; }
.play-btn.fx-steam .nav-gear polygon { fill: rgba(230, 192, 110, 0.35); stroke: #ffe7ad; }
.play-btn__bracket { position: absolute !important; top: 22%; bottom: 22%; width: 5px; }
.play-btn__bracket--l { left: 7px; background: repeating-linear-gradient(180deg, var(--cyan) 0 4px, rgba(10, 60, 70, 0.9) 4px 7px); box-shadow: 0 0 8px rgba(63, 240, 255, 0.5); }
.play-btn__bracket--r { right: 7px; background: repeating-linear-gradient(180deg, var(--brass-hi) 0 5px, #4a3418 5px 8px); box-shadow: 0 0 6px rgba(255, 170, 60, 0.4); }
.play-btn__rivets { position: absolute !important; inset: 6px; pointer-events: none; }
.play-btn__rivets i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe7ad, #8a6430); }
.play-btn__rivets i:nth-child(1) { right: 60px; top: 2px; }
.play-btn__rivets i:nth-child(2) { right: 18px; top: 2px; }
.play-btn__rivets i:nth-child(3) { right: 36%; top: 2px; }
.play-btn__rivets i:nth-child(4) { right: 36%; bottom: 2px; }
.play-btn__charge {
  position: absolute !important;
  left: 1.5px; right: 1.5px; bottom: 1.5px;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), #fff 50%, var(--amber));
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
  transform: scaleX(0);
  transform-origin: left;
}
.play-btn.is-charging .play-btn__charge { transform: scaleX(1); transition: transform 0.95s var(--ease); }
.play-btn.fx-zap, .play-btn.fx-steam, .play-btn:focus-visible {
  --line: var(--hot);
  --fill:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
    linear-gradient(100deg, rgba(10, 56, 68, 0.76) 0%, rgba(8, 44, 56, 0.66) 47%, rgba(90, 54, 20, 0.66) 53%, rgba(76, 44, 16, 0.78) 100%);
  outline: none;
}
@media (hover: hover) {
  .play-btn:hover {
    --line: var(--hot);
    --fill:
      linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 40%),
      linear-gradient(100deg, rgba(10, 50, 62, 0.74) 0%, rgba(8, 40, 52, 0.64) 47%, rgba(80, 48, 18, 0.64) 53%, rgba(70, 40, 14, 0.76) 100%);
  }
}
.avatar.fx-fire, .swatch.fx-fire { animation: fx-press-soft 0.4s var(--ease-out); }
@keyframes fx-press-soft { 0% { transform: scale(1); } 30% { transform: scale(0.96); } 100% { transform: none; } }


/* ------------------------------------------------------------- shards */
.shards { grid-area: shards; justify-self: center; width: auto; min-width: min(100%, 300px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.shards__head { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 0.26em; color: var(--ink-mute); padding: 0 4px; }
.shards__count { color: var(--cyan); opacity: 0.7; }
.shards__rail {
  position: relative;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(6, 10, 16, 0.3), rgba(6, 10, 16, 0.14));
  border-top: 1px solid rgba(63, 240, 255, 0.22);
  border-bottom: 1px solid rgba(200, 150, 62, 0.28);
  backdrop-filter: blur(3px);
  pointer-events: auto;
}
.shards__rail::before, .shards__rail::after {
  content: "";
  position: absolute;
  top: -1px; bottom: -1px;
  width: 14px;
  border: 1px solid rgba(200, 150, 62, 0.55);
}
.shards__rail::before { left: 0; border-right: 0; }
.shards__rail::after { right: 0; border-left: 0; }
.shards__row { display: flex; justify-content: center; gap: clamp(8px, 1.1vw, 16px); scrollbar-width: none; }
.shards__row::-webkit-scrollbar { display: none; }
.shard {
  --w: clamp(50px, 4.6vw, 70px);
  position: relative;
  flex: 0 0 var(--w);
  width: var(--w);
  aspect-ratio: 4 / 5;
  background: radial-gradient(circle at 50% 42%, rgba(63, 240, 255, 0.16), rgba(4, 8, 13, 0.3) 70%);
  clip-path: polygon(50% 0, 100% 20%, 100% 80%, 50% 100%, 0 80%, 0 20%);
}
.shard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(63, 240, 255, 0.4);
  clip-path: polygon(evenodd, 50% 0, 100% 20%, 100% 80%, 50% 100%, 0 80%, 0 20%, 50% 0,
    50% 1.6px, 1.5px calc(20% + 0.8px), 1.5px calc(80% - 0.8px), 50% calc(100% - 1.6px), calc(100% - 1.5px) calc(80% - 0.8px), calc(100% - 1.5px) calc(20% + 0.8px), 50% 1.6px);
  animation: shard-idle 4s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.35s);
}
.shard > * { position: relative; }
.shard__icon { position: absolute; left: 50%; top: 50%; width: 42%; transform: translate(-50%, -50%); }
.shard__icon * { fill: none; stroke: rgba(63, 240, 255, 0.4); stroke-width: 1.4; stroke-dasharray: 3 3; }
.shard__id { position: absolute; top: 22%; left: 0; right: 0; text-align: center; font-size: 8px; letter-spacing: 0.12em; color: var(--ink-mute); }
.shard__qty { position: absolute; bottom: 20%; left: 0; right: 0; text-align: center; font-size: 9px; color: rgba(63, 240, 255, 0.55); }
@keyframes shard-idle { 0%, 100% { background: rgba(63, 240, 255, 0.3); } 50% { background: rgba(63, 240, 255, 0.75); } }

/* ============================================================ PANELS */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}
.panel::before, .panel::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--brass);
  pointer-events: none;
}
.panel::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }

/* ============================================================ PROFILE */
.screen--profile {
  grid-template-columns: minmax(300px, 420px) 1fr auto;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "crumb . arrow" "panel . arrow";
  column-gap: 24px;
  row-gap: 14px;
}
.profile-crumb { grid-area: crumb; display: flex; gap: 10px; align-items: center; font-size: 11px; letter-spacing: 0.24em; color: var(--ink-dim); pointer-events: none; }
.crumb-sep { color: var(--brass); }
.profile-panel {
  grid-area: panel;
  align-self: center;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.profile-panel { border-top: 2px solid var(--gang); transition: border-color 0.9s var(--ease); }
.panel__head { padding: 20px 22px 14px; border-bottom: 1px solid var(--panel-edge); }
.panel__head .kicker { color: var(--gang); transition: color 0.9s var(--ease); }
.panel__title { margin: 8px 0 0; font-weight: 400; font-size: clamp(18px, 1.6vw, 24px); letter-spacing: 0.18em; }
.panel__body { padding: 6px 22px 22px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(63, 240, 255, 0.35) transparent; }
.field { padding-top: 18px; }
.field__label { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-weight: 400; font-size: 12px; letter-spacing: 0.26em; color: var(--ink); }
.field__label label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.field__num { color: var(--brass-hi); font-size: 10px; }
.field__mood { margin-left: auto; font-size: 10px; letter-spacing: 0.18em; color: var(--gang); transition: color 0.9s var(--ease); }
.field__hint { margin: 10px 0 0; font-size: 10px; letter-spacing: 0.12em; color: var(--ink-mute); }

.avatar-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.avatar {
  --cut: 10px;
  aspect-ratio: 1;
  min-height: 48px;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--ink-mute);
  background: rgba(150, 190, 215, 0.2);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  touch-action: manipulation;
  transition: background 0.25s, color 0.25s;
}
.avatar::before { content: ""; position: absolute; inset: 1.5px; clip-path: inherit; background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.05), rgba(5, 8, 12, 0.92) 75%); }
.avatar > *:not(.fx-bolt) { position: relative; z-index: 1; }
.avatar__icon { width: 54%; height: auto; margin: 16% auto 0; display: block; }
.avatar__icon * { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-dasharray: 3 2.5; }
.avatar__id { position: absolute !important; left: 8px; bottom: 6px; font-size: 9px; letter-spacing: 0.1em; }
.avatar__tag { position: absolute !important; right: 6px; top: 6px; font-size: 7px; letter-spacing: 0.12em; color: var(--bg); background: var(--gang); padding: 2px 4px; opacity: 0; transform: translateY(-3px); transition: opacity 0.25s, transform 0.25s; }
.avatar[aria-checked="true"] { background: var(--gang); color: var(--gang); }
.avatar[aria-checked="true"]::before { background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--gang) 22%, transparent), rgba(5, 8, 12, 0.92) 75%); }
.avatar[aria-checked="true"] .avatar__icon * { stroke-dasharray: none; filter: drop-shadow(0 0 4px var(--gang)); }
.avatar[aria-checked="true"] .avatar__tag { opacity: 1; transform: none; }
.avatar.fx-zap, .avatar:focus-visible { background: rgba(190, 252, 255, 0.85); outline: none; }

.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.swatch {
  aspect-ratio: 1;
  min-height: 44px;
  border: 1px solid rgba(150, 190, 215, 0.18);
  background: rgba(5, 8, 12, 0.7);
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  display: grid;
  place-items: center;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.swatch::after { clip-path: none; }
.swatch__chip {
  width: 62%;
  aspect-ratio: 1;
  background: var(--sw);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  box-shadow: 0 0 12px var(--sw);
  position: relative;
  z-index: 1;
}
.swatch[aria-checked="true"] { border-color: var(--sw); box-shadow: 0 0 0 1px var(--sw), 0 0 18px -2px var(--sw), inset 0 0 14px -6px var(--sw); }
.swatch:focus-visible { outline: 1px dashed var(--sw); outline-offset: 3px; }

.clan-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  min-height: 52px;
  background: rgba(3, 6, 10, 0.82);
  border: 1px solid rgba(150, 190, 215, 0.16);
  border-bottom: 2px solid var(--gang);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.clan-input:focus-within { border-color: var(--gang); box-shadow: 0 0 0 1px var(--gang), 0 0 22px -6px var(--gang); }
.clan-input__prefix { color: var(--gang); animation: status 1.2s steps(2) infinite; }
.clan-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  caret-color: var(--gang);
}
.clan-input__count { font-size: 10px; color: var(--ink-mute); letter-spacing: 0.1em; }

.screen--profile .profile-back { grid-area: arrow; align-self: center; }

/* ========================================================= COLLECTION */
.screen--collection {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  row-gap: clamp(12px, 2vh, 22px);
  justify-items: center;
}
.coll-head { width: 100%; display: flex; align-items: center; gap: clamp(14px, 2vw, 32px); }
.nav-arrow--compact { min-height: clamp(60px, 8vh, 80px); }
.coll-head__titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.coll-title { margin: 0; font-weight: 400; font-size: clamp(26px, 3.6vw, 56px); letter-spacing: 0.14em; line-height: 1; background: linear-gradient(180deg, #f6fafc, #8ea0b2 55%, #e7eef5); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 16px rgba(63, 240, 255, 0.18)); }
.coll-sub { margin: 0; font-size: clamp(9px, 0.75vw, 12px); letter-spacing: 0.24em; color: var(--ink-dim); }
.coll-sub b { color: var(--cyan); font-weight: 400; }
.coll-frame { width: min(100%, 940px); height: 100%; min-height: 0; padding: clamp(8px, 1.2vw, 16px); }
.coll-scroll {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(63, 240, 255, 0.4) transparent;
  padding-right: 4px;
  outline: none;
  -webkit-overflow-scrolling: touch;
}
.coll-scroll:focus-visible { box-shadow: inset 0 0 0 1px var(--cyan); }
.coll-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(6px, 1.1vw, 14px); padding: 2px; }
.slot {
  --cut: clamp(6px, 1vw, 12px);
  position: relative;
  aspect-ratio: 1;
  background: linear-gradient(135deg, rgba(200, 150, 62, 0.55), rgba(90, 110, 130, 0.35) 40%, rgba(63, 240, 255, 0.4));
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  opacity: 0;
  transform: translateY(10px) scale(0.96);
}
.is-active .slot {
  opacity: 1;
  transform: none;
  transition: opacity 0.45s var(--ease-out), transform 0.6s var(--ease-out);
  transition-delay: calc(240ms + min(var(--i), 25) * 22ms);
}
.slot::before {
  content: "";
  position: absolute;
  inset: 1.5px;
  clip-path: inherit;
  background:
    repeating-linear-gradient(0deg, rgba(63, 240, 255, 0.03) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 50% 45%, rgba(63, 240, 255, 0.07), rgba(5, 8, 13, 0.94) 72%);
}
.slot > * { position: absolute; }
.slot__id { top: 8%; left: 10%; font-size: clamp(7px, 0.7vw, 10px); letter-spacing: 0.1em; color: var(--ink-mute); }
.slot__display {
  left: 26%; top: 26%; right: 26%; bottom: 26%;
  border: 1px dashed rgba(63, 240, 255, 0.28);
  background: radial-gradient(circle, rgba(63, 240, 255, 0.06), transparent 70%);
}
.slot__display::before, .slot__display::after { content: ""; position: absolute; left: 50%; top: 50%; background: rgba(63, 240, 255, 0.25); }
.slot__display::before { width: 30%; height: 1px; transform: translate(-50%, -50%); }
.slot__display::after { width: 1px; height: 30%; transform: translate(-50%, -50%); }
.slot__corner { right: 8%; bottom: 8%; width: 18%; height: 3px; background: linear-gradient(90deg, var(--brass), var(--brass-hi)); opacity: 0.6; }
@media (hover: hover) {
  .slot:hover { background: linear-gradient(135deg, rgba(230, 192, 110, 0.8), rgba(63, 240, 255, 0.85)); }
  .slot:hover .slot__display { border-color: rgba(63, 240, 255, 0.6); }
}

/* ============================================================ VEIL / TOAST / BOOT */
#veil {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  background: radial-gradient(ellipse at var(--vx, 50%) 50%, rgba(190, 252, 255, 0.6), rgba(63, 240, 255, 0.16) 38%, rgba(5, 8, 12, 0) 70%);
}
#veil.is-dive { --vx: 22%; }
#veil.is-dive, #veil.is-rise { animation: veil 0.7s var(--ease-out) forwards; }
@keyframes veil { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

#toast {
  position: fixed;
  left: 50%;
  top: 42%;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(calc(100% - 32px), 460px);
  padding: 18px 22px;
  background: rgba(6, 12, 18, 0.88);
  border: 1px solid rgba(63, 240, 255, 0.5);
  box-shadow: 0 0 40px -10px var(--cyan);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -40%) scaleY(0.2);
}
#toast.is-on { animation: toast 3.2s var(--ease-out) forwards; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, -50%) scaleY(0.05); }
  8% { opacity: 1; transform: translate(-50%, -50%) scaleY(1.05); }
  12%, 85% { opacity: 1; transform: translate(-50%, -50%) scaleY(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scaleY(0.6); }
}
.toast__title { font-size: 14px; letter-spacing: 0.26em; color: var(--cyan); }
.toast__body { font-size: 11px; letter-spacing: 0.12em; color: var(--ink-dim); }

#boot {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.8s var(--ease), visibility 0s linear 0.8s;
}
#boot.is-done { opacity: 0; visibility: hidden; }
.boot__inner { width: min(78vw, 360px); display: flex; flex-direction: column; gap: 14px; }
.boot__title { font-size: 26px; letter-spacing: 0.12em; color: var(--ink); }
.boot__title span { color: var(--brass); }
.boot__bar { height: 2px; background: rgba(63, 240, 255, 0.15); overflow: hidden; }
.boot__bar i { display: block; height: 100%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); transform: scaleX(0.04); transform-origin: left; transition: transform 0.4s var(--ease); }
.boot__label { font-size: 10px; letter-spacing: 0.3em; color: var(--ink-mute); }

/* ======================================================= RESPONSIVE */

/* Tablet & small laptops */
@media (max-width: 1100px) {
  .nav-arrow { --cut: 18px; min-height: 80px; padding-right: 22px; }
  .nav-arrow--right { padding-left: 22px; }
  .screen--profile { grid-template-columns: minmax(280px, 360px) 1fr auto; column-gap: 16px; }
  .shards { min-width: 0; }
}

/* Short landscape (phones held sideways, small laptop windows) */
@media (orientation: landscape) and (max-height: 560px) {
  :root { --gut: 14px; }
  .title { font-size: clamp(26px, 5vw, 46px); }
  .title__meta { margin-top: 6px; font-size: 9px; }
  .nav-arrow { min-height: 58px; padding-top: 8px; padding-bottom: 8px; --cut: 14px; }
  .nav-arrow__sub { display: none; }
  .screen--menu { row-gap: 8px; }
  .play-btn { height: 54px; min-width: 220px; }
  .shards__head { display: none; }
  .shards__rail { padding: 6px 12px; }
  .shard { --w: 38px; }
  .shard__id { display: none; }
  .screen--profile { grid-template-columns: minmax(260px, 340px) 1fr auto; grid-template-rows: minmax(0, 1fr); grid-template-areas: "panel . arrow"; }
  .profile-crumb { display: none; }
  .profile-panel { align-self: stretch; }
  .panel__head { padding: 12px 16px 10px; }
  .panel__body { padding: 0 16px 16px; }
  .field { padding-top: 12px; }
  .avatar-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
  .avatar { min-height: 0; }
  .avatar__id, .avatar__tag { display: none; }
  .nav-arrow--compact { min-height: 50px; }
}

/* Portrait: phones and tablets held upright get a dedicated composition */
@media (orientation: portrait) and (max-width: 900px) {
  .screen--menu {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr auto auto auto;
    grid-template-areas:
      "title title"
      ". ."
      "left right"
      "play play"
      "shards shards";
    column-gap: 10px;
    row-gap: 12px;
  }
  .menu-title { justify-self: center; text-align: center; }
  .title { font-size: clamp(20px, 6.8vw, 52px); }
  .title__meta { justify-content: center; font-size: 9px; gap: 6px 10px; letter-spacing: 0.18em; }
  .title__rule { display: none; }
  .screen--menu .nav-arrow {
    margin: 0;
    min-height: 58px;
    padding: 10px 14px;
    justify-content: center;
    --cut: 12px;
  }
  .screen--menu .nav-arrow__sub { display: none; }
  .screen--menu .nav-arrow__text, .screen--menu .nav-arrow--right .nav-arrow__text { text-align: center; }
  .screen--menu .nav-arrow__label { font-size: clamp(13px, 3.6vw, 18px); letter-spacing: 0.22em; }
  .screen--menu .nav-arrow__bracket { display: none; }
  .play-zone { justify-self: stretch; }
  .play-btn { width: 100%; min-width: 0; height: 74px; }
  .shards { width: auto; }
  .shards__head { padding: 0 4px; }
  .shards__rail { padding: 10px 14px; }
  .shards__row { justify-content: center; }
  .shard { --w: 60px; }

  .screen--profile {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "crumb arrow" ". ." "panel panel";
    row-gap: 10px;
  }
  .profile-crumb { align-self: center; }
  .screen--profile .profile-back {
    grid-area: arrow;
    align-self: center;
    margin: 0 calc(-1 * var(--pad-r)) 0 0;
    min-height: 52px;
    padding: 8px calc(var(--pad-r) + 2px) 8px 20px;
    --cut: 12px;
  }
  .screen--profile .profile-back .nav-arrow__sub { display: none; }
  .screen--profile .profile-back .nav-arrow__label { font-size: 14px; }
  .swatch { min-height: 40px; }
  .avatar-grid { grid-template-columns: repeat(4, minmax(0, 72px)); justify-content: start; }
  .profile-panel { max-height: min(48dvh, 560px); align-self: end; margin: 0 calc(-1 * var(--pad-r)) calc(-1 * var(--pad-b)) calc(-1 * var(--pad-l)); border-left: 0; border-right: 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  .panel__head { padding: 14px 18px 10px; }
  .panel__body { padding: 0 18px 18px; }
  .panel__title { font-size: 16px; }
  .field { padding-top: 14px; }
  .avatar-grid { gap: 8px; }
  .swatches { gap: 8px; }

  .coll-head { gap: 12px; }
  .screen--collection .nav-arrow--compact { padding-top: 8px; padding-bottom: 8px; min-height: 52px; }
  .screen--collection .nav-arrow__sub { display: none; }
  .coll-frame { padding: 8px; }
  .coll-sub { letter-spacing: 0.14em; }
}

@media (max-width: 380px) {
  .swatches { gap: 6px; }
  .title__meta > span:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ======================================================= AUTH HUD */
.auth-hud {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  background: rgba(14, 16, 22, 0.82);
  border: 1px solid rgba(63, 240, 255, 0.3);
  backdrop-filter: blur(8px);
  font-size: 11px;
  letter-spacing: 0.14em;
}
.auth-hud[hidden] { display: none; }
.auth-hud__user {
  color: var(--gold, #e0b85a);
  font-weight: 700;
  text-transform: uppercase;
}
.auth-hud__logout {
  background: rgba(255, 59, 59, 0.14);
  border: 1px solid rgba(255, 59, 59, 0.45);
  color: #fecaca;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.auth-hud__logout:hover {
  background: rgba(255, 59, 59, 0.28);
  border-color: rgba(255, 59, 59, 0.8);
}
