/* Glim of Shadows v1 — 跟 GlimStar／PLNTverse／CAMPverse 同一套色票（VERSE_KIT §1）：曜石黑 × 暖白，本站強調色霧紫 #9A8FB4。
   class 命名沿用 CAMPverse（.top #view .card .tile .btn .chip .hero #sheet .panel .tab .t-ic #toast），verse-fx 的預設值照這組寫。 */
:root {
  --m-bg-0: #0d0b09; --m-bg-1: #14110e; --m-surface: rgba(255, 255, 255, .03); --m-hairline: rgba(255, 246, 232, .09);
  --m-text: #f4f0ea; --m-muted: #94897b; --m-acc: #9A8FB4; --m-acc-soft: rgba(154, 143, 180, .12); --m-acc-line: rgba(154, 143, 180, .45); --m-ember: #e8935a;
  --m-font: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  --m-font-display: "Fraunces", "Noto Serif TC", "PingFang TC", serif;
  --m-num: "Space Grotesk", "JetBrains Mono", monospace;
  --read-size: 17px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--m-bg-0); color: var(--m-text); font-family: var(--m-font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; padding-bottom: calc(68px + env(safe-area-inset-bottom)); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button, select, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
h1, h2, h3 { margin: 0; font-family: var(--m-font-display); font-weight: 600; letter-spacing: .01em; }
.num { font-family: var(--m-num); font-variant-numeric: tabular-nums; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 10px; background: linear-gradient(var(--m-bg-0) 70%, transparent); }
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; overflow: hidden; }
.brand-mark { color: var(--m-acc); font-size: 13px; }
.brand-name { font-family: var(--m-font-display); font-weight: 700; letter-spacing: .14em; font-size: 14px; white-space: nowrap; }
.brand-sub { color: var(--m-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--m-hairline); color: var(--m-muted); font-size: 18px; flex: none; }

.view { padding: 4px 16px 24px; max-width: 720px; margin: 0 auto; }
.section { margin-top: 26px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sec-head h2 { font-size: 17px; }
.sec-head .more { color: var(--m-acc); font-size: 12px; letter-spacing: .08em; white-space: nowrap; min-height: 32px; }
.eyebrow { color: var(--m-acc); font-size: 11px; letter-spacing: .22em; }
.muted { color: var(--m-muted); }
.small { font-size: 12px; }

/* hero：今晚的故事 */
.hero { position: relative; overflow: hidden; border-radius: 20px; border: 1px solid var(--m-hairline); padding: 22px 20px 18px; cursor: pointer;
  background: radial-gradient(110% 90% at 88% 6%, rgba(154,143,180,.20), transparent 55%), radial-gradient(90% 70% at 0% 100%, rgba(154,143,180,.07), transparent 60%), var(--m-bg-1); }
.hero h1 { font-size: 29px; line-height: 1.25; margin-top: 10px; position: relative; z-index: 1; overflow-wrap: anywhere; }
.hero .lead { margin: 12px 0 0; color: #d9d2c8; font-size: 15px; line-height: 1.75; position: relative; z-index: 1; max-width: 30em; }
.hero .meta { margin-top: 12px; position: relative; z-index: 1; }
.hero .cta { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero svg.moon { position: absolute; right: 16px; top: 16px; width: 54px; opacity: .5; pointer-events: none; }

/* 卡片 */
.card { background: var(--m-surface); border: 1px solid var(--m-hairline); border-radius: 16px; padding: 14px; }
.card + .card { margin-top: 10px; }
.card.row { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: start; cursor: pointer; }
.mins { font-family: var(--m-num); color: var(--m-acc); line-height: 1; padding-top: 2px; text-align: center; }
.mins b { display: block; font-size: 22px; font-weight: 600; }
.mins small { display: block; font-size: 10px; color: var(--m-muted); margin-top: 5px; font-family: var(--m-font); }
.title { font-weight: 600; font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.title .done { color: var(--m-acc); font-size: 11px; font-weight: 500; margin-left: 6px; white-space: nowrap; }
.hook { font-size: 13px; margin-top: 5px; color: var(--m-text); opacity: .78; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--m-hairline); font-size: 11px; color: var(--m-muted); margin: 6px 6px 0 0; white-space: nowrap; }
.chip.acc { color: var(--m-acc); border-color: var(--m-acc-line); }
.chip.ember { color: var(--m-ember); border-color: rgba(232,147,90,.45); }
.fav-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--m-hairline); color: var(--m-muted); font-size: 16px; margin: -4px -4px 0 0; }
.fav-btn.on { color: var(--m-acc); border-color: var(--m-acc-line); }

/* 類型入口 */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 64px; padding: 12px; border-radius: 14px; border: 1px solid var(--m-hairline); background: var(--m-surface); text-align: left; min-width: 0; }
.tile b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.tile span { font-size: 11px; color: var(--m-muted); }
.tiles.two { grid-template-columns: repeat(2, 1fr); }

/* 篩選 */
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; height: 44px; border-radius: 12px; border: 1px solid var(--m-hairline); background: var(--m-bg-1); padding: 0 14px; font-size: 16px; outline: none; }
.search input:focus { border-color: var(--m-acc-line); }
.selects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.selects select { height: 44px; min-width: 0; border-radius: 10px; border: 1px solid var(--m-hairline); background: var(--m-bg-1); padding: 0 8px; font-size: 14px; color: var(--m-text); }
.pill-row { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.pill-row::-webkit-scrollbar { display: none; }
.pill { white-space: nowrap; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--m-hairline); font-size: 13px; color: var(--m-muted); min-height: 40px; }
.pill.on { color: var(--m-text); border-color: var(--m-acc); background: var(--m-acc-soft); }
.count-line { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 10px; font-size: 12px; color: var(--m-muted); min-height: 32px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--m-hairline); font-size: 13px; color: var(--m-text); }
.btn.primary { background: var(--m-acc); color: #15121c; border-color: var(--m-acc); font-weight: 600; }
.btn.on { border-color: var(--m-acc); color: var(--m-acc); }
.btn.block { width: 100%; margin-top: 14px; }
.btn[disabled] { opacity: .35; cursor: default; }
.empty { color: var(--m-muted); text-align: center; padding: 40px 10px; font-size: 13px; line-height: 1.7; }
.notice { margin-top: 14px; border: 1px solid rgba(232,147,90,.4); background: rgba(232,147,90,.07); color: #f3c9a8; border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.6; }
.notice.calm { border-color: var(--m-acc-line); background: var(--m-acc-soft); color: #d9d2e6; }

/* 閱讀面板（bottom sheet） */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.66); display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet .panel { position: relative; width: 100%; max-width: 720px; height: 94dvh; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--m-bg-1); border: 1px solid var(--m-hairline); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 14px 20px calc(28px + env(safe-area-inset-bottom)); }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--m-hairline); margin: 0 auto 12px; }
.sheet .close { position: sticky; float: right; top: 0; width: 44px; height: 44px; margin: -6px -8px 0 8px; border-radius: 50%; border: 1px solid var(--m-hairline); background: var(--m-bg-1); color: var(--m-muted); font-size: 20px; z-index: 2; }
.sheet h2 { font-size: 26px; line-height: 1.3; margin-top: 8px; overflow-wrap: anywhere; }
.byline { margin-top: 8px; color: var(--m-muted); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.byline a { color: var(--m-acc); }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--m-hairline); }
.seg { display: inline-flex; border: 1px solid var(--m-hairline); border-radius: 999px; overflow: hidden; }
.seg button { min-width: 44px; min-height: 44px; padding: 0 12px; color: var(--m-muted); font-family: var(--m-font-display); }
.seg button[data-size="s"] { font-size: 13px; } .seg button[data-size="m"] { font-size: 16px; } .seg button[data-size="l"] { font-size: 20px; }
.seg button.on { color: #15121c; background: var(--m-acc); }
.story { max-width: 34em; margin: 18px auto 0; font-size: var(--read-size); line-height: 1.95; color: #ebe5dc; letter-spacing: .02em; }
.story p { margin: 0 0 1.15em; overflow-wrap: anywhere; }
.story p.speaking { color: #fff; box-shadow: -10px 0 0 -8px var(--m-acc); }
.story .lead-in { color: var(--m-muted); font-size: .88em; margin-bottom: 1.4em; }
.endmark { text-align: center; color: var(--m-acc); letter-spacing: .5em; margin: 26px 0 6px; }
.readline { text-align: center; color: var(--m-muted); font-size: 12px; min-height: 18px; }
.links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.pager .btn { flex-direction: column; align-items: flex-start; border-radius: 14px; padding: 10px 14px; text-align: left; min-width: 0; }
.pager .btn:last-child { align-items: flex-end; text-align: right; }
.pager small { color: var(--m-muted); font-size: 11px; }
.pager b { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }

/* 我的 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { border: 1px solid var(--m-hairline); border-radius: 14px; padding: 14px 10px; text-align: center; background: var(--m-surface); }
.stat b { display: block; font-family: var(--m-num); font-size: 26px; color: var(--m-acc); font-weight: 600; }
.stat span { font-size: 11px; color: var(--m-muted); }

/* 投稿 */
.form label { display: block; margin-top: 14px; font-size: 13px; color: var(--m-muted); }
.form input[type="text"], .form select, .form textarea { display: block; width: 100%; margin-top: 6px; border-radius: 12px; border: 1px solid var(--m-hairline); background: var(--m-bg-1); padding: 12px 14px; font-size: 16px; color: var(--m-text); outline: none; }
.form textarea { min-height: 220px; line-height: 1.8; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--m-acc-line); }
.form .check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 8px 0; margin-top: 6px; color: var(--m-text); font-size: 14px; line-height: 1.6; cursor: pointer; }
.form .check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--m-acc); }
.form .err { color: var(--m-ember); font-size: 13px; margin-top: 10px; min-height: 18px; }
.draft .title { font-size: 15px; }
.draft pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; color: var(--m-muted); line-height: 1.7; margin: 6px 0 0; max-height: 7.5em; overflow: hidden; }

/* 關於、出處 */
.prose { font-size: 14px; line-height: 1.85; color: #e2dcd2; }
.prose p { margin: 0 0 .9em; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; margin: 6px 0 0; font-size: 14px; line-height: 1.7; }
.kv dt { color: var(--m-acc); font-size: 13px; padding-top: 1px; }
.kv dd { margin: 0; overflow-wrap: anywhere; color: #e2dcd2; }
.credit { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--m-hairline); color: var(--m-muted); font-size: 11.5px; line-height: 1.7; }
.credit a, .credit button { color: var(--m-acc); }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: rgba(13,11,9,.92); backdrop-filter: blur(12px); border-top: 1px solid var(--m-hairline); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 48px; font-size: 11px; color: var(--m-muted); padding: 4px 0; }
.tab .t-ic { font-size: 17px; line-height: 1; }
.tab.on { color: var(--m-acc); }

.skeleton { height: 240px; border-radius: 20px; background: linear-gradient(90deg, var(--m-bg-1), #1b1712, var(--m-bg-1)); background-size: 200% 100%; animation: sk 1.4s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.toast { position: fixed; left: 16px; right: 16px; width: fit-content; max-width: calc(100% - 32px); margin: 0 auto; bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--m-acc); color: #15121c; padding: 9px 18px; border-radius: 999px; font-size: 13px; z-index: 60; text-align: center; }
.toast[hidden] { display: none; }

/* 靜態故事頁（s/<id>.html，不靠 JS） */
.page { max-width: 720px; margin: 0 auto; padding: 8px 18px 48px; }
.page h1 { font-size: 30px; line-height: 1.3; margin-top: 10px; overflow-wrap: anywhere; }
.page .story { margin-left: 0; }
.crumb { color: var(--m-muted); font-size: 12px; margin-top: 6px; }
.crumb a { color: var(--m-acc); }

@media (min-width: 760px) { .hero h1 { font-size: 34px; } .tiles { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 430px) { .top .brand-sub { display: none; } }   /* 手機寬度放不下副標（右邊有搜尋與 ◆ 兩顆按鈕） */
