/* ── Custom properties ───────────────────────────────────────────── */
:root {
  --color-bg:       #f5f0e8;
  --color-surface:  #ffffff;
  --color-border:   #d4c9b0;
  --color-text:     #2c2416;
  --color-muted:    #7a6e5f;
  --color-link:     #5b4a2e;
  --color-primary:  #8b6914;
  --color-primary-hover: #6d5210;
  --color-danger:   #c0392b;

  /* pieces */
  --color-sun:      #f4c430;
  --color-sun-border: #d4a017;
  --color-shadow:   #2c3e6b;
  --color-shadow-border: #1a2540;
  --color-empty:    #ede7d9;
  --color-empty-hover: #ddd5c0;

  /* player roof colors */
  --color-p-red:    #c0392b;
  --color-p-blue:   #2980b9;
  --color-p-green:  #27ae60;
  --color-p-yellow: #d4ac0d;

  --radius:    4px;
  --radius-lg: 8px;
  --gap:       1rem;
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--color-link); }
a:hover { color: var(--color-primary); }

/* ── Layout ──────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--gap);
}

main.container { flex: 1; padding-top: 1.5rem; padding-bottom: 2rem; }

/* ── Nav ─────────────────────────────────────────────────────────── */
.site-nav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.6rem 0;
}
.site-nav .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-nav .brand {
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--color-primary);
  letter-spacing: 0.02em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  list-style: none;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

/* ── Nav dropdown ────────────────────────────────────────────────── */
.nav-has-dropdown { position: relative; }
.nav-dropdown-btn {
  background: none;
  border: none;
  color: var(--color-link);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-dropdown-btn:hover { color: var(--color-primary); }
.nav-caret { font-size: 0.6rem; opacity: 0.7; }
.nav-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: -0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
  padding: 0.3rem 0;
  list-style: none;
  min-width: 150px;
  z-index: 400;
}
.nav-dropdown-right { left: auto; right: 0; }
.nav-dropdown li a {
  display: block;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.nav-dropdown li a:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}
.nav-dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: 0.3rem 0;
}
.nav-dropdown-signout {
  display: block;
  width: 100%;
  padding: 0.4rem 0.9rem;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.9rem;
  color: var(--color-danger);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.nav-dropdown-signout:hover { background: var(--color-bg); }
[x-cloak] { display: none !important; }

@media (max-width: 640px) {
  .nav-has-dropdown { position: static; }
  .nav-dropdown {
    position: static;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--color-border);
    padding: 0 0 0 0.75rem;
    margin-top: 0.25rem;
    min-width: unset;
  }
  .nav-dropdown-right { right: auto; }
  /* On mobile, sign-out button inside dropdown gets full-width treatment */
  .nav-dropdown-signout { padding: 0.4rem 0; }
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: #fff;
}
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover { background: var(--color-empty); }
.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.btn-sm { padding: 0.25rem 0.65rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.resign-card { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.resign-btn {
  width: 100%;
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: transparent;
}
.resign-btn:hover { background: var(--color-danger); color: #fff; }
.resign-confirm-msg {
  font-size: 0.83rem;
  color: var(--color-danger);
  text-align: center;
  margin-bottom: 0.5rem;
}

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; }
.form-control {
  width: 100%;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-size: 0.95rem;
  color: var(--color-text);
}
.form-control:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}
.form-error { color: var(--color-danger); font-size: 0.82rem; margin-top: 0.25rem; }

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

/* ── Flash messages ──────────────────────────────────────────────── */
.flash {
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.flash-error   { background: #fdf0ef; border-color: #f5c6c2; color: #7a1a12; }
.flash-success { background: #edfbf0; border-color: #b6edd0; color: #1a5c30; }
.flash-info    { background: #eef4fb; border-color: #b8d4f0; color: #1a3a5c; }

/* ── Update toast ────────────────────────────────────────────────── */
.update-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  background: #1a2a3a;
  color: #e8f0fa;
  border: 1px solid #3a5a7a;
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  box-shadow: 0 4px 18px rgba(0,0,0,0.35);
  max-width: 300px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.update-toast strong { display: block; margin-bottom: 0.25rem; }
.update-toast .btn-reload {
  margin-top: 0.6rem;
  display: inline-block;
  background: var(--color-sun);
  color: #1a1a1a;
  border: none;
  border-radius: var(--radius);
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
.update-toast .btn-reload:hover { opacity: 0.85; }

/* ── Auth pages ──────────────────────────────────────────────────── */
.auth-wrap {
  max-width: 380px;
  margin: 3rem auto;
}
.auth-wrap h1 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.auth-footer  { font-size: 0.85rem; margin-top: 1rem; text-align: center; }

/* ── Two-column home layout ──────────────────────────────────────── */
.page-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}
@media (max-width: 640px) {
  .page-cols { grid-template-columns: 1fr; }
}

/* ── Games table ─────────────────────────────────────────────────── */
.games-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.games-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
.games-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
.games-table tbody tr:last-child td { border-bottom: none; }
.games-table tbody tr:hover { background: var(--color-bg); }

/* ── Status badges ───────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-waiting { background: #fef3cd; color: #7a5900; }
.status-active  { background: #d4edda; color: #1a5c30; }
.status-ended   { background: #e9ecef; color: #495057; }

/* ── Color swatches ──────────────────────────────────────────────── */
.color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.color-swatch-red    { background: var(--color-p-red); }
.color-swatch-blue   { background: var(--color-p-blue); }
.color-swatch-green  { background: var(--color-p-green); }
.color-swatch-yellow { background: var(--color-p-yellow); }
.color-swatch-empty  { background: var(--color-empty); }

/* ── Lobby player list ───────────────────────────────────────────── */
.lobby-players {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.lobby-players li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}
.lobby-players .player-name { font-weight: 500; }
.lobby-empty { color: var(--color-muted); font-style: italic; }

/* ── Inline badges ───────────────────────────────────────────────── */
.badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--color-empty);
  color: var(--color-muted);
  text-transform: uppercase;
}
.badge-you { background: #d4edda; color: #1a5c30; }
.badge-bot { background: #e8eaf6; color: #3949ab; }
.invite-badge {
  position: absolute; top: -4px; right: -10px;
  background: var(--color-primary, #c00); color: #fff;
  border-radius: 999px; font-size: 0.68rem; font-weight: 700;
  min-width: 1.1rem; height: 1.1rem; line-height: 1.1rem;
  text-align: center; padding: 0 0.2rem;
}

/* ── Game layout ─────────────────────────────────────────────────── */
.game-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
@media (max-width: 700px) {
  .game-layout { flex-direction: column; }
}

/* ── Board grid ──────────────────────────────────────────────────── */
:root { --cell-size: 38px; }
/* Mobile cell-size overrides live in the Mobile section below */
@media (max-width: 640px)  { .board-grid { gap: 1px; } }

.board-area { flex-shrink: 0; }

/* ── Board coordinate labels ─────────────────────────────────────── */
.board-labels-container {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}
.board-col-labels {
  display: flex;
  gap: 2px;
  margin-left: calc(20px + 2px); /* row-label column width + gap */
}
.board-row-with-labels {
  display: flex;
  gap: 2px;
  align-items: flex-start;
}
.board-row-labels {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 2px; /* align with first cell (board top border) */
}
.board-label {
  width: var(--cell-size);
  height: var(--cell-size);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  color: var(--color-muted);
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}
.board-row-labels .board-label { width: 20px; }

/* ── Board error panel ────────────────────────────────────────────── */
.board-error {
  margin-top: 0.5rem;
  background: #fdecea;
  border: 1px solid var(--color-danger);
  border-radius: var(--radius);
  padding: 0.45rem 2.2rem 0.45rem 0.75rem;
  position: relative;
  color: var(--color-danger);
  font-size: 0.84rem;
  user-select: text;
  line-height: 1.4;
}
.board-error-close {
  position: absolute;
  top: 0.25rem;
  right: 0.35rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-danger);
  font-size: 1rem;
  line-height: 1;
  padding: 0.1rem 0.2rem;
  opacity: 0.65;
}
.board-error-close:hover { opacity: 1; }

.board-grid {
  display: grid;
  grid-template-columns: repeat(12, var(--cell-size));
  grid-template-rows: repeat(12, var(--cell-size));
  gap: 2px;
  background: var(--color-border);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
}

.board-cell {
  background: var(--color-empty);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  user-select: none;
  transition: background 0.1s;
}
.board-cell.cell-available { cursor: pointer; }
.board-cell.cell-available:hover { background: var(--color-empty-hover); }

/* piece backgrounds */
.board-cell.piece-sun    { background: var(--color-sun); cursor: default; }
.board-cell.piece-shadow { background: var(--color-shadow); cursor: default; }
.board-cell.piece-roof   { cursor: default; }
.board-cell.piece-roof-red    { background: var(--color-p-red);    color: #fff; }
.board-cell.piece-roof-blue   { background: var(--color-p-blue);   color: #fff; }
.board-cell.piece-roof-green  { background: var(--color-p-green);  color: #fff; }
.board-cell.piece-roof-yellow { background: var(--color-p-yellow); color: var(--color-text); }

/* staged: piece preview with white ring */
.board-cell.staged { outline: 2px solid rgba(255,255,255,0.85); outline-offset: -2px; opacity: 0.82; cursor: pointer; }

/* ── Game sidebar ─────────────────────────────────────────────────── */
.game-sidebar {
  min-width: 220px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (max-width: 700px) {
  .game-sidebar { min-width: 0; max-width: 100%; width: 100%; }
}

.card-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 0.6rem;
}

/* ── Spectator banner ─────────────────────────────────────────────── */
.spectator-banner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  text-align: center;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}

/* ── Turn badges ──────────────────────────────────────────────────── */
@keyframes turn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 105, 20, 0.45); }
  55%       { box-shadow: 0 0 0 7px rgba(139, 105, 20, 0); }
}
.turn-badge {
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
}
.turn-badge-yours   {
  background: var(--color-primary);
  color: #fff;
  animation: turn-pulse 1.6s ease-out infinite;
}
.turn-badge-waiting { color: var(--color-muted); background: none; }
.turn-badge-ended   { background: var(--color-empty); color: var(--color-muted); }

/* ── Piece palette ────────────────────────────────────────────────── */
.palette {
  display: flex;
  gap: 0.4rem;
}
.palette-btn {
  flex: 1;
  padding: 0.35rem 0.3rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 0.8rem;
  text-align: center;
  transition: border-color 0.12s, background 0.12s;
}
.palette-btn:hover:not(:disabled) { background: var(--color-empty); }
.palette-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.palette-btn.palette-active-sun    { border-color: var(--color-sun-border); background: #fef8e0; }
.palette-btn.palette-active-shadow { border-color: var(--color-shadow); background: #e8eaf6; color: var(--color-shadow); }
.palette-btn.palette-active-roof   { border-color: var(--roof-color, var(--color-primary)); background: #f5ebd0; }
.piece-count { font-size: 0.72rem; opacity: 0.65; display: block; }

/* ── Player row in score panel ────────────────────────────────────── */
.player-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
}
.player-row:last-child { border-bottom: none; }
.player-row.is-current-turn { font-weight: 600; }
.player-row .pname { flex: 1; }
.player-row .pscore { font-size: 0.8rem; color: var(--color-muted); white-space: nowrap; }

/* ── Supply panel ─────────────────────────────────────────────────── */
.supply-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--color-border);
}
.supply-row:last-child { border-bottom: none; }
.supply-icon { width: 1.1em; text-align: center; }
.supply-sun    { color: var(--color-sun-border); }
.supply-shadow { color: var(--color-shadow); }
.supply-count  { margin-left: auto; font-weight: 600; }

/* ── Team sections in score panel ────────────────────────────────── */
.team-section { margin-bottom: 0.5rem; }
.team-section:last-child { margin-bottom: 0; }
.team-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  padding: 0.2rem 0 0.3rem;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 0.15rem;
}

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.page-info {
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* ── Vote button ──────────────────────────────────────────────────── */
.vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-muted);
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.4;
  transition: color 0.1s, border-color 0.1s;
}
.vote-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.vote-btn-active {
  border-color: var(--color-primary) !important;
  color: var(--color-primary) !important;
  font-weight: 600;
}
.vote-btn:disabled { cursor: default; opacity: 0.55; }
.vote-count-static { font-size: 0.82rem; color: var(--color-muted); }

/* ── Replays filter bar ──────────────────────────────────────────── */
.replays-filters {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Replay viewer ───────────────────────────────────────────────── */
.just-placed {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  position: relative;
  z-index: 1;
}

.replay-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.replay-step-badge {
  flex: 1;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
  padding: 0 0.25rem;
}

/* ── Hamburger nav ───────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem 0.25rem;
  line-height: 1;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: opacity 0.15s;
}

@media (max-width: 640px) {
  .nav-hamburger { display: flex; }

  .site-nav { position: relative; }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem 1rem;
    gap: 0.7rem;
    z-index: 300;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  }
  .nav-links.nav-open { display: flex; }

  /* make sign-out button full width on mobile */
  .nav-links .btn { display: block; text-align: center; }
}

/* ── Mobile: board cell size (fills viewport width) ──────────────── */
/* Formula: (viewport - 2rem container padding - 22px row-label col) / 12 cells */
@media (max-width: 640px) {
  :root { --cell-size: min(34px, calc((100vw - 2rem - 24px) / 12)); }
}
/* Very small screens: drop coordinate labels to reclaim ~24px */
@media (max-width: 360px) {
  :root { --cell-size: calc((100vw - 2rem) / 12); }
  .board-col-labels, .board-row-labels { display: none; }
}

/* ── Mobile: touch polish ────────────────────────────────────────── */
@media (max-width: 640px) {
  .board-cell { touch-action: manipulation; }
  .palette-btn, .btn { touch-action: manipulation; }
}

/* ── Mobile: desktop-only hides turn card + palette in sidebar ───── */
@media (max-width: 640px) {
  .desktop-only { display: none !important; }
}

/* ── Mobile: game layout bottom padding for fixed action bar ─────── */
@media (max-width: 640px) {
  .game-layout {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Mobile: action bar (fixed bottom, hidden on desktop) ────────── */
.mobile-action-bar {
  display: none;
}
@media (max-width: 640px) {
  .mobile-action-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-top: 2px solid var(--color-border);
    padding: 0.55rem 0.75rem;
    padding-bottom: max(0.55rem, env(safe-area-inset-bottom, 0.55rem));
    z-index: 200;
    min-height: 3.4rem;
  }
}

/* Info text (waiting / opponent's turn) */
.mobile-action-info {
  flex: 1;
  text-align: center;
  font-size: 0.88rem;
  color: var(--color-muted);
  font-weight: 500;
}

/* Piece picker row */
.mobile-palette {
  display: flex;
  flex: 1;
  gap: 0.35rem;
}
.mobile-palette-btn {
  flex: 1;
  min-height: 2.5rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 1rem;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0 0.2rem;
  transition: border-color 0.12s, background 0.12s;
}
.mobile-palette-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mobile-palette-btn.palette-active-sun    { border-color: var(--color-sun-border); background: #fef8e0; }
.mobile-palette-btn.palette-active-shadow { border-color: var(--color-shadow); background: #e8eaf6; }
.mobile-palette-btn.palette-active-roof   { border-color: var(--roof-color, var(--color-primary)); background: #f5ebd0; }
.mobile-piece-count { font-size: 0.7rem; opacity: 0.7; line-height: 1; }

/* Action bar "my turn" highlight */
.mobile-action-bar.my-turn {
  border-top-color: var(--color-primary);
  border-top-width: 3px;
}

/* (your-turn-toast removed — replaced by sticky-toast-stack) */

/* Push permission prompt bar */
.push-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-top: 2px solid var(--color-primary);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  z-index: 600;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
  font-size: 0.9rem;
}
.push-prompt-btns { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* Confirm + clear button group */
.mobile-action-confirm {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.mobile-action-confirm .btn {
  min-height: 2.5rem;
  padding: 0 0.7rem;
  font-size: 0.9rem;
}

/* ── Footer ──────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 0.8rem 0;
  font-size: 0.78rem;
  color: var(--color-muted);
  text-align: center;
}

/* ── Sticky toast stack ──────────────────────────────────────────── */
.sticky-toast-stack {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 700;
  max-width: 340px;
  width: calc(100vw - 2rem);
}
.sticky-toast {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}
.sticky-toast-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.sticky-toast-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* ── Turn card highlight ─────────────────────────────────────────── */
@keyframes turn-card-pulse {
  0%, 100% { border-color: var(--color-primary); box-shadow: 0 0 0 0 rgba(139,105,20,0.35); }
  55%       { box-shadow: 0 0 0 6px rgba(139,105,20,0); }
}
.turn-card-active {
  border: 2px solid var(--color-primary) !important;
  animation: turn-card-pulse 2s ease-out infinite;
}
.turn-badge-yours {
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

/* ── Game switcher dropdown ──────────────────────────────────────── */
.game-switcher-dropdown { max-height: 70vh; overflow-y: auto; }
.game-switcher-current { font-weight: 700; background: var(--color-bg); }
