:root {
  --navy: #1E2F3D;
  --navy-2: #04194e;
  --accent: #D6283E;
  --accent-soft: #fde8eb;
  --bg: #f6f4f0;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5f6b78;
  --line: #e4e0d8;
  --ok: #2f7d4f;
  --ok-soft: #e3f2e8;
  --shadow: 0 1px 2px rgba(20,30,40,.06), 0 4px 14px rgba(20,30,40,.06);
  --radius: 14px;
  --tabbar-h: 64px;
  --serif: "Lora", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11181f;
    --card: #1a232c;
    --text: #e9edf1;
    --muted: #9aa6b2;
    --line: #2a3540;
    --accent: #F24056;
    --accent-soft: #3a1a20;
    --ok: #5cc38a;
    --ok-soft: #173126;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
a { color: var(--accent); }
img { max-width: 100%; height: auto; }
button { font: inherit; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--navy); color: #fff;
}
.topbar h1 { font: 600 18px/1.2 var(--sans); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 32px; height: 32px; border-radius: 8px; }
.back { background: none; border: 0; color: #fff; padding: 4px; margin-left: -6px; display: flex; cursor: pointer; }

/* Main */
main { max-width: 720px; margin: 0 auto; padding: 16px; outline: none; }
.section-title { font: 600 13px/1 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 24px 0 10px; }
.section-title:first-child { margin-top: 4px; }

/* Cards */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: block; color: inherit; text-decoration: none;
}
.card + .card { margin-top: 12px; }
.card-body { padding: 16px; }
.card h2, .card h3 { font-family: var(--serif); margin: 0 0 6px; line-height: 1.3; }
.card h2 { font-size: 22px; }
.card h3 { font-size: 18px; }
.meta { font-size: 13px; color: var(--muted); }
.excerpt { color: var(--muted); font-size: 15px; margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--line); }
.hero .thumb { aspect-ratio: 16/9; }
.eyebrow { display: inline-block; font: 600 12px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }

.row { display: flex; gap: 12px; padding: 12px; align-items: center; }
.row .mini { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; flex: none; background: var(--line); }
.row .row-text { min-width: 0; }
.row h3 { font-size: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Buttons & chips */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; font-size: 15px;
}
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 14px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }

.search {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; margin-bottom: 12px;
}

/* Reader */
.reader h1 { font: 700 28px/1.25 var(--serif); margin: 4px 0 8px; }
.reader .content { font: 18px/1.75 var(--serif); }
.reader .content p { margin: 0 0 1.1em; }
.reader .content h2, .reader .content h3 { font-family: var(--serif); line-height: 1.3; }
.reader .content img, .reader .content iframe, .reader .content video { max-width: 100%; border-radius: 10px; }
.reader .content iframe { width: 100%; aspect-ratio: 16/9; height: auto; border: 0; }
.reader .content blockquote { margin: 1em 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.reader .content figure { margin: 1em 0; }
.reader-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 8px; }

/* Plan */
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 10px 0 6px; }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: 999px; transition: width .3s; }
.reading { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.reading:first-child { border-top: 0; }
.reading .day { font-size: 12px; color: var(--muted); width: 54px; flex: none; }
.reading .ref { flex: 1; min-width: 0; }
.reading .ref a { color: var(--text); text-decoration: none; font-weight: 500; }
.reading.today { background: var(--accent-soft); }
.check {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); background: transparent;
  flex: none; cursor: pointer; display: grid; place-items: center; color: #fff; padding: 0;
}
.check[aria-checked="true"] { background: var(--ok); border-color: var(--ok); }
.check svg { width: 16px; height: 16px; }
.today-reading { display: flex; align-items: center; gap: 14px; }
.today-reading .ref { font: 600 20px/1.3 var(--serif); }
.field { display: grid; gap: 6px; margin: 12px 0; font-size: 14px; color: var(--muted); }
.field select, .field input {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit;
}
.done-badge { display: inline-block; background: var(--ok-soft); color: var(--ok); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; }

/* Store */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.product .thumb { aspect-ratio: 1/1; }
.product .card-body { padding: 12px; }
.product h3 { font-size: 15px; font-family: var(--sans); font-weight: 600; }
.price { font-weight: 700; color: var(--accent); }
.placeholder { aspect-ratio: 1/1; display: grid; place-items: center; background: var(--navy); color: #fff; font: 600 15px/1.3 var(--serif); padding: 12px; text-align: center; }

/* States */
.skeleton { background: linear-gradient(90deg, var(--line) 25%, var(--card) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); height: 120px; }
.skeleton + .skeleton { margin-top: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.more { margin: 16px auto 0; display: flex; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--accent); }
