@media (max-width: 920px) {
  .app-shell {
    width: min(100% - 28px, 690px);
    padding: 16px 0 24px;
  }

  .start-screen {
    padding: 38px 0 20px;
  }

  .start-copy {
    text-align: center;
  }

  .start-copy .brand {
    justify-content: center;
  }

  .start-copy h1,
  .start-lead,
  .relay-preview {
    margin-inline: auto;
  }

  .eyebrow {
    margin-top: 22px;
  }

  .start-copy h1 {
    font-size: clamp(3rem, 9vw, 5rem);
  }

  .relay-preview {
    margin-bottom: 6px;
  }

  .game-screen {
    min-height: calc(100svh - 40px);
  }

  .game-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "controls"
      "board";
    gap: 12px;
  }

  .control-panel {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    padding: 11px;
  }

  .game-meta {
    grid-column: 1 / -1;
  }

  .relay-status {
    grid-column: 1 / 2;
  }

  .palette {
    grid-column: 2 / 3;
    grid-row: 2 / 4;
  }

  .secondary-button {
    grid-column: 1 / 2;
  }

  .color-board,
  .color-board[data-size="9"],
  .color-board[data-size="13"] {
    width: min(100%, 570px);
  }
}

@media (max-width: 580px) {
  .home-link {
    top: 10px;
    left: 10px;
    width: 44px;
    height: 44px;
  }

  .app-shell {
    width: min(100% - 20px, 500px);
    padding-top: 10px;
  }

  .start-screen {
    min-height: calc(100svh - 20px);
    padding: 52px 0 12px;
  }

  .start-copy .brand {
    display: none;
  }

  .eyebrow {
    margin: 0 0 7px;
  }

  .start-copy h1 {
    font-size: clamp(2.75rem, 14vw, 4rem);
  }

  .start-lead {
    margin-top: 14px;
    font-size: 0.92rem;
    line-height: 1.48;
  }

  .relay-preview {
    height: 80px;
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 18px;
  }

  .preview-tile {
    width: 43px;
    height: 43px;
    flex-basis: 43px;
    border-radius: 11px;
  }

  .relay-preview .preview-tile:nth-child(3),
  .relay-preview .preview-tile:nth-child(4) {
    display: none;
  }

  .setup-card {
    padding: 20px;
    border-radius: 24px;
  }

  .setup-card__header {
    padding-bottom: 13px;
  }

  .mode-picker {
    margin-top: 14px;
  }

  .mode-option {
    min-height: 73px;
    padding: 9px 7px;
  }

  .mode-option small {
    line-height: 1.2;
  }

  .quick-rules {
    margin: 14px 0;
  }

  .quick-rules li {
    font-size: 0.68rem;
  }

  .game-header {
    min-height: 46px;
    padding-left: 50px !important;
  }

  .brand--compact {
    gap: 7px;
    font-size: 0.64rem;
  }

  .brand--compact .brand-mark {
    width: 33px;
    height: 33px;
  }

  .game-actions {
    gap: 5px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .status-line {
    min-height: 34px;
    margin: 4px 0 7px;
    padding: 7px 10px;
    font-size: 0.68rem;
  }

  .control-panel {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 8px;
    border-radius: 18px;
  }

  .game-meta,
  .relay-status,
  .palette,
  .secondary-button {
    grid-column: 1;
  }

  .game-meta {
    grid-row: 1;
  }

  .relay-status {
    grid-row: 2;
    min-height: 49px;
    padding-block: 6px;
  }

  .palette {
    grid-row: 3;
  }

  .secondary-button {
    grid-row: 4;
    min-height: 44px;
  }

  .stat-card {
    min-height: 50px;
    padding: 6px 8px;
  }

  .stat-card strong {
    font-size: 1.12rem;
  }

  .palette legend {
    margin-bottom: 5px;
  }

  .palette-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .color-button {
    min-height: 44px;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 6px;
    padding: 4px 5px;
  }

  .color-swatch {
    width: 28px;
    height: 28px;
  }

  .color-key,
  .color-button:disabled .color-key::after {
    display: none;
  }

  .color-name {
    font-size: 0.6rem;
  }

  .color-board,
  .color-board[data-size="9"],
  .color-board[data-size="13"] {
    width: 100%;
    padding: 6px;
    border-radius: 20px;
  }

  .game-dialog {
    margin-inline: 8px;
    padding: 25px 21px;
    border-radius: 24px;
  }

  .game-dialog h2 {
    font-size: 2.1rem;
  }
}

@media (max-width: 350px) {
  .mode-option strong {
    font-size: 0.72rem;
  }

  .mode-best,
  .mode-option small {
    font-size: 0.56rem;
  }

  .color-name {
    font-size: 0.56rem;
  }

  .tile-relay {
    border-width: 1px;
  }
}

@media (max-height: 760px) and (min-width: 921px) {
  .app-shell {
    padding-block: 15px;
  }

  .game-screen {
    min-height: calc(100svh - 30px);
  }

  .color-board,
  .color-board[data-size="9"],
  .color-board[data-size="13"] {
    width: min(61vh, 620px);
  }
}

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