:root {
  color-scheme: dark;
  --bg: #07120f;
  --panel: rgba(7, 14, 18, 0.76);
  --panel-strong: rgba(8, 12, 15, 0.92);
  --line: rgba(232, 214, 157, 0.28);
  --gold: #dcb85d;
  --gold-soft: #f5d884;
  --green: #11865f;
  --green-dark: #0b513e;
  --cyan: #56d7eb;
  --danger: #e36b63;
  --text: #f7f3e8;
  --muted: #b8c6c3;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  position: relative;
  height: 100svh;
  isolation: isolate;
  overflow: hidden;
}

.screen-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(4, 11, 12, 0.38), rgba(3, 8, 9, 0.88)),
    image-set(url("/assets/backgrounds/home.webp") type("image/webp"), url("/assets/backgrounds/home.png") type("image/png"));
  background-size: cover;
  background-position: center;
  transition: filter 240ms ease, opacity 240ms ease;
}

.app-shell[data-view="match"] .screen-bg {
  background-image:
    linear-gradient(180deg, rgba(4, 11, 12, 0.2), rgba(3, 8, 9, 0.72)),
    image-set(url("/assets/backgrounds/match-standard.webp") type("image/webp"), url("/assets/backgrounds/match-standard.png") type("image/png"));
}

.app-shell[data-bg="night"] .screen-bg {
  background-image:
    linear-gradient(180deg, rgba(4, 11, 12, 0.24), rgba(3, 8, 9, 0.72)),
    image-set(url("/assets/backgrounds/match-night.webp") type("image/webp"), url("/assets/backgrounds/match-night.png") type("image/png"));
}

.app-shell[data-bg="final"] .screen-bg {
  background-image:
    linear-gradient(180deg, rgba(4, 6, 8, 0.18), rgba(3, 6, 7, 0.72)),
    image-set(url("/assets/backgrounds/match-final.webp") type("image/webp"), url("/assets/backgrounds/match-final.png") type("image/png"));
}

.app-shell[data-view="result"][data-result="victory"] .screen-bg,
.app-shell[data-view="result"][data-result="tie"] .screen-bg {
  background-image:
    linear-gradient(180deg, rgba(5, 10, 10, 0.18), rgba(3, 8, 9, 0.76)),
    image-set(url("/assets/backgrounds/result-victory.webp") type("image/webp"), url("/assets/backgrounds/result-victory.png") type("image/png"));
}

.app-shell[data-view="result"][data-result="defeat"] .screen-bg {
  background-image:
    linear-gradient(180deg, rgba(5, 10, 10, 0.22), rgba(3, 8, 9, 0.82)),
    image-set(url("/assets/backgrounds/result-defeat.webp") type("image/webp"), url("/assets/backgrounds/result-defeat.png") type("image/png"));
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 18%, rgba(220, 184, 93, 0.16), transparent 34%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.48), transparent 26%, transparent 74%, rgba(0, 0, 0, 0.48));
}

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: calc(8px + var(--safe-top)) 14px 8px;
  background: linear-gradient(180deg, rgba(2, 8, 10, 0.88), rgba(2, 8, 10, 0));
}

.brand-lockup {
  justify-self: center;
  min-width: 0;
  width: min(46vw, 180px);
  height: 44px;
  display: grid;
  place-items: center;
}

.brand-lockup img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.44));
}

.app-shell[data-view="home"] .brand-lockup {
  visibility: hidden;
}

.icon-action,
.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(5, 14, 16, 0.74);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.icon-home,
.icon-gear,
.icon-close,
.icon-undo,
.nav-icon {
  width: 20px;
  height: 20px;
  display: block;
  position: relative;
}

.icon-home::before {
  content: "";
  position: absolute;
  inset: 5px 3px 2px;
  border: 2px solid var(--gold-soft);
  border-top: 0;
}

.icon-home::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 2px;
  height: 14px;
  transform: rotate(45deg);
  border-left: 2px solid var(--gold-soft);
  border-top: 2px solid var(--gold-soft);
}

.icon-gear::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px dashed var(--gold-soft);
  border-radius: 50%;
}

.icon-close::before,
.icon-close::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 9px;
  height: 2px;
  background: var(--gold-soft);
}

.icon-close::before {
  transform: rotate(45deg);
}

.icon-close::after {
  transform: rotate(-45deg);
}

.icon-undo::before {
  content: "";
  position: absolute;
  inset: 4px 2px;
  border: 2px solid var(--gold-soft);
  border-right: 0;
  border-radius: 14px 0 0 14px;
}

.icon-undo::after {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 8px;
  height: 8px;
  border-left: 2px solid var(--gold-soft);
  border-bottom: 2px solid var(--gold-soft);
  transform: rotate(45deg);
}

.view-stack {
  height: 100svh;
  padding: calc(70px + var(--safe-top)) 14px calc(18px + var(--safe-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}

.app-shell[data-view="home"] .view-stack {
  padding-bottom: calc(10px + var(--safe-bottom));
}

.view {
  width: min(100%, 520px);
  margin: 0 auto;
}

.home-view {
  min-height: calc(100svh - 92px - var(--safe-top) - var(--safe-bottom));
  display: grid;
  align-items: center;
}

.title-stage {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: 100%;
}

.select-view {
  display: grid;
  align-content: start;
  gap: 0;
}

.title-logo {
  display: block;
  width: min(100%, 430px);
  margin: 0 auto;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.48));
}

.title-actions {
  position: relative;
  display: grid;
  gap: 8px;
  width: min(100%, 320px);
  padding: 12px;
  border: 1px solid rgba(245, 216, 132, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), transparent 36%),
    linear-gradient(180deg, rgba(8, 23, 23, 0.9), rgba(5, 13, 15, 0.9));
  box-shadow: var(--shadow);
  text-align: center;
}

.title-actions::before,
.title-actions::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 18px;
  border-top: 2px solid var(--gold-soft);
  border-bottom: 2px solid var(--gold-soft);
  pointer-events: none;
}

.title-actions::before {
  left: 8px;
  border-left: 2px solid var(--gold-soft);
}

.title-actions::after {
  right: 8px;
  border-right: 2px solid var(--gold-soft);
}

.title-actions .primary-button {
  width: 100%;
  min-height: 42px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.55rem, 6vw, 2.25rem);
  line-height: 1.04;
}

.title-actions h1 {
  margin-bottom: 2px;
  font-size: clamp(1.55rem, 5vw, 2.1rem);
}

h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
  line-height: 1.18;
}

.detail-panel p,
.result-panel p,
.result-quote p {
  color: var(--muted);
  line-height: 1.55;
}

.section-heading,
.detail-stage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
}

.section-heading span {
  font-weight: 800;
}

.character-list {
  display: grid;
  gap: 7px;
}

.character-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 68px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(10, 23, 25, 0.88), rgba(8, 12, 14, 0.7));
  box-shadow: var(--shadow);
}

.character-card.is-locked {
  filter: grayscale(0.8);
  opacity: 0.62;
}

.character-card picture,
.detail-character,
.character-wipe,
.result-character picture {
  overflow: hidden;
  border: 1px solid rgba(220, 184, 93, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    rgba(3, 10, 11, 0.72);
}

.character-card picture {
  width: 56px;
  height: 58px;
  border-radius: 8px;
}

.character-card img,
.detail-character img,
.character-wipe img,
.result-character img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.character-card-body {
  min-width: 0;
}

.character-card h2 {
  margin: 2px 0 1px;
  font-size: 1rem;
}

.character-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.level-badge,
.chip-button,
.card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(220, 184, 93, 0.46);
  border-radius: 999px;
  color: var(--gold-soft);
  background: rgba(19, 17, 10, 0.76);
  font-size: 0.72rem;
  font-weight: 800;
}

.card-action {
  width: 54px;
}

.meter-row,
.stat-meter {
  display: inline-flex;
  gap: 4px;
}

.character-card .meter-row {
  display: none;
}

.meter-row i,
.stat-meter i {
  width: 18px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.meter-row i.is-on,
.stat-meter i.is-on {
  background: linear-gradient(90deg, var(--green), var(--cyan));
}

.detail-character {
  width: min(66vw, 300px);
  aspect-ratio: 0.78;
  margin: 0 auto 12px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.detail-panel,
.result-panel,
.settings-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.stat-rows {
  display: grid;
  gap: 9px;
  margin: 18px 0;
}

.stat-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.detail-actions,
.result-actions,
.match-actions {
  display: grid;
  gap: 8px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 48px;
  border: 1px solid rgba(220, 184, 93, 0.42);
  border-radius: 8px;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
}

.primary-button {
  color: #12100a;
  background: linear-gradient(180deg, #ffeaa0, #d2a641);
}

.secondary-button {
  color: var(--text);
  background: linear-gradient(180deg, rgba(37, 56, 58, 0.92), rgba(8, 18, 20, 0.9));
}

.danger-button {
  color: white;
  border-color: rgba(227, 107, 99, 0.5);
  background: linear-gradient(180deg, rgba(204, 82, 72, 0.9), rgba(93, 25, 23, 0.9));
}

.match-view {
  display: grid;
  gap: 10px;
}

.match-hud {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  gap: 8px;
  align-items: center;
}

.score-chip,
.turn-chip {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 12, 14, 0.82);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

.turn-chip {
  color: var(--gold-soft);
  font-weight: 800;
  font-size: 0.86rem;
}

.disc-mini {
  width: 18px;
  height: 18px;
  display: inline-block;
  border-radius: 50%;
  vertical-align: middle;
}

.disc-mini.black {
  background: radial-gradient(circle at 35% 30%, #4d5458, #030405 66%);
}

.disc-mini.white {
  background: radial-gradient(circle at 35% 30%, #ffffff, #bfc7c5 68%);
}

.cpu-pane {
  display: grid;
  grid-template-columns: 104px 1fr;
  align-items: end;
  gap: 10px;
}

.character-wipe {
  width: 104px;
  height: 124px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.speech-bubble {
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent),
    rgba(5, 14, 16, 0.86);
}

.speech-bubble[data-mood="winning"],
.speech-bubble[data-mood="advantage"] {
  border-color: rgba(220, 184, 93, 0.64);
}

.speech-bubble[data-mood="losing"],
.speech-bubble[data-mood="disadvantage"] {
  border-color: rgba(227, 107, 99, 0.58);
}

.speech-bubble span {
  color: var(--gold-soft);
  font-size: 0.75rem;
  font-weight: 900;
}

.speech-bubble p {
  margin: 6px 0 0;
  line-height: 1.45;
}

.board-wrap {
  display: grid;
  place-items: center;
}

.board-frame {
  width: min(100%, 470px);
  aspect-ratio: 1;
  padding: 3.5%;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 232, 153, 0.2), transparent 28%),
    image-set(url("/assets/board/board-base.svg") type("image/svg+xml"));
  background-size: cover;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5);
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: 100%;
  height: 100%;
  border: 1px solid rgba(236, 214, 137, 0.38);
  background:
    linear-gradient(rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.12)),
    #096143;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  border: 1px solid rgba(1, 28, 21, 0.88);
  background: transparent;
}

.cell.is-legal {
  background: radial-gradient(circle, rgba(86, 215, 235, 0.14), transparent 62%);
}

.cell.is-last-move::before {
  content: "";
  position: absolute;
  inset: 8%;
  z-index: 1;
  border: 2px solid rgba(245, 216, 132, 0.92);
  border-radius: 6px;
  box-shadow: inset 0 0 16px rgba(245, 216, 132, 0.24), 0 0 12px rgba(245, 216, 132, 0.55);
  pointer-events: none;
}

.cell.is-rival-move::before {
  border-color: rgba(227, 107, 99, 0.95);
  box-shadow: inset 0 0 16px rgba(227, 107, 99, 0.22), 0 0 14px rgba(227, 107, 99, 0.68);
}

.last-move-tag {
  position: absolute;
  top: 3px;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  padding: 1px 4px;
  border-radius: 999px;
  color: #fff4df;
  background: rgba(111, 28, 26, 0.92);
  border: 1px solid rgba(255, 214, 159, 0.58);
  font-size: clamp(0.42rem, 1.8vw, 0.56rem);
  font-weight: 900;
  line-height: 1.1;
  pointer-events: none;
}

.disc {
  position: relative;
  z-index: 2;
  width: 78%;
  aspect-ratio: 1;
  display: block;
  border-radius: 50%;
  box-shadow: inset -7px -8px 12px rgba(0, 0, 0, 0.22), 0 4px 7px rgba(0, 0, 0, 0.32);
  animation: placeDisc 180ms ease-out;
}

.disc.black {
  background: radial-gradient(circle at 34% 28%, #5b6265, #141719 48%, #020303 78%);
}

.disc.white {
  background: radial-gradient(circle at 34% 28%, #ffffff, #e3e9e6 48%, #a9b3ae 82%);
}

.legal-dot {
  position: relative;
  z-index: 2;
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(86, 215, 235, 0.72);
  box-shadow: 0 0 14px rgba(86, 215, 235, 0.9);
}

.analysis-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--muted);
}

.eval-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, #141719 0 50%, #dfe7e4 50%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.eval-fill {
  display: block;
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold-soft));
  transition: width 220ms ease;
}

.match-actions {
  grid-template-columns: 52px 1fr 1fr;
}

.result-view {
  min-height: calc(100svh - 110px);
  display: grid;
  align-content: end;
  gap: 10px;
  padding-bottom: 16px;
}

.result-effects {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  display: grid;
  place-items: center;
  opacity: 0.48;
}

.result-effects img {
  position: absolute;
  width: 110%;
  max-width: 760px;
}

.result-character {
  position: relative;
  display: grid;
  grid-template-columns: minmax(132px, 42%) 1fr;
  align-items: end;
  gap: 10px;
  min-height: 230px;
}

.result-character picture {
  align-self: stretch;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(220, 184, 93, 0.48);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    rgba(3, 10, 11, 0.72);
  box-shadow: var(--shadow);
}

.result-character img {
  width: 100%;
  height: 100%;
  min-height: 230px;
  display: block;
  object-fit: cover;
  object-position: top center;
}

.result-quote {
  position: relative;
  align-self: center;
  min-height: 120px;
  padding: 14px;
  border: 1px solid rgba(220, 184, 93, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent),
    rgba(5, 14, 16, 0.88);
  box-shadow: var(--shadow);
}

.result-quote::before {
  content: "";
  position: absolute;
  left: -10px;
  bottom: 34px;
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  border-left: 1px solid rgba(220, 184, 93, 0.5);
  border-bottom: 1px solid rgba(220, 184, 93, 0.5);
  background: rgba(5, 14, 16, 0.88);
}

.result-quote span {
  position: relative;
  color: var(--gold-soft);
  font-size: 0.72rem;
  font-weight: 900;
}

.result-quote p {
  position: relative;
  margin: 8px 0 0;
  font-weight: 800;
}

.result-score {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.result-score span {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.35rem;
}

.result-actions {
  grid-template-columns: 1fr 1fr 1fr;
}

.settings-dialog {
  width: min(calc(100vw - 28px), 480px);
  max-height: calc(100svh - 28px - var(--safe-top) - var(--safe-bottom));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  overflow: auto;
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(6px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-row.vertical {
  display: grid;
  gap: 8px;
  padding: 10px 0;
}

.setting-row input[type="checkbox"] {
  width: 46px;
  height: 26px;
  accent-color: var(--gold);
}

.setting-row input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
}

.settings-panel .danger-button {
  width: 100%;
  margin-top: 16px;
}

.thinking-dots {
  display: inline-block;
  animation: pulse 850ms ease-in-out infinite;
}

@keyframes placeDisc {
  from {
    transform: scale(0.75) rotateY(70deg);
    opacity: 0;
  }
}

@keyframes spinSlow {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.45;
    transform: scale(0.98);
  }
}

@keyframes reveal {
  45% {
    filter: brightness(2.2);
    transform: scale(1.08);
  }
}

@media (min-width: 720px) {
  .view-stack {
    padding-top: calc(82px + var(--safe-top));
  }

  .match-view {
    max-width: 640px;
  }

  .cpu-pane {
    grid-template-columns: 130px 1fr;
  }

  .character-wipe {
    width: 130px;
    height: 150px;
  }
}

@media (max-height: 900px) {
  .view-stack {
    padding-top: calc(58px + var(--safe-top));
  }

  .detail-character {
    width: min(56vw, 240px);
    margin-bottom: 8px;
  }

  .detail-panel,
  .result-panel,
  .settings-panel {
    padding: 12px;
  }

  .stat-rows {
    gap: 7px;
    margin: 12px 0;
  }

  .stat-row {
    font-size: 0.8rem;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    min-height: 42px;
  }

  .title-logo {
    width: min(82%, 330px);
  }

  .title-actions {
    padding: 10px 12px 12px;
  }

  .title-actions h1 {
    font-size: clamp(1.42rem, 4.8vw, 1.9rem);
  }

  .title-actions .primary-button {
    min-height: 40px;
  }

  .section-heading {
    margin: 7px 0;
  }

  .character-list {
    gap: 6px;
  }

  .character-card {
    grid-template-columns: 50px 1fr auto;
    min-height: 58px;
    padding: 6px 8px;
  }

  .character-card picture {
    width: 50px;
    height: 50px;
  }

  .character-card p {
    font-size: 0.74rem;
  }
}

@media (max-height: 720px) {
  .view-stack {
    padding-top: calc(54px + var(--safe-top));
    padding-bottom: calc(10px + var(--safe-bottom));
  }

  .detail-stage {
    margin: 4px 0 6px;
  }

  .detail-character {
    width: min(48vw, 190px);
    margin-bottom: 8px;
  }

  .detail-panel h2 {
    font-size: 1.2rem;
  }

  .detail-panel p {
    font-size: 0.82rem;
    line-height: 1.4;
  }

  .stat-rows {
    margin: 9px 0;
  }

  .stat-row {
    grid-template-columns: 60px 1fr;
  }

  .cpu-pane {
    grid-template-columns: 86px 1fr;
  }

  .character-wipe {
    width: 86px;
    height: 96px;
  }

  .speech-bubble {
    min-height: 82px;
    padding: 10px;
  }

  .board-frame {
    width: min(88vw, 390px);
  }

  .analysis-bar {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .match-actions {
    grid-template-columns: 48px 1fr 1fr;
  }

  .result-view {
    min-height: auto;
    align-content: start;
    padding-bottom: 10px;
  }

  .result-character {
    grid-template-columns: minmax(104px, 36%) 1fr;
    min-height: 174px;
  }

  .result-character img {
    min-height: 174px;
  }

  .result-quote {
    min-height: 96px;
    padding: 11px;
  }

  .result-score {
    margin: 10px 0;
  }

  .title-logo {
    width: min(72%, 280px);
  }

  .title-actions {
    padding: 9px 12px 10px;
  }

  .title-actions h1 {
    font-size: 1.26rem;
  }

  .title-actions .primary-button {
    min-height: 38px;
  }

  .character-card {
    grid-template-columns: 48px 1fr auto;
    min-height: 50px;
    padding: 5px 8px;
  }

  .character-card picture {
    width: 48px;
    height: 44px;
  }

  .character-card p {
    font-size: 0.72rem;
  }
}
