

:root {
  
  --bg: #f1f1f0;
  --bg-2: #e9e9e8;
  --surface: #ffffff;
  --surface-2: #f6f6f5;
  --surface-3: #ececeb;
  --line: rgba(10, 10, 10, 0.09);
  --line-2: rgba(10, 10, 10, 0.17);
  --fg: #0a0a0a;
  --fg-2: #4a4a4a;
  --fg-3: #686868;
  --ember: #0a0a0a;
  --ember-2: #3c3c3c;
  --ember-ink: #ffffff;
  --ember-soft: rgba(10, 10, 10, 0.06);
  --ice: #6b6b6b;
  --ice-soft: rgba(10, 10, 10, 0.06);
  --good: #12804f;
  --good-soft: rgba(18, 128, 79, 0.1);
  --warn: #9a6400;
  --warn-soft: rgba(180, 120, 0, 0.12);
  --bad: #c42a42;
  --bad-soft: rgba(196, 42, 66, 0.09);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 12px 32px -18px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 30px 80px -40px rgba(0, 0, 0, 0.4);
  --grain-opacity: 0.05;
  --glow: rgba(0, 0, 0, 0.07);
  --blob-a: #4a4a4a;
  --blob-b: #050505;
  --blob-stroke: rgba(0, 0, 0, 0.25);

  --font-display: "Tektur", "Onest", system-ui, sans-serif;
  --font-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --r-s: 8px;
  --r-m: 14px;
  --r-l: 22px;
  --r-xl: 32px;
  --ease: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-soft: cubic-bezier(0.25, 0.8, 0.3, 1);
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050505;
    --bg-2: #0b0b0b;
    --surface: #111111;
    --surface-2: #161616;
    --surface-3: #1f1f1f;
    --line: rgba(255, 255, 255, 0.08);
    --line-2: rgba(255, 255, 255, 0.16);
    --fg: #efefef;
    --fg-2: #a6a6a6;
    --fg-3: #8b8b8b;
    --ember: #f2f2f2;
    --ember-2: #9a9a9a;
    --ember-ink: #070707;
    --ember-soft: rgba(255, 255, 255, 0.07);
    --ice: #8c8c8c;
    --ice-soft: rgba(255, 255, 255, 0.06);
    --good: #4fd69c;
    --good-soft: rgba(79, 214, 156, 0.11);
    --warn: #f2c14e;
    --warn-soft: rgba(242, 193, 78, 0.12);
    --bad: #ff6b81;
    --bad-soft: rgba(255, 107, 129, 0.12);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 18px 40px -24px rgba(0, 0, 0, 0.9);
    --shadow-lg: 0 40px 100px -40px rgba(0, 0, 0, 0.95);
    --grain-opacity: 0.06;
    --glow: rgba(255, 255, 255, 0.07);
    --blob-a: #3d3d3d;
    --blob-b: #141414;
    --blob-stroke: rgba(255, 255, 255, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #050505;
  --bg-2: #0b0b0b;
  --surface: #111111;
  --surface-2: #161616;
  --surface-3: #1f1f1f;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.16);
  --fg: #efefef;
  --fg-2: #a6a6a6;
  --fg-3: #8b8b8b;
  --ember: #f2f2f2;
  --ember-2: #9a9a9a;
  --ember-ink: #070707;
  --ember-soft: rgba(255, 255, 255, 0.07);
  --ice: #8c8c8c;
  --ice-soft: rgba(255, 255, 255, 0.06);
  --good: #4fd69c;
  --good-soft: rgba(79, 214, 156, 0.11);
  --warn: #f2c14e;
  --warn-soft: rgba(242, 193, 78, 0.12);
  --bad: #ff6b81;
  --bad-soft: rgba(255, 107, 129, 0.12);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 40px 100px -40px rgba(0, 0, 0, 0.95);
  --grain-opacity: 0.06;
  --glow: rgba(255, 255, 255, 0.07);
  --blob-a: #3d3d3d;
  --blob-b: #141414;
  --blob-stroke: rgba(255, 255, 255, 0.45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img, svg { max-width: 100%; }

.ic { width: 1em; height: 1em; flex: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--ember); color: var(--ember-ink); }

:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 10px;
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

.mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-2); }
.faint { color: var(--fg-3); }


.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.logo-mark { width: 20px; height: 36px; flex: none; overflow: visible; }
.logo-word { font: 600 21px/1 var(--font-display); letter-spacing: -0.01em; text-transform: lowercase; }
.logo-word b { font-weight: 600; color: var(--fg-2); }


.btn {
  --h: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding: 0 22px; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  font: 600 15px/1 var(--font-body); letter-spacing: 0.005em; white-space: nowrap;
  transition: transform 0.25s var(--ease), background-color 0.2s, border-color 0.2s, box-shadow 0.3s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary {
  color: var(--ember-ink);
  background: linear-gradient(135deg, var(--ember) 0%, var(--ember-2) 100%);
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--line) inset;
}
.btn-primary:hover { box-shadow: 0 16px 40px -14px var(--glow), 0 0 0 1px var(--line-2) inset; transform: translateY(-1px); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--fg); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--fg-3); }
.btn-soft { background: var(--surface-3); color: var(--fg); }
.btn-soft:hover { background: var(--line-2); }
.btn-danger { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-sm { --h: 38px; padding: 0 15px; font-size: 14px; }
.btn-lg { --h: 58px; padding: 0 30px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.icon-btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.icon-btn svg { width: 19px; height: 19px; }


.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}


.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; font: 600 12px/1 var(--font-body); letter-spacing: 0.02em; white-space: nowrap;
  background: var(--surface-3); color: var(--fg-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-ember { background: var(--ember-soft); color: var(--ember); }
.pill-ice { background: var(--ice-soft); color: var(--ice); }
.pill-live::before { animation: pulse-dot 1.6s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 0 currentColor; } 50% { box-shadow: 0 0 0 4px transparent; opacity: 0.6; } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 12px/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-3);
}
.eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--ember); }


.field { display: grid; gap: 8px; }
.field label, .field .label { font: 600 13px/1.2 var(--font-body); color: var(--fg-2); }
.input {
  height: 50px; width: 100%; padding: 0 16px; border-radius: var(--r-m);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--fg);
  font: 500 15px/1 var(--font-body); transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.input::placeholder { color: var(--fg-3); }
.input:hover { border-color: var(--line-2); }
.input:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 4px var(--ember-soft); background: var(--surface); }
.input.mono { font-family: var(--font-mono); font-size: 14px; }
textarea.input { height: auto; min-height: 110px; padding: 14px 16px; line-height: 1.5; resize: vertical; }
.hint { font-size: 13px; color: var(--fg-3); line-height: 1.45; }
.error-text { font-size: 13px; color: var(--bad); }


.toasts {
  position: fixed; z-index: 150; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 16px; background: var(--fg); color: var(--bg);
  box-shadow: var(--shadow-lg); font-weight: 500; font-size: 14.5px;
  animation: toast-in 0.45s var(--ease) both;
}
.toast .t-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.toast.err .t-dot { background: var(--bad); }
.toast.out { animation: toast-out 0.3s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }


.modal-root { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5, 6, 12, 0.62); backdrop-filter: blur(6px); animation: fade-in 0.3s ease both; }
.modal {
  position: relative; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow-lg); padding: 28px; animation: modal-in 0.45s var(--ease) both;
}
.modal.wide { width: min(680px, 100%); }
.modal h2 { margin: 0 0 6px; font: 600 22px/1.2 var(--font-display); letter-spacing: -0.02em; text-wrap: balance; }
.modal .modal-sub { margin: 0 0 22px; color: var(--fg-2); }
.modal-close { position: absolute; top: 16px; right: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 24px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(0.985); } }
@media (max-width: 560px) {
  .modal-root { place-items: end center; padding: 0; }
  .modal { width: 100%; border-radius: 26px 26px 0 0; padding: 26px 20px calc(24px + env(safe-area-inset-bottom, 0px)); max-height: 92dvh; animation-name: sheet-in; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
}


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}


.lang-btn { font: 700 12.5px/1 var(--font-mono); letter-spacing: 0.04em; width: auto; min-width: 42px; padding: 0 10px; }


.btn { transition: transform 0.35s var(--ease-soft), background-color 0.25s, border-color 0.25s, box-shadow 0.4s var(--ease-soft), color 0.25s, filter 0.25s; }
.btn:active { transform: scale(0.985); transition-duration: 0.12s; }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.toast { animation: toast-in 0.55s var(--ease-soft) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.toast.out { animation: toast-out 0.35s ease both; }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }
.modal-backdrop { animation: fade-in 0.4s ease both; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal { animation: modal-in 0.5s var(--ease-soft) both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.995); } }
@media (max-width: 560px) {
  .modal { animation: sheet-in 0.5s var(--ease-soft) both; }
  @keyframes sheet-in { from { transform: translateY(32px); opacity: 0.2; } }
}
.pill-live::before { animation: pulse-dot 2.4s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 0 currentColor; opacity: 1; } 50% { box-shadow: 0 0 0 3px transparent; opacity: 0.55; } }
.skeleton { animation-duration: 1.8s !important; animation-timing-function: ease-in-out !important; }

.flag { display: inline-block; flex: none; object-fit: cover; }
