.tutorial-intro {
  color: var(--color-text-muted);
  margin: 0 auto var(--space-7);
  text-align: center;
  max-width: 640px;
  font-size: var(--text-105);
}

.tutorial-top-callout {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-125);
  margin: 0 auto var(--space-175);
  padding: var(--space-135) var(--space-14);
}

.tutorial-top-copy h1 {
  margin: 0 0 var(--space-035);
}

.tutorial-top-kicker {
  display: inline-flex;
  align-items: center;
  margin: 0 0 var(--space-035);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-highlight-border);
  background: var(--color-highlight-surface);
  color: var(--color-highlight-text);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tutorial-top-copy .tutorial-intro {
  margin: 0;
  max-width: 42ch;
  text-align: left;
}

.tutorial-multiplayer {
  margin-top: var(--space-8);
}

.tutorial-multiplayer-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-7);
}

.tutorial-multiplayer-card h2 {
  margin: 0 0 var(--space-045);
  font-size: clamp(var(--text-14), 2.2vw, var(--text-20));
}

.tutorial-multiplayer-card p {
  margin: 0;
  color: var(--color-text-muted);
  max-width: var(--width-sm);
}

.level-grid {
  display: grid;
  gap: var(--space-125);
  max-width: 760px;
  margin: 0 auto var(--space-8);
}

.level-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-125);
  background: var(--color-surface-panel);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  position: relative;
  box-shadow: var(--shadow-soft);
}

.level-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.level-card.completed {
  border-color: var(--color-border-success);
  background: var(--color-success-soft);
}

.level-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--color-surface-soft);
  border-color: var(--color-border-soft);
}

.level-card.battle-level {
  border-color: var(--color-battle-border);
  background: var(--color-battle-soft);
}

.level-card.battle-level .level-badge {
  background: var(--color-battle-primary);
}

.level-card.battle-level.completed {
  border-color: var(--color-battle-primary-strong);
  background: var(--color-battle-soft-strong);
}

.level-card.battle-level.completed .level-badge {
  background: var(--color-success);
}

.level-badge {
  display: inline-flex;
}

.level-card.completed .level-badge {
  background: var(--color-success);
}

.level-card.next-up {
  border-color: var(--color-highlight-border);
  background: linear-gradient(
    180deg,
    var(--color-callout-start),
    var(--color-highlight-surface)
  );
  box-shadow:
    var(--shadow-soft),
    0 0 0 2px var(--color-highlight-shadow);
}

.level-card.next-up:hover {
  border-color: var(--color-highlight-strong);
}

.level-info {
  flex: 1;
}

.level-info h2 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-11);
}

.level-info p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-09);
}

.level-status {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.level-lock-reason {
  width: 100%;
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.alert {
  background: var(--color-alert-surface);
  border: 1px solid var(--color-alert-border);
  color: var(--color-alert-text);
  padding: var(--space-085) var(--space-11);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-5);
  text-align: center;
}

.tutorial-lock-alert {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-12);
}

.tutorial-lock-alert--inline {
  margin-bottom: var(--space-2);
  padding: var(--space-11) var(--space-125);
  border-radius: var(--radius-md);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.tutorial-lock-alert--inline.is-dismissing {
  opacity: 0;
  transform: translateY(-4px);
}

.tutorial-lock-alert--inline .tutorial-lock-alert-icon {
  width: 30px;
  height: 30px;
  font-size: var(--text-md);
}

.tutorial-lock-alert--inline .tutorial-lock-alert-text {
  font-size: var(--text-md);
}

.tutorial-lock-alert-icon {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--color-highlight-surface);
  color: var(--color-highlight-strong);
  font-size: var(--text-09);
  line-height: 1;
  border: 1px solid var(--color-highlight-border);
}

.tutorial-lock-alert-text {
  margin: 0;
  font-size: var(--text-09);
  font-weight: 600;
  color: var(--color-text-strong);
}

.level-status .stat {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.level-status .stat.perfect {
  color: var(--color-success);
  font-weight: 500;
}

.ai-badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  font-size: var(--text-072);
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
}

.back-link {
  color: var(--color-text-strong);
  text-decoration: none;
  font-size: var(--text-09);
  font-weight: 600;
}

.back-link:hover {
  text-decoration: underline;
}

.back-link::before {
  content: "← ";
}

.play-modes-page {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-6);
}

.game-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.game-page-top {
  margin-bottom: 0;
}

.game-page-main {
  padding: var(--space-6);
}

.game-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.bot-game-start-dialog {
  width: min(420px, 100%);
  margin: var(--space-5) auto 0;
  padding: var(--space-4);
}

.bot-game-start-dialog .game-page-actions {
  margin-top: 0;
  justify-content: center;
}

.bot-player-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.bot-player-legend--top {
  margin-bottom: 0;
}

.bot-player-legend--bottom {
  margin-top: 0;
}

.bot-game-main #board-container .board-wrapper {
  --board-margin: 0 auto 0;
}

.bot-player-legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-md);
  font-weight: 600;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    border-color 0.18s ease;
}

.bot-player-legend--turn-aware .bot-player-legend-item:not(.is-current-turn) {
  opacity: 0.74;
}

.bot-player-legend-item.is-current-turn {
  border-color: var(--color-highlight-strong);
  background: linear-gradient(
    180deg,
    color-mix(
      in srgb,
      var(--color-callout-start),
      var(--color-text-inverse) 22%
    ),
    color-mix(
      in srgb,
      var(--color-highlight-surface),
      var(--color-text-inverse) 14%
    )
  );
  transform: scale(1.08);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--color-highlight-border), transparent 42%),
    0 0 18px color-mix(in srgb, var(--color-highlight-strong), transparent 35%),
    var(--shadow-strong);
  animation: bot-turn-pulse 1.3s ease-in-out infinite;
}

.bot-player-legend-emoji {
  font-size: var(--text-11);
  line-height: 1;
}

.local-friend-mirror-toggle-row {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.local-friend-mirror-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

.local-friend-mirror-switch-input {
  position: absolute;
  opacity: 0;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
}

.local-friend-mirror-switch-track {
  inline-size: 42px;
  block-size: 24px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border-soft);
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: background-color 0.18s ease;
}

.local-friend-mirror-switch-thumb {
  inline-size: 18px;
  block-size: 18px;
  border-radius: 50%;
  background: var(--color-text-inverse);
  box-shadow: var(--shadow-soft);
  transition: translate 0.18s ease;
}

.local-friend-mirror-switch-input:checked + .local-friend-mirror-switch-track {
  background: var(--color-highlight-strong);
  border-color: var(--color-highlight-strong);
}

.local-friend-mirror-switch-input:checked
  + .local-friend-mirror-switch-track
  .local-friend-mirror-switch-thumb {
  translate: 18px 0;
}

.local-friend-mirror-switch-input:focus-visible
  + .local-friend-mirror-switch-track {
  outline: 2px solid var(--color-highlight-border);
  outline-offset: 2px;
}

.local-content--friend-mirrored .local-friend-mirror-switch-text {
  rotate: 180deg;
}

.local-player-legend-face {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.local-content--friend-mirrored
  .local-player-legend--friend
  .local-player-legend-face {
  rotate: 180deg;
}

@keyframes bot-turn-pulse {
  0%,
  100% {
    transform: scale(1.08);
  }

  50% {
    transform: scale(1.12);
  }
}

.play-modes-top {
  margin-bottom: 0;
  width: 100%;
}

.play-modes-heading-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.play-modes-heading-row .tutorial-top-kicker {
  align-self: flex-start;
  margin: 0;
}

.play-modes-heading-row h1 {
  margin: 0;
  line-height: 1;
  transform: translateY(-4px);
}

.play-modes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  width: 100%;
}

.play-mode-card {
  --play-mode-accent: var(--color-highlight-border);
  --play-mode-surface: var(--color-highlight-surface);
  --play-mode-emphasis: var(--color-highlight-strong);

  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  border-color: var(--play-mode-accent);
  background: linear-gradient(
    180deg,
    var(--color-callout-start),
    var(--play-mode-surface)
  );
  box-shadow:
    var(--shadow-soft),
    0 0 0 1px color-mix(in srgb, var(--play-mode-accent), transparent 70%);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.play-mode-card:hover {
  transform: translateY(-2px);
  border-color: var(--play-mode-emphasis);
  box-shadow:
    var(--shadow-soft),
    0 0 0 2px color-mix(in srgb, var(--play-mode-accent), transparent 62%);
}

.play-mode-card:focus-visible {
  outline: 3px solid var(--play-mode-accent);
  outline-offset: 2px;
}

.play-mode-card:active {
  transform: translateY(1px);
  box-shadow:
    var(--shadow-soft),
    0 0 0 1px color-mix(in srgb, var(--play-mode-accent), transparent 70%);
}

.play-mode-card--bot {
  --play-mode-accent: var(--color-success);
  --play-mode-surface: var(--color-success-soft);
  --play-mode-emphasis: var(--color-success-strong);
}

.play-mode-card--local {
  --play-mode-accent: var(--color-highlight-border);
  --play-mode-surface: var(--color-highlight-surface);
  --play-mode-emphasis: var(--color-highlight-strong);
}

.play-mode-card--online {
  --play-mode-accent: var(--color-border-strong);
  --play-mode-surface: var(--color-surface-muted);
  --play-mode-emphasis: var(--color-text-muted);
}

.play-mode-card h2 {
  margin: 0;
  font-size: var(--text-11);
}

.play-mode-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.play-mode-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  font-size: var(--text-20);
  line-height: 1;
}

.play-mode-emoji--local {
  font-size: 0;
}

.play-mode-emoji--local::before {
  content: "💻";
  font-size: var(--text-20);
  line-height: 1;
}

.play-mode-emoji--pair {
  gap: 0;
}

.play-mode-emoji-slot {
  display: inline-flex;
  font-size: 0;
  line-height: 1;
}

.play-mode-emoji-slot::before {
  font-size: var(--text-20);
  line-height: 1;
  color: inherit;
}

.play-mode-emoji-slot--first::before {
  content: "💻";
}

.play-mode-emoji-slot--second::before {
  content: "📱";
}

.play-mode-emoji--pair span + span {
  margin-left: -0.36em;
}

@media (hover: none) and (pointer: coarse) {
  .play-mode-emoji--local::before {
    content: "📱";
  }

  .play-mode-emoji-slot--first::before {
    content: "📱";
  }

  .play-mode-emoji-slot--second::before {
    content: "💻";
  }
}

.play-mode-card p {
  margin: 0;
  color: var(--color-text-muted);
  min-height: 2.8em;
}

.play-modes-footer {
  margin: 0;
  text-align: center;
}

.play-modes-footer-link {
  color: var(--color-text-muted);
  font-size: var(--text-09);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.play-modes-footer-link:hover,
.play-modes-footer-link:focus-visible {
  color: var(--color-text-primary);
}

@media (max-width: 900px) {
  .play-modes-grid {
    grid-template-columns: 1fr;
  }

  .game-page-main {
    padding: var(--space-5);
  }

  .play-mode-card p {
    min-height: 0;
  }
}

.restart-form {
  display: inline;
}

.tutorial-description {
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.tutorial-instruction-callout {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  box-sizing: border-box;
  margin-bottom: var(--space-16);
  padding: var(--space-065) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-instruction-border);
  background: var(--color-instruction-bg);
  box-shadow: var(--shadow-soft);
  color: var(--color-text-strong);
  font-weight: 600;
}

.tutorial-instruction-emoji {
  font-size: var(--text-105);
  line-height: 1;
}

#lesson-title .lesson-step-progress {
  font-size: 0.62em;
  color: var(--color-text-muted);
  font-weight: 600;
}

.step-message {
  font-size: var(--text-11);
  font-weight: 600;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-card);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  text-align: center;
  border: 1px solid var(--color-border-soft);
  box-shadow: var(--shadow-soft);
}

#tutorial-content {
  position: relative;
}

#local-content {
  position: relative;
}

#tutorial-animation-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 9;
}

#local-animation-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 9;
}

.level-complete-overlay {
  position: absolute;
  inset: -56px 0 0;
  z-index: 8;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: transparent;
  border-radius: var(--radius-lg);
  padding-top: var(--space-1);
}

.level-complete-dialog {
  position: relative;
  width: min(420px, calc(100% - var(--space-6)));
  text-align: center;
  padding: var(--space-135) var(--space-12);
  background: linear-gradient(
    180deg,
    var(--color-callout-start),
    var(--color-callout-end)
  );
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-soft);
  box-shadow: var(--shadow-strong);
  animation: level-complete-pop 220ms ease-out;
}

.level-complete-dialog .landing-auth-close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 999px;
  line-height: 1;
}

@keyframes level-complete-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.level-complete-dialog h2 {
  color: var(--color-success);
  margin-bottom: var(--space-2);
  font-size: var(--text-16);
}

.level-complete-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-highlight-surface);
  border: 1px solid var(--color-highlight-border);
  font-size: var(--text-13);
  margin-bottom: var(--space-045);
}

.level-complete-dialog p {
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.progress-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-panel);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-soft);
}

.progress-stats .stat {
  color: var(--color-text-muted);
  font-size: var(--text-09);
}

.all-complete {
  font-size: var(--text-11);
  color: var(--color-accent-primary);
  font-weight: 500;
  margin-top: var(--space-4);
}

.result-page {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: var(--space-175) var(--space-5);
  background: linear-gradient(
    180deg,
    var(--color-callout-start),
    var(--color-callout-end)
  );
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-strong);
  animation: level-complete-pop 220ms ease-out;
}

.result-header {
  text-align: center;
  margin-bottom: var(--space-125);
}

.result-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--color-highlight-surface);
  border: 1px solid var(--color-highlight-border);
  border-radius: 50%;
  font-size: var(--text-14);
  margin-bottom: var(--space-055);
}

.result-header h1 {
  margin: 0 0 var(--space-2);
}

.result-status {
  color: var(--color-success);
  font-weight: 600;
  margin: 0;
}

.result-message {
  color: var(--color-text-muted);
  margin: var(--space-045) 0 0;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.result-stats--battle {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-4);
}

.stat-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.stat-value {
  display: block;
  font-size: var(--text-lg);
  font-weight: bold;
  color: var(--color-text-primary);
}

.result-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.level-complete-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.inline-form {
  display: inline;
}

.result-actions .ds-button,
.level-complete-dialog .ds-button {
  font-size: var(--text-md);
  padding: var(--space-3) var(--space-5);
}

.level-complete-auth-form {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-2);
}

.level-complete-email-input {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-soft);
  background: var(--color-surface-panel);
  color: var(--color-text-primary);
  font-size: var(--text-md);
  line-height: 1.4;
}

.level-complete-email-input::placeholder {
  color: var(--color-text-subtle);
}

.level-complete-auth-submit {
  width: 100%;
}

.level-complete-code-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
}

.level-complete-code-input {
  width: 100%;
  min-height: 48px;
  text-align: center;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-soft);
  background: var(--color-surface-panel);
  color: var(--color-text-primary);
  font-size: var(--text-14);
  font-weight: 600;
}

.level-complete-helper-link {
  display: inline-block;
  margin-top: var(--space-1);
  font-family: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: var(--color-text-subtle);
  font-size: var(--text-sm);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.level-complete-helper-link:hover {
  color: var(--color-text-muted);
}

/* Battle Mode Styles */

.battle-title {
  text-align: center;
  color: var(--color-battle-text);
}

.battle-actions {
  display: flex;
  justify-content: center;
  margin-top: var(--space-4);
}

.battle-container {
  position: relative;
}

.battle-round-result-overlay {
  z-index: 12;
}

.battle-round-result-overlay.is-pending {
  opacity: 0;
  pointer-events: none;
}

.battle-round-result-dialog h2 {
  margin: var(--space-1) 0 var(--space-1);
}

.battle-round-result-dialog {
  width: min(380px, calc(100% - var(--space-6)));
  padding: var(--space-11) var(--space-9);
}

.battle-round-result-dialog p {
  margin: 0;
}

.battle-round-result-dialog .battle-round-seeds {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: var(--space-6) 0 var(--space-4);
  gap: var(--space-6);
}

.battle-round-result-dialog .battle-round-seed-slot {
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  --seed-rotation: 0deg;
}

.battle-round-result-dialog .battle-round-seed {
  transform: scale(2.4) rotate(var(--seed-rotation));
  transform-origin: center;
  transition:
    transform 0.2s ease,
    filter 0.2s ease;
  filter: drop-shadow(
    0 3px 5px color-mix(in srgb, var(--color-surface-dark), transparent 60%)
  );
}

.battle-round-result-dialog .battle-round-seed-slot:nth-child(4n + 1) {
  --seed-rotation: -5deg;
}

.battle-round-result-dialog .battle-round-seed-slot:nth-child(4n + 2) {
  --seed-rotation: 2deg;
}

.battle-round-result-dialog .battle-round-seed-slot:nth-child(4n + 3) {
  --seed-rotation: -1deg;
}

.battle-round-result-dialog .battle-round-seed-slot:nth-child(4n) {
  --seed-rotation: 4deg;
}

.battle-round-result-dialog .battle-round-seed-slot.pending {
  opacity: 0.45;
  filter: grayscale(0.35);
}

.battle-round-result-dialog .battle-round-seed-slot.pending .battle-round-seed {
  transform: scale(2.05) rotate(var(--seed-rotation));
}

.battle-round-result-dialog .battle-round-seed-slot.earned {
  filter: none;
}

.battle-round-result-dialog .battle-round-seed-slot.earned .battle-round-seed {
  transform: scale(2.4) rotate(var(--seed-rotation));
  filter: drop-shadow(
      0 3px 6px color-mix(in srgb, var(--color-surface-dark), transparent 55%)
    )
    drop-shadow(
      0 0 10px color-mix(in srgb, var(--color-warning), transparent 62%)
    );
}

.battle-round-result-dialog .ds-button {
  margin-top: var(--space-5);
}

.battle-round-result--win h2 {
  color: var(--color-success);
}

.battle-round-result--loss h2 {
  color: var(--color-danger);
}

.battle-round-result--draw h2 {
  color: var(--color-highlight-text);
}

@media (max-width: 900px) {
  .tutorial-multiplayer-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .tutorial-multiplayer-card {
    padding: var(--space-6);
  }
}

@media (max-width: 720px) and (orientation: landscape) {
  .tutorial-top-callout {
    padding: var(--space-12);
  }

  .tutorial-top-copy .tutorial-intro {
    max-width: 48ch;
  }

  .tutorial-header {
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  .level-complete-overlay {
    align-items: center;
    inset: 0;
    padding: 0;
  }

  .progress-stats {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-4);
  }

  .result-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
  }

  .result-actions {
    flex-direction: column;
    align-items: center;
  }

  .result-page {
    padding: var(--space-145) var(--space-5);
  }

  #tutorial-content,
  #battle-content {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }
}

@media (orientation: landscape) {
  .tutorial-lock-alert {
    width: min(100%, 760px);
    margin-left: auto;
    margin-right: auto;
  }

  #battle-content {
    padding-bottom: calc(var(--space-12) + env(safe-area-inset-bottom));
  }

  #bot-content #bot-game-over .level-complete-overlay {
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  #local-content #local-game-over .level-complete-overlay {
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  #hint-button {
    position: fixed;
    right: var(--space-4);
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    z-index: 8;
  }

  #hint-button :where(.hint-btn) {
    box-shadow: var(--shadow-strong);
    min-height: 48px;
    padding: var(--space-2) var(--space-5);
    white-space: nowrap;
  }
}

@media (orientation: landscape) and (min-width: 1100px) {
  #hint-button {
    right: var(--space-8);
    bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .bot-game-main {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
  }

  .bot-player-legend--top {
    margin-bottom: 0;
  }

  .bot-player-legend--bottom {
    margin-top: 0;
  }

  .bot-player-legend-item {
    padding: var(--space-1) var(--space-2);
  }

  .bot-game-main #board-container .board-wrapper {
    --board-margin: 0 auto calc(var(--space-1) * -1);
  }

  .tutorial-top-callout {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-095);
    padding: var(--space-11);
  }

  .tutorial-top-copy .tutorial-intro {
    text-align: left;
    max-width: none;
  }

  .tutorial-header {
    position: relative;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
  }

  .restart-form {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0;
  }

  .level-complete-overlay {
    align-items: center;
    inset: 0;
    padding: 0;
  }

  .tutorial-multiplayer-card {
    padding: var(--space-175);
  }

  .tutorial-intro {
    font-size: var(--text-md);
    margin-bottom: var(--space-6);
  }

  .level-grid {
    gap: var(--space-4);
  }

  .level-card {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .level-badge {
    width: 44px;
    height: 44px;
    font-size: var(--text-11);
  }

  .level-info h2 {
    font-size: var(--text-md);
  }

  .step-message {
    font-size: var(--text-md);
    padding: var(--space-085) var(--space-4);
  }

  .progress-stats {
    flex-direction: column;
    gap: var(--space-3);
  }

  .result-stats {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .result-actions {
    flex-direction: column;
    align-items: center;
  }

  .result-page {
    padding: var(--space-135) var(--space-11);
  }

  #tutorial-content,
  #battle-content {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }
}

@media (max-width: 480px) {
  .tutorial-multiplayer-card {
    padding: var(--space-5);
  }

  .tutorial-multiplayer-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) and (orientation: portrait) {
  .tutorial-top-callout {
    padding: var(--space-4);
  }

  .tutorial-top-kicker {
    font-size: var(--text-072);
  }

  .tutorial-description {
    margin-bottom: var(--space-125);
  }

  .tutorial-instruction-callout {
    width: 100%;
    justify-content: flex-start;
    padding: var(--space-3) var(--space-3);
    line-height: 1.3;
  }

  .step-message {
    font-size: var(--text-md);
    padding: var(--space-3) var(--space-3);
  }

  .level-card {
    padding: var(--space-4);
  }

  .result-page {
    padding: var(--space-125);
  }

  .result-check {
    width: 42px;
    height: 42px;
    font-size: var(--text-13);
  }

  .result-actions {
    gap: var(--space-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-lock-alert--inline {
    transition: none;
  }

  .tutorial-lock-alert--inline.is-dismissing {
    transform: none;
  }

  .bot-player-legend-item.is-current-turn {
    animation: none;
    transform: scale(1.08);
  }

  .result-page,
  .level-complete-dialog {
    animation: none;
  }
}
