:root {
  color-scheme: dark;
  --ink: #101113;
  --panel: #17191c;
  --panel-2: #202327;
  --line: #34383d;
  --text: #f2eee5;
  --muted: #a8aaad;
  --gold: #e5b958;
  --teal: #52c7b8;
  --coral: #df6f62;
  --violet: #9885ce;
  --green: #83b86b;
  --danger: #ef665e;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--text);
  overscroll-behavior: none;
  touch-action: manipulation;
}

button { font: inherit; letter-spacing: 0; }

button:focus-visible {
  outline: 3px solid rgba(82, 199, 184, .7);
  outline-offset: 2px;
}

.app {
  min-height: 100dvh;
  background: #101113;
  overflow: hidden;
}

.topbar {
  height: 58px;
  padding-block: 0;
  padding-inline: max(14px, env(safe-area-inset-left)) max(14px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: #111315;
  position: relative;
  z-index: 20;
}

.brand { display: flex; align-items: baseline; gap: 9px; }
.brand strong { color: var(--gold); font-size: 14px; }
.brand span { font-weight: 800; font-size: 18px; }
.phase-block { display: flex; align-items: center; gap: 10px; }
.phase-block span { color: var(--muted); font-size: 13px; }
.phase-block strong { min-width: 52px; color: var(--text); font-variant-numeric: tabular-nums; }

.icon-button {
  justify-self: end;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}

.game-layout {
  min-height: calc(100dvh - 58px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
}

.arena-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0c0e10;
}

.status-strip {
  height: 50px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
  background: #17191c;
}

.status-strip div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-right: 1px solid #2b2e32;
}

.status-strip span { color: var(--muted); font-size: 12px; }
.status-strip strong { font-size: 14px; font-variant-numeric: tabular-nums; }

.arena-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  aspect-ratio: 1 / 1;
  max-height: calc(100dvh - 142px);
  align-self: center;
  width: min(100%, calc(100dvh - 142px));
  overflow: hidden;
  background: #131517;
}

#arena {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.phase-banner {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translate(-50%, -16px);
  min-width: 210px;
  padding: 10px 20px 12px;
  border-top: 1px solid rgba(229, 185, 88, .8);
  border-bottom: 1px solid rgba(229, 185, 88, .8);
  text-align: center;
  background: rgba(12, 13, 15, .88);
  opacity: 0;
  transition: .24s ease;
  pointer-events: none;
}

.phase-banner.is-visible { opacity: 1; transform: translate(-50%, 0); }
.phase-banner span { display: block; color: var(--gold); font-size: 12px; }
.phase-banner strong { display: block; margin-top: 3px; font-size: 24px; }

.joystick {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: 18px;
  width: 112px;
  height: 112px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 50%;
  background: rgba(12, 14, 15, .54);
  backdrop-filter: blur(3px);
  touch-action: none;
}

.joystick::before {
  content: "移动";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,.35);
  font-size: 12px;
}

.joystick i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 50%;
  background: rgba(32, 35, 39, .88);
  transform: translate(0, 0);
  pointer-events: none;
}

.score-button {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(229, 185, 88, .6);
  border-radius: 50%;
  background: rgba(16,17,19,.78);
  color: var(--gold);
  font-weight: 800;
}

.mobility-tools {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: 18px;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.ability-button {
  position: relative;
  width: 58px;
  height: 58px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 50%;
  color: #f3eee4;
  background: rgba(17,19,21,.82);
  box-shadow: 0 5px 16px rgba(0,0,0,.44);
  backdrop-filter: blur(4px);
  touch-action: none;
}

.ability-button.is-skill { width: 70px; height: 70px; border-color: rgba(229,185,88,.74); color: var(--gold); }
.ability-button span { position: relative; z-index: 2; font-size: 26px; line-height: 1; }
.ability-button b { position: absolute; inset: 0; border-radius: 50%; background: rgba(7,8,9,.72); transform: translateY(100%); transform-origin: bottom; }
.ability-button:active:not(:disabled) { transform: scale(.96); }
.ability-button:disabled { opacity: .45; }

.event-ticker {
  min-height: 34px;
  padding: 7px 16px;
  border-top: 1px solid var(--line);
  color: #d5d1ca;
  background: #17191c;
  font-size: 13px;
  text-align: center;
}

.combat-panel {
  min-width: 0;
  padding: 14px;
  border-left: 1px solid var(--line);
  background: #17191c;
  overflow-y: auto;
}

.target-card {
  min-height: 78px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.target-portrait,
.result-portrait,
.start-cat {
  background-image: url("./assets/cat-roster.png?v=20260825m");
  background-size: 400% 200%;
  background-repeat: no-repeat;
}

.target-portrait {
  width: 64px;
  height: 64px;
  background-color: transparent;
  filter: drop-shadow(0 5px 5px rgba(0,0,0,.72));
}

.target-portrait.is-monster {
  position: relative;
  background-image: none;
  filter: none;
}

.target-portrait.is-monster::before {
  content: "";
  position: absolute;
  inset: 14px 8px;
  background:
    radial-gradient(circle at 31% 48%, #f0c55f 0 3px, transparent 4px),
    radial-gradient(circle at 69% 48%, #f0c55f 0 3px, transparent 4px),
    radial-gradient(ellipse, #4f353b 0 46%, transparent 48%);
}

.target-copy { min-width: 0; }
.target-copy > span { display: block; color: var(--coral); font-size: 11px; }
.target-copy > strong { display: block; margin: 2px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target-copy small { display: block; margin-top: 5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.health-track {
  height: 7px;
  overflow: hidden;
  border: 1px solid #4a2b2a;
  background: #26191a;
}

.health-track i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--coral);
  transform-origin: left;
  transition: transform .18s ease;
}

.health-track.is-player { height: 10px; border-color: #654f28; }
.health-track.is-player i { background: var(--gold); }

.player-vitals { padding: 13px 0 11px; }
.player-name-row, .meter-row { display: flex; justify-content: space-between; align-items: center; }
.player-name-row { margin-bottom: 7px; }
.player-name-row span { color: var(--teal); font-size: 12px; }
.meter-row { margin-top: 6px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.meter-row span:last-child { color: var(--violet); }
.role-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; margin-top: 7px; font-size: 10px; }
.role-row span { min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-row span:last-child { text-align: right; color: var(--teal); }
.role-row strong { color: var(--gold); font-size: 10px; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-button {
  position: relative;
  min-width: 0;
  height: 82px;
  padding: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #22252a;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: 1fr 1fr;
  text-align: left;
  cursor: pointer;
}

.action-button i { grid-row: 1 / 3; align-self: center; font-style: normal; font-size: 24px; }
.action-button span { align-self: end; font-weight: 800; font-size: 14px; }
.action-button small { color: var(--muted); font-size: 10px; }
.action-button b {
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: currentColor;
  transform-origin: left;
  transform: scaleX(0);
}

.action-button.is-hiss { color: #62d1c4; }
.action-button.is-scratch { color: #ee8376; }
.action-button.is-yowl { color: #ac99e0; }
.action-button.is-chew { color: #8bc274; }
.action-button span, .action-button i { color: inherit; }
.action-button:active:not(:disabled) { transform: translateY(1px); background: #292d32; }
.action-button:disabled { opacity: .46; cursor: default; }
.action-button.is-channeling { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }

.combat-log {
  min-height: 46px;
  margin: 10px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--gold);
  color: #ddd8ce;
  background: #111315;
  font-size: 12px;
  line-height: 1.4;
}

.mini-ranking header { display: flex; justify-content: space-between; align-items: baseline; }
.mini-ranking header span { color: var(--muted); font-size: 10px; }
.mini-ranking ol { margin: 8px 0 0; padding: 0; list-style: none; }
.mini-ranking li {
  height: 26px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  border-bottom: 1px solid #292c30;
  color: var(--muted);
  font-size: 11px;
}
.mini-ranking li.is-player { color: var(--gold); font-weight: 800; }
.mini-ranking li.is-cut { border-left: 2px solid var(--danger); padding-left: 5px; }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}
.drawer.is-open { display: block; }
.drawer-backdrop { position: absolute; inset: 0; border: 0; background: rgba(0,0,0,.68); }
.drawer article {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(520px, 100%);
  padding: 18px max(18px, env(safe-area-inset-left)) calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: #1b1e21;
}
.drawer article header { display: flex; align-items: center; justify-content: space-between; }
.drawer article > p { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.text-button { border: 0; color: var(--teal); background: transparent; cursor: pointer; }
.score-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.score-grid div { padding: 9px 10px; border-left: 3px solid var(--line); background: #111315; }
.score-grid span { color: var(--muted); font-size: 11px; }
.score-grid strong { float: right; }

.modal-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background: #101113;
}
.modal-screen.is-visible { display: grid; }

#startScreen { grid-template-rows: minmax(0, 1fr) auto; }
.start-art {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background-image: url("./assets/arena-map.png?v=20260825m");
  background-size: cover;
  background-position: center;
}
.start-art::after { content: ""; position: absolute; inset: 0; background: rgba(10,11,12,.42); }
.start-cat {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: -3%;
  width: min(70vw, 460px);
  aspect-ratio: 1 / 1;
  transform: translateX(-50%);
  filter: drop-shadow(0 18px 30px rgba(0,0,0,.7));
}
.start-title {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 8%;
  width: min(92%, 620px);
  transform: translateX(-50%);
  text-align: center;
  text-shadow: 0 3px 18px #000;
}
.start-title span { color: var(--gold); font-size: 13px; font-weight: 800; }
.start-title h1 { margin: 2px 0 5px; font-size: 64px; line-height: 1; }
.start-title p { margin: 0; color: #e1ddd4; }
.start-controls { padding: 16px max(18px, env(safe-area-inset-left)) calc(18px + env(safe-area-inset-bottom)); background: #17191c; }
.start-controls > small { display: block; margin-top: 9px; color: var(--muted); text-align: center; font-size: 11px; }
.roster-head { width: min(720px, 100%); margin: 0 auto 7px; display: flex; justify-content: space-between; align-items: baseline; }
.roster-head strong { font-size: 12px; }
.roster-head span { color: var(--gold); font-size: 11px; }
.roster-picker { width: min(720px, 100%); margin: 0 auto 12px; display: grid; grid-template-columns: repeat(8, minmax(62px, 1fr)); gap: 6px; }
.roster-option { min-width: 0; height: 72px; padding: 3px 2px 4px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #202327; }
.roster-option[aria-selected="true"] { border-color: var(--gold); color: var(--text); box-shadow: inset 0 0 0 1px var(--gold); }
.roster-option .roster-cat { display: block; width: 48px; height: 48px; margin: -2px auto -1px; background-image: url("./assets/cat-roster.png?v=20260825m"); background-size: 400% 200%; background-repeat: no-repeat; filter: drop-shadow(0 4px 4px rgba(0,0,0,.6)); }
.roster-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.loadout-head { width: min(720px, 100%); margin: 0 auto 7px; display: flex; align-items: center; justify-content: space-between; }
.loadout-head > strong { font-size: 12px; }
.hood-toggle { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; cursor: pointer; }
.hood-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.hood-toggle span::before { content: ""; display: inline-block; width: 28px; height: 16px; margin-right: 7px; border: 1px solid #555b61; border-radius: 10px; vertical-align: -4px; background: #24272b radial-gradient(circle at 7px 7px, #9b9da0 0 5px, transparent 6px); transition: .16s ease; }
.hood-toggle input:checked + span { color: var(--gold); }
.hood-toggle input:checked + span::before { border-color: #c89b47; background: #6f5527 radial-gradient(circle at 21px 7px, #f2d48a 0 5px, transparent 6px); }
.weapon-picker { width: min(720px, 100%); margin: 0 auto 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.weapon-option { min-width: 0; height: 52px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #202327; display: grid; grid-template-columns: 28px 1fr; grid-template-rows: 1fr 1fr; text-align: left; }
.weapon-option[aria-selected="true"] { border-color: var(--gold); color: var(--text); box-shadow: inset 0 0 0 1px var(--gold); }
.weapon-option i { grid-row: 1 / 3; align-self: center; color: var(--gold); font-style: normal; font-size: 20px; }
.weapon-option strong { align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.weapon-option small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 9px; }
.segment { width: min(440px, 100%); margin: 0 auto 12px; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); border-radius: 6px; }
.segment button { min-height: 34px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; }
.segment button.is-active { color: var(--text); background: #30343a; }
.primary-button { display: block; width: min(440px, 100%); min-height: 48px; margin: auto; border: 1px solid #f0c35f; border-radius: 6px; color: #17120a; background: var(--gold); font-weight: 900; cursor: pointer; }

.result-screen { place-items: center; background: rgba(12,13,15,.96); }
.result-card { width: min(92vw, 420px); padding: 22px; text-align: center; }
.result-card > span { color: var(--gold); font-size: 12px; }
.result-card h2 { margin: 5px 0 12px; font-size: 34px; }
.result-portrait { width: 190px; height: 190px; margin: 0 auto 10px; filter: drop-shadow(0 12px 14px rgba(0,0,0,.68)); }
.result-card > strong { display: block; font-size: 22px; }
.result-card p { min-height: 40px; color: var(--muted); }

.power-draft {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(8, 9, 10, .88);
  backdrop-filter: blur(8px);
}
.power-draft.is-visible { display: grid; }
.power-draft-dialog { width: min(560px, 100%); padding: 22px; border: 1px solid #4a4240; background: #17191c; }
.power-draft-dialog > span { color: var(--gold); font-size: 11px; font-weight: 800; }
.power-draft-dialog h2 { margin: 5px 0 4px; font-size: 26px; }
.power-draft-dialog p { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.power-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.power-choice { min-width: 0; min-height: 92px; padding: 12px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: #22252a; text-align: left; }
.power-choice strong, .power-choice span { display: block; }
.power-choice strong { color: var(--teal); }
.power-choice span { margin-top: 7px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.power-choice:active { border-color: var(--gold); }

.cat-cell-0 { background-position: 0% 0%; }
.cat-cell-1 { background-position: 33.333% 0%; }
.cat-cell-2 { background-position: 66.666% 0%; }
.cat-cell-3 { background-position: 100% 0%; }
.cat-cell-4 { background-position: 0% 100%; }
.cat-cell-5 { background-position: 33.333% 100%; }
.cat-cell-6 { background-position: 66.666% 100%; }
.cat-cell-7 { background-position: 100% 100%; }

@media (max-width: 760px) {
  .app { height: 100dvh; min-height: 100dvh; overflow: hidden; }
  .topbar { height: 50px; grid-template-columns: 1fr auto 36px; }
  .brand strong { display: none; }
  .brand span { font-size: 16px; }
  .phase-block { gap: 6px; }
  .phase-block span { font-size: 11px; }
  .game-layout { height: calc(100dvh - 50px); min-height: 0; display: block; padding-bottom: calc(228px + env(safe-area-inset-bottom)); overflow: hidden; }
  .arena-column {
    --battle-view-height: calc(100dvh - 350px - env(safe-area-inset-bottom));
    height: calc(100dvh - 50px);
    min-height: 0;
    overflow: hidden;
  }
  .status-strip { height: 42px; }
  .status-strip span { display: none; }
  .status-strip strong { font-size: 12px; }
  .arena-wrap { flex: 0 0 auto; width: 100%; height: var(--battle-view-height); max-height: none; aspect-ratio: auto; }
  #arena {
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(100vw, var(--battle-view-height));
    height: max(100vw, var(--battle-view-height));
    transform: translate(-50%, -50%);
  }
  .event-ticker { min-height: 30px; padding: 6px 10px; font-size: 11px; }
  .combat-panel {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(228px + env(safe-area-inset-bottom));
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--line);
    overflow: hidden;
    background: rgba(23,25,28,.97);
    backdrop-filter: blur(8px);
  }
  .target-card { min-height: 45px; grid-template-columns: 40px 1fr; gap: 8px; padding-bottom: 5px; }
  .target-portrait { width: 40px; height: 40px; }
  .target-copy > span, .target-copy small { display: none; }
  .target-copy > strong { margin: 0 0 5px; font-size: 13px; }
  .player-vitals { padding: 5px 0; }
  .player-name-row { margin-bottom: 4px; font-size: 12px; }
  .meter-row { margin-top: 3px; font-size: 10px; }
  .role-row { margin-top: 4px; }
  .health-track.is-player { height: 7px; }
  .actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .action-button { height: 56px; padding: 4px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-align: center; }
  .action-button i { font-size: 18px; line-height: 1; }
  .action-button span { font-size: 10px; line-height: 1; }
  .action-button small { display: none; }
  .combat-log { min-height: 26px; height: 26px; margin: 5px 0 0; padding: 5px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
  .mini-ranking { display: none; }
  .joystick { position: fixed; z-index: 40; bottom: calc(272px + env(safe-area-inset-bottom)); width: 94px; height: 94px; }
  .joystick i { width: 40px; height: 40px; margin: -20px; }
  .phase-banner { top: 8%; }
  .mobility-tools { position: fixed; z-index: 40; bottom: calc(272px + env(safe-area-inset-bottom)); gap: 8px; }
  .ability-button { width: 52px; height: 52px; }
  .ability-button.is-skill { width: 62px; height: 62px; }
  #startScreen { grid-template-columns: minmax(0, 1fr); }
  .start-art, .start-controls, .roster-picker, .weapon-picker { min-width: 0; width: 100%; }
  .start-title h1 { font-size: 34px; }
  .roster-picker { display: flex; overflow-x: auto; scrollbar-width: none; }
  .roster-picker::-webkit-scrollbar { display: none; }
  .roster-option { flex: 0 0 65px; }
  .weapon-option { height: 48px; padding-inline: 4px; grid-template-columns: 22px 1fr; }
  .weapon-option i { font-size: 17px; }
}

@media (max-width: 390px) {
  .phase-block span { display: none; }
  .arena-column { --battle-view-height: calc(100dvh - 342px - env(safe-area-inset-bottom)); }
  .game-layout { padding-bottom: calc(220px + env(safe-area-inset-bottom)); }
  .combat-panel { height: calc(220px + env(safe-area-inset-bottom)); }
  .joystick, .mobility-tools { bottom: calc(264px + env(safe-area-inset-bottom)); }
  .role-row { font-size: 9px; }
  .power-choices { grid-template-columns: 1fr; }
  .power-choice { min-height: 68px; }
}

@media (orientation: landscape) and (max-height: 600px) {
  #startScreen { grid-template-columns: minmax(230px, 34%) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .start-art { min-height: 100%; }
  .start-cat { width: min(31vw, 250px); bottom: 4%; }
  .start-title { top: 7%; width: 92%; }
  .start-title h1 { margin-top: 5px; font-size: 31px; line-height: 1.05; }
  .start-title p { font-size: 11px; }
  .start-controls { min-width: 0; padding: 9px 12px; overflow-y: auto; }
  .roster-picker { margin-bottom: 8px; }
  .roster-option { height: 64px; }
  .roster-option .roster-cat { width: 41px; height: 41px; }
  .weapon-picker { margin-bottom: 7px; }
  .segment { margin-bottom: 7px; }
  .topbar { height: 46px; }
  .game-layout { height: calc(100dvh - 46px); min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 310px; padding-bottom: 0; overflow: hidden; }
  .arena-column { height: calc(100dvh - 46px); min-height: 0; }
  .status-strip { height: 38px; }
  .arena-wrap { flex: 1 1 auto; width: min(100%, calc(100dvh - 114px)); height: auto; max-height: calc(100dvh - 114px); aspect-ratio: 1 / 1; }
  #arena { position: static; width: 100%; height: 100%; transform: none; }
  .combat-panel { position: static; height: calc(100dvh - 46px); min-height: 0; padding: 10px; border-left: 1px solid var(--line); overflow-y: auto; }
  .target-card { grid-template-columns: 48px 1fr; }
  .target-portrait { width: 48px; height: 48px; }
  .player-vitals { padding: 8px 0; }
  .action-button { height: 62px; }
  .combat-log { margin: 7px 0; }
  .mini-ranking { display: block; }
  .joystick, .mobility-tools { position: absolute; }
  .mobility-tools { right: 14px; bottom: 12px; }
}

@media (orientation: landscape) and (max-height: 420px) {
  .result-screen { place-items: start center; overflow-y: auto; padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .result-card { width: min(92vw, 520px); padding: 8px 12px; }
  .result-card h2 { margin: 2px 0 4px; font-size: 24px; }
  .result-portrait { width: 104px; height: 104px; margin-bottom: 3px; }
  .result-card > strong { font-size: 18px; }
  .result-card p { min-height: 0; margin: 3px 0 6px; font-size: 11px; }
  .result-card .primary-button { min-height: 48px; }
  .joystick { left: max(8px, env(safe-area-inset-left)); bottom: max(7px, env(safe-area-inset-bottom)); width: 76px; height: 76px; }
  .joystick i { width: 32px; height: 32px; margin: -16px; }
  .mobility-tools { right: max(8px, env(safe-area-inset-right)); bottom: max(7px, env(safe-area-inset-bottom)); flex-direction: column; gap: 4px; }
  .ability-button { width: 48px; height: 48px; }
  .ability-button.is-skill { width: 54px; height: 54px; }
  .ability-button span { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
