:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: rgba(16, 30, 50, 0.88);
  --panel-strong: #14243a;
  --line: rgba(148, 163, 184, 0.22);
  --text: #f8fafc;
  --muted: #91a4bc;
  --cyan: #51e5d4;
  --cyan-dark: #0f766e;
  --amber: #ffcb69;
  --coral: #ff6b6b;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Noto Sans JP", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 12%, rgba(81, 229, 212, 0.13), transparent 34%),
    radial-gradient(circle at 88% 76%, rgba(255, 107, 107, 0.1), transparent 30%),
    linear-gradient(155deg, #08111f 0%, #0c1727 52%, #07101d 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

button {
  min-height: 44px;
  border: 0;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.52;
}

.global-controls {
  position: fixed;
  z-index: 20;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
}

.utility-toggle {
  min-width: 94px;
  padding: 8px 12px;
  border: 1px solid rgba(81, 229, 212, 0.3);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(8, 17, 31, 0.88);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  backdrop-filter: blur(10px);
}

.help-toggle {
  min-width: 70px;
  border-color: rgba(255, 203, 105, 0.38);
  color: var(--amber);
}

.top-toggle {
  min-width: 64px;
}

body:has(#title-screen:not([hidden])) .top-toggle {
  display: none;
}

.sound-toggle[aria-pressed="false"] {
  border-color: var(--line);
  color: var(--muted);
}

.help-dialog {
  width: min(calc(100% - 24px), 680px);
  max-height: min(86dvh, 780px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(81, 229, 212, 0.3);
  border-radius: 24px;
  color: var(--text);
  background: linear-gradient(155deg, #14243a, #091522 78%);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.68);
}

.help-dialog::backdrop {
  background: rgba(3, 9, 18, 0.82);
  backdrop-filter: blur(5px);
}

.help-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.help-dialog-header h2,
.help-dialog-header p {
  margin: 0;
}

.help-close {
  width: 44px;
  min-width: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.5rem;
}

.help-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: calc(86dvh - 174px);
  padding: 16px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.help-content section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.help-content h3 {
  margin: 0 0 7px;
  color: var(--cyan);
  font-size: 0.86rem;
  letter-spacing: 0.06em;
}

.help-content p,
.help-content ul {
  margin: 0;
  color: #c7d4e5;
  font-size: 0.82rem;
  line-height: 1.7;
}

.help-content ul {
  padding-left: 1.2rem;
}

.help-content strong {
  color: var(--text);
}

.help-quick-start {
  grid-column: 1 / -1;
  border-color: rgba(81, 229, 212, 0.34) !important;
  background: rgba(81, 229, 212, 0.06) !important;
}

.help-flow {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.help-flow li {
  align-items: flex-start;
}

.cue-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 12px;
  margin-top: 8px !important;
}

.help-effect-catalog {
  grid-column: 1 / -1;
}

.help-effect-catalog > p {
  margin-bottom: 12px;
}

.help-effects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.help-effects details {
  overflow: hidden;
  border: 1px solid rgba(81, 229, 212, 0.18);
  border-radius: 12px;
  background: rgba(8, 17, 31, 0.58);
}

.help-effects details[open] {
  grid-column: 1 / -1;
  border-color: rgba(81, 229, 212, 0.42);
}

.help-effects summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
  list-style: none;
}

.help-effects summary::-webkit-details-marker {
  display: none;
}

.help-effects summary::before {
  color: var(--cyan);
  content: "+";
  font-size: 1rem;
}

.help-effects details[open] summary::before {
  content: "−";
}

.help-effects summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.04em;
}

.help-effect-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 8px 8px;
}

.help-effect-list article {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.help-effect-list article > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.help-effect-list article strong {
  font-size: 0.76rem;
}

.help-effect-list article small {
  color: var(--amber);
  font-size: 0.56rem;
  text-align: right;
}

.help-effect-list article span {
  color: #c7d4e5;
  font-size: 0.7rem;
  line-height: 1.5;
}

.help-close-bottom {
  display: block;
  width: calc(100% - 44px);
  margin: 0 22px 20px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: clamp(16px, 4vw, 40px);
}

.screen {
  width: min(100%, 760px);
}

.title-screen {
  position: relative;
  overflow: hidden;
  padding: clamp(34px, 8vw, 72px) clamp(24px, 7vw, 72px);
  border: 1px solid var(--line);
  border-radius: 32px;
  text-align: center;
  background: linear-gradient(145deg, rgba(20, 36, 58, 0.94), rgba(9, 19, 34, 0.95));
  box-shadow: var(--shadow);
}

.title-screen::after {
  position: absolute;
  top: -110px;
  right: -80px;
  width: 280px;
  height: 280px;
  border: 44px solid rgba(81, 229, 212, 0.08);
  border-radius: 50%;
  content: "";
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(3.8rem, 14vw, 7.6rem);
  font-weight: 950;
  letter-spacing: -0.075em;
  line-height: 0.76;
}

h1 span {
  color: transparent;
  -webkit-text-stroke: 2px var(--cyan);
}

.title-copy {
  margin: clamp(30px, 6vw, 48px) 0 22px;
  color: #d9e4f0;
  font-size: clamp(1rem, 3vw, 1.25rem);
  line-height: 1.75;
}

.first-run-guide {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  margin: 0 auto 18px;
  padding: 14px;
  border: 1px solid rgba(81, 229, 212, 0.25);
  border-radius: 18px;
  text-align: left;
  background: rgba(4, 16, 29, 0.56);
}

.first-run-guide-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.first-run-guide-heading .eyebrow,
.first-run-guide-heading h2 {
  margin: 0;
}

.first-run-guide-heading h2 {
  font-size: 0.88rem;
}

.first-run-steps,
.help-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.first-run-steps li,
.help-flow li {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.first-run-steps b,
.help-flow b {
  display: grid;
  width: 25px;
  min-width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  color: #07151c;
  background: var(--cyan);
  font-size: 0.7rem;
}

.first-run-steps span,
.help-flow span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.first-run-steps strong,
.help-flow strong {
  color: var(--text);
  font-size: 0.7rem;
  line-height: 1.35;
}

.first-run-steps small,
.help-flow small {
  color: var(--muted);
  font-size: 0.56rem;
  line-height: 1.35;
}

.beginner-guide-button {
  display: block;
  min-height: 44px;
  margin: 10px auto 0;
  padding: 8px 14px;
  border: 1px solid rgba(81, 229, 212, 0.34);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(81, 229, 212, 0.07);
  font-size: 0.7rem;
  font-weight: 900;
}

.rule-card {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 28px;
  flex-wrap: wrap;
}

.rule-card span {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.record-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 430px);
  margin: -12px auto 24px;
}

.record-card div {
  display: grid;
  gap: 4px;
  padding: 10px 8px;
  border: 1px solid rgba(255, 203, 105, 0.2);
  border-radius: 12px;
  background: rgba(255, 203, 105, 0.045);
}

.record-card span {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.record-card strong {
  overflow: hidden;
  color: var(--amber);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.progress-note {
  width: min(100%, 430px);
  margin: -14px auto 22px;
  overflow: hidden;
  color: #778ba3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-seed-button {
  display: grid;
  width: min(100%, 420px);
  min-height: 58px;
  margin: 0 auto 10px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 203, 105, 0.68);
  border-radius: 16px;
  color: #1c1304;
  background: linear-gradient(135deg, #ffe29a, var(--amber));
  box-shadow: 0 10px 28px rgba(255, 203, 105, 0.18);
  font-weight: 1000;
  letter-spacing: 0.1em;
}

.daily-seed-button small {
  margin-top: 2px;
  color: rgba(28, 19, 4, 0.72);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
}

.daily-seed-button small b {
  font: inherit;
}

.daily-seed-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.seed-form,
.ranking-form {
  display: grid;
  gap: 8px;
  width: min(100%, 430px);
  margin: 14px auto 0;
  text-align: left;
}

.seed-form label,
.ranking-form label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.seed-form label small {
  display: block;
  margin-top: 2px;
  color: #778ba3;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0;
}

.seed-form div,
.ranking-form div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.seed-form input,
.ranking-form input {
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(4, 12, 23, 0.72);
  font: inherit;
}

.seed-form input:focus-visible,
.ranking-form input:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

.seed-retry-button {
  min-height: 44px;
  margin-top: 10px;
  padding: 8px 14px;
  border: 1px solid rgba(81, 229, 212, 0.28);
  border-radius: 999px;
  color: var(--cyan);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 800;
}

.leaderboard-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  margin: 30px auto 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: left;
  background: rgba(5, 14, 27, 0.58);
}

.leaderboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.leaderboard-heading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.leaderboard-heading > small,
.leaderboard-empty {
  color: var(--muted);
  font-size: 0.7rem;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.leaderboard-list li > strong {
  color: var(--amber);
  font-size: 1.25rem;
}

.leaderboard-list li > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.leaderboard-list b,
.leaderboard-list span,
.leaderboard-list small {
  overflow-wrap: anywhere;
}

.leaderboard-list span {
  color: var(--amber);
  font-size: 0.75rem;
  font-weight: 800;
}

.leaderboard-list small {
  color: var(--muted);
  line-height: 1.45;
}

.leaderboard-replay {
  justify-self: start;
  min-height: 44px;
  padding: 6px 0;
  color: var(--cyan);
  background: transparent;
  font-size: 0.7rem;
  font-weight: 800;
}

.ranking-form {
  margin: 16px auto;
  padding: 14px;
  border: 1px solid rgba(255, 203, 105, 0.24);
  border-radius: 14px;
  background: rgba(255, 203, 105, 0.045);
}

.ranking-form p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.primary-button {
  position: relative;
  z-index: 1;
  width: min(100%, 330px);
  min-height: 58px;
  padding: 14px 24px;
  border-radius: 18px;
  color: #061614;
  background: linear-gradient(135deg, #7df7e9, var(--cyan));
  box-shadow: 0 12px 28px rgba(81, 229, 212, 0.24);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 34px rgba(81, 229, 212, 0.32);
}

.origin-screen {
  padding: clamp(24px, 6vw, 52px);
  border: 1px solid var(--line);
  border-radius: 32px;
  text-align: center;
  background: linear-gradient(145deg, rgba(20, 36, 58, 0.96), rgba(9, 19, 34, 0.98));
  box-shadow: var(--shadow);
}

.origin-screen h2 {
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 2.8rem);
}

.origin-copy {
  margin: 14px 0;
  color: #c2d0df;
  line-height: 1.7;
}

.origin-screen .seed-label {
  max-width: none;
  margin: 0 0 22px;
}

.origin-choice {
  min-height: 190px;
  border-color: rgba(255, 203, 105, 0.24);
  background: linear-gradient(155deg, rgba(32, 50, 76, 0.94), rgba(15, 28, 46, 0.95));
}

.origin-choice strong {
  color: var(--amber);
  font-size: 1rem;
}

.origin-choice small {
  margin: 0;
  color: var(--cyan);
}

.game-screen {
  padding: clamp(16px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: clamp(22px, 5vw, 32px);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.game-header,
.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.game-header {
  gap: 16px;
  margin-bottom: 16px;
}

.seed-label {
  max-width: 56vw;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.stage-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.stage-item {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 11px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
}

.stage-item span {
  color: var(--muted);
  font-size: 0.67rem;
}

.stage-item strong {
  overflow: hidden;
  font-size: clamp(1rem, 3.8vw, 1.35rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-overflow: ellipsis;
}

.stage-item strong small {
  color: var(--muted);
  font-size: 0.62em;
}

.stage-item.is-score {
  border-color: rgba(81, 229, 212, 0.32);
  background: rgba(81, 229, 212, 0.075);
}

.stage-item.is-score strong {
  color: var(--cyan);
}

.stage-note {
  margin: 0 0 10px;
  color: #617891;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.juice-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
  margin: 0 0 14px;
}

.juice-meter {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.juice-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.juice-heading strong {
  overflow: hidden;
  color: var(--cyan);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meter-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(3, 10, 20, 0.66);
}

.meter-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan-dark), var(--cyan));
  transition: width 260ms ease-out;
}

.fever-meter .meter-track i {
  background: linear-gradient(90deg, #ff6b6b, #ffcb69, #51e5d4);
}

.fever-meter.is-active .juice-heading strong,
.fever-meter.is-active .juice-heading span {
  color: var(--amber);
  text-shadow: 0 0 12px rgba(255, 203, 105, 0.55);
}

.fever-meter.is-active .meter-track {
  box-shadow: 0 0 14px rgba(255, 203, 105, 0.45);
}

.reach-value {
  min-width: 64px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  text-align: center;
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.reach-value.is-active {
  border-color: rgba(255, 203, 105, 0.55);
  color: var(--amber);
  background: rgba(255, 203, 105, 0.09);
}

.build-strip {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: -6px 0 20px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 203, 105, 0.22);
  border-radius: 14px;
  background: rgba(255, 203, 105, 0.045);
}

.build-strip > div:not(.active-charms) {
  display: grid;
  min-width: 66px;
  gap: 2px;
}

.build-strip > div > span,
.build-summary-button span,
.empty-build {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.build-summary-button {
  display: grid;
  min-width: 66px;
  gap: 2px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: inherit;
  background: transparent;
}

.build-summary-button:hover,
.build-summary-button:focus-visible {
  border-color: rgba(255, 203, 105, 0.42);
  background: rgba(255, 203, 105, 0.08);
}

.build-strip strong {
  color: var(--amber);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.build-strip strong small {
  color: var(--muted);
  font-size: 0.68em;
}

.active-charms {
  display: flex;
  min-width: 0;
  justify-content: flex-end;
  gap: 5px;
  overflow-x: auto;
  padding: 3px;
}

.build-detail-dialog {
  width: min(calc(100% - 24px), 430px);
  max-height: min(72dvh, 620px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 203, 105, 0.42);
  border-radius: 20px;
  color: var(--text);
  background: linear-gradient(155deg, #14243a, #091522 78%);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.68);
}

.build-detail-dialog::backdrop {
  background: rgba(3, 9, 18, 0.74);
  backdrop-filter: blur(4px);
}

.build-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.build-detail-header h2,
.build-detail-header p {
  margin: 0;
}

.build-detail-list {
  display: grid;
  gap: 7px;
  max-height: calc(min(72dvh, 620px) - 78px);
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.build-detail-list article {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
}

.build-detail-list .build-tag-summary {
  border-color: rgba(255, 203, 105, 0.48);
  background: rgba(255, 203, 105, 0.08);
}

.build-detail-list .build-tag-summary strong {
  color: var(--amber);
}

.build-detail-list small {
  color: var(--amber);
  font-size: 0.54rem;
  font-weight: 950;
  letter-spacing: 0.12em;
}

.build-detail-list strong {
  color: var(--cyan);
  font-size: 0.82rem;
}

.build-detail-list p {
  margin: 0;
  color: #c4d1df;
  font-size: 0.72rem;
  line-height: 1.45;
}

.build-detail-empty {
  padding: 24px 10px;
  color: var(--muted);
  text-align: center;
}

.charm-chip,
.special-chip,
.mod-chip,
.tactic-chip {
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1px solid rgba(81, 229, 212, 0.22);
  border-radius: 999px;
  color: #c9fff8;
  background: rgba(81, 229, 212, 0.08);
  font-size: 0.62rem;
  font-weight: 800;
}

.tactic-chip {
  border-color: rgba(255, 203, 105, 0.55);
  color: #fff1c8;
  background: rgba(255, 203, 105, 0.12);
}

.origin-banner {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  margin: -8px 0 20px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 203, 105, 0.3);
  border-radius: 14px;
  background: rgba(255, 203, 105, 0.065);
}

.origin-banner > span {
  color: var(--amber);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.origin-banner strong {
  color: #fff0cb;
  font-size: 0.8rem;
}

.origin-banner small {
  min-width: 0;
  overflow: hidden;
  color: #b9c7d6;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.special-chip {
  border-color: rgba(255, 203, 105, 0.3);
  color: #ffe4ac;
  background: rgba(255, 203, 105, 0.09);
}

.mod-chip {
  border-color: rgba(183, 148, 246, 0.32);
  color: #ddcaff;
  background: rgba(183, 148, 246, 0.1);
}

.boss-banner {
  display: grid;
  gap: 4px;
  margin: -8px 0 20px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 107, 107, 0.42);
  border-radius: 14px;
  background: linear-gradient(100deg, rgba(255, 107, 107, 0.12), rgba(3, 10, 20, 0.35));
}

.boss-banner[hidden] {
  display: none;
}

.boss-banner p {
  margin: 0;
  color: var(--coral);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.boss-banner strong {
  color: #fff0f0;
  font-size: 1rem;
}

.boss-banner span,
.boss-banner small {
  color: #c4ceda;
  font-size: 0.72rem;
}

.boss-banner small {
  color: var(--amber);
  font-weight: 800;
}

.status-strip {
  padding: 12px clamp(12px, 3vw, 22px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(3, 10, 20, 0.46);
}

.status-item {
  display: grid;
  min-width: 72px;
  gap: 4px;
  text-align: center;
}

.status-item span {
  color: var(--muted);
  font-size: clamp(0.64rem, 2.6vw, 0.76rem);
}

.status-item strong {
  font-size: clamp(1.35rem, 5vw, 1.9rem);
  line-height: 1;
}

.ball-wrap {
  display: grid;
  width: clamp(72px, 21vw, 104px);
  aspect-ratio: 1;
  place-items: center;
  margin: -24px 8px -16px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff7e7, var(--amber));
  box-shadow: 0 12px 34px rgba(255, 203, 105, 0.28);
}

.draw-ball {
  color: #202638;
  font-size: clamp(2rem, 9vw, 3.2rem);
  font-weight: 950;
  letter-spacing: -0.05em;
}

.draw-ball.is-drawing {
  animation: ball-pop 340ms ease-out;
}

.card-panel {
  width: min(100%, 560px);
  margin: clamp(24px, 6vw, 38px) auto 0;
}

.column-labels,
.bingo-card {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.column-labels {
  gap: clamp(4px, 1.5vw, 8px);
  margin-bottom: 8px;
}

.column-labels span {
  color: var(--cyan);
  text-align: center;
  font-size: clamp(0.86rem, 3.5vw, 1.1rem);
  font-weight: 950;
  letter-spacing: 0.12em;
}

.bingo-card {
  overflow: hidden;
  gap: clamp(3px, 1vw, 7px);
  padding: clamp(6px, 1.5vw, 10px);
  border: 1px solid rgba(81, 229, 212, 0.22);
  border-radius: clamp(18px, 4vw, 26px);
  background: rgba(81, 229, 212, 0.055);
}

.bingo-cell {
  position: relative;
  display: grid;
  min-width: 0;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: clamp(10px, 2.6vw, 16px);
  color: #d8e3ee;
  background: var(--panel-strong);
  font-size: clamp(1rem, 5.4vw, 1.75rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
}

.cell-number {
  position: relative;
  z-index: 1;
}

.special-badge {
  position: absolute;
  z-index: 2;
  top: 5px;
  right: 6px;
  min-width: 17px;
  padding: 2px 4px;
  border-radius: 999px;
  color: #081018;
  background: var(--amber);
  font-size: clamp(0.5rem, 1.8vw, 0.66rem);
  font-weight: 950;
  line-height: 1.1;
}

.bingo-cell.special-bomb .special-badge {
  color: white;
  background: var(--coral);
}

.bingo-cell.special-wild .special-badge,
.bingo-cell.special-multiplier .special-badge {
  background: var(--cyan);
}

.bingo-cell::after {
  position: absolute;
  inset: 15%;
  border: 2px solid transparent;
  border-radius: 50%;
  content: "";
  transform: scale(0.25);
  transition: 180ms ease-out;
}

.bingo-cell.is-marked {
  color: #071a19;
  background: linear-gradient(145deg, #83f5e7, var(--cyan));
  border-color: rgba(255, 255, 255, 0.24);
}

.bingo-cell.is-marked::after {
  border-color: rgba(7, 26, 25, 0.24);
  transform: scale(1);
}

.bingo-cell.is-free {
  color: #271f0d;
  background: linear-gradient(145deg, #ffe3a9, var(--amber));
  font-size: clamp(0.72rem, 3.3vw, 1.05rem);
  letter-spacing: 0.03em;
}

.bingo-cell.is-disabled-free {
  color: var(--coral);
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 107, 107, 0.13),
    rgba(255, 107, 107, 0.13) 6px,
    rgba(20, 36, 58, 0.9) 6px,
    rgba(20, 36, 58, 0.9) 12px
  );
}

.bingo-cell.is-hit {
  z-index: 1;
  animation: cell-hit 480ms ease-out;
}

.bingo-cell.is-reach:not(.is-marked) {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 1px rgba(255, 203, 105, 0.42), 0 0 16px rgba(255, 203, 105, 0.23);
  animation: reach-pulse 1.15s ease-in-out infinite alternate;
}

.bingo-cell.is-boss-locked {
  border-color: rgba(255, 107, 107, 0.75);
  color: #8391a5;
  background:
    linear-gradient(135deg, transparent 42%, rgba(255, 107, 107, 0.45) 43% 57%, transparent 58%),
    rgba(28, 17, 28, 0.9);
  filter: saturate(0.45);
}

.bingo-cell.is-new-line {
  box-shadow: 0 0 0 2px var(--amber), 0 0 26px rgba(255, 203, 105, 0.55);
}

.bingo-card.is-combo {
  animation: combo-glow 460ms ease-out;
}

.game-screen.is-impact .card-panel {
  animation: board-impact 300ms ease-out;
}

.stage-item.is-score strong.is-score-pop {
  animation: score-pop 420ms ease-out;
}

.score-overlay {
  position: fixed;
  z-index: 30;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(calc(100% - 32px), 440px);
  justify-items: center;
  gap: 3px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 203, 105, 0.55);
  border-radius: 22px;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(20, 36, 58, 0.96), rgba(8, 17, 31, 0.97));
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.55), 0 0 36px rgba(255, 203, 105, 0.14);
  opacity: 0;
  transform: translate(-50%, -48%) scale(0.92);
}

.score-overlay.is-presenting {
  animation: overlay-card 420ms ease-out both;
}

.score-overlay > * {
  margin: 0;
  opacity: 0;
  transform: translateY(7px);
}

.score-overlay.is-presenting > * {
  animation: score-step 190ms ease-out forwards;
}

.score-overlay .combo-label {
  color: var(--cyan);
  font-size: 0.65rem;
  font-weight: 950;
  letter-spacing: 0.16em;
  animation-delay: 0ms;
}

.score-overlay strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--amber);
  font-size: clamp(1.15rem, 6vw, 1.85rem);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  animation-delay: 50ms !important;
}

.score-overlay span {
  color: #c4d1df;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.score-overlay span:nth-of-type(1) {
  animation-delay: 115ms !important;
}

.score-overlay span:nth-of-type(2) {
  animation-delay: 180ms !important;
}

.score-overlay b {
  color: var(--cyan);
  font-size: clamp(1.5rem, 8vw, 2.4rem);
  font-variant-numeric: tabular-nums;
  animation-delay: 245ms !important;
}

.announcement {
  min-height: 26px;
  margin: 18px 0 10px;
  color: var(--muted);
  text-align: center;
  font-size: clamp(0.82rem, 3vw, 0.95rem);
  font-weight: 800;
}

.announcement.is-bingo {
  color: var(--amber);
}

.score-feed {
  display: grid;
  min-height: 42px;
  max-height: 124px;
  gap: 6px;
  width: min(100%, 560px);
  margin: 0 auto 12px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(3, 10, 20, 0.38);
}

.score-feed-empty {
  align-self: center;
  margin: 0;
  color: #60758d;
  text-align: center;
  font-size: 0.72rem;
}

.score-event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(255, 203, 105, 0.08);
  animation: feed-enter 240ms ease-out both;
  animation-delay: var(--feed-delay, 0ms);
}

.score-event strong {
  color: var(--amber);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.score-event span {
  color: #dce6f1;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.game-actions {
  display: flex;
  justify-content: center;
}

.command-dock {
  display: grid;
}

.play-area {
  min-width: 0;
}

.ball-hand-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 16px 0 10px;
  padding: 12px;
  border: 1px solid rgba(81, 229, 212, 0.28);
  border-radius: 18px;
  background: rgba(81, 229, 212, 0.055);
}

.ball-hand-panel h2 {
  margin: 0;
  font-size: 0.9rem;
}

.ball-hand-panel .eyebrow {
  margin-bottom: 3px;
  font-size: 0.58rem;
}

.ball-hand-hint {
  max-width: 120px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.35;
}

.ball-hand {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 8px;
}

.hand-ball {
  display: grid;
  min-width: 0;
  min-height: 58px;
  place-content: center;
  gap: 1px;
  border: 2px solid rgba(81, 229, 212, 0.35);
  border-radius: 999px;
  color: #07151c;
  background: linear-gradient(145deg, #f8fafc, #80eee1);
  font-size: 1.2rem;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(81, 229, 212, 0.15);
}

.hand-ball-number {
  font-size: 1.2rem;
  font-weight: 950;
  line-height: 1;
}

.hand-ball-cue {
  font-size: 0.5rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  line-height: 1;
}

.hand-ball.is-miss {
  border-color: rgba(148, 163, 184, 0.34);
  background: linear-gradient(145deg, #f8fafc, #a9b9ca);
}

.hand-ball.is-reach {
  border-color: rgba(255, 203, 105, 0.82);
  background: linear-gradient(145deg, #fff7d6, #ffcb69);
  box-shadow: 0 8px 22px rgba(255, 203, 105, 0.28);
}

.hand-ball.is-bingo {
  border-color: rgba(255, 107, 107, 0.9);
  background: linear-gradient(145deg, #fff0d0, #ff8e78);
  box-shadow: 0 8px 24px rgba(255, 107, 107, 0.38);
}

.hand-ball.is-effect {
  border-color: rgba(196, 181, 253, 0.9);
  background: linear-gradient(145deg, #f5f3ff, #c4b5fd);
  box-shadow: 0 8px 22px rgba(196, 181, 253, 0.28);
}

.hand-ball:hover {
  transform: translateY(-2px);
}

.hand-ball.is-quick-pick {
  outline: 2px solid rgba(248, 250, 252, 0.92);
  outline-offset: -4px;
}

.push-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.danger-button {
  min-height: 58px;
  padding: 14px 24px;
  border: 1px solid rgba(255, 107, 107, 0.65);
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #c2414b, #ff6b6b);
  font-weight: 950;
  letter-spacing: 0.08em;
}

.evolution-chip {
  border-color: rgba(255, 107, 107, 0.55);
  color: #ffd4d4;
  background: rgba(255, 107, 107, 0.14);
}

.draw-button {
  display: grid;
  width: min(100%, 390px);
  min-height: 72px;
  place-items: center;
  padding: 10px 24px;
  border-radius: 22px;
  color: #081516;
  background: linear-gradient(135deg, #7df7e9, var(--cyan));
  box-shadow: 0 14px 36px rgba(81, 229, 212, 0.26);
}

.draw-button span {
  font-size: 1.45rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  line-height: 1;
}

.draw-button small {
  opacity: 0.58;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.draw-button.is-fever {
  color: #291606;
  background: linear-gradient(110deg, #ff6b6b, #ffcb69 48%, #51e5d4);
  background-size: 180% 100%;
  box-shadow: 0 14px 44px rgba(255, 203, 105, 0.45);
  animation: fever-flow 850ms linear infinite alternate;
}

.game-screen.is-fever {
  border-color: rgba(255, 203, 105, 0.65);
  box-shadow: var(--shadow), 0 0 44px rgba(255, 203, 105, 0.16);
}

.announcement.is-fever {
  color: white;
  text-shadow: 0 0 18px var(--amber);
}

.complete-panel {
  margin-top: 22px;
  padding: 24px;
  border: 1px solid rgba(255, 203, 105, 0.35);
  border-radius: 22px;
  text-align: center;
  background: rgba(255, 203, 105, 0.07);
  animation: result-enter 360ms ease-out;
}

.complete-panel h2 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 6vw, 2.1rem);
}

.complete-panel > p:not(.eyebrow) {
  margin: 0 0 20px;
  color: var(--muted);
}

.complete-panel.is-failed {
  border-color: rgba(255, 107, 107, 0.42);
  background: rgba(255, 107, 107, 0.08);
}

.complete-panel.is-failed .eyebrow {
  color: var(--coral);
}

.result-score {
  display: grid;
  gap: 4px;
  width: min(100%, 240px);
  margin: 0 auto 20px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(3, 10, 20, 0.35);
}

.result-score span {
  color: var(--muted);
  font-size: 0.7rem;
}

.result-score strong {
  color: var(--cyan);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.choice-panel {
  margin-top: 22px;
  padding: clamp(18px, 4vw, 26px);
  border: 1px solid rgba(81, 229, 212, 0.3);
  border-radius: 22px;
  background: rgba(3, 10, 20, 0.55);
}

.tactic-panel {
  margin: 10px auto 16px;
  border-color: rgba(255, 203, 105, 0.5);
  background:
    radial-gradient(circle at 50% 0, rgba(255, 203, 105, 0.12), transparent 58%),
    rgba(3, 10, 20, 0.75);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.28);
}

.tactic-panel .eyebrow {
  color: var(--amber);
}

.tactic-choice {
  border-color: rgba(255, 203, 105, 0.26);
}

.tactic-choice strong {
  color: var(--amber);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.tactic-choice small {
  align-self: end;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.tactic-choice.has-synergy {
  border-color: rgba(81, 229, 212, 0.65);
  background: linear-gradient(145deg, rgba(81, 229, 212, 0.13), rgba(20, 36, 58, 0.84));
  box-shadow: 0 0 22px rgba(81, 229, 212, 0.09);
}

.tactic-choice.has-synergy small {
  color: var(--cyan);
}

.choice-panel h2 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 5vw, 1.9rem);
}

.choice-panel > p:not(.eyebrow) {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.85rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lucky-panel {
  text-align: center;
}

.lucky-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 360px);
  margin: 0 auto;
}

.lucky-number {
  min-height: 72px;
  border: 1px solid rgba(255, 203, 105, 0.45);
  border-radius: 16px;
  color: #241a09;
  background: linear-gradient(145deg, #fff0c8, var(--amber));
  font-size: 1.55rem;
  font-weight: 950;
}

.lucky-number:hover {
  transform: translateY(-2px);
}

.choice-card {
  display: grid;
  min-width: 0;
  min-height: 138px;
  align-content: start;
  gap: 9px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  text-align: left;
  background: rgba(20, 36, 58, 0.8);
}

.choice-card:not(:disabled):hover {
  border-color: var(--cyan);
  transform: translateY(-2px);
}

.choice-card strong {
  color: var(--cyan);
  font-size: 0.92rem;
}

.choice-card span {
  color: #bdcad9;
  font-size: 0.74rem;
  line-height: 1.55;
}

.choice-card .choice-synergy {
  display: inline-flex;
  width: fit-content;
  margin-top: 2px;
  padding: 3px 7px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.08);
  font-size: 0.56rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.choice-card .choice-synergy.is-synergy {
  border-color: rgba(81, 229, 212, 0.55);
  color: var(--cyan);
  background: rgba(81, 229, 212, 0.1);
}

.choice-card .choice-synergy.is-new-path {
  border-color: rgba(255, 203, 105, 0.45);
  color: var(--amber);
  background: rgba(255, 203, 105, 0.08);
}

.choice-card small {
  margin-top: auto;
  color: var(--amber);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.shop-heading,
.shop-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.shop-heading > strong {
  color: var(--amber);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.shop-actions {
  margin-top: 16px;
}

.shop-actions .primary-button {
  width: auto;
  min-height: 48px;
}

noscript {
  display: block;
  padding: 16px;
  color: white;
  background: #7f1d1d;
  text-align: center;
}

@keyframes ball-pop {
  0% {
    opacity: 0.4;
    transform: scale(0.5) rotate(-12deg);
  }
  70% {
    transform: scale(1.12) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes cell-hit {
  0% {
    transform: scale(0.82);
  }
  55% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes board-impact {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-2px); }
  70% { transform: translateX(2px); }
}

@keyframes combo-glow {
  0% { box-shadow: 0 0 0 rgba(255, 203, 105, 0); }
  45% { box-shadow: 0 0 0 3px var(--amber), 0 0 42px rgba(255, 203, 105, 0.55); }
  100% { box-shadow: 0 0 0 rgba(255, 203, 105, 0); }
}

@keyframes score-pop {
  45% { color: white; transform: scale(1.16); text-shadow: 0 0 18px var(--cyan); }
}

@keyframes reach-pulse {
  to { color: var(--amber); transform: scale(0.97); }
}

@keyframes fever-flow {
  to { background-position: 100% 0; transform: translateY(-1px); }
}

@keyframes overlay-card {
  0% { opacity: 0; transform: translate(-50%, -44%) scale(0.9); }
  18%, 82% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -53%) scale(1); }
}

@keyframes score-step {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes feed-enter {
  from { opacity: 0; transform: translateY(7px); }
}

@keyframes result-enter {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
}

@media (max-width: 480px), (max-width: 900px) and (max-height: 520px) {
  body:has(#game-screen:not([hidden])) {
    overflow: hidden;
  }

  .app-shell {
    align-items: start;
    padding: 10px;
  }

  .app-shell:has(> #game-screen:not([hidden])) {
    padding: 0;
  }

  .global-controls {
    z-index: 40;
    top: max(5px, env(safe-area-inset-top));
    right: max(5px, env(safe-area-inset-right));
    gap: 4px;
  }

  .utility-toggle {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .utility-toggle::after {
    font-size: 0.82rem;
    letter-spacing: 0;
  }

  .help-toggle::after {
    content: "?";
    font-size: 1rem;
  }

  .top-toggle::after {
    content: "TOP";
  }

  .sound-toggle::after {
    content: "SND";
  }

  .help-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 18px;
  }

  .help-dialog-header {
    padding: 16px 14px 12px;
  }

  .help-content {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 166px);
    padding: 12px 14px;
  }

  .help-flow {
    grid-template-columns: 1fr !important;
  }

  .help-effects,
  .help-effect-list {
    grid-template-columns: 1fr;
  }

  .help-effects details[open] {
    grid-column: auto;
  }

  .help-close-bottom {
    width: calc(100% - 28px);
    margin: 0 14px 14px;
  }

  .title-screen,
  .origin-screen,
  .game-screen {
    border-radius: 22px;
  }

  .title-screen {
    margin-top: max(8px, env(safe-area-inset-top));
    padding: 54px 20px 28px;
  }

  .title-copy {
    margin: 24px 0 16px;
    font-size: 0.92rem;
  }

  .first-run-guide {
    padding: 11px;
  }

  .first-run-guide-heading {
    margin-bottom: 7px;
  }

  .first-run-steps {
    gap: 4px;
  }

  .first-run-steps li {
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 7px 4px;
    text-align: center;
  }

  .first-run-steps small {
    display: none;
  }

  .rule-card {
    margin-bottom: 24px;
  }

  .game-screen {
    display: flex;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    gap: 4px;
    flex-direction: column;
    overflow: hidden;
    padding: max(4px, env(safe-area-inset-top)) max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
    border: 0;
    border-radius: 0;
  }

  .run-hud {
    flex: 0 0 auto;
    margin: 0;
    padding: 2px 2px 5px;
    border: 1px solid rgba(81, 229, 212, 0.2);
    border-radius: 12px;
    background: rgba(8, 21, 38, 0.97);
  }

  .origin-screen {
    margin-top: max(8px, env(safe-area-inset-top));
    padding: 24px 14px calc(20px + env(safe-area-inset-bottom));
  }

  .origin-choice {
    min-height: 128px;
  }

  .origin-banner {
    display: none;
  }

  .boss-banner {
    flex: 0 0 auto;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 3px 7px;
    min-height: 30px;
    margin: 0;
    padding: 5px 8px;
    border-radius: 10px;
  }

  .boss-banner p,
  .boss-banner strong,
  .boss-banner span,
  .boss-banner small {
    font-size: 0.58rem;
  }

  .boss-banner span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .boss-banner small {
    grid-column: 1 / -1;
  }

  .game-header {
    min-height: 42px;
    gap: 5px;
    margin-bottom: 2px;
    /* Reserve all three 42px utility buttons plus their gaps. */
    padding-right: 138px;
  }

  .game-header .seed-label {
    max-width: calc(100% - 96px);
    font-size: 0.58rem;
  }

  .game-header .text-button {
    min-height: 38px;
    padding: 4px 7px;
    font-size: 0.56rem;
  }

  .stage-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 3px;
  }

  .juice-strip {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
    gap: 6px;
    margin-bottom: 0;
  }

  .reach-value {
    grid-column: auto;
    justify-self: auto;
    min-width: 64px;
    min-height: 22px;
    padding: 3px 5px;
    font-size: 0.57rem;
  }

  .build-strip {
    flex: 0 0 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    min-height: 28px;
    margin: 0;
    padding: 3px 6px;
    border-radius: 9px;
  }

  .active-charms {
    display: none;
  }

  .build-strip > div:not(.active-charms) {
    display: flex;
    min-width: 0;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
  }

  .build-summary-button {
    display: flex;
    min-width: 0;
    min-height: 44px;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    padding: 2px 4px;
  }

  .build-strip > div > span,
  .build-summary-button span {
    font-size: 0.48rem;
  }

  .build-strip strong {
    font-size: 0.72rem;
  }

  .stage-item {
    gap: 2px;
    padding: 4px 2px;
    border-radius: 9px;
  }

  .stage-item span {
    font-size: 0.55rem;
    white-space: nowrap;
  }

  .stage-item strong {
    font-size: clamp(0.78rem, 4vw, 0.96rem);
  }

  .stage-item strong > span {
    color: inherit;
    font-size: inherit;
  }

  .stage-note {
    display: none;
  }

  .juice-meter {
    gap: 3px;
  }

  .juice-heading {
    font-size: 0.54rem;
  }

  .juice-heading strong {
    font-size: 0.6rem;
  }

  .meter-track {
    height: 6px;
  }

  .play-area {
    display: grid;
    min-height: 0;
    flex: 1 1 auto;
    grid-template-rows: 38px minmax(0, 1fr) 20px;
    gap: 3px;
  }

  .status-strip {
    min-height: 0;
    padding: 3px 12px;
    border-radius: 11px;
  }

  .status-item {
    min-width: 54px;
    gap: 1px;
  }

  .status-item span {
    font-size: 0.52rem;
  }

  .status-item strong {
    font-size: 1rem;
  }

  .ball-wrap {
    width: 46px;
    margin: -7px 4px;
  }

  .draw-ball {
    font-size: 1.45rem;
  }

  .card-panel {
    display: grid;
    width: min(calc(100vw - 10px), calc((100dvh - 301px) / 1.08));
    max-width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1.08;
    margin: 0 auto;
    grid-template-rows: 14px minmax(0, 1fr);
  }

  .column-labels {
    gap: 3px;
    margin-bottom: 1px;
  }

  .column-labels span {
    font-size: 0.62rem;
  }

  .bingo-card {
    min-height: 0;
    gap: 3px;
    padding: 4px;
    border-radius: 13px;
  }

  .bingo-cell {
    border-radius: 8px;
    font-size: clamp(0.78rem, 4.3vw, 1.16rem);
  }

  .bingo-cell.is-free {
    font-size: clamp(0.54rem, 2.7vw, 0.74rem);
  }

  .special-badge {
    top: 2px;
    right: 2px;
    min-width: 12px;
    padding: 1px 2px;
    font-size: 0.42rem;
  }

  .announcement {
    min-height: 0;
    margin: 0;
    overflow: hidden;
    font-size: 0.66rem;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .score-feed {
    display: none;
  }

  .score-event {
    gap: 8px;
  }

  .score-event span {
    font-size: 0.7rem;
  }

  .command-dock {
    display: grid;
    min-height: 54px;
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 2fr) minmax(104px, 1fr);
    gap: 5px;
  }

  .ball-hand-panel {
    display: block;
    margin: 0;
    padding: 4px;
    border-radius: 12px;
  }

  .ball-hand-panel > div:first-child {
    display: none;
  }

  .ball-hand {
    height: 100%;
    gap: 4px;
  }

  .hand-ball {
    min-height: 46px;
    height: 100%;
    border-width: 1px;
    font-size: 1rem;
  }

  .hand-ball-number {
    font-size: 1rem;
  }

  .hand-ball-cue {
    font-size: 0.42rem;
  }

  .game-actions,
  .draw-button {
    width: 100%;
    height: 100%;
  }

  .draw-button {
    min-height: 54px;
    padding: 6px;
    border-radius: 12px;
  }

  .draw-button span {
    font-size: 0.8rem;
    letter-spacing: 0.05em;
  }

  .draw-button small {
    display: none;
  }

  .choice-panel,
  .complete-panel {
    position: fixed;
    z-index: 25;
    inset: 0;
    display: flex;
    height: 100dvh;
    min-height: 0;
    gap: 6px;
    flex-direction: column;
    margin: 0;
    overflow: hidden;
    padding: max(54px, calc(env(safe-area-inset-top) + 48px)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    border-radius: 0;
    background: linear-gradient(155deg, #14243a, #091522 78%);
  }

  .complete-panel.is-failed {
    border-color: rgba(255, 107, 107, 0.72);
    background:
      radial-gradient(circle at 50% 0, rgba(255, 107, 107, 0.2), transparent 48%),
      linear-gradient(155deg, #2b1722, #0b1422 72%);
  }

  .choice-panel .eyebrow,
  .complete-panel .eyebrow {
    margin-bottom: 0;
    font-size: 0.58rem;
  }

  .choice-panel h2,
  .complete-panel h2 {
    margin: 0;
    font-size: 1.22rem;
  }

  .choice-panel > p:not(.eyebrow),
  .complete-panel > p:not(.eyebrow) {
    margin: 0;
    font-size: 0.7rem;
    line-height: 1.4;
  }

  .choice-grid {
    display: grid;
    min-height: 0;
    flex: 1 1 auto;
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(0, 1fr);
    gap: 6px;
  }

  .choice-card,
  .origin-choice {
    min-height: 0;
    gap: 4px;
    padding: 9px 11px;
    border-radius: 12px;
  }

  .choice-card strong {
    font-size: 0.8rem;
  }

  .choice-card span {
    font-size: 0.66rem;
    line-height: 1.35;
  }

  .choice-card .choice-synergy {
    padding: 2px 6px;
    font-size: 0.48rem;
    line-height: 1.1;
  }

  .choice-card small {
    font-size: 0.56rem;
  }

  .lucky-grid {
    width: 100%;
    margin: auto 0;
  }

  .game-screen:has(.lucky-panel.is-scout:not([hidden])) .command-dock {
    visibility: hidden;
  }

  .lucky-panel.is-scout {
    inset: auto max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
    display: block;
    width: auto;
    height: 54px;
    padding: 4px;
    border: 1px solid rgba(255, 203, 105, 0.55);
    border-radius: 12px;
    background: rgba(8, 21, 38, 0.98);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.38);
  }

  .lucky-panel.is-scout > .eyebrow,
  .lucky-panel.is-scout > h2,
  .lucky-panel.is-scout > p {
    display: none;
  }

  .lucky-panel.is-scout .lucky-grid {
    display: grid;
    height: 100%;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 4px;
    margin: 0;
  }

  .lucky-panel.is-scout .lucky-number {
    min-width: 0;
    min-height: 44px;
    padding: 0;
    border-radius: 9px;
    font-size: 0.92rem;
  }

  .push-actions {
    display: grid;
    margin: auto 0;
    grid-template-columns: 1fr 1fr;
  }

  .push-actions > button {
    width: 100%;
    min-height: 58px;
    padding-inline: 8px;
    font-size: 0.74rem;
  }

  .result-score {
    margin: 4px auto;
  }

  .ranking-form {
    margin: 4px auto;
    padding: 8px;
  }

  .shop-actions {
    flex: 0 0 auto;
    margin-top: 0;
  }

  .shop-actions .primary-button {
    width: auto;
    min-height: 44px;
  }

  .shop-heading {
    flex: 0 0 auto;
  }

  #card-edit-skip {
    flex: 0 0 auto;
  }

  .complete-panel > .primary-button {
    flex: 0 0 auto;
    margin: auto auto 0;
  }

  .game-screen:has(.boss-banner:not([hidden])) .card-panel {
    width: min(calc(100vw - 10px), calc((100dvh - 351px) / 1.08));
  }
}

@media (max-width: 900px) and (max-height: 520px) {
  body:has(#game-screen:not([hidden])) {
    overflow: hidden;
  }

  .app-shell:has(> #game-screen:not([hidden])) {
    padding: 0;
  }

  .game-screen {
    display: grid;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    grid-template-columns: minmax(280px, 43%) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 5px;
    overflow: hidden;
    padding: 5px;
    border: 0;
    border-radius: 0;
  }

  .play-area {
    display: grid;
    min-height: 0;
    grid-column: 1;
    grid-row: 1 / -1;
    grid-template-rows: 38px minmax(0, 1fr) 20px;
    gap: 3px;
  }

  .card-panel {
    display: grid;
    width: auto;
    height: 100%;
    max-width: 100%;
    min-height: 0;
    aspect-ratio: 1 / 1.08;
    margin: 0 auto;
    grid-template-rows: 14px minmax(0, 1fr);
  }

  .game-screen:has(.boss-banner:not([hidden])) .card-panel {
    width: auto;
  }

  .run-hud {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }

  .build-strip {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
  }

  .origin-banner,
  .boss-banner {
    grid-column: 2;
    grid-row: 3;
    align-self: start;
    margin: 0;
  }

  .origin-banner {
    display: none;
  }

  .command-dock {
    display: grid;
    grid-column: 2;
    grid-row: 4;
    grid-template-columns: minmax(0, 2fr) minmax(110px, 1fr);
    gap: 5px;
  }

  .score-feed {
    display: none;
  }

  .choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
  }

  .lucky-panel.is-scout {
    right: 5px;
    bottom: 5px;
    left: calc(43% + 10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
