:root {
  --navy: #0f172a;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --paper: #ffffff;
  --wash: #f8fafc;
  --info: #1e40af;
  --warn-bg: #fffbeb;
  --warn-line: #fcd34d;
  --warn-ink: #78350f;
  --radius: 28px;
  --nav: 232px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { color-scheme: light; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--info); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--navy); }
img { max-width: 100%; height: auto; }
button, input, textarea { font: inherit; }
code { font-family: var(--mono); font-size: 0.88em; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 80;
  background: var(--navy);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
}

.nav-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--navy);
  margin: 4px auto;
}

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--nav);
  padding: 28px 22px 24px;
  border-right: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 28px;
  z-index: 40;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.brand img { height: 36px; width: auto; object-fit: contain; object-position: left center; }
.brand strong {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.brand em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail nav { display: flex; flex-direction: column; gap: 4px; }
.rail nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
}
.rail nav a:hover,
.rail nav a.is-active {
  background: var(--wash);
  color: var(--navy);
}
.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.lang {
  display: inline-flex;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.lang a { color: var(--muted); text-decoration: none; }
.lang a[aria-current="page"] { color: var(--navy); font-weight: 600; }

.stage {
  margin-left: var(--nav);
  min-height: 100vh;
  padding: 48px 32px 80px;
}

.home {
  min-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  gap: 18px;
}
.home h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--navy);
  margin: 0;
  line-height: 1.25;
}
.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.lede {
  margin: 0;
  color: var(--muted);
  max-width: 34em;
}
.box-label {
  margin: 18px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.gemini {
  width: 100%;
  margin-top: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  padding: 16px 16px 12px;
  text-align: left;
}
.gemini textarea {
  width: 100%;
  border: 0;
  resize: none;
  outline: none;
  min-height: 72px;
  max-height: 220px;
  background: transparent;
  color: var(--navy);
  line-height: 1.5;
}
.gemini textarea::placeholder { color: #94a3b8; }
.gemini-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.send {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.send:hover { background: #1e293b; }
.send:disabled { opacity: 0.35; cursor: not-allowed; }
.send svg { width: 18px; height: 18px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--wash);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.chip:hover { border-color: #cbd5e1; background: #fff; }

.fine {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 40em;
}

.sheet {
  max-width: 720px;
  margin: 0 auto;
}
.sheet h1, .article h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.02em;
  color: var(--navy);
  margin: 0 0 8px;
  line-height: 1.2;
}
.meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin: 0 0 28px;
}
.article { font-size: 17px; line-height: 1.75; }
.article h2 {
  font-family: var(--serif);
  font-size: 24px;
  color: var(--navy);
  margin: 36px 0 10px;
}
.article p { margin: 0 0 14px; }
.article ul { padding-left: 1.2em; }
.article li { margin-bottom: 8px; }
.warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 0 0 28px;
}

.plan {
  display: none;
  max-width: 760px;
  margin: 0 auto;
}
body.is-planning .home { display: none; }
body.is-planning .plan { display: block; }
body.is-planning .stage { padding-top: 32px; }

.plan-head { margin-bottom: 22px; }
.plan-head h2 {
  font-family: var(--serif);
  font-size: 28px;
  margin: 8px 0;
  color: var(--navy);
}
.back {
  border: 0;
  background: none;
  color: var(--info);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}
.desks { display: flex; flex-direction: column; gap: 16px; }
.desk {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 16px 12px;
  background: var(--paper);
}
.desk header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 8px;
}
.desk h3 { margin: 0; font-size: 15px; color: var(--navy); }
.why { margin: 0; font-size: 12px; color: var(--muted); }
.desk textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--wash);
  color: var(--navy);
  resize: vertical;
}
.reply {
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.reply label { font-size: 13px; font-weight: 600; color: var(--navy); }
.reply input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  max-width: 360px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.btn {
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 14px;
}
.btn.secondary {
  background: #fff;
  color: var(--navy);
}
.btn:hover { opacity: 0.92; }
.note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}
.banner {
  display: none;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  color: #155e75;
}
.banner.is-on { display: block; }
#packet-preview {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--wash);
  color: var(--navy);
}
.err {
  display: none;
  color: #991b1b;
  font-size: 13px;
  margin: 8px 0 0;
}
.err.is-on { display: block; }

.list { display: flex; flex-direction: column; gap: 12px; }
.item {
  display: block;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
}
.item:hover { border-color: #cbd5e1; background: var(--wash); }
.item strong {
  display: block;
  font-family: var(--serif);
  font-size: 20px;
  color: var(--navy);
  margin-bottom: 4px;
}
.item span { color: var(--muted); font-size: 14px; }
.search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  margin: 0 0 20px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 420px;
}
.form input[type="email"] {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.page-foot {
  max-width: 720px;
  margin: 48px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .rail {
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 24px rgba(15, 23, 42, 0.08);
  }
  body.nav-open .rail { transform: none; }
  .stage { margin-left: 0; padding: 72px 20px 64px; }
  .home { min-height: calc(100vh - 140px); }
}
