/* Design tokens, base elements and shared controls (buttons, inputs, cards). */
:root {
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Rajdhani', 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;
  --ink: #f5f2ea;
  --ink-2: rgba(245, 242, 234, .74);
  --ink-3: rgba(245, 242, 234, .5);
  --panel: rgba(10, 14, 18, .58);
  --panel-2: rgba(10, 14, 18, .84);
  --panel-solid: #12171c;
  --line: rgba(255, 255, 255, .1);
  --line-2: rgba(255, 255, 255, .2);
  --accent: #ffc94d;
  --accent-2: #ffdd85;
  --accent-ink: #1d1505;
  --blue: #589dff;
  --red: #ef6258;
  --good: #7ddc8c;
  --warn: #ffb547;
  --danger: #ff5a4e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .38);
  --text-shadow: 0 1px 2px rgba(0, 0, 0, .6), 0 0 1px rgba(0, 0, 0, .7);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0f13; color: var(--ink); font-family: var(--font-ui); -webkit-font-smoothing: antialiased; }
canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.btn-icon:empty, .card-icon:empty { display: none; }
.btn-icon, .card-icon { display: inline-flex; }
.team-blue { --team: var(--blue); }
.team-red { --team: var(--red); }

/* ---- Buttons ---------------------------------------------------------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 42px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s, opacity .15s;
}
.button:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.button:focus-visible, .icon-button:focus-visible, .text-button:focus-visible, select:focus-visible, input:focus-visible, .switch:focus-visible, .segmented button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.button:disabled { cursor: default; opacity: .55; }
.button.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 22px rgba(255, 201, 77, .22); }
.button.primary:hover:not(:disabled) { background: var(--accent-2); box-shadow: 0 8px 28px rgba(255, 201, 77, .32); }
.button.ghost { background: rgba(255, 255, 255, .06); color: var(--ink); border-color: var(--line); }
.button.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .11); border-color: var(--line-2); }
.button.outline { background: transparent; color: var(--ink); border-color: var(--line-2); }
.button.outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.button.small { min-height: 34px; padding: 0 12px; font-size: 15px; }
.button.xl { min-height: 62px; padding: 0 34px; font-size: 26px; letter-spacing: .1em; border-radius: 10px; }
.button.xl .icon { width: 22px; height: 22px; }
.button.busy .btn-icon { animation: spin .9s linear infinite; }

.icon-button {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); cursor: pointer; color: var(--ink-2);
  transition: background-color .15s, color .15s;
}
.icon-button:hover { background: rgba(255, 255, 255, .12); color: var(--ink); }
.icon-button .icon { width: 18px; height: 18px; }
.text-button {
  display: inline-flex; align-items: center; gap: .45em; padding: 6px 4px; background: none; border: 0;
  color: var(--ink-2); cursor: pointer; font-size: 14px; font-weight: 500;
}
.text-button:hover { color: var(--ink); }

/* ---- Inputs ----------------------------------------------------------- */
input[type="text"], input[type="email"], input:not([type]), select {
  height: 38px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, .35); color: var(--ink); font-size: 14px; min-width: 0;
}
input::placeholder { color: var(--ink-3); }
select { cursor: pointer; padding-right: 28px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
select option { background: var(--panel-solid); color: var(--ink); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; --fill: 50%; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--fill), rgba(255, 255, 255, .16) var(--fill)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .16); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px rgba(255, 201, 77, .35); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px rgba(255, 201, 77, .35); }

.switch { position: relative; width: 44px; height: 24px; border-radius: 12px; border: 0; padding: 0; cursor: pointer; background: rgba(255, 255, 255, .18); transition: background-color .15s; flex: none; }
.switch span { position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(20px); background: var(--accent-ink); }

.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); }
.segmented button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.segmented button[aria-checked="true"] { background: var(--ink); color: #111; }

/* ---- Cards and badges ------------------------------------------------- */
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font: 700 15px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.card h3 .icon { color: var(--accent); }
.level-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; background: rgba(255, 201, 77, .16); color: var(--accent); font: 700 13px/1 var(--font-display); letter-spacing: .06em; }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; background: rgba(255, 255, 255, .1); color: var(--ink-2); font: 700 11px/1 var(--font-display); letter-spacing: .1em; }
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 24px; padding: 0 7px; border-radius: 6px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line-2); border-bottom-width: 2px; font: 600 12px/1 var(--font-ui); color: var(--ink); white-space: nowrap; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

#dev { position: fixed; top: 4px; left: 6px; color: #0f0; font: 12px monospace; display: none; text-shadow: 1px 1px 0 #000; z-index: 50; pointer-events: none; }

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