/* Delistado — hoja de estilos única, sin compilación.
   Diseñada asumiendo que MUCHAS obras no tendrán carátula: el marcador de
   posición es tipográfico y deliberado, no una imagen rota. */

:root {
  --bg:        #0e1113;
  --surface:   #171b1e;
  --surface-2: #1f2428;
  --line:      #2a3034;
  --ink:       #e8ebec;
  --ink-2:     #a3adb2;
  --ink-3:     #6d787d;
  --accent:    #5eb3c6;
  --accent-dk: #2b7d92;
  --gold:      #d9a441;
  --danger:    #e0785f;
  --ok:        #6fbf8c;
  --radius:    10px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7f5; --surface: #ffffff; --surface-2: #eef0ed; --line: #dce0dc;
    --ink: #14181a; --ink-2: #4d565b; --ink-3: #808a8f;
    --accent: #1f6d81; --accent-dk: #17545f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; display: block; }

/* ---------- Estructura ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 80px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand {
  font-family: var(--serif); font-size: 22px; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none; flex: none;
}
.brand span { color: var(--accent); }
.nav { display: flex; gap: 16px; margin-left: auto; align-items: center; font-size: 14.5px; }
.nav a { color: var(--ink-2); text-decoration: none; }
.nav a:hover, .nav a.on { color: var(--ink); }

/* ---------- Buscador ---------- */
.searchbar { flex: 1 1 260px; min-width: 200px; }
.searchbar form { display: flex; gap: 8px; }
.searchbar input {
  flex: 1; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); padding: 9px 14px; border-radius: 999px;
  font-size: 15px; font-family: inherit;
}
.searchbar input::placeholder { color: var(--ink-3); }
.searchbar input:focus { border-color: var(--accent); outline: none; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 8px; font-size: 14.5px; font-family: inherit;
  cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn:hover { border-color: var(--accent); color: var(--ink); }
.btn.on { background: var(--accent-dk); border-color: var(--accent); color: #fff; }
.btn.primary { background: var(--accent-dk); border-color: var(--accent-dk); color: #fff; }
.btn.primary:hover { background: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.gold.on { background: #7a5a12; border-color: var(--gold); color: #fff; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- Tipografía ---------- */
h1 { font-family: var(--serif); font-size: clamp(28px, 5vw, 40px); font-weight: 400;
     letter-spacing: -.02em; line-height: 1.1; margin: 0 0 6px; text-wrap: balance; }
h2 { font-family: var(--serif); font-size: 22px; font-weight: 400; margin: 34px 0 14px; }
.eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
           text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
.muted { color: var(--ink-2); }
.dim   { color: var(--ink-3); font-size: 14px; }

/* ---------- Carátulas y su ausencia ---------- */
.cover { aspect-ratio: 2/3; border-radius: var(--radius); overflow: hidden;
         background: var(--surface-2); position: relative; }
/* La imagen va superpuesta al marcador tipográfico: si no carga, se retira
   sola (onerror) y debajo ya está el sustituto. Nunca hay hueco roto. */
.cover .cover-img { position: absolute; inset: 0; width: 100%; height: 100%;
                    object-fit: cover; background: var(--surface-2); }
.cover-none {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; padding: 10px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius);
}
.cover-none .ini { font-family: var(--serif); font-size: 2.2rem; color: var(--ink-2); line-height: 1; }
.cover-none .ico { font-size: 1.1rem; opacity: .75; }

/* ---------- Resultados y rejillas ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.card { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 8px; }
.card .t { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.card .s { font-size: 12.5px; color: var(--ink-3); }
.card:hover .cover { outline: 2px solid var(--accent); outline-offset: 2px; }

.hits { display: flex; flex-direction: column; gap: 2px; }
.hit {
  display: grid; grid-template-columns: 54px 1fr auto; gap: 14px; align-items: center;
  padding: 12px 10px; border-radius: var(--radius); text-decoration: none; color: inherit;
  border: 1px solid transparent;
}
.hit:hover { background: var(--surface); border-color: var(--line); }
.hit .cover { aspect-ratio: 2/3; width: 54px; }
.hit .t { font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.hit .s { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.hit .meta { text-align: right; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  background: var(--surface-2); color: var(--ink-2);
  padding: 3px 7px; border-radius: 4px; border: 1px solid var(--line);
}
.tag.mine { background: var(--accent-dk); color: #fff; border-color: var(--accent-dk); }
.tag.new  { background: transparent; color: var(--ink-3); }

/* ---------- Ficha de obra ---------- */
.work { display: grid; grid-template-columns: 200px 1fr; gap: 30px; align-items: start; }
/* En el móvil la ficha va en UNA columna.
   Antes era 120px + resto, y como los paneles ocupaban solo la segunda
   columna quedaba un hueco vertical enorme bajo la carátula: en una pantalla
   estrecha eso es la mitad del ancho desperdiciado. */
@media (max-width: 640px) {
  .work { grid-template-columns: 1fr; gap: 16px; }
  /* La carátula va dentro de un div envoltorio, así que el tamaño hay que
     ponerlo AHÍ: apuntar a .cover directamente no coincide con nada. */
  .work > div:first-child { width: 140px; }
  .work > div:last-child  { min-width: 0; }   /* evita desbordes por texto largo */
}
.work .synopsis { color: var(--ink-2); max-width: 62ch; }
.work .source { font-size: 12px; color: var(--ink-3); margin-top: 8px; }

.panel { background: var(--surface); border: 1px solid var(--line);
         border-radius: var(--radius); padding: 18px 20px; margin: 22px 0; }
.panel h3 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase;
            letter-spacing: .1em; color: var(--ink-3); font-weight: 600; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Estrellas: 0,5 a 5 en pasos de media */
.stars { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 0; }
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars label {
  cursor: pointer; font-size: 26px; line-height: 1; color: var(--ink-3);
  width: .5em; overflow: hidden; transition: color .1s;
}
.stars label:nth-of-type(odd) { direction: rtl; }
.stars label::before { content: '★'; }
.stars:hover label:hover, .stars:hover label:hover ~ label,
.stars input:checked ~ label { color: var(--gold); }
.stars-value { font-family: var(--mono); font-size: 13px; color: var(--ink-2); margin-left: 10px; }

/* ---------- Diario ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 14px;
               padding: 10px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.timeline li:first-child { border-top: none; }
.timeline time { font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding-top: 2px; }

/* ---------- Avisos ---------- */
.flash { background: color-mix(in srgb, var(--ok) 14%, var(--surface));
         border: 1px solid var(--ok); color: var(--ink);
         padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 14.5px; }
.error { background: color-mix(in srgb, var(--danger) 14%, var(--surface));
         border: 1px solid var(--danger); color: var(--ink);
         padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 14.5px; }

.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.empty .big { font-size: 40px; margin-bottom: 12px; }

/* ---------- Estadísticas ---------- */
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 14px 18px; min-width: 116px; }
.stat .n { font-family: var(--serif); font-size: 30px; line-height: 1; }
.stat .l { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }

/* ---------- Formularios ---------- */
.form { max-width: 380px; margin: 60px auto; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.field input {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); padding: 10px 13px; border-radius: 8px;
  font-size: 15px; font-family: inherit;
}
.field input:focus { border-color: var(--accent); outline: none; }
.field .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 28px; font-size: 14px; }
.pagination a, .pagination span { padding: 6px 11px; border: 1px solid var(--line);
                                  border-radius: 6px; text-decoration: none; color: var(--ink-2); }
.pagination .active span { background: var(--accent-dk); border-color: var(--accent-dk); color: #fff; }

/* ── Panel de administración ─────────────────────────────────────────────
   No hay tablas en el resto de la aplicación porque no hacían falta: aquí sí,
   porque se comparan filas entre sí. */

.subnav { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 22px; }

.tabla-envoltura { overflow-x: auto; }              /* en el móvil se desplaza */
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th {
  text-align: left; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); font-family: var(--mono); font-weight: 400;
  padding: 0 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tabla td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla tr:last-child td { border-bottom: none; }
.tabla td.num, .tabla th.num { text-align: right; font-family: var(--mono); font-size: 13px; }

/* Gráfico de barras sin librerías: son doce números, no hace falta más. */
.barras { display: flex; align-items: flex-end; gap: 5px; height: 90px; margin-top: 6px; }
/* El tope de anchura es para las primeras semanas: con una sola barra, sin él,
   ocupaba el ancho entero de la pantalla y parecía un error. */
.barras .b { flex: 1; max-width: 54px; display: flex; flex-direction: column;
             justify-content: flex-end; height: 100%; }
.barras .b i { display: block; background: var(--accent-dk); border-radius: 3px 3px 0 0; min-height: 2px; }
.barras .b b { font-family: var(--mono); font-size: 10px; font-weight: 400; color: var(--ink-3);
               text-align: center; padding-top: 4px; }
.barras-pie { display: flex; gap: 5px; margin-top: 2px; }
.barras-pie span { flex: 1; max-width: 54px; text-align: center; font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); }

.medidor { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.medidor i { display: block; height: 100%; background: var(--danger); }
.medidor.ok i { background: var(--ok); }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--surface-2); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--ink-3); font-family: var(--mono);
}

/* ── Entrar con Google ───────────────────────────────────────────────────── */
.btn.google { width: 100%; background: var(--surface-2); font-weight: 500; padding: 11px 16px; }
.btn.google:hover { border-color: var(--accent); }

.separador { display: flex; align-items: center; gap: 12px; margin: 18px 0; }
.separador::before, .separador::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.separador span { font-size: 12px; color: var(--ink-3); }

/* Aviso de consumo en el panel. Tiene que verse, ese es su único trabajo. */
.aviso {
  background: color-mix(in srgb, var(--gold) 16%, var(--surface));
  border: 1px solid var(--gold);
  border-radius: var(--radius); padding: 13px 16px; margin: 0 0 20px; font-size: 14px; line-height: 1.55;
}
.aviso.grave { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); border-color: var(--danger); }

/* Los resultados de la corrección son botones de formulario, no enlaces. */
.hit-form { display: contents; }
button.hit { font: inherit; color: inherit; border: 1px solid var(--line); background: var(--surface); }
button.hit:hover { border-color: var(--accent); }
