/* Title regions participate in layout; artwork and audio never float over actions. */
#game-frame .game-shell[data-screen='title'] #app {
  overflow: auto;
}
#game-frame .title-scene {
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(0, 1.1fr);
  grid-template-areas: 'heading players' 'actions players' 'audio players';
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 20px 28px;
  align-content: center;
  min-height: 100%;
  height: auto;
  padding: 24px;
  isolation: isolate;
}
#game-frame .title-scene > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.3;
  z-index: -1;
}
#game-frame .title-content {
  display: contents;
}
#game-frame .title-heading {
  grid-area: heading;
  padding: 0;
  margin: 0;
  width: 100%;
}
#game-frame .title-heading .brand-wordmark {
  width: min(100%, 250px);
}
#game-frame .title-actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  align-self: center;
  width: 100%;
  padding: 0;
  margin: 0;
}
#game-frame .title-actions .game-button {
  min-height: 44px;
  padding: 8px;
  font-size: var(--type-body);
  box-shadow: none;
}
#game-frame .title-actions :is([data-action='career'], [data-action='new-career']) {
  grid-column: 1/-1;
}
#game-frame .title-actions:has([data-action='career']) [data-action='game-help'] {
  grid-column: 1/-1;
}
#game-frame .title-actions .game-button small {
  font-size: var(--type-caption);
}
#game-frame .title-players {
  grid-area: players;
  position: relative;
  inset: auto;
  align-self: center;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 5px;
  width: 100%;
  max-height: none;
  padding: 0;
  margin: 0;
}
#game-frame .title-star {
  width: 100%;
  max-width: 110px;
  margin: 0;
  transform: none;
  animation: none;
  filter: none;
}
#game-frame .title-star:nth-child(2n) {
  margin: 0;
}
#game-frame .title-star > svg:first-child {
  width: 100%;
  max-height: 120px;
}
#game-frame .title-star > span {
  min-height: 34px;
  padding: 5px 2px;
  font-size: var(--type-caption);
  line-height: 1.2;
}
#game-frame .title-star > .team-badge {
  width: 18px;
  height: 22px;
  right: 0;
  top: 0;
}
#game-frame .title-bottom {
  grid-area: audio;
  position: static;
  inset: auto;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
  margin: 0;
}
#game-frame .title-bottom .audio-controls {
  gap: 6px;
}
#game-frame .title-bottom .audio-toggle {
  grid-template-columns: 18px minmax(0, 1fr) auto;
  min-height: 40px;
  padding: 6px;
  font-size: var(--type-caption);
  gap: 5px;
  box-shadow: none;
}
#game-frame .title-bottom .audio-toggle-icon {
  width: 18px;
  height: 18px;
}
#game-frame .title-bottom .audio-toggle-state {
  font-size: var(--type-caption);
}
#game-frame .title-bottom .beta-help-link {
  width: 36px;
  height: 40px;
  min-height: 40px;
  box-shadow: none;
}
@container game (max-width: 700px) {
  #game-frame .title-scene {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'heading' 'players' 'actions' 'audio';
    grid-template-rows: auto minmax(90px, 1fr) auto auto;
    gap: 14px;
    padding: 18px;
  }
  #game-frame .title-heading .brand-wordmark {
    width: min(74%, 240px);
    margin-inline: auto;
  }
  #game-frame .title-players {
    max-width: 460px;
    justify-self: center;
  }
  #game-frame .title-star > svg:first-child {
    max-height: 100px;
  }
}
@container game (max-width:700px) and (max-height:650px) {
  #game-frame .title-scene {
    gap: 9px;
    padding: 12px;
  }
  #game-frame .title-heading .brand-wordmark {
    width: min(64%, 180px);
  }
  #game-frame .title-star > svg:first-child {
    max-height: 68px;
  }
  #game-frame .title-star > span {
    font-size: var(--type-caption);
    min-height: 30px;
  }
  #game-frame .title-actions .game-button {
    min-height: 40px;
    padding: 6px;
    font-size: var(--type-caption);
  }
}
/* Pair cards own their strike switches. Bowler and playback controls share one bottom band. */
#game-shell .match-screen.phone-match {
  grid-template-columns: minmax(104px, 0.7fr) minmax(0, 1.3fr);
  grid-template-areas: 'score score' 'ground ground' 'comment comment' 'status status' 'batters batters' 'bowler controls';
  grid-template-rows: auto minmax(0, 1fr) auto auto auto auto;
}
#game-shell .phone-match > .match-scoreboard {
  grid-area: score;
}
#game-shell .phone-match > .stadium-wrap {
  grid-area: ground;
}
#game-shell .phone-match > .match-commentary {
  grid-area: comment;
}
#game-shell .phone-match > #field-status {
  grid-area: status;
}
#game-shell .phone-match #phone-contestants {
  display: contents;
}
#game-shell .phone-match .phone-batting-pair {
  grid-area: batters;
}
#game-shell .phone-match #phone-contestants > .phone-player-card {
  grid-area: bowler;
}
#game-shell .phone-match .phone-play-dock {
  grid-area: controls;
  padding: 4px;
}
#game-frame .phone-batter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  padding: 2px 6px 5px;
}
#game-frame .phone-batter-footer .player-settled {
  display: inline-flex;
  gap: 3px;
  font-size: var(--type-caption);
  white-space: nowrap;
}
#game-frame .phone-batter-footer .player-settled progress {
  display: none;
}
#game-frame .phone-batter-footer .keep-strike-toggle {
  font-size: var(--type-caption) !important;
  padding: 3px 5px !important;
  min-width: 0;
  margin: 0;
}
#game-shell .phone-match .phone-bowler {
  align-items: center;
  height: 100%;
  padding: 5px;
  gap: 5px;
}
#game-shell .phone-match .phone-bowler .phone-player-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
#game-shell .phone-match .phone-bowler .phone-player-copy > strong {
  white-space: normal;
  font-size: var(--type-caption);
}
#game-shell .phone-match .phone-bowler .phone-player-copy > .phone-player-figures {
  align-self: auto;
  font-size: var(--type-caption);
}
#game-shell .phone-match .phone-bowler .player-form-copy {
  font-size: 0;
}
#game-shell .phone-match .phone-bowler .player-form-copy b {
  font-size: var(--type-caption);
}
#game-frame .phone-match .phone-quick-plans .game-button {
  min-height: 36px;
  font-size: var(--type-caption);
  line-height: 12px;
  padding: 4px 2px;
}
#game-shell .phone-match .phone-play-buttons .game-button {
  min-height: 40px;
  font-size: var(--type-caption);
  padding: 6px 3px;
}
#game-frame .field-speed-control {
  position: absolute;
  left: 7px;
  top: 50%;
  margin-top: -20px;
  z-index: 3;
  width: 44px;
  min-height: 40px;
  display: grid;
  gap: 0;
  padding: 3px;
  line-height: 1.1;
  transform: none;
}
#game-frame .field-speed-control:active {
  transform: none;
}
.field-speed-control strong {
  font-size: var(--type-section);
}
.field-speed-control small {
  font-size: var(--type-caption);
}

#game-frame .title-scene > canvas {
  grid-area: players;
}
#game-shell .phone-match > .stadium-wrap {
  container: field / size;
}
@container field (max-height:260px) {
  .conditions-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 8px;
    width: 190px;
    padding: 4px 6px;
    top: 5px;
  }
  .conditions-weather {
    min-height: 22px;
    gap: 3px;
  }
  .conditions-weather-art {
    width: 18px;
    height: 18px;
  }
  .conditions-weather > strong {
    font-size: var(--type-name);
  }
  .conditions-surface {
    margin: 0;
    padding: 0;
    border: 0;
  }
  .conditions-surface > span:last-child {
    display: none;
  }
  .conditions-panel dl {
    grid-column: 1/-1;
    grid-template-columns: 1fr 1fr 1.2fr;
    gap: 5px;
    margin: 0;
  }
  .conditions-panel dl > div {
    display: flex;
    align-items: baseline;
    gap: 3px;
  }
  .conditions-panel dt {
    font-size: var(--type-caption);
    letter-spacing: 0;
  }
  .conditions-panel dd {
    font-size: var(--type-caption);
    margin: 0;
  }
  .conditions-outfield {
    grid-column: auto;
  }
}
@container field (max-height:190px) {
  .conditions-panel {
    left: 60px;
    width: min(190px, calc(100% - 116px));
  }
  .venue-board {
    display: none;
  }
  #game-frame .field-speed-control {
    top: calc(50% - 24px);
    margin-top: 0;
  }
}

@container field (min-height:191px) and (max-height:260px) {
  .venue-board {
    top: auto;
    bottom: 7px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    max-width: calc(100% - 120px);
  }
}

/* Impact choices size to the dialog, never to the surrounding browser width. */
#game-frame .impact-player-dialog {
  container: impact / inline-size;
}
#game-frame .impact-player-dialog .phone-sheet-header {
  padding: 12px;
}
#game-frame .impact-player-dialog .phone-sheet-header h2 {
  font-size: var(--type-name);
}
#game-frame .impact-player-dialog .phone-sheet-header .game-button {
  min-height: 36px;
  padding: 6px 10px;
  font-size: var(--type-caption);
}
#game-frame .impact-player-body {
  padding: 12px;
  gap: 10px;
}
#game-frame .impact-context {
  padding: 9px 10px;
  gap: 3px;
}
#game-frame .impact-context h3 {
  font-size: var(--type-body);
}
#game-frame .impact-context p {
  font-size: var(--type-caption);
}
#game-frame .impact-player-body .impact-choice-note {
  font-size: var(--type-caption);
  color: var(--dim);
}
#game-frame .impact-player-dialog .impact-player-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  gap: 8px;
  padding: 10px;
  background: var(--ui-surface, #1b2942);
  border: 1px solid var(--edge);
  border-radius: 0;
}
#game-frame .impact-player-option > .impact-person {
  grid-column: 1;
  grid-row: 1;
}
#game-frame .impact-player-option > .impact-player-detail {
  grid-column: 1;
  grid-row: 2;
}
#game-frame .impact-player-option > b {
  grid-column: 2;
  grid-row: 1 / 3;
}
#game-frame .impact-player-option[aria-pressed='true'] {
  border-color: var(--gold);
  background: var(--panel);
}
#game-frame .impact-player-dialog .impact-person strong {
  display: block;
  font-size: var(--type-section);
  white-space: normal;
  overflow-wrap: normal;
}
#game-frame .impact-player-dialog .impact-person small {
  font-size: var(--type-caption);
}
#game-frame .impact-player-dialog .impact-player-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  font-size: var(--type-caption);
}
#game-frame .impact-player-detail > span {
  min-width: 0;
  margin: 0;
}
#game-frame .impact-player-detail > .impact-metric-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
}
#game-frame .impact-metric-row > b {
  text-align: right;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
#game-frame .impact-metric-row .selection-ability {
  display: flex;
  min-width: 0;
  width: 100%;
  gap: 6px;
}
#game-frame .impact-metric-row .selection-ability-icon {
  width: 16px;
  height: 18px;
}
#game-frame .impact-metric-row .selection-ability-track {
  flex: 1;
  width: auto;
  height: 7px;
}
#game-frame .impact-energy progress {
  width: 100%;
  height: 7px;
  accent-color: var(--mint);
}
#game-frame .impact-player-detail > .impact-quota {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
}
#game-frame .impact-quota > b {
  text-align: right;
}
.impact-quota-blocks {
  display: flex;
  gap: 4px;
}
.impact-quota-blocks i {
  width: 13px;
  height: 7px;
  background: var(--mint);
}
#game-frame .impact-player-detail > .impact-style {
  color: var(--cream);
}
#game-frame .impact-player-detail .impact-confidence .scout-confidence {
  font-size: var(--type-caption);
}
#game-frame .impact-player-detail > .impact-career-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
}
#game-frame .impact-selected {
  grid-template-columns: minmax(0, 1fr);
}
#game-frame .impact-player-dialog .phone-sheet-actions {
  padding: 10px 12px;
}
#game-frame .impact-player-dialog .phone-sheet-actions .game-button {
  min-height: 40px;
  font-size: var(--type-caption);
}
@container impact (max-width:480px) {
  .impact-swap {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* One currency mark and one toolbar treatment throughout club management. */
.club-money {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#game-frame .club-money > .club-coin {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  margin: 0;
}
#game-frame .career-store {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  min-width: 84px;
  padding: 7px 10px;
}
#game-frame .career-store > .store-basket {
  width: 22px;
  height: 22px;
  color: var(--gold);
}
#game-frame .career-store > strong {
  font-size: var(--type-name);
  line-height: 1;
}
#game-frame .store-heading .scene-title {
  display: flex;
  align-items: center;
  gap: 9px;
}
#game-frame .game-topbar {
  padding: 4px 8px;
  min-height: 48px;
  gap: 6px;
}
#game-frame .game-topbar .topbar-tools {
  display: flex;
  gap: 4px;
  align-items: center;
}
#game-frame .game-topbar .game-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 7px;
  border: 1px solid var(--edge);
  background: var(--navy);
  color: var(--cream);
  border-radius: 0;
  box-shadow: none;
  font-size: var(--type-title);
}
#game-frame .game-topbar .audio-toggle[aria-pressed='true'] {
  border-color: var(--mint);
  background: #223c44;
}
#game-frame .game-topbar > .game-button > span {
  display: none;
}
#game-frame .game-topbar .game-button > svg {
  width: 21px;
  height: 21px;
}
#game-frame .scout-reading {
  grid-template-columns: 110px minmax(0, 1fr) 45px;
}
#game-frame .player-outlook.is-compact .scout-reading {
  grid-template-columns: 110px minmax(0, 1fr) 45px;
}
#game-frame .scout-reading > span:first-child {
  font-size: var(--type-caption);
  line-height: 1.35;
}
#game-frame .squad-ability-reading {
  grid-template-columns: 110px minmax(0, 1fr) 42px;
}
#game-frame .squad-ability-footer {
  padding-left: 0;
}
#game-frame .scout-confidence > span:last-child {
  font-size: var(--type-caption);
}
#game-frame .academy-prospect-card {
  padding: 12px;
}
#game-frame .prospect-heading {
  gap: 10px;
}
#game-frame .prospect-new {
  width: 34px;
  height: 24px;
  min-width: 34px;
  display: grid;
  place-items: center;
  background: var(--mint);
  color: #132238;
  font-size: var(--type-caption);
  font-weight: 800;
  letter-spacing: 0.04em;
}
#game-frame .prospect-badges {
  margin-block: 8px;
}
#game-frame .prospect-actions {
  margin-top: 10px;
  padding-top: 10px;
}
#game-frame .prospect-actions .game-button {
  min-height: 40px;
  padding: 7px;
  font-size: var(--type-caption);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.promotion-window {
  display: block;
  font-size: var(--type-caption);
  font-weight: 500;
}
/* Preserve the same visible controls when a phone unfolds into the wider scene. */
#game-shell .play-style + .match-screen.is-casual {
  height: calc(100% - 43px);
  min-height: 0;
}
#game-shell .is-casual .dugout {
  overflow: auto;
  min-height: 0;
}
.impact-quota-blocks i {
  background: linear-gradient(
    to right,
    var(--mint) var(--quota-fill, 100%),
    var(--edge) var(--quota-fill, 100%)
  );
}
#game-frame .training-session-card .club-money {
  color: var(--gold);
}
#game-frame .store-pack-price .club-money {
  font-size: var(--type-section);
}
#game-frame .management-running-cost {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 8px 0;
  border-top: 1px solid var(--edge);
  color: var(--dim);
  font-size: var(--type-caption);
}
#game-frame .career-store {
  flex-direction: row;
}
#game-frame .career-store > strong {
  font-size: var(--type-name) !important;
}
#game-frame .prospect-heading {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
}
#game-frame .prospect-heading > .prospect-new {
  grid-column: 3;
  grid-row: 1;
  align-self: start;
}
#game-frame .prospect-heading > .pixel-portrait {
  grid-column: 1;
  grid-row: 1;
}
#game-frame .prospect-heading > div {
  grid-column: 2;
  grid-row: 1;
}
#game-frame .career-store .club-money > span {
  font-size: var(--type-name);
  line-height: 1;
  font-weight: 800;
}
#game-frame .game-button:disabled {
  opacity: 1;
  background: var(--navy);
  border-color: var(--edge);
  color: var(--dim);
  box-shadow: none;
}
#game-frame .impact-player-detail > .impact-metric-row,
#game-frame .impact-player-detail > .impact-quota {
  grid-template-columns: 64px minmax(0, 1fr) 36px;
}
#game-frame .impact-energy progress {
  appearance: none;
  border: 0;
  background: var(--edge);
  border-radius: 0;
}
#game-frame .impact-energy progress::-webkit-progress-bar {
  background: var(--edge);
}
#game-frame .impact-energy progress::-webkit-progress-value {
  background: var(--mint);
}
#game-frame .impact-energy progress::-moz-progress-bar {
  background: var(--mint);
}
