/* Smartphone-only game screen.  Shared game state stays in app.js; only the
 * presentation changes when device-layout.js marks the display as mobile. */
html[data-device-layout="mobile"] .page-shell {
  width: min(100% - 16px, 640px);
  padding-bottom: 18px;
}

html[data-device-layout="mobile"] .topbar {
  min-height: 58px;
}

html[data-device-layout="mobile"] .topbar-copy,
html[data-device-layout="mobile"] .hero,
html[data-device-layout="mobile"] .roster-panel .legend,
html[data-device-layout="mobile"] .learning-panel .panel-heading,
html[data-device-layout="mobile"] .learning-panel .learning-card,
html[data-device-layout="mobile"] .learning-panel .hint {
  display: none;
}

html[data-device-layout="mobile"] .game-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

html[data-device-layout="mobile"] .battle-panel {
  order: 1;
  width: 100%;
  padding: 8px;
}

html[data-device-layout="mobile"] .board-wrap {
  min-height: 0;
  aspect-ratio: 17 / 13;
}

html[data-device-layout="mobile"] .battle-caption {
  min-height: 30px;
  padding: 7px 9px;
}

html[data-device-layout="mobile"] .roster-panel {
  order: 2;
  width: 100%;
  height: auto;
  max-height: none;
  padding: 10px;
}

html[data-device-layout="mobile"] .roster {
  display: flex;
  gap: 8px;
  min-height: 0;
  margin: 10px 0 0;
  padding: 0 42px 6px 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
}

html[data-device-layout="mobile"] .roster-scroll-hint {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 2px -3px;
  color: #7a8491;
  font-size: 9px;
  line-height: 1.2;
}

html[data-device-layout="mobile"] .roster-scroll-hint strong {
  color: #277b7b;
  white-space: nowrap;
}

html[data-device-layout="mobile"] .alpaca-card {
  grid-template-columns: 36px 1fr;
  flex: 0 0 164px;
  min-height: 82px;
  scroll-snap-align: start;
}

html[data-device-layout="mobile"] .alpaca-card:hover {
  transform: none;
}

html[data-device-layout="mobile"] .learning-panel {
  order: 3;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
  padding: 10px;
}

html[data-device-layout="mobile"] .learning-controls,
html[data-device-layout="mobile"] .mini-stats,
html[data-device-layout="mobile"] .smart-mode-notice {
  grid-column: 1 / -1;
}

html[data-device-layout="mobile"] .learning-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

html[data-device-layout="mobile"] .learning-controls label {
  display: grid;
  gap: 3px;
}

html[data-device-layout="mobile"] .mini-stats {
  display: flex;
  gap: 6px;
}

html[data-device-layout="mobile"] .mini-stats > div {
  flex: 1;
}

html[data-device-layout="mobile"] #study-button {
  grid-column: 1 / -1;
  margin: 0;
}

html[data-device-layout="mobile"] .game-layout.stage-selecting {
  display: block;
  max-width: none;
}

html[data-device-layout="mobile"] .battle-panel.is-stage-select .stage-gate-card {
  min-height: min(460px, 64svh);
  padding: 18px;
}
