/* Identidad Extrarradio: cabina nocturna, magenta de marca, Fraunces + Spline Sans Mono */
:root {
  --paper: #15100f;
  --card: #1f1918;
  --ink: #f4ece4;
  --muted: #8a8079;
  --line: rgba(244, 236, 228, .14);
  --accent: #C01253;
  --accent-soft: #e87aa1;
  --accent-ink: #f4ece4;
  --ok: #8fcaa2; --ok-bg: #1f2d25;
  --lent: #edb45a; --lent-bg: #33270f;
  --late: #e0557f; --late-bg: #3a1622;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  --serif: "Fraunces", Georgia, "Iowan Old Style", serif;
  --mono: "Spline Sans Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root {
    --paper: #f7f1ea; --card: #ffffff; --ink: #2a1f1d; --muted: #6f655e; --line: #e6dccf;
    --accent: #C01253; --accent-soft: #C01253; --accent-ink: #ffffff;
    --ok: #3f6b4f; --ok-bg: #e4f0e8; --lent: #8a5a12; --lent-bg: #faecd0;
    --late: #a12d2d; --late-bg: #f7dcdc;
    --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .04);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
h2, h3 { font-family: var(--serif); }
nav a, .badge, .tag, .chip, button.small, .code { font-family: var(--mono); }
h2 { margin: 0; font-size: 1.5rem; }
h2 small { font: 400 .85rem system-ui, sans-serif; color: var(--muted); margin-left: .5rem; }
h3 { margin: 0 0 .5rem; }
a { color: var(--accent-soft); }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .6rem 1rem; background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-name { font: 500 .72rem/1.1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); border-left: 1px solid var(--line); padding-left: .7rem; }
@media (max-width: 480px) { .brand-name { display: none; } }
#user-box { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--muted); }

nav {
  display: flex; gap: .25rem; max-width: 1000px; margin: .5rem auto 0; padding: 0 1rem; overflow-x: auto;
}
nav a {
  position: relative; display: flex; align-items: center; gap: .4rem; padding: .5rem .8rem;
  border-radius: 999px; color: var(--ink); text-decoration: none; white-space: nowrap; font-size: .95rem;
}
nav a.active { background: var(--accent); color: var(--accent-ink); }
nav .badge {
  min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem; border-radius: 999px; background: var(--late);
  color: #fff; font: 700 .72rem/1.2rem system-ui; text-align: center; font-style: normal;
}
nav .badge[hidden] { display: none; }

main { max-width: 1000px; margin: 0 auto; padding: 1rem; min-height: 60vh; }
.loading { color: var(--muted); text-align: center; padding: 3rem 0; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; align-items: center; }
.filters input[type=search] { flex: 1 1 220px; }

input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], input:not([type]),
select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
}
.filters select { width: auto; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.ghost { background: transparent; }
button.danger { color: var(--late); }
button.small { padding: .3rem .6rem; font-size: .85rem; }
button:disabled { opacity: .55; cursor: not-allowed; }

.check { display: flex; gap: .5rem; align-items: center; font-size: .92rem; color: var(--muted); }
.check input { width: auto; }
.field { display: block; margin-bottom: .75rem; }
.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
.hint { font-size: .85rem; color: var(--muted); margin: .25rem 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.card.err { border-color: var(--late); }
.auth { max-width: 380px; margin: 2rem auto; }
.auth form { display: block; }
.auth button { width: 100%; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .75rem; }
.group-title { margin: 1.25rem 0 .5rem; font-size: 1.05rem; border-bottom: 1px solid var(--line); padding-bottom: .25rem; }
.group-title small { color: var(--muted); font: 400 .8rem system-ui; }

.book { display: flex; gap: .75rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.book .cover { width: 64px; height: 96px; flex: none; border-radius: 4px; object-fit: cover; background: var(--line); }
.book .cover.ph {
  display: flex; align-items: center; justify-content: center; font: 700 1.8rem Georgia, serif; color: var(--accent);
  background: var(--paper); border: 1px solid var(--line);
}
.book .info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.book .title { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.book .author, .book .meta { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.book .actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; padding-top: .4rem; align-items: center; }
.tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.tag { font-size: .72rem; padding: .05rem .5rem; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); }
.badge-st { display: inline-block; font-size: .78rem; padding: .1rem .55rem; border-radius: 999px; width: fit-content; }
.badge-st.ok { background: var(--ok-bg); color: var(--ok); }
.badge-st.lent { background: var(--lent-bg); color: var(--lent); }
.badge-st.late { background: var(--late-bg); color: var(--late); }
.switch { display: flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--muted); cursor: pointer; }

.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); }

.loan { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; align-items: center;
  padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: .5rem; }
.loan .txt { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.loan .sub { font-size: .85rem; color: var(--muted); }
.section-title { margin: 1.5rem 0 .5rem; font-size: 1.1rem; }

.post { display: block; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem .95rem; margin-bottom: .5rem; }
.post:hover { border-color: var(--accent); }
.post .t { font-weight: 700; }
.post .sub { font-size: .82rem; color: var(--muted); }
.post .excerpt { margin-top: .25rem; font-size: .93rem; color: var(--muted); overflow-wrap: anywhere; }
.reply { padding: .7rem .9rem; border-left: 3px solid var(--line); margin: .6rem 0; background: var(--card); border-radius: 0 var(--radius) var(--radius) 0; }
.reply .sub { font-size: .8rem; color: var(--muted); }
.body { white-space: pre-wrap; overflow-wrap: anywhere; }

.code { font: 700 1.1rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; background: var(--paper);
  padding: .15rem .5rem; border-radius: 6px; border: 1px solid var(--line); }
.members { margin: .4rem 0; font-size: .9rem; color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); padding: 0; width: min(520px, 94vw); max-height: 92vh; overflow: auto; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.modal { padding: 1.1rem; }
dialog video { width: 100%; border-radius: 8px; background: #000; }

#toast {
  position: fixed; left: 50%; bottom: 5.2rem; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 10px; max-width: 90vw;
  transition: opacity .2s, transform .2s; z-index: 100; font-size: .92rem;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--late); color: #fff; }

@media (max-width: 700px) {
  nav {
    position: fixed; bottom: 0; left: 0; right: 0; margin: 0; padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom));
    justify-content: space-around; background: var(--paper); border-top: 1px solid var(--line); z-index: 20; gap: 0;
  }
  nav a { flex-direction: column; gap: 0; padding: .3rem .4rem; font-size: .68rem; border-radius: 10px; flex: 1; justify-content: center; }
  nav a .ic { font-size: 1.25rem; }
  nav .badge { position: absolute; top: 0; right: 18%; }
  main { padding-bottom: 5.5rem; }
  #toast { bottom: 6rem; }
  #user-box .who { display: none; }
}

/* ficha bibliográfica */
.book .cover-link { flex: none; display: block; line-height: 0; }
.book a.title { color: var(--ink); text-decoration: none; }
.book a.title:hover { color: var(--accent); text-decoration: underline; }
.ficha { display: flex; gap: 1rem; margin-bottom: .75rem; }
.ficha-main { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.ficha-main h3 { margin: 0; overflow-wrap: anywhere; }
.cover.big { width: 110px; height: 165px; flex: none; border-radius: 6px; object-fit: cover; background: var(--line); }
.cover.big.ph { display: flex; align-items: center; justify-content: center; font: 700 3rem Georgia, serif; color: var(--accent); background: var(--paper); border: 1px solid var(--line); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem .75rem; margin: .75rem 0; }
.facts dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
dialog h4 { margin: 1rem 0 .25rem; font-family: Georgia, serif; }

/* conversación por libro */
.reads { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin: .5rem 0; font-size: .92rem; }
details.spoiler { background: var(--paper); border: 1px dashed var(--line); border-radius: 8px; padding: .4rem .6rem; }
details.spoiler summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
details.spoiler .body { margin-top: .4rem; }
dialog .reply { margin: .5rem 0; }
dialog form[data-form="book-comment"] { margin-top: .75rem; }
.meta a { color: var(--accent); text-decoration: none; }
.meta a:hover { text-decoration: underline; }

.kicker { margin: 0 0 .4rem; font: 500 .72rem/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-soft); }
.kicker::before { content: ''; display: inline-block; width: 18px; height: 3px; background: var(--accent); margin-right: .5rem; vertical-align: middle; }

.logo-dia { display: none; }
@media (prefers-color-scheme: light) { .logo-noche { display: none; } .logo-dia { display: block; } }

nav[hidden] { display: none; }
