:root {
  --bg: #14121a; --surface: #1d1a25; --line: #2e2a3a; --text: #ebe5d8; --muted: #9a93a8;
  --accent: #86c4ad; --accent-ink: #0f1f19; --danger: #e5736a;
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 var(--sans); -webkit-text-size-adjust: 100%; }
body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; line-height: 1.25; }
h1 { font-size: 2rem; margin: 1.2rem 0 .3rem; }
h2 { font-size: 1.35rem; }
p { margin: .5rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1.1rem; border-bottom: 1px solid var(--line); }
.brand { font-family: var(--serif); font-size: 1.3rem; color: var(--text); text-decoration: none; }
.chip { font: inherit; font-size: .9rem; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: .3rem .9rem; min-height: 40px; }
.wrap { max-width: 720px; margin: 0 auto; padding: 1rem 1.1rem 4rem; }
.hero { padding: 2.2rem 0 1rem; }
.hero p { color: var(--muted); font-family: var(--serif); font-size: 1.15rem; }

.grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 1rem; }
.card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.card:hover { border-color: var(--accent); }
.cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--line); border-radius: 12px; }
.card .cover { border-radius: 0; }
.cover.ph { background: var(--line); }
.card-body { padding: .8rem 1rem 1rem; }
.card h3 { font-size: 1.15rem; }
.meta { color: var(--muted); font-size: .85rem; margin: .3rem 0 0; }
.counts { color: var(--muted); font-size: .8rem; margin: .2rem 0 0; }
.empty { color: var(--muted); text-align: center; margin: 3rem 1rem; grid-column: 1 / -1; }

.player { width: 100%; display: block; margin-top: .8rem; border-radius: 12px; }
video.player { background: #000; aspect-ratio: 16 / 9; }
.desc { color: var(--muted); }
.poem-text { margin: 1.6rem 0; padding: 1.2rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stanza { font-family: var(--serif); font-size: 1.25rem; line-height: 1.8; white-space: pre-line; margin: 0 0 1.4rem; }
.stanza:last-child { margin-bottom: 0; }
.sign { font-family: var(--serif); font-style: italic; color: var(--accent); margin: 1rem 0; }

.btn { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .6rem 1rem; min-height: 44px; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.link { background: none; border: 0; color: var(--accent); padding: .4rem .2rem; min-height: 36px; text-decoration: underline; }
.btn.small { min-height: 32px; font-size: .8rem; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.reacts { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: 1rem 0; }
.react { font: inherit; display: inline-flex; align-items: center; gap: .4rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .9rem; min-height: 44px; cursor: pointer; }
.react[aria-pressed='true'] { border-color: var(--accent); background: rgba(134,196,173,.15); }
.react:disabled { opacity: .5; }
.react .lbl { font-size: .85rem; }
.react .n { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }

input, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; width: 100%; min-height: 44px; }
.compose { display: grid; gap: .6rem; margin: .8rem 0 1.2rem; }
.comments-box { margin-top: 2rem; }
.comment { border-bottom: 1px solid var(--line); padding: .7rem 0; }
.comment p { margin: .2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.who { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }

dialog.sheet { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem; width: min(92vw, 380px); }
dialog.sheet::backdrop { background: rgba(0,0,0,.6); }
.sheet-body { display: grid; gap: .8rem; }
.gbox { min-height: 44px; display: flex; justify-content: center; }
.or { text-align: center; color: var(--muted); font-size: .85rem; }

.foot { max-width: 720px; margin: 0 auto; padding: 1.5rem 1.1rem 3rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem; }
.prose h2 { margin: 1.6rem 0 .3rem; }
.prose p, .prose li { color: var(--text); }

#toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translate(-50%, 10px); background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; max-width: 90vw; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
