:root {
  --bg: #f4f1ea;
  --panel: rgba(255, 252, 245, 0.94);
  --panel-strong: #fffdf7;
  --border: #c8bca5;
  --line: #ddd1ba;
  --text: #2a241c;
  --muted: #6b6253;
  --accent: #8a5a2b;
  --accent-strong: #5f3914;
  --accent-soft: #efe2cf;
  --shadow: 0 20px 60px rgba(77, 57, 28, 0.08);
}

body[data-theme="dark"] {
  --bg: #121416;
  --panel: rgba(24, 28, 32, 0.94);
  --panel-strong: #1a1f24;
  --border: #39434d;
  --line: #2d363f;
  --text: #edf0f3;
  --muted: #aab4bd;
  --accent: #d0a36f;
  --accent-strong: #f0c48f;
  --accent-soft: #2d251d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(208, 163, 111, 0.18), transparent 25%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 35%),
    var(--bg);
  color: var(--text);
}

body {
  padding: 24px;
  transition: background 180ms ease, color 180ms ease;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.brand-block {
  max-width: 560px;
}

.eyebrow,
.section-kicker,
.panel-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 700;
}

#brand-title,
.hero-card h2,
.panel h3,
.prose-block h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#brand-title {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1;
}

.subtitle,
.hero-copy,
.panel-note,
.status-line,
.theory-meta p,
.prose-block p,
.plain-list {
  color: var(--muted);
}

.subtitle {
  margin: 12px 0 0;
  max-width: 52ch;
  line-height: 1.55;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-end;
}

.nav-bar,
.toggle-group,
.mode-switcher,
.theory-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-button,
.toggle-button,
.mode-button,
.theory-button,
.action-button {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nav-button:hover,
.toggle-button:hover,
.mode-button:hover,
.theory-button:hover,
.action-button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.nav-button.active,
.toggle-button.active,
.mode-button.active,
.theory-button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.control-stack {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.clock-box {
  min-width: 112px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: right;
}

.clock-time {
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.clock-date {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.page-shell {
  display: grid;
  gap: 20px;
}

.page-panel {
  display: none;
  gap: 20px;
}

.page-panel.active {
  display: grid;
}

.hero-card,
.panel {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 26px 28px;
  display: grid;
  gap: 16px;
}

.hero-copy {
  margin: 0;
  max-width: 75ch;
  line-height: 1.6;
}

.panel {
  padding: 24px 24px 26px;
}

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

.panel-note {
  margin: 0;
  max-width: 44ch;
  line-height: 1.5;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.field,
.question-card {
  display: grid;
  gap: 8px;
}

.field span,
.question-card label {
  font-weight: 600;
}

.field input,
.field textarea,
.question-card input,
.question-card textarea,
.question-card select,
.prompt-output,
.pad-editor {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: var(--panel-strong);
  color: var(--text);
}

.field textarea,
.question-card textarea {
  min-height: 110px;
  resize: vertical;
}

.field-wide {
  margin-top: 16px;
}

.question-list {
  display: grid;
  gap: 18px;
}

.question-section {
  display: grid;
  gap: 14px;
}

.question-section + .question-section {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.question-section h4 {
  margin: 0;
  font-size: 1rem;
}

.question-section p {
  margin: 0;
  color: var(--muted);
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffaf3;
}

.prompt-note {
  margin-bottom: 14px;
}

.prompt-output {
  min-height: 320px;
  resize: vertical;
  line-height: 1.5;
}

.pad-panel {
  min-height: 68vh;
}

.pad-editor {
  min-height: 68vh;
  resize: none;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow: hidden;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 1rem;
}

.status-line {
  min-height: 1.4em;
  margin: 12px 4px 0;
}

.theory-meta {
  margin: 16px 0 14px;
}

.theory-meta p {
  margin: 0;
}

.theory-text {
  margin: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-strong);
  white-space: pre-wrap;
  line-height: 1.6;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 0.95rem;
  max-height: 70vh;
  overflow: auto;
}

.prose-panel {
  display: grid;
  gap: 22px;
}

.prose-block {
  display: grid;
  gap: 10px;
}

.prose-block p {
  margin: 0;
  line-height: 1.6;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.65;
}

@media (max-width: 900px) {
  body {
    padding: 16px;
  }

  .topbar,
  .toolbar,
  .panel-header {
    display: grid;
  }

  .toolbar,
  .control-stack {
    justify-items: stretch;
    align-items: stretch;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .clock-box {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .panel,
  .hero-card {
    padding: 20px;
    border-radius: 22px;
  }

  .action-row {
    width: 100%;
  }

  .action-button {
    flex: 1 1 140px;
  }
}
