/* Deep Space: shared tokens, board and controls for the website and the app. */
:root {
  --ink: #070B1A;
  --panel: #111936;
  --panel-2: #1A2450;
  --line: #2A3566;
  --gold: #FFD166;
  --gold-deep: #D9992B;
  --ruby: #FF6B81;
  --lagoon: #4CC9F0;
  --emerald: #34D399;
  --amethyst: #A78BFA;
  --text: #EEF1FF;
  --text-2: #C4CAEC;
  --muted: #8891C2;
  --void: #02040C;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--body); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; margin: 0; }

/* ---------- board ---------- */
.board {
  display: grid; padding: 6px; border-radius: 18px; background: var(--void);
  width: 100%; aspect-ratio: 1; user-select: none; -webkit-user-select: none; touch-action: none;
  box-shadow: 0 0 0 1px var(--line), 0 0 40px rgba(76,201,240,.12);
}
.tile {
  position: relative; border: 0 solid var(--void); padding: 0; border-radius: 0; display: grid; place-items: center;
  background-image: linear-gradient(rgba(255,255,255,.16), rgba(0,0,0,.12));
  box-shadow: inset 0 0 0 1px rgba(2,4,12,.42);
  transition: filter .12s;
}
/* Region edges */
.tile.et { border-top-width: 4px; }
.tile.el { border-left-width: 4px; }
.board.n9 .tile.et, .board.n10 .tile.et, .board.n11 .tile.et { border-top-width: 3px; }
.board.n9 .tile.el, .board.n10 .tile.el, .board.n11 .tile.el { border-left-width: 3px; }
.tile.ctl { border-top-left-radius: 12px; }
.tile.ctr { border-top-right-radius: 12px; }
.tile.cbl { border-bottom-left-radius: 12px; }
.tile.cbr { border-bottom-right-radius: 12px; }
@media (hover: hover) { .tile:hover { filter: brightness(1.1); } }
.tile:active { filter: brightness(.88); }
.tile .dot { width: 16%; aspect-ratio: 1; border-radius: 50%; background: var(--ink); opacity: .6; pointer-events: none; }
.tile.auto .dot { opacity: .28; }
.tile svg { width: 76%; height: 76%; pointer-events: none; filter: drop-shadow(0 0 5px rgba(255,246,210,.85)); }
.tile.star svg { animation: pop .22s ease-out; }
.tile.clash { background-image: repeating-linear-gradient(45deg, rgba(7,11,26,.42) 0 3px, transparent 3px 8px) !important; }
.tile.clash.star svg { animation: shake .35s; }
.tile.flash-bad { animation: bad .5s; }
.tile.glow { box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 6px var(--ink), inset 0 0 18px 6px rgba(255,255,255,.55); z-index: 1; animation: pulse 1.1s ease-in-out infinite; }
.tile.glow-soft { box-shadow: inset 0 0 0 3px rgba(255,255,255,.9); z-index: 1; }
.board.won .tile { animation: wave .7s ease-out both; }
.board.frozen { box-shadow: 0 0 0 3px var(--lagoon), 0 0 30px rgba(76,201,240,.4); }
@keyframes pop { from { transform: scale(.2) rotate(-40deg); } to { transform: scale(1); } }
@keyframes shake { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
@keyframes bad { 0%, 100% { filter: none; } 30% { filter: brightness(.55) saturate(2) hue-rotate(-20deg); } }
@keyframes wave { 45% { filter: brightness(1.4); } }
@keyframes pulse { 50% { filter: brightness(1.25); } }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 14px; border: 0;
  font-weight: 700; font-size: 15px; text-decoration: none;
}
.btn-gold { background: var(--gold); color: var(--ink); box-shadow: inset 0 -4px 0 var(--gold-deep); }
.btn-gold:active { box-shadow: inset 0 -1px 0 var(--gold-deep); transform: translateY(2px); }
.btn-dark { background: var(--panel); color: var(--text); }
.btn-light { background: var(--panel-2); color: var(--text); border: 1.5px solid var(--line); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-lg { min-height: 56px; font-size: 17px; font-weight: 700; border-radius: 16px; }

/* Stardust */
.coin {
  display: inline-block; width: 1em; height: 1em; vertical-align: -0.14em; background: var(--gold);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  max-width: min(440px, calc(100vw - 32px)); background: var(--text); color: var(--ink);
  padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; line-height: 1.4; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
