/* Shared look for every game: colours, type, buttons, cards, menu, player chips, status line, share panel. */
:root {
  --sand: #f3e6d0;
  --sand-deep: #e7d3b3;
  --paper: #fffaf0;
  --ink: #2a1a10;
  --muted: #6d5544;
  --clay: #b5653a;
  --clay-dark: #8f4a27;
  --line: #3a2416;
  --dark-piece: #1f1612;
  --light-piece: #fff8ea;
  --gold: #f2b632;
  --go: #2f8f4e;
  --danger: #d6342c;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--sand);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
h1, h2 { font-family: Georgia, "Times New Roman", serif; margin: 0; }

.hero { text-align: center; padding: 20px 0 20px; }
.kicker { margin: 0 0 4px; text-transform: uppercase; letter-spacing: .18em; font-size: 12px; color: var(--clay-dark); font-weight: 700; }
.hero h1 { font-size: clamp(36px, 11vw, 60px); line-height: 1; letter-spacing: -.01em; }
.lead { color: var(--muted); margin: 12px auto 0; max-width: 34ch; }

.menu { display: grid; gap: 12px; }
.card { background: var(--paper); border: 1px solid var(--sand-deep); border-radius: 14px; padding: 16px; }
.card h2 { font-size: 20px; margin-bottom: 6px; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.levels { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 10px 16px;
  border: 2px solid var(--line); border-radius: 10px;
  background: transparent; color: var(--ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--line); color: var(--sand); }
.btn[aria-pressed=true] { background: var(--line); color: var(--sand); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .link:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.link { background: none; border: 0; padding: 10px 4px; color: var(--clay-dark); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; justify-self: center; display: inline-block; }
.error { color: var(--danger); font-weight: 700; text-align: center; margin: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mode { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }

.players { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.player { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 2px solid transparent; background: var(--paper); min-width: 0; }
.player.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(242, 182, 50, .25); }
.swatch { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); }
.who { display: grid; min-width: 0; line-height: 1.2; }
.who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--muted); font-size: 12px; }

.status { text-align: center; font-weight: 700; font-size: 17px; margin: 12px 0 8px; min-height: 2.9em; display: flex; align-items: center; justify-content: center; }
.status.over { font-family: Georgia, serif; font-size: 22px; }

.board-area { width: 100%; margin: 0 auto; }
.cover { text-align: center; padding: 28px 16px; }
.cover p { font-size: 20px; font-weight: 700; color: var(--ink); }

.share { background: var(--paper); border: 1px solid var(--sand-deep); border-radius: 14px; padding: 14px; margin-top: 14px; }
.share p { margin: 0 0 8px; font-weight: 700; }
.share input { width: 100%; padding: 10px; border: 2px solid var(--sand-deep); border-radius: 8px; font: inherit; font-size: 14px; background: #fff; color: var(--ink); margin-bottom: 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.actions { margin-top: 14px; }

dialog { border: 0; border-radius: 16px; padding: 20px; max-width: min(520px, calc(100vw - 32px)); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgba(42, 26, 16, .6); }
dialog h2 { margin-bottom: 10px; }
dialog ol, dialog ul { padding-left: 20px; margin: 0 0 16px; }
dialog li { margin-bottom: 8px; }
dialog .btn { width: 100%; }

@keyframes pulse { 50% { opacity: .45; } }
