/* Papiro · Hashtag Labs design language (Manrope, border-only cards, radius 6/8/10/14), plus topic pastels. */
@font-face { font-family: "Manrope"; src: url("/fonts/manrope-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/manrope-latin-ext-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; unicode-range: U+0100-024F, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #FAFAF8; --card: #FFFFFF; --fg: #0B0B0A; --muted: #6B6B65; --border: #E4E3DE; --border2: #C9C8C2; --track: #EEEDE8;
  --inv: #0B0B0A; --inv-fg: #FAFAF8; --ink: #0B0B0A; --danger: #B42318; --med: rgba(245, 154, 139, .22);
  --sky: #7CC8F0; --ease: cubic-bezier(.2, 0, 0, 1); --ease-out: cubic-bezier(.05, .7, .1, 1); --ease-in: cubic-bezier(.3, 0, .8, .15);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0B0B0A; --card: #171716; --fg: #F4F4F1; --muted: #8A8A83; --border: #2B2B28; --border2: #4A4A45; --track: #2B2B28;
    --inv: #F4F4F1; --inv-fg: #0B0B0A; --danger: #F59A8B; --med: rgba(245, 154, 139, .18); color-scheme: dark; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { font: 16px/1.5 Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- splash ---------- */
#splash { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; transition: opacity .45s var(--ease), visibility 0s .45s; }
#splash.gone { opacity: 0; visibility: hidden; }
.splash-mark { width: 96px; height: 96px; animation: splashIn .7s var(--ease-out) both; }
.splash-word { font-size: 34px; font-weight: 700; letter-spacing: -.04em; animation: fadeUp .6s .15s var(--ease-out) both; }
@keyframes splashIn { from { transform: scale(.6) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeUp { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- layout ---------- */
#app { height: 100%; max-width: 560px; margin: 0 auto; }
.screen { height: 100%; display: flex; flex-direction: column; padding: calc(var(--safe-t) + 16px) 20px calc(var(--safe-b) + 18px); animation: screenIn .35s var(--ease-out) both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -20px; padding: 0 20px; -webkit-overflow-scrolling: touch; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.brand svg { width: 36px; height: 36px; }
.title { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -.02em; }
.row { display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 44px; height: 44px; flex-shrink: 0; border: 1px solid var(--border); border-radius: 10px; background: transparent; display: flex; align-items: center; justify-content: center; text-decoration: none; transition: background-color .2s var(--ease), transform .15s var(--ease); }
.icon-btn:active { transform: scale(.94); background: var(--track); }
.label { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; text-wrap: balance; }
.lead { margin: 8px 0 0; font-size: 15px; line-height: 1.5; color: var(--muted); }

/* ---------- buttons ---------- */
.btn { height: 56px; width: 100%; border: 0; border-radius: 10px; font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; transition: transform .15s var(--ease), background-color .45s var(--ease), opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { background: var(--track); color: var(--muted); cursor: default; }
.btn-yellow { background: #FFD600; color: var(--ink); }
.btn-ink { background: var(--inv); color: var(--inv-fg); }
.btn-line { background: transparent; border: 1px solid var(--border); color: var(--fg); }
.btn-text { height: 44px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
.btn-sm { height: 44px; font-size: 15px; }

/* ---------- chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 12px -20px 0; padding: 0 20px 4px; scrollbar-width: none; flex-shrink: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: transparent; font-size: 14px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; transition: background-color .3s var(--ease), border-color .3s var(--ease), color .3s; }
.chip .dot { width: 8px; height: 8px; border-radius: 4px; flex-shrink: 0; }
.chip[aria-pressed="true"] { color: var(--ink); }
.chip.all[aria-pressed="true"] { background: var(--inv); color: var(--inv-fg); border-color: var(--inv); }
.chip.add { border-style: dashed; color: var(--muted); }
.pick { min-height: 40px; padding: 8px 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); font-size: 14px; font-weight: 600; line-height: 1.25; text-align: left; transition: background-color .25s var(--ease), border-color .25s var(--ease), transform .15s var(--ease); }
.pick:active { transform: scale(.96); }
.pick[aria-pressed="true"] { color: var(--ink); }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- paper card ---------- */
.deck { position: relative; flex: 1; min-height: 0; margin-top: 14px; }
.card { position: absolute; inset: 0; background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.card.in { animation: cardIn .5s var(--ease-out) both; }
.card.out { animation: cardOut .38s var(--ease-in) forwards; z-index: 2; pointer-events: none; }
@keyframes cardIn { from { transform: translateY(26px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cardOut { to { transform: translateX(-115%) rotate(-12deg); } }
.card-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.band { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 12px; color: var(--ink); flex-shrink: 0; }
.band-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.band-top .read-tag { display: inline-flex; gap: 4px; align-items: center; letter-spacing: .04em; }
.year { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.ptitle { margin: 0; font-size: 21px; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; text-wrap: pretty; }
.authors { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4; }
.meta { margin: -6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.why { margin: 0; display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; line-height: 1.4; }
.why .dot { width: 8px; height: 8px; border-radius: 4px; flex-shrink: 0; }
.med { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--med); font-size: 12.5px; font-weight: 600; line-height: 1.45; }
.rule { height: 1px; background: var(--border); flex-shrink: 0; }
.ptext { margin: -6px 0 0; font-size: 14.5px; line-height: 1.55; }
.by { font-weight: 600; letter-spacing: 0; text-transform: none; }
.read-btn { margin-top: auto; height: 48px; border-radius: 10px; background: var(--inv); color: var(--inv-fg); font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; flex-shrink: 0; transition: transform .15s var(--ease); }
.read-btn:active { transform: scale(.97); }
.state { position: absolute; inset: 0; border: 1px dashed var(--border2); border-radius: 14px; padding: 28px 24px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 12px; animation: cardIn .4s var(--ease-out) both; }
.skeleton { position: absolute; inset: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--card); }
.skeleton .band { height: 120px; background: var(--track); }
.skeleton i { display: block; height: 14px; margin: 18px 20px 0; border-radius: 6px; background: var(--track); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- shuffle bar ---------- */
.bar { display: flex; gap: 10px; margin-top: 14px; flex-shrink: 0; }
.save { width: 56px; height: 56px; flex-shrink: 0; border: 1px solid var(--border); border-radius: 10px; background: transparent; display: flex; align-items: center; justify-content: center; transition: border-color .2s, transform .15s var(--ease); }
.save:active { transform: scale(.92); }
.save[aria-pressed="true"] { border-color: var(--fg); }
.save[aria-pressed="true"] svg { fill: currentColor; animation: pop .35s var(--ease-out); }
@keyframes pop { 40% { transform: scale(1.25); } }
.shuffle { position: relative; overflow: hidden; flex: 1; height: 56px; border: 0; border-radius: 10px; color: var(--ink); font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; transition: background-color .5s var(--ease), transform .15s var(--ease); }
.shuffle:active { transform: scale(.97); }
.shuffle svg, .shuffle span { position: relative; }
.shuffle svg { transition: transform .55s var(--ease); }
.ripple { position: absolute; left: 50%; top: 50%; width: 80px; height: 80px; margin: -40px 0 0 -40px; border-radius: 50%; background: rgba(255, 255, 255, .6); transform: scale(0); pointer-events: none; }
.ripple.go { animation: ripple .65s var(--ease) forwards; }
@keyframes ripple { from { transform: scale(0); opacity: .6; } to { transform: scale(6); opacity: 0; } }
.foot { margin: 10px 0 0; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- lists, toggles, segments ---------- */
.group { border: 1px solid var(--border); border-radius: 14px; background: var(--card); overflow: hidden; }
.item { width: 100%; min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border: 0; background: transparent; text-align: left; text-decoration: none; }
.item + .item { border-top: 1px solid var(--border); }
.item b { display: block; font-size: 15px; font-weight: 600; }
.item small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.switch { width: 44px; height: 26px; flex-shrink: 0; border-radius: 13px; padding: 3px; background: var(--border); display: flex; transition: background-color .3s var(--ease); }
.switch::after { content: ""; width: 20px; height: 20px; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .3s var(--ease-out); }
[aria-pressed="true"] > .switch, [aria-checked="true"] > .switch { background: var(--sky); }
[aria-pressed="true"] > .switch::after, [aria-checked="true"] > .switch::after { transform: translateX(18px); }
.seg { display: grid; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.seg button { height: 38px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; transition: background-color .3s var(--ease), color .3s; }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { color: var(--ink); }
.section { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.search { height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 44px; border: 0; outline: none; background: transparent; color: var(--fg); font-size: 15px; font-weight: 600; }
.search input::placeholder { color: var(--muted); font-weight: 500; }
.field-row { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 0; background: transparent; text-align: left; }
.field-row .dot { width: 10px; height: 10px; border-radius: 5px; flex-shrink: 0; }
.field-row b { display: block; font-size: 15px; font-weight: 700; line-height: 1.25; }
.field-row small { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field-row svg { margin-left: auto; flex-shrink: 0; transition: transform .3s var(--ease); }
.field-row[aria-expanded="true"] svg { transform: rotate(180deg); }
.field + .field { border-top: 1px solid var(--border); }
.field .subs { padding: 0 14px 14px; animation: fadeUp .3s var(--ease-out) both; }
.radio { width: 100%; min-height: 76px; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); text-align: left; transition: border-color .25s var(--ease); }
.radio[aria-checked="true"] { border: 2px solid var(--fg); padding: 13px 15px; }
.radio b { display: block; font-size: 16px; } .radio small { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.radio .ring { margin-left: auto; width: 22px; height: 22px; flex-shrink: 0; border-radius: 11px; border: 2px solid var(--border2); transition: border .25s var(--ease); }
.progress { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.progress i { height: 4px; border-radius: 6px; background: var(--border); transition: background-color .4s var(--ease); }
.progress i.on { background: var(--sky); }
.lib-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 14px 16px; text-decoration: none; }
.lib-row + .lib-row { border-top: 1px solid var(--border); }
.lib-row .yr { align-self: start; padding: 3px 0; border-radius: 6px; color: var(--ink); text-align: center; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lib-row b { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.lib-row small { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { border-radius: 10px; padding: 12px; color: var(--ink); }
.stat b { display: block; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: 12px; font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.barrow { display: grid; grid-template-columns: 120px minmax(0, 1fr) 24px; gap: 10px; align-items: center; font-size: 13px; }
.barrow span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { height: 8px; border-radius: 6px; background: var(--track); overflow: hidden; }
.track i { display: block; height: 8px; border-radius: 6px; transition: width .6s var(--ease-out); }
.tchip { height: 40px; padding: 0 6px 0 14px; display: inline-flex; align-items: center; gap: 4px; border-radius: 10px; color: var(--ink); font-size: 14px; font-weight: 600; }
.tchip button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step .n { width: 32px; height: 32px; flex-shrink: 0; border-radius: 16px; background: var(--sky); color: var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.step b { display: block; font-size: 15px; } .step small { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.feat { display: flex; gap: 14px; align-items: flex-start; }
.feat .ic { width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; color: var(--ink); display: flex; align-items: center; justify-content: center; }
.feat b { display: block; font-size: 15px; } .feat small { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.45; }

/* ---------- taste test ---------- */
.taste { position: relative; flex: 1; min-height: 0; margin-top: 20px; }
.taste .behind { position: absolute; inset: 14px 10px -8px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.taste .card { touch-action: pan-y; user-select: none; cursor: grab; transition: transform .3s var(--ease-out); }
.taste .card.drag { transition: none; }
.stamp { position: absolute; top: 20px; padding: 5px 11px; border-radius: 6px; font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); opacity: 0; pointer-events: none; }
.stamp.yes { left: 18px; background: #7DD3A8; transform: rotate(-8deg); }
.stamp.no { right: 18px; background: #F59A8B; transform: rotate(8deg); }
.round { width: 64px; height: 64px; border-radius: 32px; display: flex; align-items: center; justify-content: center; transition: transform .15s var(--ease); }
.round:active { transform: scale(.9); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 96px); transform: translate(-50%, 20px); padding: 12px 16px; border-radius: 10px; background: var(--inv); color: var(--inv-fg); font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s var(--ease), transform .3s var(--ease-out); z-index: 40; max-width: calc(100% - 40px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
