:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #050505;
  --bg-2: #0a0b0c;
  --panel: #0d0e0f;
  --panel-2: #151719;
  --raised: #1d2023;
  --surface: var(--panel);
  --surface-2: var(--panel-2);

  /* text */
  --ink: #f4f2ea;
  --text: #d5d3ca;
  --muted: #aaa79f;
  --faint: #74716a;

  /* lines */
  --line: rgba(235, 233, 224, 0.14);
  --line-strong: rgba(235, 233, 224, 0.28);
  --line-soft: rgba(235, 233, 224, 0.07);

  /* metallic Continuum accent + legacy aliases so existing markup keeps working */
  --accent: #e5e2d8;
  --accent-strong: #b9b6ad;
  --accent-tint: rgba(229, 226, 216, 0.11);
  --accent-line: rgba(229, 226, 216, 0.44);
  --violet: var(--accent);
  --violet-2: var(--accent-strong);
  --mint: var(--accent);
  --mint-2: var(--accent-strong);
  --gold: var(--accent);
  --gold-soft: var(--accent-tint);
  --gold-line: var(--accent-line);

  /* supporting hues */
  --cyan: #c7cbd0;
  --green: #d8d5cb;
  --amber: #d1b77e;
  --danger: #d98d8d;

  /* chrome + elevation */
  --chrome-bg: rgba(5, 5, 5, 0.84);
  --shadow: rgba(0, 0, 0, 0.58);
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.48), 0 2px 8px rgba(0, 0, 0, 0.3);
  --elev-2: 0 8px 24px rgba(0, 0, 0, 0.46), 0 2px 6px rgba(0, 0, 0, 0.34);
  --elev-3: 0 24px 60px rgba(0, 0, 0, 0.62), 0 8px 20px rgba(0, 0, 0, 0.42);
  --glow-accent: 0 0 0 1px rgba(229, 226, 216, 0.28), 0 10px 34px rgba(229, 226, 216, 0.12);
  --ring: 0 0 0 3px var(--accent-tint), 0 0 0 1px var(--accent);

  /* radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-pill: 999px;
  --radius: var(--radius-md);

  /* touch */
  --touch: 44px;
  --touch-lg: 56px;

  /* type scale */
  --fs-display: clamp(40px, 6vw, 76px);
  --fs-h2: clamp(24px, 3vw, 38px);
  --fs-h3: 20px;
  --fs-h4: 16px;
  --fs-body: 15px;
  --fs-meta: 13px;
  --fs-label: 11px;
  --lh-tight: 1.05;
  --lh-body: 1.55;
  --tracking-label: 0;
  --weight-label: 800;
  --weight-strong: 850;
  --weight-display: 900;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Consolas, monospace;
  --disp: var(--font-sans);
  --mono: var(--font-mono);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f2ea;
  --bg-2: #e8e5da;
  --panel: #ffffff;
  --panel-2: #f1eee4;
  --raised: #e1ded3;
  --ink: #121210;
  --text: #2a2a26;
  --muted: #5d5b55;
  --faint: #87837a;
  --line: rgba(26, 25, 22, 0.14);
  --line-strong: rgba(26, 25, 22, 0.26);
  --line-soft: rgba(26, 25, 22, 0.07);
  --accent: #2a2a26;
  --accent-strong: #050505;
  --accent-tint: rgba(5, 5, 5, 0.08);
  --accent-line: rgba(5, 5, 5, 0.32);
  --chrome-bg: rgba(244, 242, 234, 0.82);
  --shadow: rgba(18, 18, 16, 0.12);
  --elev-1: 0 1px 2px rgba(18, 18, 16, 0.06), 0 2px 6px rgba(18, 18, 16, 0.05);
  --elev-2: 0 10px 28px rgba(18, 18, 16, 0.08), 0 2px 6px rgba(18, 18, 16, 0.05);
  --elev-3: 0 24px 56px rgba(18, 18, 16, 0.14), 0 6px 16px rgba(18, 18, 16, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 18%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(180deg, #050505 0%, #0a0b0c 52%, #050505 100%);
  background-size: auto, 84px 84px, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  letter-spacing: 0;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }

.shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--chrome-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.1);
  backdrop-filter: blur(20px) saturate(1.1);
}

.topbar-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand img {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  object-fit: contain;
  background: #02030b;
}

.brand strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand small {
  display: block;
  color: var(--faint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.nav a:hover,
.nav .primary-link {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.hero {
  padding: 54px 0 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 26px;
  align-items: end;
}

.eyebrow {
  color: var(--violet);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, p { margin: 0; }

h1 {
  max-width: 860px;
  margin-top: 12px;
  color: var(--ink);
  font-size: clamp(40px, 6vw, 76px);
  line-height: .95;
  font-weight: 900;
}

h2 {
  margin-top: 5px;
  color: var(--ink);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.05;
  font-weight: 900;
}

.lead {
  max-width: 790px;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(16px, 1.7vw, 20px);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button,
.mini-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  border-color: rgba(244, 242, 234, 0.62);
  color: #070707;
  background: linear-gradient(180deg, #f7f5ed 0%, #c9c6bd 100%);
}

.button.ghost,
.mini-button {
  color: var(--muted);
}

.mini-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.mini-button.danger {
  border-color: rgba(255, 143, 190, 0.34);
  color: var(--danger);
}

input[type="file"] { display: none; }

.kernel-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--elev-2);
}

.kernel-card { padding: 22px; }

.kernel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.kernel-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.kernel-head strong {
  color: var(--green);
  font-size: 46px;
  line-height: .9;
}

.meter {
  height: 10px;
  margin: 20px 0;
  border: 1px solid rgba(229, 226, 216, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.kernel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.kernel-grid div {
  border: 1px solid rgba(235, 233, 224, 0.12);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.kernel-grid b {
  display: block;
  color: var(--ink);
  font-size: 22px;
}

.kernel-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.grid,
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 18px 0;
}

.split {
  grid-template-columns: minmax(320px, .82fr) minmax(0, 1.18fr);
  padding-bottom: 72px;
}

.panel { padding: 22px; }

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid rgba(235, 233, 224, 0.18);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: rgba(5, 6, 18, 0.48);
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

form .button {
  margin-top: 16px;
}

.warning {
  margin-top: 16px;
  border: 1px solid rgba(244, 201, 107, 0.22);
  border-radius: 8px;
  padding: 13px 14px;
  color: #f5dfaa;
  background: rgba(244, 201, 107, 0.06);
  font-size: 13px;
}

.command-box,
.recovery-box {
  min-height: 190px;
  margin: 14px 0 0;
  border: 1px solid rgba(235, 233, 224, 0.12);
  border-radius: 8px;
  padding: 14px;
  color: #dcd7ff;
  background: rgba(5, 6, 18, 0.54);
  white-space: pre-wrap;
  overflow: auto;
}

.recovery-box {
  min-height: 540px;
  font-size: 13px;
}

.timeline {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
}

.entry {
  border: 1px solid rgba(235, 233, 224, 0.12);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.entry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.entry-type {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.entry-time {
  color: var(--faint);
  font-size: 12px;
}

.entry strong {
  display: block;
  color: var(--ink);
  margin-bottom: 5px;
}

.entry p,
.entry small {
  color: var(--muted);
}

.empty {
  border: 1px dashed rgba(235, 233, 224, 0.18);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .hero,
  .grid,
  .split,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .nav {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 28px, 1240px); }
  .actions { flex-direction: column; }
  .button { width: 100%; }
  .panel-head { flex-direction: column; }
}

/* ── Shared theme + interaction polish (added by unified design layer) ── */
html[data-theme="light"] body {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), transparent 24%),
    var(--bg);
}

.theme-toggle-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 11px;
  font-weight: var(--weight-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  padding: 0 14px;
  cursor: pointer;
}

.button,
.mini-button,
.nav a,
.theme-toggle-button {
  transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease), transform .12s var(--ease);
}

.theme-toggle-button:hover {
  border-color: var(--accent-line);
  background: var(--accent-tint);
}

.button.primary {
  box-shadow: var(--elev-1);
}

.button:hover,
.mini-button:hover {
  border-color: var(--accent-line);
}

.button.primary:hover {
  box-shadow: var(--elev-2);
  transform: translateY(-1px);
}

.button:active,
.mini-button:active {
  transform: translateY(1px);
}

.button:focus-visible,
.mini-button:focus-visible,
.nav a:focus-visible,
.theme-toggle-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-color: var(--accent);
}
