/* Jewel & Ink: shared tokens, board and controls for the website and the app. */
:root {
  --ink: #10142A;
  --velvet: #1B2140;
  --velvet-2: #232A4E;
  --line: #2A3260;
  --gold: #F5C04A;
  --gold-deep: #C8902A;
  --ruby: #E5677A;
  --lagoon: #3CC4C9;
  --emerald: #3FBF8F;
  --amethyst: #A07BE8;
  --text: #EEF0FA;
  --text-2: #C9CEEA;
  --muted: #8D95BE;
  --parchment: #F4F5FA;
  --card: #FFFFFF;
  --ink-2: #353B5E;
  --ink-3: #5A6190;
  --rule: #E1E4F0;
  --display: 'Bricolage Grotesque', 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: 800; letter-spacing: -0.02em; margin: 0; }

/* ---------- board ---------- */
.board {
  display: grid; gap: 4px; padding: 10px; border-radius: 22px; background: #0A0D1E;
  width: 100%; aspect-ratio: 1; user-select: none; -webkit-user-select: none; touch-action: none;
}
.tile {
  position: relative; border: 0; padding: 0; border-radius: 8px; display: grid; place-items: center;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.35);
  transition: transform .08s, filter .12s;
}
.board.n9 .tile, .board.n10 .tile, .board.n11 .tile { border-radius: 6px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), inset 0 1.5px 0 rgba(255,255,255,.35); }
@media (hover: hover) { .tile:hover { filter: brightness(1.08); } }
.tile:active { transform: scale(.94); }
.tile .dot { width: 18%; aspect-ratio: 1; border-radius: 50%; background: var(--ink); opacity: .55; pointer-events: none; }
.tile.auto .dot { opacity: .25; }
.tile svg { width: 64%; height: 64%; pointer-events: none; }
.tile.queen svg { animation: pop .2s ease-out; }
.tile.clash { background-image: repeating-linear-gradient(45deg, rgba(16,20,42,.32) 0 3px, transparent 3px 8px) !important; }
.tile.clash.queen svg { animation: shake .35s; }
.tile.flash-bad { animation: bad .5s; }
.tile.glow { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(245,192,74,.7); z-index: 1; }
.tile.glow-soft { box-shadow: 0 0 0 3px rgba(255,255,255,.85); 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(60,196,201,.35); }
@keyframes pop { from { transform: scale(.3) rotate(-12deg); } 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(.6) saturate(2) hue-rotate(-20deg); transform: scale(.9); } }
@keyframes wave { 45% { filter: brightness(1.35); transform: scale(1.06); } }

/* ---------- 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(--velvet); color: var(--text); }
.btn-light { background: var(--card); color: var(--ink); border: 1.5px solid #CDD1E6; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-lg { min-height: 56px; font-size: 17px; font-weight: 800; border-radius: 16px; }

.coin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; background: var(--gold); box-shadow: inset 0 -.12em 0 var(--gold-deep); vertical-align: -0.12em; }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  max-width: min(420px, 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,.25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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