:root {
  --ink: #120d0a;
  --wood: #2c1d14;
  --wood-2: #3d291c;
  --gold: #e4c27a;
  --gold-dim: #8d6a38;
  --cinnabar: #b64032;
  --paper: #f4e7cf;
  --ink-text: #24180f;
  --jade: #2f7d62;
  --line: #8a6840;
  --blue: #7eb7dc;
  --yellow: #e6b34d;
  --green: #73d196;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; min-height: 100dvh; }

html {
  height: 100%;
  height: 100dvh;
}

body {
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
  color: var(--paper);
  background: #120d0a;
  min-height: 100%;
  min-height: 100dvh;
}

body.map-shop {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(226, 148, 72, 0.28), transparent 46%),
    linear-gradient(180deg, #3a2418 0%, #120d0a 42%);
}

body.map-arena {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(120, 150, 190, 0.22), transparent 42%),
    linear-gradient(180deg, #1c2430 0%, #100e0c 48%);
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

#app[hidden], #gate[hidden] { display: none !important; }

#toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 30;
  max-width: min(560px, calc(100% - 24px));
  padding: 10px 16px;
  background: var(--paper);
  color: var(--ink-text);
  border-radius: 2px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translate(-50%, -10px);
  pointer-events: none;
  transition: 0.2s ease;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.gate-card, .panel {
  background:
    linear-gradient(180deg, rgba(255, 220, 170, 0.05), transparent 28%),
    var(--wood);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 3px #1a100c, 0 16px 40px rgba(0, 0, 0, 0.35);
}

.gate-card {
  width: min(980px, 100%);
  padding: 36px 32px 28px;
}

.brand-mark {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark h1, .top h1 {
  font-family: "DFKai-SB", "KaiTi", "PMingLiU", serif;
  font-weight: 500;
  letter-spacing: 0.18em;
  margin: 0;
}

.brand-mark h1 { font-size: 48px; }

.brand-mark p, .lede {
  margin: 8px 0 0;
  color: #ead9bc;
  line-height: 1.65;
}

.seal-row, .class-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 22px 0;
}

.class-card, .seal-btn {
  width: 148px;
  text-align: left;
  background: #1b120e;
  border: 1px solid #6d5336;
  padding: 12px;
  color: var(--paper);
}

.class-card.on, .seal-btn.on, .doll-slot.on, .tab.on, .map-btn.on, .slot-btn.on {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}

.seal {
  font-family: "DFKai-SB", "KaiTi", serif;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--cinnabar);
  color: #fff6e8;
  transform: rotate(-8deg);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
}

.class-card strong, .seal-btn strong { display: block; margin-top: 8px; letter-spacing: 0.12em; }

.class-card span, .hint, .muted { color: #d9c7aa; font-size: 13px; line-height: 1.55; }

.name-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.auth-form { display: grid; gap: 12px; max-width: 420px; margin-top: 18px; }

.auth-form label { display: grid; gap: 6px; color: #ead9bc; font-size: 14px; }

.auth-form input {
  background: var(--paper);
  color: var(--ink-text);
  border: none;
  padding: 10px 12px;
}

.auth-links { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.name-row input, .name-line input {
  background: var(--paper);
  color: var(--ink-text);
  border: none;
  padding: 10px 12px;
  min-width: 180px;
}

.primary, .ghost, .danger {
  border: none;
  padding: 12px 18px;
  letter-spacing: 0.14em;
}

.primary { background: var(--cinnabar); color: #fff8ef; }
.ghost { background: transparent; color: var(--gold); border: 1px solid var(--gold-dim); }
.danger { background: #6e2a24; color: #fff1e4; }
.primary:disabled { background: #5c4036; color: #b7a28e; cursor: not-allowed; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 24px 0;
  flex-wrap: wrap;
}

.top h1 { font-size: 28px; letter-spacing: 0.12em; }

.maps, .slot-switch, .tabs, .pad, .skill-row, .overlay-actions, .confirm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-btn, .slot-btn, .tab, .tiny {
  background: #1b120e;
  border: 1px solid #6d5336;
  padding: 8px 12px;
}

#wallet {
  color: var(--gold);
  letter-spacing: 0.04em;
}

#view { padding: 16px 22px 28px; }

.shop {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(320px, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.panel { padding: 16px; }

.panel h2 {
  font-family: "DFKai-SB", "KaiTi", serif;
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 8px;
  letter-spacing: 0.12em;
}

.doll { display: grid; gap: 8px; margin-top: 12px; }

.doll-slot {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  background: #1b120e;
  border: 1px solid #6d5336;
  padding: 8px;
}

.doll-slot b { font-weight: 600; }

.steps { margin: 8px 0 0; padding-left: 18px; color: #ead9bc; }
.steps li { margin: 4px 0; }

.star-num {
  font-family: "DFKai-SB", "KaiTi", serif;
  font-size: 84px;
  line-height: 0.85;
  margin: 8px 0;
  color: var(--gold);
}

.pips { display: flex; gap: 5px; margin-bottom: 10px; }
.pips i {
  width: 16px;
  height: 16px;
  border: 1px solid var(--gold-dim);
  transform: rotate(45deg);
}
.pips i.lit { background: var(--gold); border-color: var(--gold); }

.deltas { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0; color: #f0d7a4; }
.checks { display: grid; gap: 6px; margin: 10px 0; color: #ead9bc; }
.checks em { font-style: normal; color: #cbb892; }

.log { margin: 12px 0 0; padding-left: 18px; color: #ead9bc; }
.log li { margin: 4px 0; }

.sheet {
  background: linear-gradient(#f8efdc, #ead9b8);
  color: var(--ink-text);
  padding: 14px;
  margin-top: 12px;
}

.sheet h3 { margin: 0 0 8px; font-family: "DFKai-SB", "KaiTi", serif; font-size: 24px; font-weight: 500; }
.stat { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dashed rgba(36, 24, 15, 0.15); }

.goods { display: grid; gap: 8px; }
.good {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #1b120e;
  border: 1px solid #6d5336;
}
.q-blue { color: var(--blue); }
.q-yellow { color: var(--yellow); }
.q-green { color: var(--green); }
.q-white { color: #f4efe4; }

.confirm {
  margin-bottom: 10px;
  padding: 10px;
  background: #4a2a18;
  border: 1px solid var(--gold);
}

.arena {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
}

.rival {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  background: #1b120e;
  border: 1px solid #6d5336;
  padding: 10px;
}

.rival strong { display: block; letter-spacing: 0.08em; }
.tag {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.tag-easy { background: var(--jade); color: white; }
.tag-even { background: var(--gold-dim); color: white; }
.tag-hard { background: var(--cinnabar); color: white; }
.tag-dead { background: #6a1d24; color: #ffe1c4; }

.stage { position: relative; background: #0e0c0a; border: 1px solid var(--line); }
.stage canvas {
  width: 100%;
  height: min(68vh, 720px);
  display: block;
  background: #6d8a48;
  cursor: crosshair;
}
.stage canvas.actors {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: transparent;
  z-index: 2;
}
.stage .overlay { z-index: 3; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  background: rgba(10, 8, 6, 0.78);
  text-align: center;
}
.overlay[hidden] { display: none !important; }
.overlay h2 {
  font-family: "DFKai-SB", "KaiTi", serif;
  font-size: 56px;
  margin: 0;
  letter-spacing: 0.2em;
}

.fight-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 8px; flex-wrap: wrap; }
#hp-line { color: var(--gold); }

.skill {
  position: relative;
  overflow: hidden;
  min-width: 96px;
  min-height: 64px;
  background: #1b120e;
  border: 1px solid #6d5336;
  padding: 8px;
}
.skill b { display: block; letter-spacing: 0.12em; }
.skill small, .page-btn small { color: var(--gold); letter-spacing: 0.08em; }
.cd-num { display: block; color: #d9c7aa; font-size: 12px; }
.cd-mask {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0;
  background: rgba(0, 0, 0, 0.58);
  pointer-events: none;
}
.pad button.held, .skill:active { border-color: var(--gold); }

.p2-pad { display: none; }
body.duel .p2-pad { display: flex; }

#combat-feed {
  min-height: 72px;
  margin: 8px 0 0;
  padding-left: 18px;
  color: #ead9bc;
}

.foot {
  margin: 18px 0 0;
  color: #b7a48c;
  font-size: 12px;
}

.workshop.good .star-num { animation: pop 0.45s ease; }
.workshop.bad { animation: shake 0.4s ease; }

@keyframes pop {
  0% { transform: scale(0.86); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

body.fighting .rival-list { opacity: 0.55; pointer-events: none; }
.rival-list .primary { margin: 8px 0; }

@media (max-width: 1040px) {
  .shop, .arena { grid-template-columns: 1fr; }
  .brand-mark h1 { font-size: 36px; }
  .star-num { font-size: 64px; }
}

.page-list { display: grid; gap: 8px; margin: 10px 0; }
.page-card, .page-btn {
  text-align: left;
  background: #1b120e;
  border: 1px solid #6d5336;
  color: var(--paper);
  padding: 8px;
}
.page-card small, .page-btn small { display: block; }
.page-card small { color: #d9c7aa; }
.page-card.on, .page-btn.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.page-btn { position: relative; overflow: hidden; min-width: 88px; }
.dr { display: grid; grid-template-columns: 36px 1fr; gap: 6px; align-items: center; margin: 4px 0; }
.dr i { display: block; height: 8px; width: 0; background: #d7c4ff; }
.dr.mag i { background: #9eb6ff; }
.tiny.on { border-color: var(--gold); color: var(--gold); }

.paper {
  display: grid;
  grid-template-columns: 1fr 108px 1fr;
  grid-template-areas:
    ". helm ."
    "weapon figure neck"
    "ring figure armor"
    ". boots .";
  gap: 8px;
  margin: 12px 0;
}
.eq {
  text-align: left;
  background: #1b120e;
  border: 1px solid #6d5336;
  padding: 8px;
}
.eq span, .eq em, .bag-item small { display: block; color: #d9c7aa; font-style: normal; }
.eq.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.helm { grid-area: helm; }
.weapon { grid-area: weapon; }
.neck { grid-area: neck; }
.ring { grid-area: ring; }
.armor { grid-area: armor; }
.boots { grid-area: boots; }
.figure {
  grid-area: figure;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 148px;
  background: #1b120e;
  border: 1px solid #6d5336;
}
.person {
  width: 34px;
  height: 62px;
  border-radius: 16px 16px 8px 8px;
  box-shadow: inset 0 -16px 0 rgba(0, 0, 0, 0.25);
}
.bag-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bag-item {
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 4px;
  padding: 0;
  background: transparent;
  border: 0;
}
.bag-main {
  text-align: left;
  background: #1b120e;
  border: 1px solid #6d5336;
  padding: 8px;
}
.bag-item.fit .bag-main { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.bag-drop {
  background: #3a1c16;
  border: 1px solid #8a4032;
  color: #f0c2b4;
  padding: 0;
}

.charm-stock { display: grid; gap: 8px; margin: 10px 0; }
.charm-stock div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.charm-stock b { color: var(--gold); }

@media (max-width: 1200px) {
  .shop { grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.2fr); }
  .shop > .panel:last-child { grid-column: 1 / -1; }
}

.page-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 4px 8px;
  align-items: center;
}
.page-card > button {
  grid-row: span 2;
  background: #2a1c14;
  border: 1px solid #6d5336;
  color: var(--gold);
  padding: 8px 0;
}
.page-card input {
  width: 100%;
  background: transparent;
  color: var(--paper);
  border: 0;
  border-bottom: 1px solid #6d5336;
  font: inherit;
  padding: 2px 0;
}
.page-card span { color: #d9c7aa; font-size: 13px; }
.mix-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.mix-row > span { width: 3em; color: #d9c7aa; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.challenge-box {
  margin: 0.6rem 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid #e6c56e;
  background: rgba(60, 30, 18, 0.55);
  border-radius: 8px;
}
.challenge-box p { margin: 0 0 0.5rem; }
#net-line { color: #e6c56e; font-weight: 600; }

.room-field {
  display: grid;
  grid-template-columns: 3.5em 1fr;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  color: #ead9bc;
  font-size: 0.92rem;
}
.room-field input {
  background: #1b120e;
  border: 1px solid #6d5336;
  color: #f8efdc;
  padding: 6px 8px;
  width: 100%;
  box-sizing: border-box;
}
.room-roster {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.room-roster li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: #1b120e;
  border: 1px solid #6d5336;
  font-size: 0.9rem;
}
.room-roster span { color: #cbb892; }
#room-idle .primary, #room-panel .primary { margin-top: 6px; }

#gear-bracket-btns .tiny.on {
  border-color: #e6c56e;
  color: #1b120e;
  background: #e6c56e;
}

/* —— Mobile / touch HUD (cross-play, same server) —— */
html.touch-ui, body.touch-ui {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body.touch-ui {
  /* Keep chrome clear of notch / home indicator */
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

body.touch-ui #top {
  padding: 8px 10px;
  padding-top: max(8px, env(safe-area-inset-top, 0px));
}
body.touch-ui #view {
  padding: 8px 10px max(16px, env(safe-area-inset-bottom, 0px));
}
body.touch-ui .brand-mark h1 { font-size: 28px; letter-spacing: 0.12em; }
body.touch-ui #wallet { font-size: 12px; line-height: 1.45; }
body.touch-ui .rival-list { max-height: 36vh; overflow: auto; }
body.touch-ui .stage {
  width: 100%;
  max-width: 100%;
}
body.touch-ui .stage canvas {
  width: 100%;
  max-width: 100%;
  height: min(52dvh, 560px);
  aspect-ratio: auto;
  object-fit: contain;
  touch-action: none;
}
body.touch-ui.fighting .rival-list { display: none; }
body.touch-ui.fighting .stage canvas {
  height: min(68dvh, 720px);
}
/* Desktop pad stays for mouse/keyboard; hide under the floating HUD on touch. */
body.touch-ui .pad,
body.touch-ui .p2-pad {
  display: none !important;
}
body.touch-ui #combat-feed {
  min-height: 0;
  max-height: 4.5em;
  overflow: hidden;
  font-size: 12px;
}

#touch-hud {
  position: fixed;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding:
    max(10px, env(safe-area-inset-top, 0px))
    max(10px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px))
    max(10px, env(safe-area-inset-left, 0px));
  gap: 12px;
}
#touch-hud[hidden] { display: none !important; }

/* Bottom-left chrome: stick above 退出/全屏 */
.touch-left {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  z-index: 19;
  max-width: 44vw;
}

.touch-fs {
  position: static;
  pointer-events: auto;
  z-index: 19;
  min-width: 72px;
  min-height: 44px;
  align-self: stretch;
  background: rgba(46, 28, 18, 0.88) !important;
  border-color: var(--gold) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
.touch-fs[data-on="1"] {
  background: rgba(182, 64, 50, 0.9) !important;
}

.touch-stick {
  pointer-events: auto;
  width: 132px;
  flex: 0 0 auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  /* Stick only — do not expand hit box over right-side buttons */
  position: relative;
  z-index: 1;
}
.touch-stick-base {
  width: 120px;
  height: 120px;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(18, 12, 8, 0.42);
  border: 2px solid rgba(228, 194, 122, 0.55);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  position: relative;
}
.touch-stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(228, 194, 122, 0.85);
  border: 2px solid #f6edd9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transform: translate(0, 0);
  will-change: transform;
}
.touch-hint {
  display: block;
  text-align: center;
  margin-top: 4px;
  font-size: 11px;
  color: rgba(234, 217, 188, 0.85);
  text-shadow: 0 1px 2px #000;
}

.touch-actions {
  /* Container ignores hits; only .touch-btn children receive them (multitouch). */
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(52vw, 320px);
  position: relative;
  z-index: 20;
}
.touch-actions .touch-btn {
  pointer-events: auto;
}
.touch-skills, .touch-pages {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  gap: 6px;
  width: min(52vw, 280px);
}
.touch-btn {
  position: relative;
  overflow: hidden;
  min-height: 56px;
  min-width: 72px;
  padding: 8px 6px;
  background: rgba(27, 18, 14, 0.78);
  border: 1px solid #6d5336;
  color: var(--paper);
  border-radius: 6px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.touch-btn b { display: block; font-size: 13px; letter-spacing: 0.08em; }
.touch-btn small { color: var(--gold); font-size: 11px; }
.touch-btn .cd-num { font-size: 11px; color: #d9c7aa; }
.touch-btn.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.touch-btn:active { border-color: var(--gold); transform: scale(0.97); }
.touch-lock {
  min-width: 88px;
  min-height: 52px;
  background: rgba(70, 40, 22, 0.82);
}

/* Landscape phones: fill width, use most of the short axis */
@media (orientation: landscape) and (max-height: 520px) {
  body.touch-ui #view { padding: 4px 8px; }
  body.touch-ui .stage canvas,
  body.touch-ui.fighting .stage canvas {
    height: min(100dvh - 12px, 100svh - 12px, calc(100vh - 12px));
    max-height: none;
  }
  body.touch-ui #top { display: none; }
  body.touch-ui.fighting .arena > aside { display: none; }
  body.touch-ui .fight-head { margin-bottom: 4px; }
  body.touch-ui #combat-feed { display: none; }
  .touch-stick { width: 112px; }
  .touch-stick-base { width: 100px; height: 100px; }
  .touch-stick-knob { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
  .touch-skills, .touch-pages {
    grid-template-columns: repeat(4, minmax(56px, 1fr));
    width: min(58vw, 360px);
  }
  .touch-btn { min-height: 48px; min-width: 56px; padding: 6px 4px; }
  .touch-hint { display: none; }
  .touch-fs { min-height: 40px; min-width: 64px; }
  .touch-left { gap: 6px; max-width: 36vw; }
}

@media (orientation: portrait) and (max-width: 520px) {
  body.touch-ui .stage canvas { height: min(48dvh, 420px); }
  body.touch-ui.fighting .stage canvas { height: min(58dvh, 520px); }
  .touch-actions { max-width: 58vw; }
}

/* Native fullscreen or CSS fallback (iOS) */
html.is-fullscreen,
html.fs-fallback,
body.is-fullscreen,
body.fs-fallback {
  background: #0e0c0a;
  overflow: hidden;
  width: 100%;
  height: 100%;
  height: 100dvh;
}
body.is-fullscreen #top,
body.fs-fallback #top,
body.is-fullscreen.touch-ui #top,
body.fs-fallback.touch-ui #top {
  display: none !important;
}
body.is-fullscreen #view,
body.fs-fallback #view {
  padding: 0 !important;
  margin: 0 !important;
  height: 100%;
  height: 100dvh;
}
body.is-fullscreen .arena,
body.fs-fallback .arena {
  display: block;
  height: 100%;
  height: 100dvh;
}
body.is-fullscreen .arena > aside,
body.fs-fallback .arena > aside,
body.is-fullscreen .rival-list,
body.fs-fallback .rival-list {
  display: none !important;
}
body.is-fullscreen .arena > .panel,
body.fs-fallback .arena > .panel {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 0;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
body.is-fullscreen .fight-head,
body.fs-fallback .fight-head,
body.is-fullscreen #combat-feed,
body.fs-fallback #combat-feed {
  display: none !important;
}
body.is-fullscreen .stage,
body.fs-fallback .stage {
  flex: 1 1 auto;
  border: none;
  height: 100%;
  min-height: 0;
}
body.is-fullscreen .stage canvas,
body.fs-fallback .stage canvas,
body.is-fullscreen.touch-ui .stage canvas,
body.fs-fallback.touch-ui .stage canvas,
body.is-fullscreen.touch-ui.fighting .stage canvas,
body.fs-fallback.touch-ui.fighting .stage canvas {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  min-height: 0;
}


/* Hero skin picker */
.skin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.skin-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  gap: 4px;
  padding: 10px;
}
.skin-card .skin-preview {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #1a120c;
  display: block;
}
canvas.skin-preview {
  object-fit: contain;
  pointer-events: none;
}
.skin-preview-empty {
  display: grid;
  place-items: center;
  font-size: 28px;
  color: var(--gold-dim);
}
.skin-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
}
.skin-lobby {
  flex-wrap: wrap;
  margin-bottom: 8px;
}
