:root {
  color-scheme: light;
  --ink: #37291c;
  --paper: #fff6df;
  --cream: #f9e8bd;
  --line: #3b2d1f;
  --red: #d85a4a;
  --blue: #4a7ab8;
  --green: #5c9a58;
  --yellow: #e8b847;
  --purple: #8768a7;
  --aqua: #4f9fa2;
  --shadow: rgba(69, 46, 24, 0.18);
  font-family:
    ui-rounded, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 16%, rgba(255, 236, 173, 0.95), transparent 30%),
    radial-gradient(circle at 82% 24%, rgba(148, 208, 194, 0.55), transparent 26%),
    linear-gradient(135deg, #fff2cd 0%, #d8edda 52%, #f7d9bf 100%);
  color: var(--ink);
}

button {
  font: inherit;
  color: inherit;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.screen,
.battle-screen {
  position: relative;
  width: min(100vw - 24px, calc((100vh - 24px) * 16 / 9));
  height: min(100vh - 24px, calc((100vw - 24px) * 9 / 16));
  max-width: 1360px;
  max-height: 765px;
  min-width: 720px;
  min-height: 405px;
  border: 4px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 24px 60px var(--shadow);
  overflow: hidden;
}

.screen {
  padding: 24px;
}

.is-hidden {
  display: none;
}

.page-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(120, 193, 207, 0.35) 0 36%, transparent 37%),
    repeating-linear-gradient(-8deg, rgba(95, 150, 87, 0.12) 0 12px, transparent 12px 28px);
}

.page-bg::after {
  content: "";
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: -10%;
  height: 36%;
  background: #a8d078;
  border-top: 4px solid var(--line);
  transform: rotate(-1.5deg);
}

.page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: #ffe294;
  box-shadow: 0 5px 0 rgba(59, 45, 31, 0.15);
}

.brand h1,
.brand h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1;
}

.brand h1 {
  font-size: clamp(32px, 4vw, 58px);
}

.brand h2 {
  font-size: clamp(26px, 3vw, 42px);
}

.subtitle {
  display: block;
  margin-top: 6px;
  color: #765a37;
  font-size: 15px;
  font-weight: 800;
}

.wallet {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 900;
}

.install-chip,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: #fff8e9;
  box-shadow: 0 4px 0 rgba(59, 45, 31, 0.12);
}

.install-chip {
  min-height: 40px;
  cursor: pointer;
  background: #f06d56;
  color: #fffaf0;
  font-weight: 950;
  white-space: nowrap;
}

.prop-icon {
  display: inline-block;
  width: var(--icon-size, 28px);
  height: var(--icon-size, 28px);
  flex: 0 0 auto;
  background-image: url("../assets/generated/props-sheet-alpha.webp");
  background-repeat: no-repeat;
  background-size: 400% 200%;
  background-position: var(--prop-pos, 0% 0%);
  vertical-align: middle;
}

.icon-btn,
.primary-btn,
.secondary-btn {
  border: 3px solid var(--line);
  box-shadow: 0 5px 0 rgba(59, 45, 31, 0.16);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.icon-btn:active,
.primary-btn:active,
.secondary-btn:active,
.card-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(59, 45, 31, 0.16);
}

.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff8e9;
  font-size: 22px;
  font-weight: 900;
}

.primary-btn,
.secondary-btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 950;
}

.primary-btn {
  background: #f06d56;
  color: #fffaf0;
}

.secondary-btn {
  background: #fff8e9;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  gap: 20px;
  align-items: stretch;
  min-height: 0;
}

.hero-stage {
  position: relative;
  border: 4px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  background: #8ed2e0;
  box-shadow: inset 0 -18px 0 rgba(85, 57, 32, 0.08);
}

.hero-image,
.stage-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-copy {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-height: 0;
}

.hook {
  border: 4px solid var(--line);
  border-radius: 20px;
  background: #fff8e9;
  padding: 18px;
  box-shadow: 0 8px 0 rgba(59, 45, 31, 0.12);
}

.hook strong {
  display: block;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.08;
}

.hook p {
  margin: 10px 0 0;
  color: #715235;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

.card-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  border: 4px solid var(--line);
  border-radius: 18px;
  background: var(--card, #fff8e9);
  box-shadow: 0 7px 0 rgba(59, 45, 31, 0.14);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
}

.card-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: -6px 0 0 -5px;
  filter: drop-shadow(0 5px 0 rgba(59, 45, 31, 0.13));
}

.card-btn strong {
  font-size: 21px;
  line-height: 1.05;
}

.card-btn span {
  color: #765a37;
  font-weight: 800;
  line-height: 1.25;
}

.mode-grid,
.stage-grid,
.shop-grid {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.mode-grid {
  grid-template-columns: repeat(4, 1fr);
}

.stage-grid {
  grid-template-columns: repeat(4, 1fr);
}

.mode-grid,
.stage-grid {
  align-items: start;
}

.shop-grid {
  grid-template-columns: repeat(4, 1fr);
  overflow: auto;
  padding-bottom: 10px;
}

.mode-card,
.stage-card,
.shop-card,
.team-panel {
  border: 4px solid var(--line);
  border-radius: 20px;
  background: #fff8e9;
  box-shadow: 0 7px 0 rgba(59, 45, 31, 0.14);
}

.mode-card,
.stage-card,
.shop-card {
  display: grid;
  align-content: start;
  min-height: 230px;
  padding: 16px;
  cursor: pointer;
  text-align: left;
}

.mode-card,
.stage-card {
  grid-template-rows: auto auto auto 1fr;
}

.mode-card.is-active,
.stage-card.is-active {
  outline: 6px solid rgba(232, 184, 71, 0.55);
  background: #fff1bd;
}

.mode-card b,
.stage-card b,
.shop-card b {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
}

.mode-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.mode-title .portrait,
.mode-title .prop-icon {
  flex: 0 0 auto;
}

.mode-title b {
  margin-bottom: 0;
  line-height: 1.05;
}

.mini-preview {
  position: relative;
  height: 142px;
  margin-bottom: 14px;
  border: 3px dashed rgba(59, 45, 31, 0.35);
  border-radius: 15px;
  background: #94d4dd;
  overflow: hidden;
}

.mini-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.team-layout {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 16px;
  min-height: 0;
}

.team-panel {
  padding: 16px;
  overflow: hidden;
}

.slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.slot,
.char-tile {
  border: 3px solid var(--line);
  border-radius: 16px;
  background: #fff9ec;
}

.slot {
  min-height: 176px;
  padding: 10px;
  text-align: center;
}

.slot small {
  display: block;
  margin-bottom: 6px;
  color: #765a37;
  font-weight: 900;
}

.char-tile {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 66px;
  padding: 7px 9px;
  cursor: pointer;
  text-align: left;
}

.char-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  overflow: auto;
  max-height: 420px;
  padding-right: 4px;
}

.portrait {
  position: relative;
  width: 58px;
  height: 58px;
}

.sprite-portrait {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  background-image: url("../assets/generated/characters-sheet-alpha.webp");
  background-repeat: no-repeat;
  background-size: 400% 200%;
  background-position: var(--sprite-pos, 0% 0%);
  filter: drop-shadow(0 5px 0 rgba(59, 45, 31, 0.13));
}

.char-name {
  display: block;
  font-size: 17px;
  font-weight: 950;
}

.role {
  display: inline-flex;
  margin-top: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2e0b5;
  color: #684b2d;
  font-size: 12px;
  font-weight: 900;
}

.shop-card .price {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.shop-visual {
  display: grid;
  place-items: center;
  height: 96px;
  overflow: hidden;
}

.prep-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  min-height: 0;
}

.battle-map-preview {
  position: relative;
  min-height: 0;
  border: 4px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  background: #88d1df;
}

.control-sheet {
  display: grid;
  gap: 12px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 3px solid var(--line);
  border-radius: 16px;
  background: #fff8e9;
  font-weight: 900;
}

.kbd {
  display: inline-grid;
  min-width: 44px;
  height: 38px;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(59, 45, 31, 0.12);
}

.result-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  min-height: 0;
}

.result-visual,
.reward-panel {
  border: 4px solid var(--line);
  border-radius: 22px;
  background: #fff8e9;
  padding: 18px;
  box-shadow: 0 7px 0 rgba(59, 45, 31, 0.14);
}

.result-visual {
  display: grid;
  place-items: center;
  text-align: center;
}

.result-visual .big {
  display: block;
  font-size: clamp(42px, 7vw, 84px);
  line-height: 1;
}

.reward-panel {
  display: grid;
  align-content: center;
  gap: 12px;
}

.reward-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 3px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-weight: 950;
}

.reward-line strong {
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #8ed2e0;
}

.battle-touch {
  position: absolute;
  inset: auto 22px 18px 22px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  pointer-events: none;
}

.stick,
.round-action,
.pause-btn {
  pointer-events: auto;
  border: 4px solid var(--line);
  box-shadow: 0 6px 0 rgba(59, 45, 31, 0.2);
}

.stick {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(255, 248, 233, 0.78);
  display: grid;
  place-items: center;
  touch-action: none;
}

.stick span {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: #f06d56;
}

.touch-actions {
  display: flex;
  gap: 14px;
}

.round-action {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  color: #fffaf0;
  font-weight: 950;
  cursor: pointer;
}

.round-action.attack {
  background: #d85a4a;
}

.round-action.throw {
  background: #4a7ab8;
}

.pause-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 248, 233, 0.9);
  font-weight: 950;
  cursor: pointer;
}

.rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 26px;
  text-align: center;
  background: var(--paper);
}

.rotate-hint strong {
  font-size: 26px;
}

.rotate-hint span {
  font-weight: 800;
  color: #765a37;
}

.install-panel {
  position: fixed;
  z-index: 18;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 28px));
  padding: 10px 10px 10px 14px;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: #fff8e9;
  box-shadow: 0 10px 0 rgba(59, 45, 31, 0.2), 0 18px 36px rgba(59, 45, 31, 0.18);
}

#screen.is-hidden ~ .install-panel {
  display: none;
}

.install-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.install-copy strong {
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
}

.install-copy span {
  color: #765a37;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.install-panel button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 13px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #f06d56;
  color: #fffaf0;
  font-weight: 950;
  box-shadow: 0 4px 0 rgba(59, 45, 31, 0.16);
  cursor: pointer;
}

.install-panel button:disabled {
  cursor: default;
  opacity: 0.75;
}

.install-panel[data-install-state="ready"] {
  background: #fff1bd;
  outline: 4px solid rgba(232, 184, 71, 0.45);
}

.install-panel[data-page="lobby"],
.install-panel[data-page="stages"],
.install-panel[data-page="team"],
.install-panel[data-page="result"],
.install-panel[data-page="shop"] {
  display: none;
}

/* Polish layer: premium board-game surfaces without changing layout geometry. */
.screen {
  background:
    linear-gradient(180deg, rgba(255, 251, 236, 0.7), rgba(255, 246, 223, 0) 42%),
    var(--paper);
}

.screen::before,
.battle-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.42),
    inset 0 -18px 38px rgba(79, 49, 24, 0.12);
}

.battle-screen::before {
  background:
    linear-gradient(180deg, rgba(50, 34, 18, 0.2), transparent 22%),
    linear-gradient(0deg, rgba(50, 34, 18, 0.18), transparent 28%);
}

.page-bg {
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 232, 142, 0.55), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(74, 122, 184, 0.2), transparent 24%),
    linear-gradient(180deg, rgba(120, 193, 207, 0.35) 0 36%, transparent 37%),
    repeating-linear-gradient(-8deg, rgba(95, 150, 87, 0.12) 0 12px, transparent 12px 28px);
}

.page-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.26), transparent 22%, transparent 78%, rgba(255, 255, 255, 0.18)),
    repeating-linear-gradient(0deg, rgba(59, 45, 31, 0.035) 0 1px, transparent 1px 18px);
}

.topbar {
  text-shadow: 0 1px 0 rgba(255, 248, 233, 0.75);
}

.brand-mark,
.icon-btn,
.install-chip,
.chip,
.primary-btn,
.secondary-btn,
.card-btn,
.mode-card,
.stage-card,
.shop-card,
.team-panel,
.hook,
.battle-map-preview,
.result-visual,
.reward-panel,
.control-row {
  border-color: #3a2a1c;
}

.icon-btn,
.primary-btn,
.secondary-btn,
.install-chip,
.card-btn,
.mode-card,
.stage-card,
.shop-card,
.char-tile {
  transition:
    transform 140ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 140ms cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 140ms ease;
}

.icon-btn:hover,
.primary-btn:hover,
.secondary-btn:hover,
.install-chip:hover,
.card-btn:hover,
.mode-card:hover,
.stage-card:hover,
.shop-card:hover:not(:disabled),
.char-tile:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: saturate(1.06);
}

button:focus-visible {
  outline: 4px solid rgba(74, 122, 184, 0.55);
  outline-offset: 2px;
}

button:disabled {
  cursor: default;
  filter: saturate(0.78);
}

.primary-btn {
  background:
    linear-gradient(180deg, rgba(255, 150, 117, 0.75), rgba(216, 90, 74, 0) 55%),
    #f06d56;
}

.secondary-btn,
.chip,
.icon-btn {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 248, 233, 0) 60%),
    #fff8e9;
}

.card-btn,
.mode-card,
.stage-card,
.shop-card,
.team-panel,
.hook,
.result-visual,
.reward-panel {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 248, 233, 0) 46%),
    var(--card, #fff8e9);
}

.card-btn::before,
.mode-card::before,
.stage-card::before,
.shop-card::before,
.team-panel::before,
.hook::before,
.result-visual::before,
.reward-panel::before {
  content: "";
  position: absolute;
  inset: 6px 7px auto;
  height: 22%;
  min-height: 18px;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent);
  pointer-events: none;
}

.mode-card.is-active,
.stage-card.is-active {
  outline: 6px solid rgba(232, 184, 71, 0.55);
  outline-offset: -6px;
  background:
    linear-gradient(180deg, rgba(255, 249, 222, 0.85), rgba(255, 241, 189, 0) 58%),
    #fff1bd;
}

.mode-card.is-active::after,
.stage-card.is-active::after {
  content: "선택";
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border: 2px solid rgba(59, 45, 31, 0.82);
  border-radius: 999px;
  background: #e8b847;
  color: #3b2d1f;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 2px 0 rgba(59, 45, 31, 0.16);
}

.mini-preview,
.hero-stage,
.battle-map-preview {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.38),
    inset 0 -16px 20px rgba(59, 45, 31, 0.1),
    0 5px 0 rgba(59, 45, 31, 0.12);
}

.mini-preview::after,
.hero-stage::after,
.battle-map-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.26), transparent 34%),
    linear-gradient(0deg, rgba(59, 45, 31, 0.12), transparent 30%);
}

.shop-card .price,
.reward-line strong {
  color: #3d6f44;
  text-shadow: 0 1px 0 rgba(255, 248, 233, 0.78);
}

.reward-line {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 248, 233, 0.68)),
    #fff;
}

.result-visual .big {
  width: max-content;
  margin: 0 auto 8px;
  padding: 10px;
  border: 3px solid rgba(59, 45, 31, 0.2);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 232, 148, 0.72), transparent 64%),
    rgba(255, 248, 233, 0.72);
}

.stick,
.round-action,
.pause-btn {
  backdrop-filter: blur(7px);
}

.stick {
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.82), rgba(255, 248, 233, 0.55) 58%, rgba(255, 248, 233, 0.28)),
    rgba(255, 248, 233, 0.76);
}

.stick span {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 180, 145, 0.95), rgba(240, 109, 86, 0.95) 58%, #bd4438);
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.34);
}

.round-action.attack {
  background:
    linear-gradient(180deg, #f27461, #c8443a);
}

.round-action.throw {
  background:
    linear-gradient(180deg, #6093d1, #386fab);
}

.pause-btn {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 248, 233, 0.78));
}

@media (orientation: portrait) and (max-width: 820px) {
  .rotate-hint {
    display: grid;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: max(4px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right))
      max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
  }

  .screen,
  .battle-screen {
    width: min(100vw - 8px, calc((100vh - 8px) * 16 / 9));
    height: min(100vh - 8px, calc((100vw - 8px) * 9 / 16));
    min-width: 0;
    min-height: 0;
    border-width: 3px;
    border-radius: 18px;
  }

  .screen {
    padding: 10px;
  }

  .page {
    gap: 8px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    font-size: 22px;
    border-width: 3px;
  }

  .brand h1 {
    font-size: 28px;
  }

  .brand h2 {
    font-size: 25px;
  }

  .wallet {
    gap: 5px;
  }

  .chip {
    padding: 5px 8px;
    border-width: 2px;
    font-size: 14px;
  }

  .hero-layout,
  .team-layout,
  .prep-layout,
  .result-layout {
    gap: 10px;
  }

  .hook {
    padding: 10px;
    border-width: 3px;
    border-radius: 16px;
  }

  .hook strong {
    font-size: 21px;
  }

  .hero-copy .hook p {
    display: none;
  }

  .menu-grid {
    gap: 8px;
  }

  .card-btn {
    min-height: 58px;
    padding: 8px 10px;
    border-width: 3px;
    border-radius: 14px;
  }

  .card-icon {
    width: 34px;
    height: 34px;
    margin: -4px 0 -1px -4px;
  }

  .card-btn strong {
    font-size: 15px;
  }

  .card-btn > span:not(.card-icon) {
    display: none;
  }

  .primary-btn,
  .secondary-btn {
    min-height: 36px;
    padding: 0 12px;
    border-width: 3px;
    border-radius: 12px;
    font-size: 14px;
  }

  .subtitle,
  .card-btn span,
  .mode-card span,
  .stage-card span {
    font-size: 12px;
  }

  .mode-card,
  .stage-card {
    min-height: 170px;
    padding: 10px;
  }

  .mini-preview {
    height: 84px;
    margin-bottom: 8px;
  }

  .mode-card b,
  .stage-card b {
    font-size: 16px;
  }

  .round-action {
    width: 74px;
    height: 74px;
  }

  .stick {
    width: 94px;
    height: 94px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  html,
  body {
    width: 100dvw;
    height: 100dvh;
  }

  .app-shell {
    width: 100dvw;
    height: 100dvh;
    padding: 0;
  }

  .screen,
  .battle-screen {
    width: 100dvw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .screen {
    padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
      max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .page-bg {
    overflow: hidden;
  }

  .page {
    gap: 6px;
  }

  .page:has(.team-layout) {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .topbar {
    gap: 6px;
    min-height: 0;
  }

  .brand {
    min-width: 0;
  }

  .brand > div {
    min-width: 0;
  }

  .brand h1 {
    font-size: 24px;
  }

  .brand h2 {
    font-size: 22px;
  }

  .subtitle {
    max-width: min(430px, 54vw);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    line-height: 1.1;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    border-width: 2px;
  }

  .wallet {
    flex: 0 0 auto;
  }

  .install-chip {
    min-height: 36px;
    padding: 5px 9px;
    border-width: 2px;
    font-size: 12px;
  }

  .chip {
    gap: 3px;
    padding: 4px 7px;
    font-size: 12px;
  }

  .chip .prop-icon {
    --icon-size: 18px;
  }

  .mode-grid,
  .stage-grid {
    gap: 8px;
  }

  .mode-card,
  .stage-card {
    min-height: 136px;
    padding: 8px;
    border-width: 3px;
    border-radius: 14px;
  }

  .mode-card b,
  .stage-card b,
  .shop-card b {
    margin-bottom: 5px;
    font-size: 15px;
    line-height: 1.08;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mode-title {
    gap: 6px;
    margin-bottom: 5px;
  }

  .mode-title .portrait,
  .mode-title .prop-icon {
    width: 32px !important;
    height: 32px !important;
    --icon-size: 32px;
  }

  .mini-preview {
    height: 58px;
    margin-bottom: 6px;
    border-width: 2px;
    border-radius: 10px;
  }

  .mode-card span,
  .stage-card span,
  .role {
    font-size: 10px;
    line-height: 1.25;
  }

  .stage-card span + span {
    display: none;
  }

  .team-layout {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 8px;
    overflow: hidden;
  }

  .team-panel {
    min-height: 0;
    padding: 9px;
    border-width: 3px;
    border-radius: 14px;
  }

  .team-panel > b {
    display: block;
    font-size: 13px;
    line-height: 1.1;
  }

  .slots {
    gap: 6px;
    margin-top: 7px;
  }

  .slot {
    min-width: 0;
    min-height: 128px;
    padding: 6px 4px;
    border-width: 2px;
    border-radius: 12px;
  }

  .slot small {
    margin-bottom: 4px;
    font-size: 10px;
    line-height: 1.1;
  }

  .slot .portrait {
    width: 54px !important;
    height: 54px !important;
    margin: 0 auto;
  }

  .char-name {
    font-size: 14px;
    line-height: 1.15;
  }

  .slot .char-name {
    margin-top: 4px;
  }

  .role {
    max-width: 100%;
    margin-top: 3px;
    padding: 3px 6px;
    white-space: nowrap;
  }

  .char-list {
    max-height: none;
    height: calc(100% - 23px);
    gap: 5px;
    margin-top: 7px;
    padding-right: 2px;
  }

  .char-tile {
    grid-template-columns: 42px 1fr;
    min-height: 50px;
    padding: 4px 6px;
    border-width: 2px;
    border-radius: 12px;
  }

  .char-tile .portrait {
    width: 42px !important;
    height: 42px !important;
  }

  .page > .team-layout + .topbar {
    align-self: end;
  }

  .page > .team-layout + .topbar .secondary-btn,
  .page > .team-layout + .topbar .primary-btn {
    min-height: 36px;
  }

  .prep-layout {
    grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.5fr);
    gap: 8px;
    overflow: hidden;
  }

  .battle-map-preview {
    border-width: 3px;
    border-radius: 14px;
  }

  .control-sheet {
    min-height: 0;
    align-content: start;
    gap: 6px;
    overflow: auto;
  }

  .control-sheet .hook {
    padding: 8px;
    border-radius: 13px;
  }

  .control-sheet .hook strong {
    font-size: 17px;
  }

  .control-sheet .hook p {
    display: none;
  }

  .control-row {
    min-height: 32px;
    padding: 6px 8px;
    border-width: 2px;
    border-radius: 11px;
    font-size: 12px;
  }

  .kbd {
    min-width: 30px;
    height: 26px;
    border-width: 2px;
    border-radius: 8px;
    font-size: 11px;
  }

  .result-layout {
    grid-template-columns: 0.95fr 1.05fr;
    gap: 8px;
    overflow: hidden;
  }

  .result-visual,
  .reward-panel {
    min-height: 0;
    padding: 10px;
    border-width: 3px;
    border-radius: 14px;
  }

  .result-visual .big .prop-icon {
    --icon-size: 86px !important;
  }

  .result-visual h2 {
    margin: 4px 0;
    font-size: 22px;
    line-height: 1.08;
  }

  .result-visual p {
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.25;
  }

  .reward-panel {
    gap: 5px;
    align-content: start;
    overflow: auto;
  }

  .reward-line {
    min-height: 31px;
    padding: 5px 9px;
    border-width: 2px;
    border-radius: 11px;
    font-size: 12px;
  }

  .reward-panel .primary-btn,
  .reward-panel .secondary-btn {
    min-height: 36px;
  }

  .shop-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(128px, auto);
    gap: 8px;
    padding: 0 2px 52px 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .shop-card {
    min-height: 128px;
    padding: 8px;
    border-width: 3px;
    border-radius: 14px;
    overflow: hidden;
  }

  .shop-visual,
  .shop-card > div {
    height: 44px !important;
    overflow: hidden;
  }

  .shop-card .portrait {
    width: 48px !important;
    height: 48px !important;
  }

  .shop-card > div .prop-icon {
    --icon-size: 44px !important;
  }

  .shop-card p {
    display: none;
  }

  .shop-card .price {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .install-panel {
    display: none;
  }

  .install-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  .install-copy span {
    display: none;
  }

  .install-panel button {
    min-height: 36px;
    padding: 0 9px;
    border-width: 2px;
    border-radius: 10px;
    font-size: 12px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .screen::before,
  .battle-screen::before {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.35),
      inset 0 -10px 24px rgba(79, 49, 24, 0.1);
  }

  .topbar {
    align-items: center;
  }

  .brand-mark,
  .icon-btn,
  .chip,
  .install-chip {
    box-shadow: 0 3px 0 rgba(59, 45, 31, 0.14);
  }

  .card-btn,
  .mode-card,
  .stage-card,
  .shop-card,
  .team-panel,
  .hook,
  .result-visual,
  .reward-panel {
    box-shadow:
      0 4px 0 rgba(59, 45, 31, 0.13),
      0 8px 18px rgba(59, 45, 31, 0.08);
  }

  .card-btn::before,
  .mode-card::before,
  .stage-card::before,
  .shop-card::before,
  .team-panel::before,
  .hook::before,
  .result-visual::before,
  .reward-panel::before {
    inset: 4px 5px auto;
    min-height: 12px;
  }

  .card-btn {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.04) 42%),
      var(--card, #fff8e9);
  }

  .card-icon {
    filter:
      drop-shadow(0 3px 0 rgba(59, 45, 31, 0.12))
      drop-shadow(0 6px 10px rgba(59, 45, 31, 0.08));
  }

  .mode-card,
  .stage-card {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 248, 233, 0) 46%),
      #fff8e9;
  }

  .mode-card.is-active,
  .stage-card.is-active {
    box-shadow:
      0 4px 0 rgba(112, 83, 30, 0.28),
      0 8px 18px rgba(112, 83, 30, 0.16);
  }

  .mode-card.is-active::after,
  .stage-card.is-active::after {
    top: 6px;
    right: 6px;
    bottom: auto;
    padding: 2px 6px;
    border-width: 1px;
    font-size: 9px;
  }

  .mini-preview {
    border-style: solid;
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.42),
      inset 0 -8px 12px rgba(59, 45, 31, 0.1);
  }

  .mode-card span,
  .stage-card span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .stage-card span + span {
    display: none;
  }

  .slot,
  .char-tile {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 249, 236, 0) 50%),
      #fff9ec;
    box-shadow: inset 0 -4px 0 rgba(59, 45, 31, 0.06);
  }

  .role {
    background:
      linear-gradient(180deg, rgba(255, 241, 194, 0.92), rgba(239, 213, 153, 0.88));
    color: #5d4326;
  }

  .battle-touch {
    z-index: 5;
    inset: auto 18px 14px 18px;
  }

  .stick {
    width: 100px;
    height: 100px;
  }

  .stick span {
    width: 48px;
    height: 48px;
  }

  .touch-actions {
    gap: 12px;
  }

  .round-action {
    width: 78px;
    height: 78px;
    font-size: 14px;
    text-shadow: 0 2px 0 rgba(59, 45, 31, 0.2);
    box-shadow:
      0 5px 0 rgba(59, 45, 31, 0.22),
      0 10px 18px rgba(59, 45, 31, 0.18),
      inset 0 6px 0 rgba(255, 255, 255, 0.18);
  }

  .pause-btn {
    top: 14px;
    right: 14px;
    width: 46px;
    height: 46px;
    box-shadow:
      0 4px 0 rgba(59, 45, 31, 0.18),
      0 9px 16px rgba(59, 45, 31, 0.12);
  }

  .result-visual {
    background:
      radial-gradient(circle at 50% 26%, rgba(232, 184, 71, 0.32), transparent 44%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(255, 248, 233, 0.12) 52%),
      #fff8e9;
  }

  .result-visual .big {
    margin-bottom: 5px;
    padding: 6px;
    border-radius: 22px;
  }

  .reward-line {
    box-shadow: inset 0 -3px 0 rgba(59, 45, 31, 0.05);
  }

  .shop-grid {
    grid-auto-rows: minmax(122px, auto);
    gap: 7px;
    padding: 0 2px 44px 0;
  }

  .shop-card {
    min-height: 122px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 248, 233, 0) 48%),
      #fff8e9;
  }

  .shop-card b {
    margin-bottom: 4px;
  }

  .shop-card .price {
    width: fit-content;
    max-width: 100%;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 241, 189, 0.82);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
