/* Design tokens, reset, typography, buttons and form controls.
   All colours, radii, spacing and shadows are defined here; other files only
   use these variables (art files carry their own illustration palettes). */
:root {
  /* Graphite surfaces, from the page background up to raised controls. */
  --bg: #0b0c0e;
  --bg-deep: #08090a;
  --surface-0: #101114;
  --surface-1: #15171a;
  --surface-2: #1b1d21;
  --surface-3: #23262b;
  --surface-4: #2c3036;
  --line: #262a30;
  --line-strong: #353a42;
  --hairline: rgba(255, 255, 255, 0.06);

  /* One warm accent for coins and primary actions. */
  --gold: #e0a838;
  --gold-2: #f2c44a;
  --gold-dark: #9c6d14;
  --gold-soft: rgba(242, 196, 74, 0.14);
  /* Neutral steel for secondary emphasis (selected states, level badges). */
  --steel: #4a515c;
  --steel-2: #5d6571;
  --steel-dark: #30353d;
  /* Semantic colours. */
  --green: #3ccf8e;
  --green-dark: #1f8a5c;
  --green-soft: rgba(60, 207, 142, 0.14);
  --red: #f0606f;
  --red-dark: #a8323f;
  --red-soft: rgba(240, 96, 111, 0.14);
  --info: #7fb2e6;

  --text: #eceef1;
  --text-muted: #a4a9b2;
  --text-dim: #868c96;

  /* 8px spacing scale (4px half step). */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.45);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--gold-2);
  --topbar-h: 60px;
  --sidebar-w: 300px;
  --font: 'Inter', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Roboto, Arial, sans-serif;
  --font-display: 'Inter', 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Roboto, Arial, sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
}

html,
body {
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: radial-gradient(1100px 520px at 60% -12%, rgba(255, 255, 255, 0.045), transparent 70%), var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}
p a,
.hint a {
  color: var(--gold-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

button:disabled,
input:disabled,
select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
h1 {
  font-size: var(--fs-2xl);
}
h2 {
  font-size: var(--fs-xl);
}
h3 {
  font-size: var(--fs-lg);
}

svg {
  display: block;
}

.muted {
  color: var(--text-muted);
}
.gold {
  color: var(--gold-2);
}
.win-text {
  color: var(--green);
}
.loss-text {
  color: var(--red);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
[hidden] {
  display: none !important;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: inline-block;
}
.icon svg {
  width: 100%;
  height: 100%;
}

.coin-amount {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.coin-amount .coin {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 38px;
  padding: 9px var(--s4);
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 650;
  font-size: var(--fs-md);
  letter-spacing: 0;
  white-space: nowrap;
  color: #1d1505;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: transform 0.12s, filter 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 14px rgba(242, 196, 74, 0.22);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn .icon {
  width: 16px;
  height: 16px;
}
.btn-secondary {
  color: var(--text);
  border-color: var(--line-strong);
  background: linear-gradient(180deg, var(--surface-4), var(--surface-3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.4);
}
.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(180deg, #353a42, var(--surface-4));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 14px rgba(0, 0, 0, 0.35);
}
.btn-green {
  color: #04150d;
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, #5ee0a4, var(--green));
}
.btn-green:hover:not(:disabled) {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 14px rgba(60, 207, 142, 0.25);
}
.btn-red {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, #f37a86, var(--red-dark));
}
.btn-ghost {
  color: var(--text);
  border-color: var(--line);
  background: transparent;
  box-shadow: none;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--line-strong);
  box-shadow: none;
}
.btn-sm {
  min-height: 32px;
  padding: 6px var(--s3);
  font-size: var(--fs-sm);
}
.btn-block {
  width: 100%;
  min-height: 46px;
  padding: 12px var(--s4);
  font-size: var(--fs-lg);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-muted);
  flex: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
  color: var(--text);
}
.icon-btn .icon {
  width: 18px;
  height: 18px;
}
.icon-btn.sm {
  width: 28px;
  height: 28px;
}
.icon-btn.sm .icon {
  width: 15px;
  height: 15px;
}

/* ---------- Form controls ---------- */
.input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px var(--s3);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-0);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover {
  border-color: #444a53;
}
.input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}
select.input {
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field + .field {
  margin-top: var(--s3);
}
.label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.range {
  width: 100%;
  accent-color: var(--gold);
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-0);
}
.segmented button {
  flex: 1;
  min-width: 0;
  padding: 7px 6px;
  border-radius: 6px;
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.segmented button:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}
.segmented button.active {
  background: var(--surface-4);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.4);
}
