/* M3 gameplay shell. Competitive information is intentionally opaque and
   high contrast; decoration is added in the renderer without changing the
   core state. */

:root {
  --game-cyan: #79e6ff;
  --game-blue: #6e8dff;
  --game-gold: #ffd166;
  --game-pink: #ff7bbd;
  --game-green: #75f0bb;
  --game-panel: rgba(6, 12, 31, 0.83);
  --game-border: rgba(146, 188, 255, 0.25);
}

.game-app {
  width: min(100%, 1180px);
  padding: clamp(16px, 3vw, 32px);
}

/* The document is intentionally fixed; long non-game screens must therefore
   keep their own bounded scroll region inside the app card. */
.app-shell[data-screen="home"],
.app-shell[data-screen="result"] {
  place-items: stretch;
}

.app-shell[data-screen="home"] .game-app,
.app-shell[data-screen="result"] .game-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
}

.app-shell[data-screen="play"] {
  touch-action: none;
  overscroll-behavior: none;
}

.game-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  text-align: left;
}

.game-header .status {
  flex: 0 1 auto;
  min-height: 0;
  margin: 0;
  text-align: right;
  white-space: nowrap;
}

.screen {
  width: 100%;
  min-height: 0;
  min-width: 0;
  margin-top: clamp(18px, 3vw, 30px);
}

.screen--home,
.screen--result {
  flex: 1 1 auto;
  display: grid;
  justify-items: center;
  gap: 20px;
  min-height: 0;
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(24px, 5vw, 58px) clamp(16px, 5vw, 56px);
  scrollbar-gutter: stable;
  border: 1px solid var(--game-border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 10%, rgba(121, 230, 255, 0.13), transparent 42%),
    rgba(7, 12, 29, 0.72);
}

.screen--home {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.home-scroll {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  justify-items: center;
  gap: 20px;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(24px, 5vw, 58px) clamp(16px, 5vw, 56px);
  scrollbar-gutter: stable;
}

.screen--home .home-actions {
  flex: 0 0 auto;
  width: 100%;
  padding: 12px clamp(16px, 5vw, 56px) max(12px, var(--safe-bottom));
  border-top: 1px solid rgba(146, 188, 255, 0.18);
  background: linear-gradient(180deg, rgba(7, 12, 29, 0.58), rgba(7, 12, 29, 0.94) 30%);
}

.home-intro {
  max-width: 640px;
  text-align: center;
}

.home-intro h2,
.screen--result h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.95rem);
  line-height: 1.3;
}

.home-intro p:not(.home-kicker) {
  margin: 14px auto 0;
  color: var(--muted);
  line-height: 1.7;
}

.home-kicker {
  margin: 0;
  color: var(--game-cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.home-rules {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px 16px;
  color: #d9e2ff;
  font-size: 0.83rem;
}

.home-rules span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.rule-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.rule-dot--cyan { color: var(--game-cyan); background: currentColor; }
.rule-dot--gold { color: var(--game-gold); background: currentColor; }
.rule-dot--pink { color: var(--game-pink); background: currentColor; }

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 10px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
  touch-action: manipulation;
}

.primary-button {
  color: #071023;
  background: linear-gradient(120deg, var(--game-cyan), #b4f7ff);
  box-shadow: 0 8px 28px rgba(45, 201, 255, 0.25);
}

.secondary-button {
  color: var(--text);
  border-color: var(--game-border);
  background: rgba(17, 27, 57, 0.8);
}

.primary-button:hover,
.secondary-button:hover,
.primary-button:focus-visible,
.secondary-button:focus-visible {
  filter: brightness(1.12);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(1px) scale(0.99);
}

.primary-button:focus-visible,
.secondary-button:focus-visible {
  outline: 2px solid var(--game-gold);
  outline-offset: 3px;
}

.home-hint {
  margin: -4px 0 0;
  color: #8d9abd;
  font-size: 0.75rem;
}

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

.score-guide {
  width: min(100%, 680px);
  border: 1px solid rgba(146, 188, 255, 0.2);
  border-radius: 14px;
  background: rgba(8, 15, 36, 0.58);
  color: #dbe5ff;
  text-align: left;
}

.score-guide summary,
.result-breakdown summary {
  padding: 11px 14px;
  color: var(--game-cyan);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  touch-action: manipulation;
}

.score-guide__body {
  padding: 0 16px 14px;
  color: #b9c5e4;
  font-size: 0.72rem;
  line-height: 1.55;
}

.score-guide__body h3 {
  margin: 10px 0 4px;
  color: #edf3ff;
  font-size: 0.75rem;
}

.score-guide__body p,
.score-guide__body ul {
  margin: 4px 0;
}

.score-guide__body ul {
  padding-left: 1.3em;
}

.profile-panel {
  display: grid;
  width: min(100%, 640px);
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(146, 188, 255, 0.2);
  border-radius: 16px;
  background: rgba(8, 15, 36, 0.58);
  text-align: left;
}

.profile-panel__heading,
.profile-best,
.field-row,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-best-label {
  color: #9da9c9;
  font-size: 0.68rem;
}

.quality-active-label {
  margin: -4px 0 0;
  color: #8fa2cf;
  font-size: 0.66rem;
  text-align: right;
}

.field-row,
.toggle-row {
  color: #dbe5ff;
  font-size: 0.76rem;
}

.field-row input,
.field-row select {
  min-width: 0;
  border: 1px solid rgba(146, 188, 255, 0.28);
  border-radius: 9px;
  background: rgba(17, 27, 57, 0.92);
  color: var(--text);
  padding: 8px 10px;
}

.field-row input {
  width: min(55%, 230px);
}

.field-row select {
  width: 86px;
}

.field-row input:focus-visible,
.field-row select:focus-visible,
.toggle-row input:focus-visible {
  outline: 2px solid var(--game-cyan);
  outline-offset: 2px;
}

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

.toggle-row {
  justify-content: flex-start;
  padding: 0 4px;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--game-cyan);
}

.field-error {
  margin: -3px 0 0;
  color: var(--danger);
  font-size: 0.7rem;
}

.profile-best {
  justify-content: flex-start;
  color: #9da9c9;
  font-size: 0.68rem;
}

.profile-best span {
  display: inline-flex;
  gap: 5px;
}

.profile-best strong {
  color: var(--game-gold);
  font-variant-numeric: tabular-nums;
}

.screen--practice {
  display: grid;
  justify-items: center;
  gap: 16px;
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
  padding: clamp(24px, 5vw, 58px) clamp(16px, 5vw, 56px);
  border: 1px solid var(--game-border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 10%, rgba(121, 230, 255, 0.13), transparent 42%),
    rgba(7, 12, 29, 0.72);
  text-align: center;
}

.screen--practice h2 {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 2rem);
}

.practice-message {
  max-width: 40rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.practice-stage-label {
  margin: -8px 0 0;
  color: var(--game-gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.practice-value {
  display: grid;
  min-width: 130px;
  min-height: 86px;
  place-items: center;
  border: 1px solid rgba(121, 230, 255, 0.3);
  border-radius: 18px;
  background: rgba(17, 32, 65, 0.65);
  box-shadow: inset 0 0 28px rgba(121, 230, 255, 0.08);
}

.practice-value strong {
  color: var(--game-gold);
  font-size: 2.2rem;
  font-variant-numeric: tabular-nums;
}

.practice-board {
  position: relative;
  width: min(100%, 680px);
  overflow: hidden;
  border: 1px solid rgba(121, 230, 255, 0.34);
  border-radius: 18px;
  background: #05091a;
  box-shadow: inset 0 0 30px rgba(121, 230, 255, 0.08), 0 14px 36px rgba(0, 0, 0, 0.24);
  aspect-ratio: 16 / 9;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#practice-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.practice-board-status {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  color: #dce7ff;
  font-size: 0.7rem;
  text-align: left;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.practice-board-status span:first-child {
  min-width: 3.2em;
  color: var(--game-gold);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.practice-board[data-practice-state="success"] {
  border-color: rgba(117, 240, 187, 0.72);
  box-shadow: inset 0 0 36px rgba(117, 240, 187, 0.16), 0 0 28px rgba(117, 240, 187, 0.18);
}

.practice-board[data-practice-state="stage-transition"] {
  border-color: rgba(255, 209, 102, 0.72);
  box-shadow: inset 0 0 36px rgba(255, 209, 102, 0.14), 0 0 28px rgba(255, 209, 102, 0.16);
}

.practice-board[data-practice-state="expired"] {
  border-color: rgba(255, 209, 102, 0.56);
}

.practice-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 8px;
}

.practice-steps > div {
  display: grid;
  gap: 4px;
  padding: 12px 8px;
  border: 1px solid rgba(146, 188, 255, 0.17);
  border-radius: 12px;
  background: rgba(14, 23, 48, 0.64);
}

.practice-steps span {
  color: var(--game-cyan);
  font-weight: 800;
}

.practice-steps strong {
  color: #edf3ff;
}

.practice-steps small {
  color: #aab6d6;
  font-size: 0.68rem;
  line-height: 1.4;
}

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

.screen--countdown,
.screen--finalizing {
  display: grid;
  min-height: min(58vh, 420px);
  place-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
}

.countdown-label,
.screen--finalizing h2,
.screen--finalizing p {
  margin: 0;
}

.countdown-label {
  color: var(--game-cyan);
  font-size: 0.9rem;
  letter-spacing: 0.14em;
}

.countdown-value {
  display: block;
  min-width: 1.1em;
  color: var(--game-gold);
  font-size: clamp(5rem, 18vw, 10rem);
  line-height: 0.95;
  text-shadow: 0 0 42px rgba(255, 209, 102, 0.48);
}

#countdown-message,
.screen--finalizing p {
  color: var(--muted);
}

.game-frame {
  position: relative;
  --pause-control-width: clamp(96px, 10vw, 120px);
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  overflow: hidden;
  /* Keep the visible frame stroke out of layout so the canvas retains the
     exact same aspect ratio as the logical board. */
  border: 0;
  border-radius: clamp(12px, 2vw, 22px);
  background: #05091a;
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px rgba(121, 230, 255, 0.34),
    inset 0 0 0 2px rgba(255, 255, 255, 0.04);
  isolation: isolate;
  aspect-ratio: 16 / 9;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: contain;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.game-hud {
  position: absolute;
  top: clamp(8px, 1.6vw, 18px);
  /* Reserve an explicit column for the pause control. This keeps every HUD
     pill, including the forecast row, outside the button hit area. */
  right: calc(clamp(8px, 1.6vw, 18px) + var(--pause-control-width) + 8px);
  left: clamp(8px, 1.6vw, 18px);
  z-index: 2;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 7px;
  pointer-events: none;
}

.hud-pill,
.hud-forecast {
  display: inline-flex;
  align-items: baseline;
  min-width: 0;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(160, 205, 255, 0.23);
  border-radius: 10px;
  background: var(--game-panel);
  color: var(--text);
  backdrop-filter: blur(7px);
}

.hud-pill strong {
  color: #f9fbff;
  font-size: clamp(0.92rem, 2.1vw, 1.25rem);
  font-variant-numeric: tabular-nums;
}

.hud-label {
  color: #a8b7dd;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.hud-pill--score strong { color: var(--game-cyan); }
.hud-pill--time strong { color: var(--game-gold); }
.hud-pill--combo strong { color: var(--game-pink); }
.hud-pill--blast strong { color: var(--game-gold); font-size: 0.78rem; }
.hud-pill--choices strong { color: var(--game-green); }

.hud-pill--selection {
  margin-left: auto;
}

.hud-subvalue {
  min-width: 2.3em;
  color: #b8c5e7;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.hud-forecast {
  flex-basis: 100%;
  max-width: 100%;
  align-items: center;
  gap: 10px;
  padding-top: 5px;
  padding-bottom: 5px;
}

.forecast-items {
  display: inline-flex;
  gap: 6px;
}

#hud-forecast-items {
  flex: 1 1 auto;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.forecast-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 22px;
  padding: 2px 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(16, 27, 61, 0.44);
  color: #eaf1ff;
  font-size: 0.7rem;
}

.forecast-item--window-open {
  border-color: rgba(255, 209, 102, 0.72);
  background: rgba(104, 77, 23, 0.34);
  box-shadow: 0 0 13px rgba(255, 209, 102, 0.2);
}

.forecast-item--ready {
  border-color: rgba(255, 238, 168, 0.96);
  background: rgba(126, 88, 18, 0.46);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.38);
}

.forecast-position,
.forecast-arrival {
  color: #b8c5e7;
  font-variant-numeric: tabular-nums;
}

.forecast-arrival {
  color: #79e6ff;
}

.forecast-item--window-open .forecast-arrival,
.forecast-item--ready .forecast-arrival {
  color: #fff0a8;
}

.forecast-cue {
  color: var(--game-gold);
  font-size: 0.62rem;
  font-weight: 800;
  white-space: nowrap;
}

.forecast-item--ready .forecast-cue {
  color: #fff4bf;
}

.forecast-swatch {
  display: inline-grid;
  width: 13px;
  height: 13px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.52rem;
  font-weight: 800;
}

.play-message {
  position: absolute;
  right: 0;
  bottom: 10px;
  left: 0;
  z-index: 2;
  min-height: 1.2em;
  color: #eaf1ff;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  text-align: center;
  text-shadow: 0 1px 7px #05091a;
  pointer-events: none;
}

.resume-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  background: rgba(4, 8, 23, 0.76);
  color: #eaf1ff;
  text-align: center;
  backdrop-filter: blur(5px);
}

.resume-overlay strong {
  color: var(--game-gold);
  font-size: clamp(3rem, 12vw, 6rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.resume-overlay small {
  color: #bac6e5;
}

.pause-button {
  position: absolute;
  top: clamp(8px, 1.6vw, 18px);
  right: clamp(8px, 1.6vw, 18px);
  z-index: 4;
  width: var(--pause-control-width);
  min-width: 44px;
  min-height: 44px;
  padding: 7px 8px;
  color: #eef5ff;
  background: rgba(6, 12, 31, 0.86);
  white-space: nowrap;
  pointer-events: auto;
}

.pause-menu {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 7, 19, 0.78);
  backdrop-filter: blur(7px);
  pointer-events: auto;
}

.pause-menu__card {
  display: grid;
  width: min(100%, 430px);
  gap: 10px;
  padding: clamp(20px, 4vw, 32px);
  border: 1px solid rgba(121, 230, 255, 0.34);
  border-radius: 18px;
  background: rgba(8, 15, 36, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  text-align: center;
}

.pause-menu__card h2,
.pause-menu__card p {
  margin: 0;
}

.pause-menu__card > p:not(.home-kicker) {
  color: #bac6e5;
  font-size: 0.78rem;
}

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

.pause-menu__actions button {
  min-height: 44px;
  padding: 8px 6px;
  font-size: 0.72rem;
}

.pause-rules {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(146, 188, 255, 0.18);
  border-radius: 10px;
  background: rgba(14, 23, 48, 0.7);
  color: #c7d3ef;
  font-size: 0.7rem;
  line-height: 1.5;
  text-align: left;
}

.pause-rules p {
  margin: 0;
}

.play-instruction {
  margin: 10px 0 0;
  color: #9da9c9;
  font-size: 0.78rem;
  text-align: center;
}

.screen--result .result-score {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: -3px 0 2px;
}

.result-score strong {
  color: var(--game-cyan);
  font-size: clamp(2.5rem, 11vw, 5rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 0 34px rgba(121, 230, 255, 0.26);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  width: min(100%, 600px);
  gap: 8px;
}

.result-grid > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 7px;
  border: 1px solid rgba(146, 188, 255, 0.17);
  border-radius: 10px;
  background: rgba(14, 23, 48, 0.64);
  text-align: center;
}

.result-grid span {
  color: #aab6d6;
  font-size: 0.66rem;
}

.result-grid strong {
  color: #edf3ff;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.result-breakdown {
  width: min(100%, 600px);
  border: 1px solid rgba(146, 188, 255, 0.17);
  border-radius: 12px;
  background: rgba(8, 15, 36, 0.5);
  text-align: left;
}

.result-breakdown dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 16px;
  margin: 0;
  padding: 0 14px 13px;
}

.result-breakdown dl > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #b8c5e7;
  font-size: 0.7rem;
}

.result-breakdown dt,
.result-breakdown dd {
  margin: 0;
}

.result-breakdown dd {
  color: #edf3ff;
  font-variant-numeric: tabular-nums;
}

.result-breakdown__deduction dd {
  color: #ffb3b3;
}

.result-replay {
  min-height: 1.4em;
  margin: 0;
  color: var(--game-green);
  font-size: 0.78rem;
  text-align: center;
}

.result-replay[data-fault="true"] {
  color: var(--danger);
}

.result-player-name {
  margin: -10px 0 0;
  color: #bac6e5;
  font-size: 0.82rem;
}

.result-status {
  margin: -12px 0 0;
  color: var(--game-green);
  font-size: 0.75rem;
  font-weight: 800;
}

.result-status[data-retired="true"] {
  color: var(--game-gold);
}

.result-best-mark {
  margin: -5px 0 0;
  color: var(--game-gold);
  font-weight: 800;
}

.result-record {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: -4px 0 0;
  color: #aab6d6;
  font-size: 0.7rem;
}

.result-record strong {
  color: #edf3ff;
  font-variant-numeric: tabular-nums;
}

.result-hint {
  max-width: 40rem;
  margin: -2px 0 0;
  color: var(--game-cyan);
  font-size: 0.78rem;
  line-height: 1.5;
}

.result-ranking {
  width: min(100%, 600px);
  padding: 13px 14px 12px;
  border: 1px solid rgba(146, 188, 255, 0.17);
  border-radius: 12px;
  background: rgba(8, 15, 36, 0.5);
  text-align: left;
}

.result-ranking__heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.result-ranking__heading h3 {
  margin: 0;
  color: var(--game-cyan);
  font-size: 0.8rem;
}

.result-ranking__heading span,
.result-ranking__note {
  color: #8fa2cf;
  font-size: 0.65rem;
}

.result-ranking__status {
  min-height: 1.1em;
  margin: 8px 0 0;
  color: var(--game-green);
  font-size: 0.65rem;
  line-height: 1.45;
}

.result-ranking__status[data-state="retryable_failed"],
.result-ranking__status[data-state="permanent_failed"] {
  color: #ffd166;
}

.result-ranking__list {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.result-ranking__list li {
  display: grid;
  grid-template-columns: 2em minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 4px 6px;
  border-radius: 7px;
  background: rgba(14, 23, 48, 0.62);
  color: #dce7ff;
  font-size: 0.7rem;
}

.result-ranking__rank {
  color: var(--game-gold);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.result-ranking__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-ranking__name-block {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.result-ranking__version {
  overflow: hidden;
  color: #8fa2cf;
  font-size: 0.58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-ranking__score {
  color: #eef5ff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.result-ranking__empty {
  color: #9da9c9;
  text-align: center;
}

.result-ranking__note {
  margin: 9px 0 0;
  line-height: 1.45;
}

.result-ranking__retry {
  min-height: 34px;
  margin-top: 8px;
  padding: 6px 10px;
  font-size: 0.68rem;
}

.result-ranking--legacy {
  border-color: rgba(255, 209, 102, 0.22);
  background: rgba(31, 24, 20, 0.42);
}

.result-ranking--legacy .result-ranking__heading h3 {
  color: var(--game-gold);
}

.share-panel {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.share-status {
  min-height: 1.2em;
  margin: 0;
  color: var(--game-green);
  font-size: 0.7rem;
}

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

.finalizing-mark {
  width: 64px;
  height: 64px;
  border: 2px solid rgba(121, 230, 255, 0.26);
  border-top-color: var(--game-cyan);
  border-radius: 50%;
  animation: m3-spin 900ms linear infinite;
}

@keyframes m3-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
  .game-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .game-header .status {
    text-align: left;
  }

  .hud-pill {
    min-height: 29px;
    padding: 4px 7px;
    gap: 4px;
  }

  /* The narrow HUD is a fixed four-row tray. Every item gets one grid cell,
     so the pause target and the forecast never compete for the same pixels. */
  .game-hud {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "score time combo"
      "selection selection selection"
      "blast blast choices"
      "forecast forecast forecast";
    align-items: stretch;
    gap: 5px;
    padding: 6px;
    border: 1px solid rgba(146, 188, 255, 0.18);
    border-radius: 14px;
    background: rgba(5, 10, 27, 0.62);
    backdrop-filter: blur(8px);
  }

  .game-hud > .hud-pill,
  .game-hud > .hud-forecast {
    width: 100%;
    min-width: 0;
  }

  .hud-pill--score { grid-area: score; }
  .hud-pill--time { grid-area: time; }
  .hud-pill--combo { grid-area: combo; }
  .hud-pill--selection { grid-area: selection; }
  .hud-pill--blast { grid-area: blast; }
  .hud-pill--choices { grid-area: choices; }
  .hud-forecast {
    grid-area: forecast;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  #hud-forecast-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .forecast-item {
    flex-wrap: wrap;
    align-content: center;
    overflow: hidden;
  }

  .forecast-item .forecast-position,
  .forecast-item .forecast-arrival {
    white-space: nowrap;
  }

  .forecast-item .forecast-cue {
    flex: 1 0 100%;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
  }

  .hud-pill--selection {
    margin-left: 0;
  }

  .hud-pill--blast strong {
    font-size: 0.68rem;
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .game-app {
    padding: 15px 12px;
  }

  .screen--home,
  .screen--result {
    border-radius: 18px;
  }

  .screen--home {
    padding: 0;
  }

  .home-scroll {
    padding: 28px 14px;
  }

  .hud-forecast {
    overflow: hidden;
    white-space: normal;
  }

  .game-hud {
    gap: 4px;
    padding: 5px;
  }

  .hud-pill {
    padding-right: 5px;
    padding-left: 5px;
  }

  .hud-forecast .hud-label {
    flex: 0 0 auto;
  }

  #hud-forecast-items {
    overflow: hidden;
  }

  .profile-settings-grid,
  .practice-steps {
    grid-template-columns: 1fr;
  }

  .practice-board-status {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .field-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-row input,
  .field-row select {
    width: 100%;
  }

  .pause-menu__actions {
    grid-template-columns: 1fr;
  }

  .result-ranking__heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .finalizing-mark {
    animation-duration: 2.4s;
  }
}

/* Portrait uses the same logical 16:9 board rotated clockwise: the logical
   top edge appears on the screen's right and the logical bottom on the left.
   CanvasRenderer owns the matching coordinate transform. */
@media (orientation: portrait) {
  .app-shell[data-screen="play"] {
    min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    place-items: center;
    padding: 8px;
  }

  .app-shell[data-screen="play"] .game-app {
    width: 100%;
    max-width: 620px;
    padding: 8px;
  }

  .app-shell[data-screen="play"] .game-header {
    align-items: center;
    gap: 3px;
  }

  .app-shell[data-screen="play"] .game-header .status {
    text-align: center;
  }

  .app-shell[data-screen="play"] .screen--play {
    margin-top: 8px;
  }

  .app-shell[data-screen="play"] .game-frame {
    --portrait-board-height: min(
      calc(100dvh - var(--safe-top) - var(--safe-bottom) - 142px),
      900px
    );
    width: min(100%, calc(var(--portrait-board-height) * 9 / 16));
    height: auto;
    aspect-ratio: 9 / 16;
  }

  .app-shell[data-screen="play"] .play-instruction {
    max-width: 28rem;
    margin-right: auto;
    margin-left: auto;
  }

  .app-shell[data-screen="practice"] .practice-board {
    width: min(100%, 430px);
    aspect-ratio: 9 / 16;
  }
}

/* A landscape phone has little vertical budget. Keep the complete 16:9
   board inside the visual viewport while the home/result cards retain their
   comfortable layout. */
@media (orientation: landscape) and (max-height: 600px) {
  .app-shell[data-screen="practice"] {
    min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    place-items: center;
    padding: 4px 8px;
  }

  .app-shell[data-screen="practice"] .game-app {
    display: grid;
    width: 100%;
    max-width: none;
    min-height: 0;
    padding: 4px 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .app-shell[data-screen="practice"] .game-header,
  .app-shell[data-screen="practice"] .notice {
    display: none;
  }

  .app-shell[data-screen="practice"] .screen--practice {
    grid-template-areas:
      "board kicker"
      "board title"
      "board stage"
      "board message"
      "board value"
      "board steps"
      "board actions";
    grid-template-columns: minmax(0, 1fr) minmax(210px, 0.38fr);
    align-content: center;
    align-items: center;
    gap: 4px 10px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: left;
  }

  .app-shell[data-screen="practice"] .home-kicker {
    grid-area: kicker;
    font-size: 0.58rem;
  }

  .app-shell[data-screen="practice"] .screen--practice h2 {
    grid-area: title;
    font-size: clamp(0.9rem, 2.6vw, 1.15rem);
  }

  .app-shell[data-screen="practice"] .practice-stage-label {
    grid-area: stage;
    margin: 0;
    font-size: 0.62rem;
  }

  .app-shell[data-screen="practice"] .practice-message {
    grid-area: message;
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .app-shell[data-screen="practice"] .practice-value {
    grid-area: value;
    width: 100%;
    min-width: 0;
    min-height: 32px;
    border-radius: 9px;
  }

  .app-shell[data-screen="practice"] .practice-value strong {
    font-size: 1.05rem;
  }

  .app-shell[data-screen="practice"] .practice-board {
    grid-area: board;
    width: 100%;
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px);
    justify-self: center;
    border-radius: 12px;
  }

  .app-shell[data-screen="practice"] .practice-steps {
    grid-area: steps;
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .app-shell[data-screen="practice"] .practice-steps > div {
    display: grid;
    grid-template-columns: 18px 52px 1fr;
    align-items: center;
    gap: 3px;
    padding: 3px 5px;
    border-radius: 7px;
  }

  .app-shell[data-screen="practice"] .practice-steps small {
    font-size: 0.57rem;
    line-height: 1.2;
  }

  .app-shell[data-screen="practice"] .practice-actions {
    display: grid;
    grid-area: actions;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
  }

  .app-shell[data-screen="practice"] .practice-actions button {
    min-height: 44px;
    padding: 4px 7px;
    font-size: 0.66rem;
  }

  .app-shell[data-screen="play"] {
    min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    place-items: center;
    padding: 4px 8px;
  }

  .app-shell[data-screen="play"] .game-app {
    display: grid;
    width: 100%;
    max-width: none;
    min-height: 0;
    padding: 5px 8px 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .app-shell[data-screen="play"] .game-header,
  .app-shell[data-screen="play"] .notice,
  .app-shell[data-screen="play"] .play-instruction {
    display: none;
  }

  .app-shell[data-screen="play"] .screen--play {
    margin-top: 0;
  }

  .app-shell[data-screen="play"] .game-frame {
    width: min(100%, calc((100dvh - var(--safe-top) - var(--safe-bottom) - 16px) * 16 / 9));
    height: auto;
    aspect-ratio: 16 / 9;
    max-width: none;
    margin: 0 auto;
  }
}

/* A running game owns the visual viewport. The page itself never scrolls;
   only the home, practice, and result panels can scroll when their copy is
   longer than a small device. */
.app-shell[data-screen="play"] {
  height: 100%;
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  padding: 0;
  place-items: stretch;
}

.app-shell[data-screen="play"] .game-app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-shell[data-screen="play"] .game-header,
.app-shell[data-screen="play"] .notice,
.app-shell[data-screen="play"] .play-instruction {
  display: none;
}

.app-shell[data-screen="play"] .screen--play {
  display: grid;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  margin: 0;
  place-items: center;
}

.app-shell[data-screen="play"] .game-frame {
  width: min(100%, calc((100dvh - var(--safe-top) - var(--safe-bottom) - 16px) * 16 / 9));
  height: auto;
  max-width: 1120px;
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 16px);
  margin: 0 auto;
  aspect-ratio: 16 / 9;
}

@media (orientation: portrait) {
  .app-shell[data-screen="play"] .game-frame {
    width: min(100%, calc((100dvh - var(--safe-top) - var(--safe-bottom) - 16px) * 9 / 16));
    aspect-ratio: 9 / 16;
  }
}

@media (orientation: portrait) and (max-width: 720px) {
  .app-shell[data-screen="practice"] {
    height: 100%;
    min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    padding: 0;
    place-items: stretch;
  }

  .app-shell[data-screen="practice"] .game-app {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .app-shell[data-screen="practice"] .game-header,
  .app-shell[data-screen="practice"] .notice {
    display: none;
  }

  .app-shell[data-screen="practice"] .screen--practice {
    align-content: start;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px 10px max(12px, var(--safe-bottom));
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  /* Keep the primary practice action in the first visible row without
     changing the DOM order used by the landscape board. */
  .app-shell[data-screen="practice"] .screen--practice {
    grid-template-areas:
      "actions"
      "kicker"
      "title"
      "stage"
      "message"
      "value"
      "board"
      "steps";
  }

  .app-shell[data-screen="practice"] .home-kicker { grid-area: kicker; }
  .app-shell[data-screen="practice"] .screen--practice h2 { grid-area: title; }
  .app-shell[data-screen="practice"] .practice-stage-label { grid-area: stage; }
  .app-shell[data-screen="practice"] .practice-message { grid-area: message; }
  .app-shell[data-screen="practice"] .practice-value { grid-area: value; }
  .app-shell[data-screen="practice"] .practice-board { grid-area: board; }
  .app-shell[data-screen="practice"] .practice-steps { grid-area: steps; }
  .app-shell[data-screen="practice"] .practice-actions { grid-area: actions; }

  .app-shell[data-screen="practice"] .practice-actions {
    position: sticky;
    top: 0;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 7px;
    padding: 6px 0 8px;
    background: linear-gradient(180deg, rgba(8, 11, 24, 0.98) 72%, rgba(8, 11, 24, 0));
  }

  .app-shell[data-screen="practice"] .practice-actions #practice-start,
  .app-shell[data-screen="practice"] .practice-actions #practice-continue {
    grid-column: 1 / -1;
  }

  .app-shell[data-screen="practice"] .practice-actions button {
    min-height: 44px;
    min-width: 0;
    padding: 8px 7px;
    font-size: 0.78rem;
  }

  .app-shell[data-screen="practice"] .practice-value {
    min-width: 100px;
    min-height: 52px;
  }

  .app-shell[data-screen="practice"] .practice-value strong {
    font-size: 1.7rem;
  }

  .app-shell[data-screen="practice"] .practice-board {
    width: auto;
    height: min(calc(100dvh - var(--safe-top) - var(--safe-bottom) - 182px), 640px);
    max-width: 100%;
    aspect-ratio: 9 / 16;
    justify-self: center;
  }

  .app-shell[data-screen="practice"] .practice-message {
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="running"] .practice-steps,
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="stage-transition"] .practice-steps {
    display: none;
  }
}

/* Keep the competitive board as a clean input surface.  HUD, pause, and
   feedback live in their own rows so a firework can never be hidden under a
   decorative or informational layer. */
.app-shell[data-screen="play"] .screen--play {
  display: grid;
  min-height: 0;
  margin-top: 0;
  place-items: center;
}

.app-shell[data-screen="play"] .play-stage {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 7px;
  width: min(100%, 1120px);
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  margin: 0 auto;
}

.app-shell[data-screen="play"] .play-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  min-width: 0;
}

.app-shell[data-screen="play"] .play-toolbar .game-hud {
  position: static;
  inset: auto;
  right: auto;
  left: auto;
  z-index: auto;
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(146, 188, 255, 0.18);
  border-radius: 14px;
  background: rgba(5, 10, 27, 0.78);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.app-shell[data-screen="play"] .play-toolbar .game-hud > .hud-pill,
.app-shell[data-screen="play"] .play-toolbar .game-hud > .hud-forecast {
  width: auto;
  min-width: 0;
}

.app-shell[data-screen="play"] .play-toolbar .game-hud > .hud-forecast {
  flex-basis: 100%;
}

.app-shell[data-screen="play"] .play-toolbar .hud-pill--selection {
  margin-left: auto;
}

.app-shell[data-screen="play"] .play-toolbar .pause-button {
  position: static;
  top: auto;
  right: auto;
  align-self: stretch;
  width: clamp(96px, 10vw, 120px);
  min-width: 96px;
  min-height: 44px;
  margin: 0;
}

.app-shell[data-screen="play"] .play-stage > .game-frame {
  align-self: center;
  width: min(100%, calc((100dvh - var(--safe-top) - var(--safe-bottom) - 132px) * 16 / 9));
  height: min(
    calc(100dvh - var(--safe-top) - var(--safe-bottom) - 132px),
    calc(100vw * 9 / 16)
  );
  max-width: 1120px;
  min-height: 0;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
}

.app-shell[data-screen="play"] #game-canvas {
  position: relative;
  z-index: 1;
}

.app-shell[data-screen="play"] .play-stage > .play-message {
  position: static;
  right: auto;
  bottom: auto;
  left: auto;
  z-index: auto;
  width: 100%;
  min-height: 1.2em;
  color: #eaf1ff;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
  line-height: 1.3;
  text-align: center;
  text-shadow: none;
  pointer-events: none;
}

@media (max-width: 720px) {
  .app-shell[data-screen="play"] .play-toolbar {
    gap: 5px;
  }

  .app-shell[data-screen="play"] .play-toolbar .game-hud {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "score time combo"
      "selection selection selection"
      "blast blast choices"
      "forecast forecast forecast";
    align-items: stretch;
    gap: 4px;
    padding: 5px;
  }

  .app-shell[data-screen="play"] .play-toolbar .hud-pill,
  .app-shell[data-screen="play"] .play-toolbar .hud-forecast {
    min-height: 27px;
    padding: 3px 5px;
  }

  .app-shell[data-screen="play"] .play-toolbar .game-hud > .hud-pill,
  .app-shell[data-screen="play"] .play-toolbar .game-hud > .hud-forecast {
    width: 100%;
  }

  .app-shell[data-screen="play"] .play-toolbar .hud-pill--score { grid-area: score; }
  .app-shell[data-screen="play"] .play-toolbar .hud-pill--time { grid-area: time; }
  .app-shell[data-screen="play"] .play-toolbar .hud-pill--combo { grid-area: combo; }
  .app-shell[data-screen="play"] .play-toolbar .hud-pill--selection {
    grid-area: selection;
    margin-left: 0;
  }
  .app-shell[data-screen="play"] .play-toolbar .hud-pill--blast { grid-area: blast; }
  .app-shell[data-screen="play"] .play-toolbar .hud-pill--choices { grid-area: choices; }
  .app-shell[data-screen="play"] .play-toolbar .hud-forecast {
    grid-area: forecast;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .app-shell[data-screen="play"] .play-toolbar .hud-forecast > #hud-forecast-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    min-width: 0;
  }

  .app-shell[data-screen="play"] .play-toolbar .forecast-item {
    min-width: 0;
    flex-wrap: wrap;
    align-content: center;
    overflow: hidden;
  }

  .app-shell[data-screen="play"] .play-toolbar .forecast-item .forecast-position,
  .app-shell[data-screen="play"] .play-toolbar .forecast-item .forecast-arrival {
    white-space: nowrap;
  }

  .app-shell[data-screen="play"] .play-toolbar .forecast-item .forecast-cue {
    flex: 1 0 100%;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
  }

  .app-shell[data-screen="play"] .play-stage > .game-frame {
    width: min(100%, calc((100dvh - var(--safe-top) - var(--safe-bottom) - 162px) * 16 / 9));
    height: min(
      calc(100dvh - var(--safe-top) - var(--safe-bottom) - 162px),
      calc(100vw * 9 / 16)
    );
  }
}

@media (orientation: portrait) {
  .app-shell[data-screen="play"] .screen--play {
    padding-top: max(42px, calc(var(--safe-top) + 34px));
  }

  .app-shell[data-screen="play"] .play-stage > .game-frame {
    width: min(100%, calc((100dvh - var(--safe-top) - var(--safe-bottom) - 220px) * 9 / 16));
    height: min(
      calc(100dvh - var(--safe-top) - var(--safe-bottom) - 220px),
      calc(100vw * 16 / 9)
    );
    aspect-ratio: 9 / 16;
  }
}

@media (max-width: 720px) {
  .screen--result .result-actions {
    position: sticky;
    top: 0;
    z-index: 4;
    width: 100%;
    padding: 6px 0 8px;
    background: linear-gradient(180deg, rgba(7, 12, 29, 0.98) 72%, rgba(7, 12, 29, 0));
  }
}

/* Portrait guidance is a fixed, non-interactive strip so it never consumes a
   grid row or pushes the board and actions below the fold. */
@media (orientation: portrait) {
  #orientation-guide {
    position: fixed;
    top: max(8px, var(--safe-top));
    right: max(8px, var(--safe-right));
    left: max(8px, var(--safe-left));
    z-index: 8;
    max-width: 620px;
    margin: 0 auto;
    padding: 7px 10px;
    font-size: 0.72rem;
    line-height: 1.35;
    pointer-events: none;
  }

  .app-shell[data-screen="play"] #orientation-guide {
    right: calc(max(8px, var(--safe-right)) + 124px);
    left: max(8px, var(--safe-left));
  }

  .app-shell[data-screen="practice"] .screen--practice {
    padding-top: calc(max(42px, var(--safe-top)) + 34px);
  }
}

/* While the practice is active, the board is the task. The explanatory
   heading and step cards have already done their job, so give the remaining
   viewport height to the real input surface. This keeps every target in the
   first frame even on short portrait displays. */
@media (orientation: portrait) and (max-width: 720px) {
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="running"],
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="stage-transition"] {
    grid-template-areas:
      "actions"
      "stage"
      "message"
      "value"
      "board";
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    align-content: stretch;
    gap: 5px;
    overflow: hidden;
  }

  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="running"] .home-kicker,
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="running"] h2,
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="stage-transition"] .home-kicker,
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="stage-transition"] h2 {
    display: none;
  }

  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="running"] .practice-actions,
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="stage-transition"] .practice-actions {
    position: static;
    padding: 0;
    background: none;
  }

  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="running"] .practice-stage-label,
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="stage-transition"] .practice-stage-label {
    margin: 0;
    font-size: 0.68rem;
  }

  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="running"] .practice-message,
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="stage-transition"] .practice-message {
    max-width: 100%;
    font-size: 0.76rem;
    line-height: 1.35;
  }

  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="running"] .practice-value,
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="stage-transition"] .practice-value {
    min-height: 46px;
  }

  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="running"] .practice-board,
  .app-shell[data-screen="practice"] .screen--practice[data-practice-state="stage-transition"] .practice-board {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    align-self: center;
    justify-self: center;
  }
}

#share-button, #home-share-button { background:#000; color:#fff; min-height:44px; white-space:normal; overflow-wrap:anywhere; }

/* Locale labels can be longer than the Japanese source. */
.language-setting { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-block:12px; }
.language-setting select { min-height:44px; max-width:100%; font:inherit; background:#0b1630; color:#fff; border:1px solid #7185b5; border-radius:8px; padding:8px; }
.primary-button,.secondary-button { white-space:normal; overflow-wrap:anywhere; height:auto; min-height:44px; }
.hud-label { overflow-wrap:anywhere; white-space:normal; }
.result-ranking__name { overflow-wrap:anywhere; min-width:0; }

/* The board-direction hint is only useful while learning or playing. */
.app-shell[data-screen="home"] #orientation-guide,
.app-shell[data-screen="result"] #orientation-guide { display:none; }
.screen--home .home-scroll { gap:12px; padding-block:16px; }
.screen--home .language-setting { justify-self:start; max-width:100%; margin-block:0; }
#player-name { min-height:44px; font-size:16px; }
.profile-panel__heading .hud-label { letter-spacing:normal; font-size:0.76rem; }
