/* Shared design tokens and primitives for the games hub. */

:root {
  --felt-900: #06120c;
  --felt-800: #0a1f14;
  --felt-700: #0e2d1d;
  --felt-600: #143d28;
  --rail-900: #2a1a10;
  --rail-700: #4a2f1d;
  --rail-500: #6b452a;

  --ink: #f3f7f4;
  --ink-dim: #9fb3a8;
  --ink-faint: #6b8175;

  --gold: #e8c766;
  --gold-dim: #a8904a;
  --red: #d94a4a;
  --red-dim: #8e2f2f;
  --blue: #4a8fd9;
  --green: #46b877;
  --purple: #9a6ad9;

  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.22);

  --radius: 10px;
  --radius-sm: 6px;

  --shadow-lift: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-deep: 0 18px 46px rgba(0, 0, 0, 0.6);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Georgia, "Times New Roman", "Liberation Serif", "Nimbus Roman", "DejaVu Serif", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--felt-900);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

input {
  font: inherit;
}

/* ---------- felt surface ---------- */

.felt {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.06), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, 0.5), transparent 60%),
    var(--felt-700);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line-strong);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.09s ease, filter 0.15s ease, background 0.15s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-gold {
  background: linear-gradient(180deg, #f3d986, #b8963f);
  border-color: #d8bb63;
  color: #2a1f06;
}

.btn-red {
  background: linear-gradient(180deg, #e05a5a, #a02f2f);
  border-color: #e88;
  color: #fff;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

/* ---------- chips ---------- */

.chip {
  --chip-face: #b8b8c0;
  --chip-edge: #fff;
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background:
    repeating-conic-gradient(var(--chip-edge) 0deg 18deg, transparent 18deg 36deg),
    radial-gradient(circle at 50% 50%, var(--chip-face) 0 62%, var(--chip-edge) 62% 100%);
  border: 2px solid rgba(0, 0, 0, 0.35);
  box-shadow: var(--shadow-lift), inset 0 -3px 6px rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: #1a1a1a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  flex: none;
}

.chip[data-v="1"] { --chip-face: #f2f2f2; --chip-edge: #cfcfcf; }
.chip[data-v="5"] { --chip-face: #d94a4a; --chip-edge: #f5eaea; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.chip[data-v="25"] { --chip-face: #46b877; --chip-edge: #eafaf0; color: #06280f; }
.chip[data-v="100"] { --chip-face: #2b2b33; --chip-edge: #d9d9e2; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.chip[data-v="500"] { --chip-face: #9a6ad9; --chip-edge: #efe6fb; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }

.chip.selected {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* ---------- dice ---------- */

.dice-stage {
  position: relative;
  perspective: 900px;
  pointer-events: none;
}

.die {
  position: absolute;
  width: var(--die-size, 56px);
  height: var(--die-size, 56px);
  transform-style: preserve-3d;
  will-change: transform;
  left: 0;
  top: 0;
}

.die-face {
  position: absolute;
  inset: 0;
  border-radius: 12%;
  background: linear-gradient(150deg, #fffefb, #e6e2d8);
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.12);
  display: grid;
  grid-template-areas:
    "a . c"
    "d e f"
    "g . i";
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  padding: 12%;
  gap: 3%;
  backface-visibility: hidden;
}

.pip {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a4a4a, #111);
  box-shadow: inset 0 -1px 2px rgba(255, 255, 255, 0.25);
  align-self: center;
  justify-self: center;
}

.die-face[data-pips="1"] .pip:nth-child(1) { grid-area: e; }
.die-face[data-pips="2"] .pip:nth-child(1) { grid-area: a; }
.die-face[data-pips="2"] .pip:nth-child(2) { grid-area: i; }
.die-face[data-pips="3"] .pip:nth-child(1) { grid-area: a; }
.die-face[data-pips="3"] .pip:nth-child(2) { grid-area: e; }
.die-face[data-pips="3"] .pip:nth-child(3) { grid-area: i; }
.die-face[data-pips="4"] .pip:nth-child(1) { grid-area: a; }
.die-face[data-pips="4"] .pip:nth-child(2) { grid-area: c; }
.die-face[data-pips="4"] .pip:nth-child(3) { grid-area: g; }
.die-face[data-pips="4"] .pip:nth-child(4) { grid-area: i; }
.die-face[data-pips="5"] .pip:nth-child(1) { grid-area: a; }
.die-face[data-pips="5"] .pip:nth-child(2) { grid-area: c; }
.die-face[data-pips="5"] .pip:nth-child(3) { grid-area: e; }
.die-face[data-pips="5"] .pip:nth-child(4) { grid-area: g; }
.die-face[data-pips="5"] .pip:nth-child(5) { grid-area: i; }
.die-face[data-pips="6"] .pip:nth-child(1) { grid-area: a; }
.die-face[data-pips="6"] .pip:nth-child(2) { grid-area: c; }
.die-face[data-pips="6"] .pip:nth-child(3) { grid-area: d; }
.die-face[data-pips="6"] .pip:nth-child(4) { grid-area: f; }
.die-face[data-pips="6"] .pip:nth-child(5) { grid-area: g; }
.die-face[data-pips="6"] .pip:nth-child(6) { grid-area: i; }

/* ---------- toast ---------- */

.toast-stack {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 900;
  pointer-events: none;
  width: min(92vw, 460px);
}

.toast {
  background: rgba(12, 22, 16, 0.96);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  box-shadow: var(--shadow-deep);
  animation: toast-in 0.18s ease-out;
}

.toast.bad {
  border-left-color: var(--red);
}

.toast.good {
  border-left-color: var(--green);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
