:root {
  --bg: #14110f;
  --card: #1c1815;
  --ink: #f4ede4;
  --muted: #a89a8c;
  --accent: #e0a96d;
  --heart: #ef5b5b;
  --line: rgba(244, 237, 228, .12);
  --sheet: #221d19;
  --top-h: 56px;
  --serif: "Nanum Myeongjo", "AppleMyungjo", "Noto Serif KR", serif;
  --sans: -apple-system, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f1ea; --card: #fbf7f1; --ink: #2a221c; --muted: #7d6e60;
    --accent: #a8652a; --line: rgba(42, 34, 28, .12); --sheet: #fffaf4;
  }
}
* { box-sizing: border-box; }
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; -webkit-tap-highlight-color: transparent; }

.top {
  position: fixed; inset: 0 0 auto 0; z-index: 10; height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0; display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(var(--bg), transparent);
}
.tabs { display: flex; gap: 4px; }
.tabs button { padding: 8px 10px; color: var(--muted); font-weight: 600; font-size: 16px; }
.tabs button[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.top-right { display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 20px; font-size: 20px; display: grid; place-items: center; }
.pill { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; color: var(--ink); }

#feed { height: 100dvh; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; }
#feed::-webkit-scrollbar { display: none; }
.card {
  position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--top-h) + env(safe-area-inset-top) + 8px) 72px calc(48px + env(safe-area-inset-bottom)) 28px;
}
.verse { font-family: var(--serif); font-size: clamp(22px, 6.2vw, 34px); line-height: 1.65; letter-spacing: -.01em; margin: 0; word-break: keep-all; }
.verse.long { font-size: clamp(19px, 5.2vw, 28px); }
.verse.xlong { font-size: clamp(17px, 4.6vw, 24px); }
.verse-en { font-family: Georgia, "Times New Roman", serif; font-size: clamp(15px, 4.1vw, 19px); line-height: 1.55; color: var(--muted); margin: 18px 0 0; display: none; }
.show-en .verse-en:not(:empty) { display: block; }
.verse-en:lang(ja), .verse-en:lang(zh-Hans), .verse-en:lang(zh-Hant) { font-family: "Hiragino Mincho ProN", "Songti SC", "Songti TC", "Noto Serif CJK JP", serif; line-height: 1.7; }
.verse-en.none { font-family: var(--sans); font-size: 13px; font-style: italic; opacity: .7; }
.ref2 { display: none; color: var(--muted); font-weight: 500; }
.show-en .ref2:not(:empty) { display: inline; }
.show-en .ref2:not(:empty)::before { content: " · "; }
.today-mark { color: var(--accent); font-weight: 700; letter-spacing: .04em; }
.actions .speak.on { color: var(--accent); }
.streak-line { margin-top: 22px; color: var(--accent); font-size: 15px; font-weight: 600; }
.streak { margin: 4px 0 10px; font-weight: 700; color: var(--accent); }
.week { display: flex; gap: 8px; margin-bottom: 16px; }
.week .day { width: 34px; height: 34px; border-radius: 17px; display: grid; place-items: center; font-size: 13px; border: 1px solid var(--line); color: var(--muted); }
.week .day.some { border-color: var(--accent); color: var(--ink); }
.week .day.done { background: var(--accent); border-color: var(--accent); color: #1a1410; font-weight: 700; }
.credits { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; opacity: .7; }
.widget-link { display: block; margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--accent); text-decoration: none; text-align: center; }
.sec-title { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
.langs { list-style: none; margin: 0; padding: 0; }
.lang-opt { width: 100%; text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.lang-opt .l { font-size: 17px; font-weight: 600; }
.lang-opt .n { font-size: 13px; color: var(--muted); }
.lang-opt.on .l::after { content: "  ✓"; color: var(--accent); }
.show-en .verse { font-size: clamp(20px, 5.4vw, 28px); }
.show-en .verse.long { font-size: clamp(18px, 4.8vw, 24px); }
.show-en .verse.xlong { font-size: clamp(16px, 4.3vw, 21px); }
.show-en .verse-en.long { font-size: clamp(14px, 3.7vw, 17px); }
.pill.lang[aria-pressed="false"] { color: var(--muted); }
.ref { margin-top: 20px; color: var(--accent); font-weight: 600; font-size: 15px; }
.chapter-mark { color: var(--muted); font-size: 13px; margin-bottom: 14px; letter-spacing: .08em; }
.actions { position: absolute; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; align-items: center; }
.actions button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 26px; width: 48px; }
.actions small { font-size: 11px; color: var(--muted); }
.actions .liked { color: var(--heart); }
.has-memo { color: var(--accent); }
.burst { position: absolute; left: 50%; top: 50%; font-size: 96px; color: var(--heart); transform: translate(-50%, -50%) scale(.4); opacity: 0; pointer-events: none; }
.burst.go { animation: burst .7s ease-out; }
@keyframes burst { 30% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }

.intro .verse { font-family: var(--sans); font-weight: 700; }
.hint { margin-top: 28px; color: var(--muted); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.hint .arrow { display: inline-block; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-8px); } }
.credit { position: absolute; left: 28px; right: 28px; bottom: calc(20px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; }
.loading { color: var(--muted); }

.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-body { width: 100%; max-height: 82dvh; overflow-y: auto; background: var(--sheet); border-radius: 18px 18px 0 0; padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.grid button { word-break: keep-all; padding: 10px 4px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.grid .sec { grid-column: 1 / -1; color: var(--muted); font-size: 13px; margin-top: 8px; }
.memo-verse { font-family: var(--serif); color: var(--muted); line-height: 1.6; margin: 0 0 10px; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); padding: 10px; font: inherit; font-size: 16px; }
.primary { margin-top: 10px; width: 100%; padding: 12px; border-radius: 10px; background: var(--accent); color: #1a1410; font-weight: 700; }
.saved { list-style: none; margin: 0; padding: 0; }
.saved li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.saved .t { font-family: var(--serif); line-height: 1.6; }
.saved .r { color: var(--accent); font-size: 13px; margin-top: 4px; }
.saved .m { color: var(--muted); font-size: 14px; margin-top: 4px; white-space: pre-wrap; }
.saved .empty { color: var(--muted); border: 0; }
.toast { position: fixed; left: 50%; bottom: calc(32px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; }
