:root {
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Charter, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg: #ffffff; --fg: #0f1419; --muted: #536471; --line: #eff3f4; --line2: #cfd9de;
  --hover: #f7f9f9; --accent: #534AB7; --life: #00ba7c; --halo: #7F77DD; --neg: #f4212e;
  --top-h: 52px; --bottom-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000000; --fg: #e7e9ea; --muted: #71767b; --line: #2f3336; --line2: #3e4144; --hover: #080808; --halo: #9a93ec; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 15px; line-height: 1.4; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-weight: 500; margin: 0; }
h1 { font-family: var(--serif); font-size: 22px; padding: 12px 16px 4px; }
.shell { max-width: 600px; margin: 0 auto; min-height: 100vh; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
main { padding-bottom: calc(var(--bottom-h) + 24px); }

/* ---- barra superior ---- */
header.top { position: sticky; top: 0; z-index: 5; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.logo img { height: 30px; display: block; }
.logo .d { display: none; }
@media (prefers-color-scheme: dark) { .logo .l { display: none; } .logo .d { display: block; } }
.ttl { font-family: var(--serif); font-size: 19px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.me .i { width: 22px; height: 22px; }
.i { width: 18px; height: 18px; vertical-align: -3px; }

/* ---- pestañas ---- */
nav.tabs-top { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: var(--top-h); z-index: 4; background: var(--bg); }
nav.tabs-top a { flex: 1; text-align: center; padding: 13px 0 10px; color: var(--muted); font-size: 15px; position: relative; }
nav.tabs-top a .i { display: none; }
nav.tabs-top a.on { color: var(--fg); font-weight: 700; }
nav.tabs-top a.on::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 56px; height: 4px; border-radius: 2px; background: var(--accent); }
nav.tabs-bottom { display: none; }
@media (max-width: 640px) {
  .shell { border: 0; }
  nav.tabs-top { display: none; }
  nav.tabs-bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--bottom-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); z-index: 5; }
  nav.tabs-bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 10px; }
  nav.tabs-bottom a .i { width: 24px; height: 24px; }
  nav.tabs-bottom a.on { color: var(--fg); }
  nav.tabs-bottom a.on .i { stroke-width: 2.4; }
}

/* ---- post ---- */
.post { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.post:hover { background: var(--hover); }
.pc { flex: 1; min-width: 0; }
.av { flex: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 18px; color: var(--halo); background: color-mix(in srgb, var(--halo) 10%, var(--bg));
  border: 2px solid color-mix(in srgb, var(--halo) calc(var(--ring, .2) * 100%), var(--line2));
  box-shadow: 0 0 var(--glow, 0) color-mix(in srgb, var(--halo) 55%, transparent); }
.reply .av, .pk .av { width: 32px; height: 32px; font-size: 14px; }
.av.photo { background-size: cover; background-position: center; color: transparent; }
.av.mini { width: 24px; height: 24px; box-shadow: none; }
.avl { flex: none; }
.profile { padding: 16px; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: flex-start; }
.profile .av { width: 72px; height: 72px; font-size: 30px; }
.profile h1 { padding: 0; font-size: 22px; }
.profile .bio { margin: 4px 0 6px; }
.profile .meta { color: var(--muted); font-size: 13px; }
.l1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l1 b { font-weight: 700; }
.l1 .meta { color: var(--muted); font-weight: 400; }
.post h2 { font-family: var(--serif); font-size: 19px; line-height: 1.25; margin: 3px 0 4px; }
.post.compact h2 { font-size: 17px; }
.lead { margin: 0 0 8px; color: var(--fg); }
.post p { margin: 2px 0 0; white-space: pre-wrap; }
.media { display: block; position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; margin: 8px 0 10px;
  background: var(--accent) center/cover no-repeat; border: 1px solid var(--line); }
.media.sm { aspect-ratio: 16 / 9; }
.media::before { content: ""; position: absolute; inset: 0; background: inherit; filter: grayscale(1) contrast(1.05); }
.veil { position: absolute; inset: 0; opacity: .5; mix-blend-mode: multiply; }
.life { height: 3px; background: var(--line); border-radius: 2px; margin: 2px 0 8px; }
.life span { display: block; height: 3px; background: var(--life); border-radius: 2px; }
.peek { border-left: 2px solid var(--line2); margin: 4px 0 6px; padding-left: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.pk { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); }
.pk b { color: var(--fg); font-weight: 600; }
.delta { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); margin: 2px 0 4px; }
.actions { display: flex; align-items: center; gap: 22px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.actions a, .actions .vote > span, .actions button { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.actions .i { width: 19px; height: 19px; }
form.vote { display: inline-flex; gap: 22px; margin: 0; }
form.vote button { font: inherit; font-size: 13px; background: none; border: 0; padding: 0; cursor: pointer; }
form.vote button:first-child:hover { color: var(--life); }
form.vote button:last-child:hover { color: var(--neg); }
span.vote { display: inline-flex; gap: 22px; }

/* ---- hilo ---- */
.hilo .post.main { border-bottom: 0; }
.hilo .main h2 { font-size: 24px; line-height: 1.2; }
.hilo .main .media { aspect-ratio: 4 / 3; }
.hilo .main .lead { font-size: 17px; line-height: 1.45; }
.hilo .source { display: inline-flex; gap: 6px; align-items: center; color: var(--accent); font-size: 14px; margin: 4px 0; }
.hilo .stats { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.hilo .stats b { color: var(--fg); }
.post.reply { padding-left: 16px; }
.composer { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.composer textarea { flex: 1; font: inherit; font-size: 16px; border: 0; background: none; color: var(--fg); resize: vertical; min-height: 60px; outline: none; }
.composer button { align-self: flex-end; font: inherit; font-weight: 700; font-size: 14px; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 7px 16px; cursor: pointer; }

/* ---- fab ---- */
.fab { position: fixed; right: 20px; bottom: calc(var(--bottom-h) + 20px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 6; }
.fab .i { width: 26px; height: 26px; stroke-width: 2.4; }
@media (min-width: 641px) { .fab { right: calc(50% - 300px - 76px); bottom: 28px; } }

/* ---- formularios, avisos ---- */
form.plain { display: flex; flex-direction: column; gap: 10px; padding: 8px 16px 16px; }
form.plain input, form.plain textarea, form.plain select { font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); color: var(--fg); }
form.plain textarea { min-height: 100px; }
form.plain button { font: inherit; font-weight: 700; padding: 10px 18px; border-radius: 999px; border: 0; background: var(--accent); color: #fff; cursor: pointer; align-self: flex-start; }
form.plain label { font-size: 13px; color: var(--muted); }
.notice { margin: 10px 16px; padding: 10px 12px; border-radius: 12px; font-size: 14px; background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.error { margin: 10px 16px; padding: 10px 12px; border-radius: 12px; font-size: 14px; background: color-mix(in srgb, var(--neg) 12%, var(--bg)); color: var(--neg); }
.end { text-align: center; color: var(--muted); font-size: 14px; padding: 28px 16px; }
nav.pages { display: flex; justify-content: space-between; padding: 14px 16px; font-size: 14px; color: var(--muted); }
footer { padding: 12px 16px; font-size: 12px; color: var(--muted); }
p { margin: 0 0 8px; }

/* ---- admin ---- */
.admin { padding: 0 16px; }
.admin table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin td, .admin th { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin input[type=text] { width: 100%; font: inherit; padding: 4px 6px; border: 1px solid var(--line2); border-radius: 6px; background: var(--bg); color: var(--fg); }
.admin pre { border: 1px solid var(--line); padding: 10px; border-radius: 8px; font-size: 12px; overflow: auto; }
.admin .btn, .admin button { font: inherit; font-size: 13px; border: 1px solid var(--line2); background: none; color: var(--fg); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
