/* Paper-white, hand-drawn feel carried over from the MVP. Phone first; every tap target ≥ 44px. */
:root {
  color-scheme: light;
  --paper: #f7f2e8; --paper-2: #fbf8f1; --ink: #34382f; --soft: #6c6f63; --line: #d9d4c5;
  --accent: #52654a; --wash: #e8ebde; --warm: #a36549; --draft: #eeecdf; --danger: #924b35;
  --sk: #e9e3d4; --sk-hi: #f3eee3;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--paper); font-size: 15px; line-height: 1.65;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { background: var(--paper); }
body { margin: 0; overflow-x: hidden; overscroll-behavior-y: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
button, a, summary { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 13px; background: transparent; cursor: pointer; text-align: center; line-height: 1.3;
}
button:disabled { opacity: .5; cursor: default; }
button.primary, .button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.active { background: var(--wash); border-color: var(--accent); color: var(--accent); }
button.link { border-color: transparent; text-decoration: underline; text-underline-offset: 5px; color: var(--soft); }
button.icon { padding: 0; width: 44px; font-size: 21px; border-color: transparent; color: var(--warm); }
:is(button, a, input, textarea, select, summary, label.button):focus-visible { outline: 2px solid var(--warm); outline-offset: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.shell { max-width: 640px; margin: auto; padding: 0 max(18px, env(safe-area-inset-left)) calc(100px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-right)); }
.masthead { min-height: 64px; padding-top: env(safe-area-inset-top); display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.masthead > a { min-height: 44px; display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }
.brand-mark { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 2.1; stroke-linecap: round; transform: rotate(-8deg); }
.edition { font-size: 11px; color: var(--soft); text-align: right; }
body.offline .edition { color: var(--warm); }
main { min-width: 0; min-height: 50vh; }

h1 { font-size: 23px; font-weight: 500; line-height: 1.4; margin: 5px 0 8px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
p { margin: 8px 0; }
small, .small { font-size: 12px; color: var(--soft); }
.meta { font-size: 12px; color: var(--soft); margin: 6px 0; overflow-wrap: anywhere; }
.label { font-size: 11px; color: var(--soft); margin-right: 6px; }
.danger { color: var(--danger); }
.danger:empty { display: none; }

.intro { position: relative; padding: 22px 0 14px; border-bottom: 1px solid var(--line); }
.intro.has-art { padding-right: 92px; min-height: 136px; }
.intro img { position: absolute; width: 80px; height: 98px; object-fit: cover; right: 0; top: 18px; mix-blend-mode: multiply; border-radius: 50% 40% 45% 35%; }

.stats { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 14px 0 2px; font-size: 12px; color: var(--soft); }
.stats strong { color: var(--accent); font-size: 18px; font-weight: 600; margin: 0 2px; }

/* fan card */
.fan-card { border-bottom: 1px solid var(--line); padding: 20px 0 24px; min-width: 0; }
.fan-card.folded { padding-bottom: 16px; }
.fan-top { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.who { min-width: 0; flex: 1; }
.fan-name { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; line-height: 1.4; }
.small-name { font-size: 15px; }
.signals { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12px; color: var(--soft); margin-top: 3px; }
.signals .dot { color: var(--line); }
.iron { display: inline-flex; align-items: center; gap: 5px; color: var(--warm); }
.ticks { display: inline-flex; gap: 2px; align-items: flex-end; }
.ticks i { display: block; width: 2px; height: 11px; background: currentColor; border-radius: 1px; transform: rotate(9deg); }
.ticks i:nth-child(odd) { height: 9px; transform: rotate(-6deg); }
.desc { display: flex; align-items: baseline; font-size: 12px; color: var(--soft); margin: 6px 0 0; min-width: 0; }
.desc .source-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0 4px; }
.tag { font-size: 11px; color: var(--accent); background: var(--wash); padding: 1px 7px; border-radius: 3px; }
.score { font-size: 11px; white-space: nowrap; color: var(--warm); margin-left: auto; }
.why { font-size: 13px; color: var(--soft); margin: 6px 0 0; }
blockquote { margin: 12px 0 4px; padding: 0 0 0 13px; border-left: 2px solid #c4ac89; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.translation { font-size: 12px; color: var(--soft); white-space: pre-wrap; margin: 2px 0 0 15px; }
.post .source-text { color: var(--ink); }
details.more { margin: 6px 0; }
details.more > summary { font-size: 13px; color: var(--accent); }
.draft-box { margin-top: 14px; background: var(--draft); padding: 12px 13px; border-radius: 3px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > * { min-width: 0; }
.spread { justify-content: space-between; }
.tone-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 8px 0 2px; }
.tone-row button { padding: 6px; font-size: 13px; }
.draft-text { display: block; width: 100%; min-height: 76px; resize: vertical; background: transparent; border: 0; padding: 8px 0; font-size: 16px; line-height: 1.6; }
.draft-text:focus-visible { outline-offset: 0; }
.draft-label { font-size: 11px; color: var(--soft); }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.actions.two { grid-template-columns: 2fr 1fr; }
.actions button { padding: 9px 6px; font-size: 16px; }
.note { padding: 10px 0 0; font-size: 13px; color: var(--soft); margin: 0; }
.note.ok { color: var(--accent); }
.star-mark { color: var(--warm); }

.empty { padding: 32px 0; color: var(--soft); border-bottom: 1px solid var(--line); }
.empty h2 { color: var(--ink); }
.empty .row { margin-top: 14px; }
.section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.section.tail { border-bottom: 0; }
.full { width: 100%; }
.end { text-align: center; padding: 12px 0; }

/* roster */
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 16px 0 4px; }
.filters button { padding: 8px 4px; font-size: 14px; }
.field.search { margin: 10px 0 2px; }
.fan-row { border-bottom: 1px solid var(--line); }
summary { min-height: 44px; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
summary::-webkit-details-marker { display: none; }
.fan-row > summary { padding: 12px 0; }
.fan-row > summary::after, details.secondary > summary::after, details.more > summary::after { content: '＋'; color: var(--soft); flex: none; }
.fan-row[open] > summary::after, details.secondary[open] > summary::after, details.more[open] > summary::after { content: '−'; }
.row-main { min-width: 0; flex: 1; }
.last-line { font-size: 13px; margin: 4px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-side { display: flex; align-items: center; gap: 6px; flex: none; }
.tier-chip { font-size: 11px; color: var(--accent); border: 1px solid var(--accent); border-radius: 3px; padding: 0 5px; }
.history { padding: 0 0 16px; }
.history blockquote { font-size: 14px; }
.label-line { font-size: 12px; color: var(--soft); margin-top: 16px; }
.log { margin: 4px 0 12px; padding-left: 18px; font-size: 12px; color: var(--soft); }
.log li { margin: 3px 0; overflow-wrap: anywhere; }

/* forms */
.field { display: block; margin: 18px 0; font-size: 13px; }
.field > span { display: block; margin-bottom: 7px; }
input:not([type=checkbox]):not([type=file]), select, textarea.input {
  display: block; width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 6px;
  padding: 10px; background: var(--paper-2); font-size: 16px;
}
textarea.input { resize: vertical; min-height: 88px; }
.collect-text { min-height: 160px; }
.file-pick { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; min-width: 0; }
.file-pick .small { min-width: 0; overflow-wrap: anywhere; }
.gate { padding: 40px 0 10px; position: relative; }
.gate img { width: 96px; height: 118px; object-fit: cover; mix-blend-mode: multiply; border-radius: 50% 40% 45% 35%; display: block; margin-bottom: 10px; }
.gate h1 { font-size: 26px; }
body.gated .tabs, body.gated .footnote { display: none; }

/* collect */
.kv { margin: 10px 0; }
.kv > div { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.kv dt { width: 6.4em; flex: none; color: var(--soft); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.progress { height: 8px; background: var(--wash); border-radius: 4px; overflow: hidden; margin: 12px 0 6px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s ease; }
.section .primary.full { margin-top: 12px; }
details.secondary > summary { color: var(--soft); font-size: 14px; }

/* skeletons */
.sk { height: 14px; border-radius: 4px; margin: 8px 0; background: linear-gradient(90deg, var(--sk) 0%, var(--sk-hi) 50%, var(--sk) 100%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.sk.thin { height: 10px; } .sk.block { height: 54px; } .sk.box { height: 104px; }
.sk.w30 { width: 30%; } .sk.w40 { width: 40%; } .sk.w50 { width: 50%; } .sk.w60 { width: 60%; } .sk.w70 { width: 70%; } .sk.w80 { width: 80%; } .sk.w90 { width: 90%; } .sk.w100 { width: 100%; }
.sk-card { padding: 22px 0; }
.sk-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sk-actions .sk { height: 44px; }
.sk-row { padding: 14px 0; }
.sk-stats { display: flex; gap: 12px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } .progress span { transition: none; } }

.footnote { font-size: 10px; color: var(--soft); margin: 30px 0 0; line-height: 1.9; }
.tabs {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 640px;
  padding: 6px 12px max(8px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  background: var(--paper); border-top: 1px solid var(--line); z-index: 5;
}
.tabs a { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 2px; min-height: 52px; font-size: 11px; color: var(--soft); border-radius: 8px; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current=page] { color: var(--accent); background: var(--wash); }
#notice {
  position: fixed; z-index: 10; bottom: calc(80px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 520px; background: var(--ink); color: #fff; padding: 12px 15px; border-radius: 7px; font-size: 13px; box-shadow: 0 3px 10px #34382f18; margin: 0;
}
#notice[hidden] { display: none; }

@media (min-width: 600px) {
  .shell { padding-left: 38px; padding-right: 38px; }
  .intro.has-art { padding-right: 140px; min-height: 150px; }
  .intro img { width: 110px; height: 115px; }
  .fan-card { padding: 26px 0; }
}
