/* Foro anónimo. Pensado primero para el teléfono.
   Mundo: arte cinético (interferencia cromática). El espectro vive solo en temas,
   baldosas de identidad y estados; el rojo es el único color de acción. */

:root {
  --ink-900: #260A0E;
  --ink-700: #57191F;

  --bg: #F8F1F1;
  --surface: #FFFFFF;
  --line: #EBDCDD;
  --line-strong: #DCC3C5;
  --text: #2B1114;
  --muted: #7A5458;

  --action: #D42A3A;
  --action-hover: #B31F2E;
  --action-soft: #FDE9EB;
  --danger: #8F1D26;

  --r: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font: 'Schibsted Grotesk', ui-sans-serif, system-ui, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --kx: 0;
  --ky: 0;
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 120px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100dvh; }
::selection { background: var(--action); color: #fff; }
input, textarea { caret-color: var(--action); }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul { list-style: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.skip { position: absolute; left: 12px; top: -48px; background: var(--action); color: #fff; padding: 8px 14px; border-radius: var(--r); z-index: 100; }
.skip:focus { top: 10px; }

/* ---------- barra y temas ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 12px 0 14px; background: var(--surface); color: var(--text); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; min-height: 44px; }
.mark { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 7px; overflow: hidden; background: #fff; }
.mark img { width: 100%; height: 100%; object-fit: contain; }

.search { position: relative; flex: 1; min-width: 0; max-width: 480px; display: flex; align-items: center; }
.search .ico { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 12px 0 38px; border-radius: 999px; font: inherit; font-size: 16px;
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--action); background: var(--surface); box-shadow: 0 0 0 3px var(--action-soft); }
.search input::-webkit-search-cancel-button { filter: opacity(.6); }
.me-btn { margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.me-btn:active { background: var(--bg); }


main { max-width: 760px; margin: 0 auto; padding: 16px 12px calc(96px + var(--safe-b)); outline: none; }
main.enter > * { animation: rise .4s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: .04s; }
main.enter > *:nth-child(3) { animation-delay: .08s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- bandas y encabezados ---------- */
.head, .qhead { position: relative; padding-bottom: 16px; --hue: var(--action); }
h1 { font-size: 26px; line-height: 1.15; letter-spacing: -0.025em; font-weight: 700; text-wrap: balance; }
.strands { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; border-radius: 2px; overflow: hidden; display: block; }
.strands svg { display: block; width: 100%; height: 100%; }
.strands .ov { transform: translateX(calc(var(--kx) * 2px)); transition: transform .3s var(--ease); }

.tabs { display: flex; gap: 4px; margin: 4px 0 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 0 14px; min-height: 44px; display: inline-flex; align-items: center; color: var(--muted); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; }
.tab.on { color: var(--action); border-color: var(--action); font-weight: 600; }
.tab.pending { color: var(--text); font-weight: 700; }
.tab.on.pending { color: var(--action); }
.tab .dot { width: 7px; height: 7px; margin-left: 7px; border-radius: 50%; background: var(--action); flex: none; }

/* ---------- lista ---------- */
.rows { background: var(--surface); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.rows li { border-top: 1px solid var(--line); animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.rows li:first-child { border-top: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; min-height: 72px; transition: background-color .15s; }
.row:active, .row:hover { background: #FCF6F6; }
.row-main { flex: 1; min-width: 0; }
.row h3 { font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; text-wrap: pretty; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.count { flex: none; display: inline-flex; align-items: center; gap: 5px; min-width: 44px; justify-content: center; height: 32px; padding: 0 10px; border-radius: 999px; background: var(--bg); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }

.who { display: inline-flex; align-items: center; gap: 7px; min-width: 0; color: var(--text); font-weight: 500; font-size: 13px; }
.alias { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-flag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--action-soft); color: var(--action); }
.when { color: var(--muted); font-size: 13px; }

.tile { --s: 28px; display: inline-block; width: var(--s); height: var(--s); flex: none; border-radius: 50%; overflow: hidden; background: #fff; line-height: 0; box-shadow: 0 0 0 1px rgba(38, 10, 14, .12); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; cursor: pointer; transition: transform .15s var(--ease), background-color .15s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; }
.btn-primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--action-hover); }
.btn-wide { width: 100%; height: 52px; font-size: 17px; }

.fab {
  position: fixed; z-index: 40; right: 16px; bottom: calc(16px + var(--safe-b)); height: 56px; min-width: 56px; padding: 0 16px; border-radius: 28px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--action); color: #fff; font-weight: 600;
  box-shadow: 0 6px 18px rgba(179, 31, 46, .38), 0 1px 3px rgba(26, 6, 8, .25); transition: transform .2s var(--ease), background-color .15s;
  animation: pop .45s var(--ease) both;
}
.fab span { display: none; }
.fab:active { transform: scale(.94); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.9); } to { opacity: 1; transform: none; } }

/* ---------- preguntar ---------- */
.ask { display: flex; flex-direction: column; gap: 14px; }
.ask-top { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: -4px 0 4px -8px; }
.ask-top h1 { font-size: 22px; }
.back { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); flex: none; }
.back:active { background: var(--line); }
input[type=text], .ask textarea {
  width: 100%; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: #fff; color: var(--text); font: inherit; font-size: 17px;
}
.ask textarea { resize: none; min-height: 110px; line-height: 1.5; }
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px rgba(212, 42, 58, .18); }
::placeholder { color: #9B7B7F; }
.demo { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--line); padding: 2px 8px; border-radius: 4px; }

/* ---------- menú de 3 puntos y edición en el sitio ---------- */
.menu-wrap { position: relative; flex: none; }
.menu-wrap.push { margin-left: auto; }
.menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(26, 6, 8, .18); overflow: hidden; z-index: 25; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 14px; border: 0; background: none; font: inherit; font-size: 15px; color: var(--text); text-align: left; cursor: pointer; }
.menu button:active { background: var(--bg); }
.menu button.danger { color: var(--danger); }
.edit-form { display: flex; flex-direction: column; gap: 10px; }
.edit-form textarea {
  width: 100%; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: #fff; color: var(--text); font: inherit; font-size: 17px;
  resize: none; min-height: 90px; line-height: 1.5;
}
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- detalle ---------- */
.qhead h1 { font-size: 24px; }
.qhead .meta { margin-top: 12px; }
.qbody { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 14px 0 8px; }
.prose { overflow-wrap: anywhere; font-size: 16.5px; flex: 1; min-width: 0; }
.prose p + p { margin-top: 10px; }
.thread { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.quiet { color: var(--muted); }
.center { text-align: center; padding: 28px 0; }

.post { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.post footer { display: flex; align-items: center; gap: 6px 10px; margin-top: 12px; flex-wrap: wrap; }
.grow { flex: 1; }
.kids { margin-top: 12px; border-left: 1px solid var(--line-strong); padding-left: 12px; display: flex; flex-direction: column; gap: 4px; }
.post.reply { border: 0; border-radius: 0; padding: 8px 0; background: none; font-size: 15px; }
.post.reply + .post.reply { border-top: 1px solid var(--line); }
.post.reply .prose { font-size: 15.5px; }
.post.deleted { background: none; border-style: dashed; }
.post.deleted.reply { border: 0; }

.votes { display: inline-flex; align-items: center; gap: 6px; }
.vbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--bg); color: var(--muted); font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer;
}
.vbtn:active:not(:disabled) { background: var(--action-soft); color: var(--action); }
.vbtn.on { background: var(--action); color: #fff; }
.vbtn:disabled { opacity: .35; }
.ibtn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 0; background: none; color: var(--muted); cursor: pointer; }
.ibtn:active { background: var(--action-soft); color: var(--action); }

/* barra de respuesta fija abajo */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 12px calc(8px + var(--safe-b)); }
.dock-row { max-width: 736px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; }
.dock .tile { margin-bottom: 6px; }
.dock textarea { flex: 1; min-width: 0; resize: none; max-height: 220px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 22px; font: inherit; font-size: 16px; line-height: 1.4; background: var(--bg); }
.dock textarea:focus { background: #fff; }
.send { width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%; background: var(--action); color: #fff; display: grid; place-items: center; cursor: pointer; }
.send:disabled { opacity: .5; }
.reply-chip { max-width: 736px; margin: 0 auto 6px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.reply-chip button { margin-left: auto; width: 32px; height: 32px; display: grid; place-items: center; background: none; border: 0; border-radius: 50%; color: var(--muted); }

/* ---------- identidad, vacíos y avisos ---------- */
.me { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px 0; text-align: center; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.skeleton { display: flex; flex-direction: column; gap: 10px; }
.skeleton i { display: block; height: 76px; border-radius: 12px; background: linear-gradient(100deg, #F0E4E5 30%, #F9F1F1 50%, #F0E4E5 70%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(420px, calc(100vw - 24px)); }
.toast { background: var(--ink-900); color: #fff; padding: 12px 16px; border-radius: var(--r); font-size: 15px; box-shadow: 0 8px 24px rgba(26, 6, 8, .28); animation: rise .35s var(--ease); transition: opacity .4s; }
.toast.error { background: #5A1015; }
.toast.out { opacity: 0; }

/* ---------- pantallas grandes ---------- */
@media (min-width: 700px) {
  .topbar { padding: 0 24px; gap: 20px; }
  main { padding-top: 28px; }
  h1 { font-size: 30px; }
  .fab span { display: inline; }
  .fab { right: max(24px, calc(50vw - 380px - 140px)); padding: 0 22px; }
  .row:hover { background: #FCF6F6; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.flash { animation: flash 2.2s var(--ease) both; }
@keyframes flash { 0%, 35% { background: var(--action-soft); box-shadow: 0 0 0 2px var(--action); } 100% { background: var(--surface); box-shadow: 0 0 0 0 transparent; } }

.update { position: fixed; z-index: 70; left: 12px; right: 84px; bottom: calc(84px + var(--safe-b)); max-width: 380px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-radius: 999px; background: var(--ink-900); color: #fff; font-weight: 500; box-shadow: 0 8px 24px rgba(26, 6, 8, .35); animation: pop .45s var(--ease) both; }
.update button { height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--action); color: #fff; font-weight: 600; cursor: pointer; }
.ver { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.more { display: grid; place-items: center; height: 56px; }
.more i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--action); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
