:root {
  --ink: #172033;
  --muted: #667085;
  --line: #e3e7ee;
  --paper: #ffffff;
  --soft: #f6f7f9;
  --navy: #172a4a;
  --accent: #d36655;
  --accent-soft: #fff2ee;
  --shadow: 0 18px 55px rgba(23, 32, 51, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { color: inherit; }

.center-screen, .lock-screen {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.lock-screen {
  background:
    radial-gradient(circle at 20% 10%, rgba(211, 102, 85, .12), transparent 32%),
    radial-gradient(circle at 85% 95%, rgba(23, 42, 74, .12), transparent 34%),
    #f7f7f5;
}
.lock-card {
  width: min(100%, 480px);
  padding: 46px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 28px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  color: white;
  background: var(--navy);
  font: 800 24px/1 Georgia, serif;
  box-shadow: 0 8px 24px rgba(23,42,74,.18);
}
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; }
.eyebrow {
  margin: 22px 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}
.lock-card h1 { margin: 0 0 14px; font-family: Georgia, "Yu Mincho", serif; font-size: clamp(30px, 6vw, 44px); line-height: 1.22; }
.muted { color: var(--muted); line-height: 1.8; }
.unlock-form { display: grid; gap: 10px; margin-top: 28px; }
.unlock-form label { font-size: 13px; font-weight: 750; }
input, textarea { outline: none; border: 1px solid var(--line); background: white; transition: border .18s, box-shadow .18s; }
input:focus, textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(23,42,74,.08); }
.unlock-form input { width: 100%; padding: 14px 15px; border-radius: 12px; font-size: 18px; }
.primary {
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  color: white;
  background: var(--navy);
  font-weight: 800;
  cursor: pointer;
}
.primary:hover { background: #243c63; }
.primary.compact { padding: 10px 24px; }
.error { margin: 0; color: #bb2d3b; font-size: 13px; }
.loader { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 68px;
  padding: 0 max(20px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(227,231,238,.9);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 11px; border: 0; background: none; cursor: pointer; text-align: left; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: .09em; }
.text-button, .back-button { border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 700; }
.text-button:hover, .back-button:hover { color: var(--ink); }
.page-shell { width: min(100% - 32px, 940px); margin: 0 auto; }
.home-shell { padding: 70px 0 100px; }
.hero { padding: 0 8px 36px; }
.hero .eyebrow, .topic-heading .eyebrow, .notes-card .eyebrow { margin-top: 0; }
.hero h1, .topic-heading h1 { margin: 0; font-family: Georgia, "Yu Mincho", serif; font-weight: 700; letter-spacing: -.02em; }
.hero h1 { font-size: clamp(36px, 7vw, 64px); }
.keep-phrase { white-space: nowrap; }
.hero > p:not(.eyebrow), .topic-heading > p:not(.eyebrow) { color: var(--muted); line-height: 1.8; }
.search { display: flex; align-items: center; gap: 12px; max-width: 520px; margin-top: 28px; padding: 5px 6px 5px 16px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.search span { font-size: 13px; font-weight: 750; color: var(--muted); white-space: nowrap; }
.search input { width: 100%; padding: 10px; border: 0; }
.search input:focus { box-shadow: none; }
.topic-list { display: grid; gap: 10px; }
.topic-card {
  width: 100%;
  min-height: 106px;
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 21px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  text-align: left;
  cursor: pointer;
  transition: transform .18s, border .18s, box-shadow .18s;
}
.topic-card:hover { transform: translateY(-2px); border-color: #c7ced8; box-shadow: 0 12px 28px rgba(23,32,51,.07); }
.topic-number { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--soft); color: var(--accent); font: 700 15px/1 Georgia, serif; }
.topic-copy strong, .topic-copy small { display: block; }
.topic-copy strong { margin-bottom: 7px; font-size: 17px; }
.topic-copy small { color: var(--muted); line-height: 1.6; }
.topic-duration { display: flex; align-items: center; gap: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.topic-duration b { color: var(--accent); font-size: 30px; font-weight: 300; }

.topic-shell { padding: 34px 0 110px; }
.back-button { padding: 10px 0; }
.topic-heading { padding: 42px 0 30px; }
.topic-heading h1 { max-width: 820px; font-size: clamp(32px, 6vw, 56px); line-height: 1.25; }
.player-card {
  position: sticky;
  z-index: 10;
  top: 80px;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 12px 32px rgba(23,32,51,.08);
  backdrop-filter: blur(14px);
}
.player-card audio { display: block; width: 100%; height: 40px; }
.time-row { display: flex; justify-content: space-between; margin-top: 4px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.player-card > p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.reading-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 25px 0; }
.reading-tools > span { margin-right: 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.reading-tools button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: white; cursor: pointer; font-size: 12px; }
.reading-tools button.selected { border-color: var(--navy); color: white; background: var(--navy); }
.script { display: grid; gap: 18px; }
.script-section { padding: clamp(24px, 5vw, 50px); border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 10px 34px rgba(23,32,51,.035); }
.script-section h2 { margin: 0 0 28px; padding-bottom: 16px; border-bottom: 1px solid var(--line); color: var(--accent); font-family: Georgia, "Yu Mincho", serif; font-size: 26px; }
.script-section p { margin: 0; padding: .55em .65em; border-left: 3px solid transparent; border-radius: 6px; line-height: 2.05; cursor: pointer; transition: color .18s, background .18s, opacity .18s, border .18s; }
.script-section p:hover { background: var(--soft); }
.script-section p.active { border-left-color: var(--accent); color: #b54433; background: var(--accent-soft); font-weight: 750; }
.script-section p.past { color: #98a0ae; }
.script.size-0 { font-size: 16px; }
.script.size-1 { font-size: 19px; }
.script.size-2 { font-size: 23px; }
.notes-card { margin-top: 32px; padding: clamp(24px, 5vw, 42px); border-radius: 22px; color: white; background: var(--navy); box-shadow: var(--shadow); }
.notes-card h2 { margin: 0 0 20px; font-family: Georgia, "Yu Mincho", serif; font-size: 30px; }
.notes-card textarea { width: 100%; min-height: 220px; resize: vertical; padding: 18px; border: 0; border-radius: 14px; line-height: 1.8; }
.notes-actions { display: flex; align-items: center; justify-content: flex-end; gap: 18px; margin-top: 12px; }
.notes-actions span { color: #cbd3df; font-size: 12px; }
.notes-actions .primary { color: var(--navy); background: white; }

@media (max-width: 640px) {
  .lock-card { padding: 30px 24px; border-radius: 22px; }
  .page-shell { width: min(100% - 22px, 940px); }
  .home-shell { padding-top: 46px; }
  .topic-card { grid-template-columns: 44px 1fr; gap: 12px; padding: 17px 14px; }
  .topic-duration { grid-column: 2; justify-content: space-between; }
  .topic-duration b { line-height: .5; }
  .player-card { top: 76px; padding: 14px 12px 12px; }
  .player-card > p { display: none; }
  .script-section { padding: 22px 14px; border-radius: 17px; }
  .script-section p { padding: .55em .4em; line-height: 1.95; }
  .script.size-0 { font-size: 15px; }
  .script.size-1 { font-size: 18px; }
  .script.size-2 { font-size: 21px; }
}
