:root {
  --bg: #15130f; --card: #1f1c16; --card2: #27231c; --ink: #f3ede2; --muted: #a39b8b; --line: #332e25;
  --accent: #e8a33d; --accent-ink: #1a1408; --good: #6fbf73; --bad: #d16a5a;
  --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
#app { height: 100dvh; display: flex; flex-direction: column; }

/* top bar */
.bar { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; }
.bar .brand { font-weight: 700; letter-spacing: .02em; }
.bar .meta { color: var(--muted); font-size: 13px; }
.bar .meta b { color: var(--accent); }
.bar .nav { display: flex; gap: 6px; }
.bar .nav button { padding: 6px 10px; border-radius: 999px; color: var(--muted); font-size: 13px; }
.bar .nav button.on { background: var(--card2); color: var(--ink); }

/* feed */
.feed { flex: 1; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }
.slide { height: 100%; scroll-snap-align: start; scroll-snap-stop: always; padding: 8px 16px calc(env(safe-area-inset-bottom) + 16px); display: flex; }
.card { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px 22px 16px; display: flex; flex-direction: column; min-height: 0; }
.card.review { border-color: var(--accent); }
.card .topic { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); display: flex; justify-content: space-between; }
.card h2 { font-family: var(--serif); font-size: clamp(22px, 6vw, 30px); line-height: 1.15; margin: 14px 0 12px; }
.card .body { font-size: 17px; line-height: 1.5; color: var(--ink); overflow-y: auto; flex: 1; min-height: 0; }
.card .take { margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--card2); border-radius: 0 12px 12px 0; font-size: 15px; line-height: 1.4; }
.card .take b { color: var(--accent); }
.card .src { margin-top: 14px; color: var(--muted); font-size: 13px; }
.card .src i { font-style: normal; color: var(--ink); }
.card .actions { display: flex; gap: 8px; margin-top: 14px; }
.card .actions button { flex: 1; padding: 12px 0; border-radius: 14px; background: var(--card2); font-size: 14px; }
.card .actions button.on-up { background: #2a3d2b; color: var(--good); }
.card .actions button.on-down { background: #3d2a27; color: var(--bad); }
.card .actions button.on-save { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.card .review-actions { display: flex; gap: 8px; margin-top: 14px; }
.card .review-actions button { flex: 1; padding: 12px; border-radius: 14px; background: var(--card2); }
.card .review-actions button.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.end { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; text-align: center; color: var(--muted); padding: 24px; }
.end button, .primary-btn { padding: 14px 22px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }

/* pages */
.page { flex: 1; overflow-y: auto; padding: 8px 16px calc(env(safe-area-inset-bottom) + 24px); }
.page h1 { font-family: var(--serif); font-size: 28px; margin: 8px 0 6px; }
.page p.lead { color: var(--muted); margin: 0 0 18px; line-height: 1.45; }
.chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.chip { padding: 14px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-align: left; font-size: 15px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.sticky { position: sticky; bottom: 0; padding: 14px 0 4px; background: linear-gradient(transparent, var(--bg) 40%); }
.sticky button { width: 100%; }
.list .item { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; }
.list .item h3 { font-family: var(--serif); font-size: 18px; margin: 0 0 6px; }
.list .item p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.list .item .sub { font-size: 12px; color: var(--muted); margin-top: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row .k { color: var(--muted); font-size: 14px; }
.row button { padding: 8px 14px; border-radius: 10px; background: var(--card2); font-size: 14px; }
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px; gap: 12px; }
.login input { padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 17px; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.muted { color: var(--muted); font-size: 13px; }
