@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Unbounded:wght@400;500;600;700&display=swap');

:root {
  --ink: #0a1024;
  --ink-2: #0e1630;
  --surface: #121a36;
  --surface-2: #18224a;
  --line: #26325f;
  --line-soft: #1b2650;
  --text: #e9edff;
  --muted: #94a0d0;
  --perceive: #8b9bff;
  --plan: #3ddcc4;
  --act: #ffb547;
  --reflect: #ff7a93;
  --danger: #ff6b81;
  --ok: #3ddcc4;
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: 'Unbounded', 'Hanken Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0; min-height: 100vh; max-width: 100%; background: var(--ink); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.12; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
::selection { background: var(--perceive); color: var(--ink); }
:focus-visible { outline: 2px solid var(--act); outline-offset: 3px; border-radius: 6px; }

/* Protection: nothing on the page can be selected or dragged, except form fields. */
body.guarded { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.guarded input, body.guarded textarea, body.guarded select { -webkit-user-select: text; user-select: text; }
body.guarded img, body.guarded video { -webkit-user-drag: none; }
@media print { body { display: none !important; } }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--surface-2); --fg: var(--text); --bd: var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  padding: 0.78rem 1.25rem; border-radius: 999px; border: 1px solid var(--bd);
  background: var(--bg); color: var(--fg); font-weight: 600; font-size: 0.95rem; line-height: 1;
  transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); border-color: var(--perceive); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn-primary { --bg: var(--act); --fg: #221500; --bd: var(--act); box-shadow: 0 8px 30px -8px rgba(255, 181, 71, 0.55); }
.btn-primary:hover { border-color: #ffd08a; box-shadow: 0 12px 38px -8px rgba(255, 181, 71, 0.75); }
.btn-ghost { --bg: transparent; }
.btn-danger { --bg: rgba(255, 107, 129, 0.12); --fg: #ff9aa9; --bd: rgba(255, 107, 129, 0.4); }
.btn-danger:hover { border-color: var(--danger); }
.btn-ok { --bg: rgba(61, 220, 196, 0.14); --fg: var(--plan); --bd: rgba(61, 220, 196, 0.45); }
.btn-sm { padding: 0.5rem 0.85rem; font-size: 0.82rem; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 0.4rem; }
.field > label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: 0.8rem 0.95rem; border-radius: var(--radius-sm);
  background: var(--ink-2); border: 1px solid var(--line); color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.textarea { min-height: 92px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #5f6b9c; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--perceive); box-shadow: 0 0 0 4px rgba(139, 155, 255, 0.16); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.2rem; }
.check { display: flex; align-items: center; gap: 0.6rem; font-size: 0.92rem; color: var(--text); }
.check input { width: 18px; height: 18px; accent-color: var(--act); }
.form-error { color: #ff9aa9; font-size: 0.88rem; min-height: 1.3em; }
.form-ok { color: var(--plan); font-size: 0.88rem; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 1rem; bottom: calc(1rem + var(--safe-b)); z-index: 9999; display: grid; gap: 0.6rem; max-width: min(92vw, 380px); }
.toast {
  padding: 0.85rem 1.1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.6); font-size: 0.92rem; animation: toast-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  border-left: 4px solid var(--perceive);
}
.toast.ok { border-left-color: var(--plan); }
.toast.err { border-left-color: var(--danger); }
@keyframes toast-in { from { transform: translateY(14px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--ink); }

/* ---------- Guard lock overlay (dev tools detected) ---------- */
.guard-lock {
  position: fixed; inset: 0; z-index: 100000; display: none; place-items: center; text-align: center; padding: 2rem;
  background: rgba(6, 9, 22, 0.97); backdrop-filter: blur(20px);
}
.guard-lock.on { display: grid; }
.guard-lock h2 { font-size: clamp(1.4rem, 4vw, 2.2rem); margin-bottom: 0.8rem; }
.guard-lock p { color: var(--muted); max-width: 46ch; margin: 0 auto; }

@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; }
}
[hidden] { display: none !important; }
