:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-alt: #1d2129;
  --header-main: #161b2280;
  --border: 42 47 58;
  --text: #e7e9ee;
  --text-dim: #9aa2b1;
  --accent: #5b8cff;
  --accent-text: #ffffff;
  --green: #48bb78;
  --red: #ff6b6b;
  --yellow: #e6c460;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --overlay: rgba(255, 255, 255, 0.05);
  --overlay-strong: rgba(255, 255, 255, 0.10);
  --overlay-hover: rgba(255, 255, 255, 0.15);
  --fn-output-bg: #10131a;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-alt: #eef0f4;
  --header-main: #ffffffcc;
  --border: 210 214 222;
  --text: #1a1d23;
  --text-dim: #5c6473;
  --overlay: rgba(15, 17, 21, 0.04);
  --overlay-strong: rgba(15, 17, 21, 0.08);
  --overlay-hover: rgba(15, 17, 21, 0.12);
  --fn-output-bg: #eef0f4;
  color-scheme: light;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* lucide-animated rocket — https://lucide-animated.com/icons/rocket */
@keyframes rocket-wobble {
  0% { transform: translate(0, 0); }
  15% { transform: translate(0, -3px); }
  30% { transform: translate(-3px, 0); }
  45% { transform: translate(2px, -2px); }
  60% { transform: translate(-2px, -3px); }
  75% { transform: translate(1px, -1px); }
  90% { transform: translate(-1px, -2px); }
  100% { transform: translate(0, 0); }
}
@keyframes rocket-fire {
  0%, 100% { d: path("M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"); }
  20% { d: path("M4.5 16.5c-1.5 1.26-3 5.5-3 5.5s4.74-1 6-2.5c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"); }
  50% { d: path("M4.5 16.5c-1.5 1.26-2.2 4.8-2.2 4.8s3.94-0.3 5.2-1.8c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"); }
  80% { d: path("M4.5 16.5c-1.5 1.26-2.8 5.2-2.8 5.2s4.54-0.7 5.8-2.2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"); }
}
.rocket-icon {
  overflow: visible;
  flex-shrink: 0;
  animation: rocket-wobble 6s ease-in-out infinite alternate;
}
.rocket-icon-fire {
  animation: rocket-fire 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@media (prefers-reduced-motion: reduce) {
  .rocket-icon,
  .rocket-icon-fire { animation: none; }
}

.theme-icon-moon { display: none !important; }
html[data-theme="light"] .theme-icon-sun { display: none !important; }
html[data-theme="light"] .theme-icon-moon { display: inline-flex !important; }

html[data-theme="light"] #header-logo {
  text-shadow: none;
}
html[data-theme="light"] #header-launch-btn {
  background: #1a1d23;
  color: #ffffff;
}
html[data-theme="light"] #header-launch-btn:hover {
  background: #2a2f3a;
}

/* Hardcoded dark Tailwind utilities used across HTML/JS */
html[data-theme="light"] .text-white { color: var(--text) !important; }
html[data-theme="light"] .hover\:text-white:hover { color: var(--text) !important; }
html[data-theme="light"] .text-gray-300 { color: var(--text) !important; }
html[data-theme="light"] .text-gray-400,
html[data-theme="light"] .text-gray-500,
html[data-theme="light"] .text-gray-600,
html[data-theme="light"] .text-gray-700 { color: var(--text-dim) !important; }
html[data-theme="light"] .placeholder\:text-gray-500::placeholder { color: var(--text-dim) !important; }
html[data-theme="light"] .bg-white\/5 { background-color: var(--overlay) !important; }
html[data-theme="light"] .bg-white\/10 { background-color: var(--overlay-strong) !important; }
html[data-theme="light"] .hover\:bg-white\/5:hover { background-color: var(--overlay) !important; }
html[data-theme="light"] .hover\:bg-white\/10:hover { background-color: var(--overlay-strong) !important; }
html[data-theme="light"] .hover\:bg-white\/15:hover { background-color: var(--overlay-hover) !important; }
html[data-theme="light"] .border-white { border-color: var(--text) !important; }

#view-gate {
  background: var(--bg);
}
.page-gate {
  position: fixed;
  top: var(--page-gate-top, 0px);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  background: var(--bg);
}
#view-gate-spinner,
.page-gate-spinner {
  width: 22px;
  height: 22px;
  border: 1.5px solid rgb(var(--border));
  border-top-color: var(--text-dim);
  border-radius: 50%;
  animation: view-gate-spin 0.7s linear infinite;
}
@keyframes view-gate-spin {
  to { transform: rotate(360deg); }
}

#site-banner a {
  color: var(--accent);
  text-decoration: underline;
}
#site-banner a:hover { filter: brightness(1.15); }

/* Tab active state — JS toggles the `active` class */
.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Status spans — JS replaces className entirely (e.g. "status error") */
.status       { font-size: 13px; color: var(--text-dim); }
.status.error { color: var(--red); }
.status.ok    { color: var(--green); }

/* Output boxes — JS replaces className entirely (e.g. "fn-output visible ok") */
.fn-output {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--fn-output-bg);
  border: 1px solid rgb(var(--border));
  border-radius: 6px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-all;
  display: none;
}
.fn-output.visible { display: block; }
.fn-output.error   { color: var(--red); border-color: #5c2b2b; }
.fn-output.ok      { color: var(--green); }

/* KV rows — JS injects these as raw HTML strings into #mt-info-grid / #mt-graduation-grid */
.kv       { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid rgb(var(--border)); padding-top: 8px; }
.kv-label { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.kv-value { font-family: "SF Mono", Menlo, Consolas, monospace; word-break: break-all; }



/* Range input thumb — no Tailwind equivalent for pseudo-elements */
input[type="range"] {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgb(var(--border));
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer; border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer; border: none;
}

html[data-view="launchpad"] .footer-brand {
  width: 100%;
  justify-content: space-between;
}
html[data-view="protocol"] .footer-brand {
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}
