:root {
  --bg: #f3f0ea;
  --paper: #fffcf8;
  --ink: #1c1916;
  --muted: #6e665d;
  --line: #e5ddd2;
  --accent: #1e4f46;
  --accent-soft: #e6f1ee;
  --warn: #8a5a14;
  --warn-bg: #f8efdf;
  --danger: #8d3b32;
  --danger-bg: #f8e8e5;
  --shadow: 0 1px 1px rgba(50, 36, 20, 0.04), 0 16px 40px rgba(50, 36, 20, 0.05);
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, serif;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-header, .ask, .screen, .bottom-nav { width: min(880px, calc(100% - 32px)); margin: 0 auto; }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 22px 0 8px; }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; }
.mark { width: 14px; height: 14px; border-radius: 4px; background: var(--accent); display: inline-block; }
.brand strong { font-family: var(--serif); font-size: 1.35rem; font-weight: 560; letter-spacing: -0.02em; }
.nav { display: flex; gap: 6px; }
.nav button, .text-button, .primary, .ghost, .danger {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 8px 14px;
  background: transparent;
}
.nav button[aria-current="page"] { background: var(--paper); border-color: var(--line); }
.profile { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); }
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: 44px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); min-width: 220px; padding: 8px; z-index: 5;
}
.menu-panel button { display: block; width: 100%; text-align: left; border: 0; background: none; border-radius: 10px; padding: 10px 12px; }

.ask { display: flex; gap: 8px; padding: 8px 0 18px; }
.ask input {
  flex: 1; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 14px 18px;
  outline: none;
}
.ask input:focus { border-color: #b7cfc9; }
.primary { background: var(--accent); color: #f5fbf8; }
.ghost { background: var(--paper); border-color: var(--line); }
.danger { background: var(--danger-bg); color: var(--danger); }
.text-button { padding-inline: 0; color: var(--accent); }

.screen { padding-bottom: 96px; }
.sync { color: var(--muted); margin: 0 0 18px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; margin: 0; }
h1 { font-size: 2.4rem; line-height: 1.1; }
h2 { font-size: 1.35rem; margin-bottom: 10px; }
.section { margin: 28px 0; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 10px; }
.card, .panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.card { width: 100%; text-align: left; padding: 16px 16px 14px; }
.card:hover { border-color: #d5cdc2; }
.card-top, .row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.card p { margin: 6px 0 0; }
.pill {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 0.86rem;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.quiet { background: #f3efe8; color: var(--muted); }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(440px, 100%); background: var(--paper); border-radius: 24px; padding: 36px 28px; border: 1px solid var(--line); }
.gate-card p { color: var(--muted); }
.banner {
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 16px;
}
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.detail-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.timeline li { padding-left: 14px; border-left: 2px solid var(--line); }
.source { margin-top: 6px; }
.answer { padding: 18px; }
.answer p { margin: 8px 0 0; white-space: pre-wrap; }
.sheet {
  position: fixed; inset: 0; background: rgba(28, 25, 22, 0.28); display: grid; align-items: end; z-index: 8;
}
.sheet .panel, .modal {
  width: min(640px, 100%); margin: 0 auto; background: var(--paper); border-radius: 22px 22px 0 0; padding: 20px 18px 28px;
  max-height: 88vh; overflow: auto;
}
label { display: grid; gap: 6px; margin: 12px 0; font-size: 0.92rem; color: var(--muted); }
input[type="text"], input[type="email"], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff;
}
textarea { min-height: 140px; resize: vertical; }
.checks { display: grid; gap: 8px; }
.check { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qr { width: min(260px, 100%); background: white; border-radius: 12px; }
.steps { padding-left: 18px; }
.steps li { margin: 6px 0; }
.bottom-nav { display: none; }
.empty { padding: 8px 0 4px; }

@media (max-width: 720px) {
  h1 { font-size: 2rem; }
  .nav { display: none; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; width: 100%;
    background: rgba(243, 240, 234, 0.94); border-top: 1px solid var(--line);
    justify-content: space-around; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    backdrop-filter: blur(8px);
  }
  .bottom-nav button { border: 0; background: none; padding: 8px 12px; color: var(--muted); }
  .bottom-nav button[aria-current="page"] { color: var(--ink); font-weight: 600; }
  .screen { padding-bottom: 112px; }
  .sheet { align-items: end; }
}

@media (min-width: 721px) {
  .sheet { align-items: center; }
  .sheet .panel, .modal { border-radius: 22px; margin: 24px auto; }
}
