/* Fintoc es Cine — hoja de estilos única, tema sala oscura. */

:root {
  --bg: #0a0a0e;
  --bg-glow: #16121f;
  --surface: #14141c;
  --surface-2: #1c1c27;
  --surface-3: #242433;
  --border: #2b2b3a;
  --border-strong: #3a3a4d;
  --text: #eceaf2;
  --muted: #9a98aa;
  --faint: #6e6c7d;
  --gold: #f2c45a;
  --gold-dim: #a8863a;
  --red: #e0464b;
  --green: #55d98a;
  --blue: #6aa9f5;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* El navegador oculta [hidden] con `display: none`, pero cualquier regla nuestra
   que fije un display (una clase pesa más que un atributo) lo vuelve a mostrar.
   Esto pasó con el marcador del póster, que salía encima de la portada real. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 50% -160px, var(--bg-glow), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 0.4em; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

/* --- Estructura ---------------------------------------------------------- */

.shell {
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 20px 72px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(10, 10, 14, 0.82);
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.topbar-inner {
  max-width: 1020px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.15rem; filter: saturate(1.2); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; align-items: center; }

.nav-link {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--surface-3); color: var(--text); }
.nav-link.is-admin { color: var(--gold); }

.nav-user { display: flex; align-items: center; gap: 8px; padding-left: 6px; }

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  flex: 0 0 auto;
}
.avatar-sm { width: 24px; height: 24px; font-size: 0.6rem; }

/* --- Tarjetas ------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card-flush { padding: 0; overflow: hidden; }
.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.card-header h2, .card-header h1 { margin: 0; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold-dim);
  margin-bottom: 6px;
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.76rem; }
.strong { font-weight: 700; }
.center { text-align: center; }
.right { text-align: right; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 28px; }
.mb-0 { margin-bottom: 0; }

.divider { height: 1px; background: var(--border); border: 0; margin: 20px 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-tight { gap: 8px; }
.spread { justify-content: space-between; }

/* --- Botones ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 17px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #f7d478, var(--gold));
  border-color: #d9ab45;
  color: #241c05;
}
.btn-primary:hover { background: linear-gradient(180deg, #fadd8e, #f6cb66); filter: brightness(1.05); }

.btn-danger { border-color: #6d2b30; color: #ff9fa2; background: #24151a; }
.btn-danger:hover { background: #2f181e; }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-sm { padding: 6px 11px; font-size: 0.82rem; }
.btn-block { width: 100%; }

.btn-google {
  background: #fff;
  color: #1f1f1f;
  border-color: #fff;
  font-weight: 700;
  padding: 13px 22px;
  font-size: 1rem;
}
.btn-google:hover { background: #f1f1f1; }

/* --- Insignias y estados ------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.badge-draft { color: #c8b8ff; border-color: #423a68; background: #1d1a2c; }
.badge-voting { color: var(--gold); border-color: var(--gold-dim); background: #241f10; }
.badge-guessing { color: var(--blue); border-color: #2f4c74; background: #121c2a; }
.badge-finished { color: var(--green); border-color: #2c6244; background: #0f2118; }
.badge-gold { color: #241c05; background: var(--gold); border-color: var(--gold); }
.badge-danger { color: #ff9fa2; border-color: #6d2b30; background: #24151a; }
.badge-plain { text-transform: none; letter-spacing: 0; font-weight: 600; }

/* --- Estadísticas ------------------------------------------------------- */

.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  font-weight: 700;
  margin-bottom: 4px;
}
.stat-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat-value.gold { color: var(--gold); }
.stat-hint { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* --- Tablas ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  font-weight: 750;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.table td {
  padding: 12px;
  border-bottom: 1px solid rgba(43, 43, 58, 0.6);
  vertical-align: middle;
}
table.table tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
table.table .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.table tr.is-me { background: rgba(242, 196, 90, 0.07); }
table.table tr.is-me td { border-color: rgba(242, 196, 90, 0.18); }

.rank {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
}
.rank-1 { background: var(--gold); color: #241c05; }
.rank-2 { background: #c4c8d4; color: #1c1c24; }
.rank-3 { background: #b07a4a; color: #1c1204; }

.person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.person-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Formularios -------------------------------------------------------- */

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.field-hint { font-size: 0.8rem; color: var(--faint); margin-top: 6px; }

input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="month"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(242, 196, 90, 0.13);
}
textarea { min-height: 86px; resize: vertical; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%239a98aa' d='M6 8.5 2 4.5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.score-input {
  font-family: var(--mono);
  font-size: 1.7rem !important;
  font-weight: 700;
  text-align: center;
  padding: 14px 10px !important;
  letter-spacing: -0.02em;
}

.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 22px; }

.error-box {
  background: #24151a;
  border: 1px solid #6d2b30;
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  margin-bottom: 18px;
  color: #ffb9bb;
  font-size: 0.9rem;
}
.error-box ul { margin: 0; padding-left: 18px; }

/* --- Avisos ------------------------------------------------------------- */

.flash {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid;
}
.flash-notice { background: #0f2118; border-color: #2c6244; color: #a7ecc4; }
.flash-alert { background: #24151a; border-color: #6d2b30; color: #ffb9bb; }

.callout {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-dim);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.9rem;
}
.callout-blue { border-left-color: var(--blue); }
.callout-green { border-left-color: var(--green); }

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
}
.empty-icon { font-size: 2.2rem; margin-bottom: 10px; opacity: 0.7; }

/* --- Película ----------------------------------------------------------- */

.movie {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
/* El póster y su marcador comparten este hueco; sólo uno se ve a la vez. */
.poster-slot { flex: 0 0 auto; width: 116px; }
.poster-slot .poster { width: 100%; }

.poster {
  width: 116px;
  aspect-ratio: 2 / 3;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
}
.poster-placeholder {
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  color: var(--faint);
}
.movie-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 6px; }
.movie-meta { color: var(--muted); font-size: 0.9rem; }

.countdown { font-family: var(--mono); font-weight: 700; color: var(--gold); }
.countdown.is-urgent { color: var(--red); }
.countdown.is-over { color: var(--faint); }

/* --- Notas anónimas ----------------------------------------------------- */

.anon-list { display: grid; gap: 10px; }
.anon-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  flex-wrap: wrap;
}
.anon-row.is-mine { border-color: var(--gold-dim); background: #201c11; }
.anon-row.is-correct { border-color: #2c6244; }
.anon-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--faint);
  text-transform: uppercase;
  width: 58px;
  flex: 0 0 auto;
}
.anon-score {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 800;
  width: 66px;
  flex: 0 0 auto;
  letter-spacing: -0.02em;
}
.anon-pick { flex: 1 1 190px; min-width: 170px; }
.anon-pick select { padding: 8px 11px; font-size: 0.9rem; }
.anon-owner { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; }

.ratings-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.rating-chip {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.rating-chip.is-high { border-color: #2c6244; color: #a7ecc4; }
.rating-chip.is-low { border-color: #6d2b30; color: #ffb9bb; }

/* --- Sorteo ------------------------------------------------------------- */

.draw-list { display: grid; gap: 8px; counter-reset: pick; }
.draw-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.draw-row.is-next { border-color: var(--gold-dim); background: #201c11; }
.draw-row.is-used { opacity: 0.55; }
.draw-position {
  font-family: var(--mono);
  font-weight: 800;
  color: var(--gold-dim);
  width: 26px;
  flex: 0 0 auto;
}

/* --- Login -------------------------------------------------------------- */

.plain-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 34px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-mark { font-size: 2.6rem; margin-bottom: 10px; }
.login-title { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em; }
.login-rules { text-align: left; margin-top: 26px; }

.rule-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.rule-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.92rem;
  color: var(--muted);
}
.rule-num {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--gold);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 2px;
}

/* --- Admin -------------------------------------------------------------- */

.admin-bar {
  background: #1a1408;
  border-bottom: 1px solid var(--gold-dim);
}
.admin-bar .brand { color: var(--gold); }

.section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  font-weight: 800;
  margin: 30px 0 12px;
}

.inline-form { display: inline; }

@media (max-width: 620px) {
  .shell { padding: 0 14px 60px; }
  .card { padding: 17px; }
  h1 { font-size: 1.5rem; }
  .movie { gap: 14px; }
  .poster, .poster-slot { width: 84px; }
  .movie-title { font-size: 1.2rem; }
  .nav-link { padding: 6px 9px; font-size: 0.84rem; }
  .anon-score { width: 54px; font-size: 1.2rem; }
}

.gold { color: var(--gold); }

/* --- Footer: datos de cine que van rotando ------------------------------- */

.footer {
  max-width: 1020px;
  margin: 8px auto 0;
  padding: 22px 20px 34px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-fact {
  margin: 0 auto;
  max-width: 640px;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--faint);
  font-style: italic;
  transition: opacity 0.4s ease;
}
.footer-fact::before { content: "🎞 "; font-style: normal; opacity: 0.7; }
.footer-fact.is-fading { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .footer-fact { transition: none; }
}

/* --- Campo del póster, con vista previa ---------------------------------- */

.poster-field { display: flex; gap: 14px; align-items: flex-start; }
.poster-preview { flex: 0 0 auto; width: 72px; }
.poster-preview .poster { width: 72px; margin: 0; }
.poster-preview .poster-placeholder { font-size: 1.1rem; text-align: center; line-height: 1.2; padding: 4px; }
