:root {
  color-scheme: light dark;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --text: #1c1b18;
  --muted: #5d5a52;
  --border: #d9d4c8;
  --accent: #1f5f8b;
  --accent-text: #ffffff;
  --accent-soft: #e4eef5;
  --jarvis-bubble: #eef0ec;
  --error-bg: #fbe9e7;
  --error-text: #8a2a1f;
  --ok-bg: #e6f3ea;
  --ok-text: #1f5a33;
  --focus: #d97706;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1f2226;
    --text: #ecebe6;
    --muted: #a6a39b;
    --border: #3a3e44;
    --accent: #7fb4dc;
    --accent-text: #0f1a22;
    --accent-soft: #233442;
    --jarvis-bubble: #2a2e33;
    --error-bg: #3a2320;
    --error-text: #f3b3aa;
    --ok-bg: #1f3426;
    --ok-text: #b4e2c2;
    --focus: #fbbf24;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0 16px 48px;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  max-width: 720px;
  margin-inline: auto;
  overflow-x: hidden;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 10;
}
.skip:focus { left: 16px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hero { padding: 32px 0 8px; }
.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 { margin: 0; font-size: clamp(32px, 7vw, 44px); line-height: 1.1; }
.tagline { margin: 6px 0 16px; font-size: clamp(20px, 4.5vw, 26px); color: var(--accent); }
.disclosure { margin: 0; color: var(--muted); font-size: 15px; }

h2 { margin: 0 0 8px; font-size: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-top: 20px;
}

label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
textarea { resize: vertical; min-height: 72px; }

button {
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
  min-height: 44px;
}
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button[disabled] { opacity: 0.55; cursor: default; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; }
.check input { margin-top: 5px; width: 20px; height: 20px; flex: none; }
.check label { margin: 0; font-weight: 500; }

.log { list-style: none; margin: 0 0 16px; padding: 0; }
.log li { margin: 0 0 10px; display: flex; }
.log li.user { justify-content: flex-end; }
.bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.user .bubble { background: var(--accent-soft); border-bottom-right-radius: 4px; }
.assistant .bubble { background: var(--jarvis-bubble); border-bottom-left-radius: 4px; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble .who {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.bubble a { color: var(--accent); }
.pending .bubble { color: var(--muted); font-style: italic; }
.system .bubble { background: transparent; color: var(--muted); font-size: 14px; border: 1px dashed var(--border); }

.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}
.turns { margin: 0; color: var(--muted); font-size: 14px; }

.status { margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: var(--error-bg); color: var(--error-text); }
.status p { margin: 0 0 8px; }
.status.ok { background: var(--ok-bg); color: var(--ok-text); }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.status-actions button { background: var(--surface); color: var(--text); }
.status-line { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--ok-bg); color: var(--ok-text); }
.status-line.error { background: var(--error-bg); color: var(--error-text); }
.error { color: var(--error-text); margin: 8px 0 0; }

footer { margin-top: 24px; color: var(--muted); font-size: 13px; }

/* Guide pages (/guides/<id>), rendered by the Worker with this same stylesheet. */
.guide { padding-top: 32px; }
.guide .back { display: inline-block; margin-bottom: 16px; color: var(--accent); }
.guide h1 { font-size: clamp(26px, 6vw, 36px); }
.muted { color: var(--muted); }
