/* Responsive spacing and stable disc animation overrides. */
.join-panel form {
  display: grid;
  gap: 10px;
}

.join-panel form > .primary,
.join-panel form > .secondary {
  min-width: 142px;
  justify-self: start;
  margin-top: 2px;
}

.game-shell {
  min-height: 0;
  grid-template-rows: auto auto;
  gap: 18px;
}

.table-stage {
  min-height: 0;
  grid-template-rows: auto auto;
  place-items: center;
  gap: 18px;
  padding: 28px 28px 16px;
}

.board-wrap {
  width: min(68vh, 580px, calc(100vw - 96px));
  max-width: 100%;
}

.turn-banner {
  position: static;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding: 10px 14px;
}

.turn-banner .compact-action {
  min-height: 34px;
  padding: 6px 12px;
}

.turn-note {
  color: var(--muted);
  font-weight: 700;
}

.chat-event {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  color: var(--muted);
  border: 1px solid #ffffff0d;
  border-radius: 11px;
  background: #ffffff04;
}

.chat-event > i {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--gold2);
  border-radius: 50%;
  background: #d8ab4e18;
  font-style: normal;
}

.chat-event p {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
}

.chat-event span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.chat-event b {
  color: #f3d58e;
}

.chat-event time {
  color: #ffffff55;
  font-size: 8px;
}

.status-dock {
  margin-bottom: 10px;
}

.cell.white::after,
.cell.black::after {
  animation: none;
}

.cell.white.new-disc::after,
.cell.black.new-disc::after {
  animation: drop .34s cubic-bezier(.2, .75, .3, 1.08);
}

@media (prefers-reduced-motion: reduce) {
  .cell.white.new-disc::after,
  .cell.black.new-disc::after,
  .cell.winning::after {
    animation: none;
  }
}

@media (max-width: 640px) {
  .home {
    gap: 14px;
  }

  .hero {
    min-height: 300px;
  }

  .join-panel {
    gap: 16px;
  }

  .join-panel form {
    gap: 11px;
  }

  .join-panel form > .primary,
  .join-panel form > .secondary {
    width: 100%;
    justify-self: stretch;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 10px;
  }

  .game-shell {
    gap: 14px;
  }

  .duel-header {
    grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
    gap: 7px;
  }

  .round-badge {
    grid-column: auto;
    grid-row: auto;
    min-width: 0;
    padding: 6px 3px;
  }

  .round-badge small {
    display: none;
  }

  .round-badge b {
    font-size: 13px;
  }

  .duel-player {
    grid-row: auto;
    gap: 6px;
    padding: 7px;
    overflow: hidden;
  }

  .duel-player .player-avatar {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .duel-copy strong {
    font-size: 11px;
  }

  .duel-copy small {
    font-size: 8px;
  }

  .disc-swatch {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
  }

  .duel-player .icon-button {
    width: 30px;
    min-height: 30px;
    flex: 0 0 30px;
  }

  .table-stage {
    min-height: 0;
    gap: 14px;
    padding: 18px 12px 13px;
    border-radius: 20px;
  }

  .board-wrap {
    width: min(88vw, 520px);
  }

  .drop-arrows {
    gap: 4px;
    margin: 0 8px 7px;
  }

  .drop-arrow {
    height: 29px;
  }

  .board-frame {
    padding: 7px;
    border-radius: 17px;
  }

  .board {
    gap: clamp(4px, 1vw, 7px);
    padding: 6px;
    border-radius: 11px;
  }

  .cell::after {
    inset: 10%;
  }

  .turn-banner {
    padding: 8px 10px;
    font-size: 10px;
  }

  .status-dock {
    gap: 10px;
    padding: 10px;
    margin-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .game-log {
    padding: 9px 4px 2px;
  }

  .dock-actions {
    width: 102px;
  }
}

@media (max-width: 480px) {
  .topbar {
    gap: 6px;
    padding-right: max(6px, env(safe-area-inset-right));
    padding-left: max(6px, env(safe-area-inset-left));
  }

  .brand > span {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .top-actions {
    margin-left: auto;
  }

  .music-toggle,
  .icon-button {
    width: 32px;
    min-height: 32px;
  }

  .music-controls,
  .language-control {
    min-height: 33px;
  }

  .ghost {
    min-height: 32px;
    padding: 4px 6px;
  }

  .app-shell {
    padding: 9px 7px;
  }

  .duel-header {
    grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
    gap: 5px;
  }

  .duel-player {
    padding: 6px 5px;
  }

  .duel-player .player-avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .duel-player .icon-button {
    display: none;
  }

  .disc-swatch {
    width: 15px;
    height: 15px;
    flex-basis: 15px;
  }

  .board-wrap {
    width: min(87vw, 430px);
  }

  .table-stage {
    padding-right: 10px;
    padding-left: 10px;
  }

  .status-dock {
    grid-template-columns: minmax(0, 1fr) 92px;
  }

  .me-copy strong {
    font-size: 13px;
  }

  .dock-actions {
    width: 92px;
  }
}
