/* ─────────────────────────────────────────────────────────────────────────────
   Roody · base design system (store + panel)
   Brand: Roody coral. Dark first, light theme via [data-theme="light"].
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  --bg: #09090c;
  --bg-soft: #0e0e13;
  --surface: #131318;
  --surface-2: #19191f;
  --surface-3: #202028;
  --border: #24242d;
  --border-strong: #33333e;
  --text: #ededf2;
  --text-soft: #c2c2cc;
  --muted: #8b8b99;
  --faint: #5d5d6b;

  --brand: #ff5468;
  --brand-2: #ff8f6b;
  --brand-ink: #ffffff;
  --brand-soft: rgba(255, 84, 104, 0.12);
  --brand-line: rgba(255, 84, 104, 0.35);
  --gradient: linear-gradient(135deg, #ff4d63 0%, #ff7a6b 55%, #ffa071 100%);

  --ok: #3ddc84;
  --ok-soft: rgba(61, 220, 132, 0.12);
  --warn: #f5b94a;
  --warn-soft: rgba(245, 185, 74, 0.13);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, 0.13);
  --info: #7c9cff;
  --info-soft: rgba(124, 156, 255, 0.13);

  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 18px 40px -24px rgba(0, 0, 0, 0.8);
  --ring: 0 0 0 3px rgba(255, 84, 104, 0.28);

  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Unbounded', var(--font);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f7f7f9;
  --bg-soft: #f1f1f4;
  --surface: #ffffff;
  --surface-2: #f6f6f8;
  --surface-3: #eeeef2;
  --border: #e4e4ea;
  --border-strong: #d3d3dc;
  --text: #15151b;
  --text-soft: #3b3b46;
  --muted: #6c6c7a;
  --faint: #9c9cab;
  --brand: #ec3a51;
  --brand-soft: rgba(236, 58, 81, 0.09);
  --brand-line: rgba(236, 58, 81, 0.3);
  --ok: #17a35a;
  --ok-soft: rgba(23, 163, 90, 0.1);
  --warn: #b7791f;
  --warn-soft: rgba(183, 121, 31, 0.12);
  --bad: #d93838;
  --bad-soft: rgba(217, 56, 56, 0.09);
  --info: #3d63e0;
  --info-soft: rgba(61, 99, 224, 0.09);
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.05), 0 12px 32px -20px rgba(20, 20, 30, 0.25);
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
.icon { flex: none; display: inline-block; vertical-align: middle; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(255, 84, 104, 0.35); color: #fff; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
code, kbd, pre, .mono { font-family: var(--mono); font-variant-ligatures: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s, color 0.15s;
}
.btn:hover { --btn-border: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-primary {
  --btn-fg: #fff;
  --btn-border: transparent;
  background: var(--gradient);
  box-shadow: 0 8px 24px -10px rgba(255, 84, 104, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; color: var(--text-soft); }
.btn-ghost:hover { --btn-bg: var(--surface-2); color: var(--text); }
.btn-danger { --btn-bg: var(--bad-soft); --btn-fg: var(--bad); --btn-border: transparent; }
.btn-danger:hover { --btn-border: var(--bad); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }

/* ── badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-soft);
  border: 1px solid transparent;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.badge.no-dot::before { display: none; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.badge-outline { background: transparent; border-color: var(--border-strong); color: var(--text-soft); }

/* ── forms ───────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 7px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.field small, .hint { font-size: 12.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.textarea.code { font-family: var(--mono); font-size: 13px; min-height: 260px; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b8b99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.check { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

/* ── cards, tables ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }

/* ── flash ───────────────────────────────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  border: 1px solid transparent;
}
.flash-ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(61, 220, 132, 0.25); }
.flash-bad { background: var(--bad-soft); color: var(--bad); border-color: rgba(255, 107, 107, 0.25); }
.flash-info { background: var(--info-soft); color: var(--info); }

/* ── misc ────────────────────────────────────────────────────────────────── */
.key {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.copy { cursor: pointer; }
.copy.copied { color: var(--ok) !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.soft { color: var(--text-soft); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.brand { color: var(--brand); }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .icon { display: block; margin: 0 auto 12px; color: var(--faint); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot-muted { background: var(--faint); }
.dot-bad { background: var(--bad); }

/* Markdown content (docs, descriptions, changelog). */
.prose { color: var(--text-soft); font-size: 15.5px; line-height: 1.75; min-width: 0; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--text); line-height: 1.3; scroll-margin-top: 90px; position: relative; }
.prose h1 { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
.prose h2 { font-size: 22px; margin: 44px 0 14px; padding-top: 8px; font-weight: 700; letter-spacing: -0.01em; }
.prose h3 { font-size: 17.5px; margin: 30px 0 10px; font-weight: 650; }
.prose .anchor { position: absolute; left: -22px; color: var(--faint); opacity: 0; font-weight: 400; }
.prose h2:hover .anchor, .prose h3:hover .anchor { opacity: 1; }
.prose p { margin: 0 0 16px; }
.prose a { color: var(--brand); text-decoration: underline; text-decoration-color: var(--brand-line); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--brand); }
.prose strong { color: var(--text); font-weight: 650; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 16px; }
.prose li { margin: 5px 0; }
.prose li::marker { color: var(--faint); }
.prose code { font-size: 0.86em; background: var(--surface-3); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; color: var(--text); }
.prose pre { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; margin: 0 0 18px; }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose blockquote { margin: 0 0 16px; padding: 10px 16px; border-left: 3px solid var(--brand); background: var(--brand-soft); border-radius: 0 var(--radius-xs) var(--radius-xs) 0; color: var(--text-soft); }
.prose blockquote p:last-child { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; }
.prose .table-wrap { margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.prose th { text-align: left; background: var(--surface-2); color: var(--text); font-weight: 600; }
.prose th, .prose td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }
.prose img { border-radius: var(--radius-sm); border: 1px solid var(--border); }
.prose hr { margin: 36px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Theme toggle shows the icon of the theme you would switch to. */
:root:not([data-theme='light']) .when-light { display: none; }
:root[data-theme='light'] .when-dark { display: none; }
