/* Cryptid web reader. Light cream theme, same reading stage as the Telegram Mini App. */
:root {
  --bg: #faf6ec;
  --fg: #16181c;
  --muted: #7d7462;
  --card: #f0e9d8;
  --line: #e2d9c4;
  --btn: #1f2328;
  --btn-fg: #faf6ec;
  --accent: #d9a400;
  --danger: #c0392b;
  --ok: #2e8b57;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
/* friction for copying: no selection, no callouts, no drag */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, code { -webkit-user-select: text; user-select: text; }
img, canvas { -webkit-user-drag: none; }
@media print { body { display: none !important; } }

header, main { max-width: 720px; margin: 0 auto; }
header { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: calc(14px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 6px calc(16px + env(safe-area-inset-left));
  border-bottom: 1px solid var(--line); }
header .brand { font-weight: 700; font-size: 19px; color: var(--fg); text-decoration: none; margin-right: auto; }
header a.muted { text-decoration: none; }
main { padding: 8px calc(16px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
h2 { font-size: 20px; line-height: 1.3; margin: 14px 0 6px; overflow-wrap: anywhere; }
a { color: inherit; }
a.back { display: inline-block; margin-top: 12px; color: var(--muted); text-decoration: none; font-size: 15px; }
.muted { color: var(--muted); font-size: 14px; }
.block { display: block; }
.gap { margin-top: 10px; }
.card { display: block; background: var(--card); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.card p { margin: 6px 0; }
.post-row { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--fg); }
.post-row:hover { background: #ebe2cd; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
a.button { display: inline-block; text-decoration: none; border-radius: 10px; padding: 10px 16px; background: var(--btn); color: var(--btn-fg); }
a.button.secondary { background: var(--bg); color: var(--fg); }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pill { flex: none; font-size: 13px; padding: 4px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.pill.approved { background: var(--btn); color: var(--btn-fg); }
button { font: inherit; border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; background: var(--btn); color: var(--btn-fg); }
button.secondary { background: var(--card); color: var(--fg); }
button.danger { background: transparent; color: var(--danger); padding-left: 0; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=text] { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #fffdf7; color: var(--fg); }
code { font: 13px ui-monospace, Menlo, Consolas, monospace; }
.warn { color: var(--danger); }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 688px; margin: 0 auto;
  background: #222; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 14px; }

/* photos: hold to view */
.viewer { position: relative; margin: 8px 0; border-radius: 12px; overflow: hidden; background: #000; touch-action: none; }
.viewer canvas { display: block; width: 100%; height: auto; }
.viewer canvas.hidden { visibility: hidden; }
.viewer .cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; color: #fff; background: #111; text-align: center; padding: 16px; cursor: pointer; }
.viewer .cover b { font-size: 18px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* word-by-word reader (same look as the Mini App) */
.rsvp-stage { position: relative; border-radius: 12px; overflow: hidden; background: #f5efe0; margin: 8px 0 0;
  touch-action: manipulation; box-shadow: inset 0 0 0 1px var(--line); }
.rsvp-stage canvas { display: block; width: 100%; }
.rsvp-badge { position: absolute; left: 10px; top: 8px; font: 600 10px/1 Inter, system-ui, sans-serif; letter-spacing: .08em;
  text-transform: uppercase; color: #8a7f68; }
.rsvp-progress { height: 3px; background: #e6dfcd; border-radius: 2px; overflow: hidden; margin: 4px 0 8px; }
.rsvp-progress div { height: 100%; width: 0; background: #f0be1e; }
.rsvp { margin: 0 0 4px; }
.rsvp-controls { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 0 0 12px; }
.rsvp-controls > button { flex: 0 0 auto; min-width: 104px; }
label.rsvp-speed { display: flex; align-items: center; gap: 10px; flex: 1 1 220px; min-width: 0; margin: 0; }
.rsvp-speed input[type=range] { flex: 1; min-width: 0; height: 32px; margin: 0; accent-color: var(--accent); }
.rsvp-speed span:last-child { min-width: 68px; text-align: right; font-variant-numeric: tabular-nums; color: var(--fg); }

/* plain posts: shown as written */
.plain-post { margin: 8px 0 12px; }
.plain-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; line-height: 1.6; -webkit-user-select: text; user-select: text; }
.plain-photo { display: block; width: 100%; height: auto; max-height: 80vh; object-fit: contain; border-radius: 12px; margin: 10px 0; background: #000; }
