/* Paleta cozy: papel crema, tinta cálida y pasteles apagados. Sin degradados ni brillos. */
:root {
  --paper: #fbf6ee;
  --paper-2: #f4ece0;
  --card: #fffdf9;
  --line: #e6dccd;
  --line-2: #d8cbb8;
  --ink: #3d342c;
  --ink-2: #6f6358;
  --ink-3: #9a8d80;

  --peach: #f6d9c8;
  --peach-ink: #9a4f2f;
  --sage: #d7e6d3;
  --sage-ink: #43684a;
  --lavender: #e3dcf1;
  --lavender-ink: #5b4d86;
  --sky: #d6e6f0;
  --sky-ink: #3b6580;
  --butter: #f6e8bd;
  --butter-ink: #866518;

  --accent: #c8674a;       /* terracota: acción principal */
  --accent-hover: #b45a3f;
  --accent-soft: #f3d6cb;
  --ok: #4f7d57;
  --danger: #b5483a;

  --radius: 14px;
  --shadow: 0 1px 0 var(--line), 0 6px 18px -12px #6b4e3355;
  --display: 'Fraunces', Georgia, serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-family: var(--body);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; font-variation-settings: 'SOFT' 100, 'opsz' 48; }
a { color: var(--accent); }

button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; padding: .6rem 1rem;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
button:hover:not(:disabled) { background: var(--paper-2); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { cursor: not-allowed; color: var(--ink-3); background: var(--paper-2); border-color: var(--line); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.danger:hover:not(:disabled) { background: #f7e1dc; }
button.ghost { background: transparent; }
input {
  font: inherit; padding: .65rem .8rem; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); width: 100%;
}

.wrap { max-width: 1160px; margin: 0 auto; padding: 32px 16px 80px; }

/* ---------- Encabezado ---------- */
header.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.eyebrow { margin: 0 0 2px; font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.brand h1 { margin: 0; font-size: clamp(1.9rem, 4vw, 2.7rem); line-height: 1.1; }
.status { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.dot.live { background: var(--ok); }
.dot.off { background: var(--danger); }

/* ---------- Aviso de fase ---------- */
.banner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 28px;
  padding: 18px 22px; border-radius: var(--radius); background: var(--butter);
}
.banner .eyebrow { margin: 0; color: var(--butter-ink); }
.banner h2 { margin: 2px 0; font-size: 1.35rem; }
.banner p { margin: 0; color: var(--ink-2); }
.banner .grow { flex: 1; min-width: 240px; }
.banner.voting { background: var(--sage); }
.banner.voting .eyebrow { color: var(--sage-ink); }
.banner.closed { background: var(--peach); }
.banner.closed .eyebrow { color: var(--peach-ink); }
.banner.revealed { background: var(--lavender); }
.banner.revealed .eyebrow { color: var(--lavender-ink); }
.progress { font-family: var(--display); font-size: 1.6rem; font-weight: 600; text-align: right; line-height: 1.1; }
.progress small { display: block; font-family: var(--body); font-size: .8rem; font-weight: 500; color: var(--ink-2); }

/* ---------- Tarjetas ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.card {
  --tint: var(--butter); --tint-ink: var(--butter-ink);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow); transition: border-color .2s ease;
}
.card.t-peach { --tint: var(--peach); --tint-ink: var(--peach-ink); }
.card.t-sage { --tint: var(--sage); --tint-ink: var(--sage-ink); }
.card.t-lavender { --tint: var(--lavender); --tint-ink: var(--lavender-ink); }
.card.t-sky { --tint: var(--sky); --tint-ink: var(--sky-ink); }
.card:hover { border-color: var(--line-2); }
.card.rated { border-color: var(--sage-ink); }

.thumb {
  aspect-ratio: 16 / 10; position: relative; overflow: hidden; cursor: pointer; background: var(--tint);
  border-bottom: 1px solid var(--line); display: grid; place-items: center;
  font-family: var(--display); font-size: 2.4rem; color: var(--tint-ink);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb iframe {
  position: absolute; top: 0; left: 0; width: 400%; height: 400%; transform: scale(.25); transform-origin: 0 0;
  border: 0; pointer-events: none; background: #fff;
}
.thumb .play {
  position: absolute; right: 10px; bottom: 10px; font-family: var(--body); font-size: .8rem; font-weight: 600;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); padding: 3px 10px; border-radius: 8px;
}

.card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .tag {
  align-self: flex-start; font-size: .74rem; font-weight: 700; letter-spacing: .02em;
  color: var(--tint-ink); background: var(--tint); padding: 2px 9px; border-radius: 6px;
}
.card h3 { margin: 4px 0 0; font-size: 1.28rem; line-height: 1.2; }
.card .desc { color: var(--ink-2); font-size: .94rem; margin: 0; flex: 1; }
.card .open { margin-top: 8px; }

/* ---------- Puntaje 1–10 ---------- */
.rate { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.rate .label { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; color: var(--ink-2); margin-bottom: 6px; }
.rate .label b { font-family: var(--display); font-size: 1.15rem; color: var(--ink); }
.scores { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.scores button { padding: .5rem 0; font-size: .9rem; border-radius: 8px; min-width: 0; }
.scores button.fill { background: var(--accent-soft); border-color: var(--accent-soft); }
.scores button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.scores button:disabled { background: var(--paper-2); }
.scores button:disabled.fill { background: var(--accent-soft); color: var(--ink-2); }
.scores button:disabled.on { background: var(--accent); color: #fff; }

/* ---------- Modal de vista previa ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; flex-direction: column; padding: 16px; background: #3d342ccc; }
.modal.open { display: flex; }
.modal .bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
  background: var(--card); border-radius: 12px; padding: 10px 12px;
}
.modal .bar h3 { margin: 0 8px 0 4px; flex: 1; min-width: 160px; font-size: 1.15rem; }
.modal .bar .scores { width: min(420px, 100%); }
.modal .seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.modal .seg button { border: 0; border-radius: 0; padding: .5rem .8rem; font-size: .88rem; }
.modal .seg button + button { border-left: 1px solid var(--line-2); }
.modal .seg button[aria-pressed="true"] { background: var(--paper-2); }
.modal .frame-wrap { flex: 1; display: flex; justify-content: center; background: var(--paper-2); border-radius: 12px; overflow: hidden; position: relative; }
.modal iframe { position: relative; z-index: 1; width: 100%; height: 100%; border: 0; background: #fff; transition: width .3s ease; }
.modal .frame-wrap.mobile iframe { width: min(390px, 100%); border-inline: 1px solid var(--line-2); }
.modal .fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--ink-2); padding: 20px; }
.modal .fallback img { max-width: 100%; max-height: 70vh; border-radius: 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(140%); opacity: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; max-width: calc(100% - 32px);
  text-align: center; transition: transform .25s ease, opacity .25s ease; font-weight: 500;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ================= PODIO ================= */
.reveal { position: fixed; inset: 0; z-index: 80; display: none; overflow: hidden; background: var(--paper); }
.reveal.on { display: block; }
.reveal .head { position: absolute; top: 6vh; inset-inline: 0; text-align: center; padding: 0 16px; }
.reveal .title {
  margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(2rem, 6vw, 4rem); line-height: 1.05;
  font-variation-settings: 'SOFT' 100, 'opsz' 144; opacity: 0; transform: translateY(12px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1);
}
.reveal .title.show { opacity: 1; transform: none; }
.reveal .sub { margin: 8px 0 0; color: var(--ink-3); }
.reveal .winner-banner {
  margin: 18px auto 0; display: inline-block; padding: 8px 18px; border-radius: 10px;
  background: var(--butter); color: var(--butter-ink); font-weight: 700; font-size: clamp(1rem, 2.6vw, 1.35rem);
  opacity: 0; transform: scale(.94); transition: opacity .6s ease, transform .6s cubic-bezier(.2, 1.4, .3, 1);
}
.reveal .winner-banner:empty { display: none; }
.reveal .winner-banner.show { opacity: 1; transform: none; }

.reveal .drum {
  position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%); opacity: 0; transition: opacity .3s ease;
  font-family: var(--display); font-size: clamp(1.4rem, 4vw, 2.2rem); color: var(--ink-2);
  display: flex; align-items: baseline; gap: 6px; white-space: nowrap;
}
.reveal .drum.on { opacity: 1; }
.reveal .drum i { display: inline-block; width: .3em; height: .3em; border-radius: 50%; background: var(--accent); animation: hop .9s ease-in-out infinite; }
.reveal .drum i:nth-of-type(2) { animation-delay: .15s; }
.reveal .drum i:nth-of-type(3) { animation-delay: .3s; }
@keyframes hop { 50% { transform: translateY(-10px); } }

.podium {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(980px, 100%);
  display: grid; grid-template-columns: 1fr 1.12fr 1fr; align-items: end; gap: clamp(8px, 2vw, 18px); padding: 0 16px;
}
.slot { display: flex; flex-direction: column; align-items: center; }
.slot .who {
  width: 100%; text-align: center; margin-bottom: 14px; opacity: 0; transform: translateY(16px);
  transition: opacity .7s ease, transform .8s cubic-bezier(.2, 1.3, .3, 1);
}
.slot.shown .who { opacity: 1; transform: none; }
.slot .pname { font-family: var(--display); font-weight: 600; font-size: clamp(1.05rem, 2.6vw, 1.6rem); line-height: 1.15; word-break: break-word; }
.slot.r1 .pname { font-size: clamp(1.2rem, 3.2vw, 2.1rem); }
.slot .pteam { color: var(--ink-2); font-size: clamp(.75rem, 1.6vw, .9rem); font-weight: 600; }
.slot .pscore { margin-top: 4px; font-family: var(--display); font-size: clamp(1.1rem, 2.6vw, 1.6rem); font-weight: 600; color: var(--slot-ink); }
.slot .pscore small { font-family: var(--body); font-size: .55em; font-weight: 500; color: var(--ink-3); }
.slot .pvotes { color: var(--ink-3); font-size: clamp(.72rem, 1.5vw, .85rem); }
.slot .tie { display: inline-block; margin-top: 4px; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--peach); color: var(--peach-ink); }
.slot .entry + .entry { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.pedestal {
  width: 100%; height: 0; border-radius: 14px 14px 0 0; background: var(--slot); border: 1px solid var(--line-2); border-bottom: 0;
  display: grid; place-items: start center; padding-top: 12px; overflow: hidden;
  font-family: var(--display); font-weight: 700; font-size: clamp(2.6rem, 8vw, 5rem); color: var(--slot-ink);
  transition: height 1.1s cubic-bezier(.2, .9, .2, 1);
}
.slot.r1 { --slot: var(--butter); --slot-ink: var(--butter-ink); }
.slot.r2 { --slot: var(--sky); --slot-ink: var(--sky-ink); }
.slot.r3 { --slot: var(--peach); --slot-ink: var(--peach-ink); }
.slot.r1.shown .pedestal { height: 34vh; }
.slot.r2.shown .pedestal { height: 24vh; }
.slot.r3.shown .pedestal { height: 16vh; }

.reveal .controls { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; z-index: 2; }
.reveal .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-2); font-size: 1.2rem; }

@media (max-width: 640px) {
  .reveal .head { top: 64px; }
  .slot.r1.shown .pedestal { height: 22vh; }
  .slot.r2.shown .pedestal { height: 15vh; }
  .slot.r3.shown .pedestal { height: 10vh; }
  .scores button { font-size: .82rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .15s !important; }
}

/* ================= ADMIN ================= */
.admin-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }
.col { display: flex; flex-direction: column; gap: 20px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 14px; font-size: 1.2rem; }
.panel h2 small { font-family: var(--body); font-weight: 500; font-size: .85rem; color: var(--ink-3); }
.panel .hint { margin: -6px 0 12px; color: var(--ink-2); font-size: .9rem; }
.phases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 640px) { .phases { grid-template-columns: repeat(2, 1fr); } }
.phases button { padding: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.phases button .n { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.phases button.current { background: var(--sage); border-color: var(--sage-ink); }
.phases button.current .n { color: var(--sage-ink); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--paper-2); border-radius: 12px; padding: 12px 14px; }
.stat .n { font-family: var(--display); font-size: 2rem; font-weight: 600; line-height: 1.1; }
.stat .l { color: var(--ink-2); font-size: .85rem; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row .meta { display: flex; justify-content: space-between; gap: 10px; font-size: .93rem; }
.bar-row .meta .t { color: var(--ink-3); }
.bar-track { height: 8px; background: var(--paper-2); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s ease; }
.bar-row:first-child .bar-fill { background: var(--ok); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.list-row:last-child { border-bottom: 0; }
.muted { color: var(--ink-3); }
.login { max-width: 380px; margin: 14vh auto; display: flex; flex-direction: column; gap: 12px; }
