@import url("/fonts/geist/index.css");
@import url("/fonts/geist-mono/index.css");

/*
  Design tokens, taken from the Chessmatess logo:
  slate #416072 · sky #a7dcfa · orange #fe502d · cream #fffcf0 · ink #22271e.
  Orange is the brand accent (wordmarks, ranks, tags). Slate is the action colour (buttons, active states).
  Green/red are reserved for rating movement only.
  Radius rule: containers 18px, rows/cards 12px, controls 10px, segmented tabs + chips full-pill.
*/
:root {
  --cream: #fffcf0;
  --sky: #a7dcfa;
  --sky-soft: #dcf0fc;
  --slate: #416072;
  --slate-deep: #33505f;
  --orange: #fe502d;
  --ink: #22271e;

  --bg: var(--cream);
  --surface: #ffffff;
  --surface-2: #f6f3e6;
  --surface-3: #ece8d8;
  --line: rgba(65, 96, 114, .14);
  --line-strong: rgba(65, 96, 114, .28);
  --text: var(--ink);
  --text-2: #3d4a52;
  --muted: #586e7a;
  --accent: var(--orange);
  --up: #16824a;
  --down: #cc2639;
  --up-wash: #dcf2e4;
  --down-wash: #fbe1e3;
  --shadow: 0 1px 2px rgba(65, 96, 114, .08), 0 10px 24px -14px rgba(65, 96, 114, .35);
  --r-container: 18px;
  --r-row: 12px;
  --r-control: 10px;
  --font: "Geist Variable", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono Variable", ui-monospace, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --z-raised: 2;
  --z-overlay: 20;
  --z-toast: 30;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  line-height: 1.45;
}
/* checkerboard strip across the top of every page, echoing the logo board */
body::before {
  content: ""; display: block; height: 12px;
  background: repeating-conic-gradient(var(--slate) 0 25%, var(--sky) 0 50%) 0 0 / 24px 24px;
}

button, input, select { font: inherit; color: inherit; }
a { color: var(--slate); text-underline-offset: 3px; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

/* brand wordmark: heavy mono caps like the logo lettering */
.wordmark { font-family: var(--mono); font-weight: 800; text-transform: uppercase; letter-spacing: -0.03em; color: var(--orange); }
.logo { display: block; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* rating change chip */
.chip {
  display: inline-flex; align-items: center; justify-content: center; min-width: 3.4em;
  padding: .12em .55em; border-radius: 999px;
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 650;
  background: var(--surface-3); color: var(--muted);
}
.chip.up { background: var(--up-wash); color: var(--up); }
.chip.down { background: var(--down-wash); color: var(--down); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--r-control);
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background-color .2s var(--ease-out), border-color .2s var(--ease-out), transform .12s var(--ease-out), color .2s;
}
.btn:hover { background: var(--sky-soft); border-color: var(--slate); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; background: var(--surface); border-color: var(--line-strong); }
.btn.primary { background: var(--slate); color: var(--cream); border-color: var(--slate); }
.btn.primary:hover { background: var(--slate-deep); border-color: var(--slate-deep); }
.btn.danger { color: var(--down); }
.btn.danger:hover { background: var(--down-wash); border-color: var(--down); }
.btn.armed, .btn.armed:hover { background: var(--down); color: #fff; border-color: var(--down); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--sky-soft); color: var(--text); border-color: transparent; }
.btn.small { padding: 6px 11px; font-size: 14px; }

.link-btn {
  background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--slate);
  font-weight: 600; text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.link-btn:hover { color: var(--ink); }

.field { display: grid; gap: 6px; }
.field > label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-control);
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: #7a8c96; }
.input:focus { border-color: var(--slate); box-shadow: 0 0 0 3px rgba(167, 220, 250, .7); }
.error-text { color: var(--down); font-size: 14px; min-height: 1.2em; margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  background: var(--slate); color: var(--cream); border-radius: var(--r-row);
  box-shadow: var(--shadow);
  padding: 12px 18px; opacity: 0; pointer-events: none; font-weight: 500;
  transition: opacity .25s, transform .3s var(--ease-out); z-index: var(--z-toast); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--down); color: #fff; }

@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0, var(--surface) 40%, var(--surface-2) 80%) var(--surface-2);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
}

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