@import url("../fonts/fonts.css");

:root {
  --red: #c8102e;
  --red-dark: #8f0b21;
  --blue: #1f4fd8;
  --yellow: #f5c400;
  --gold: #a8741a;
  --cream: #f8f0dc;
  --cream-2: #efe7d2;
  --ink: #1d1a16;
  --muted: #4a443b;
  --muted-2: #6b6459;
  --line: #e3d9c2;
  --ok: #2e7d32;
  --white: #ffffff;
  --radius: 18px;
  --display: "Anton", "Impact", "Arial Narrow Bold", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --marker: "Permanent Marker", "Comic Sans MS", cursive;
  --nav-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.display { font-family: var(--display); text-transform: uppercase; letter-spacing: .3px; }
.marker { font-family: var(--marker); }

/* ---------- Esqueleto de la app de invitados ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px); }
.banner-offline {
  position: sticky; top: 0; z-index: 30; background: var(--ink); color: var(--white);
  font-size: 14px; padding: 8px 16px; text-align: center;
}
.hero img { width: 100%; height: 130px; object-fit: cover; object-position: top; }
.page { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.page-head { padding: 20px 16px 18px; color: var(--white); display: flex; flex-direction: column; gap: 4px; }
.page-head h1 { font-family: var(--display); font-size: 34px; line-height: 1; text-transform: uppercase; }
.page-head p { margin: 0; font-size: 14px; opacity: .92; }
.page-head.red { background: var(--red); }
.page-head.blue { background: var(--blue); }
.page-head.yellow { background: var(--yellow); color: var(--ink); }
.page-head.ink { background: var(--ink); }

.card { background: var(--white); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.outline { border: 2px solid var(--ink); }
.section-title { font-family: var(--display); font-size: 22px; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 13px; color: var(--muted-2); }
.pill { align-self: flex-start; font-weight: 800; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.pill.red { background: var(--red); color: var(--white); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: 12px; border: 0;
  font-weight: 800; font-size: 15px; text-decoration: none; text-align: center;
}
.btn.block { width: 100%; }
.btn.ink { background: var(--ink); color: var(--white); }
.btn.red { background: var(--red); color: var(--white); }
.btn.blue { background: var(--blue); color: var(--white); }
.btn.yellow { background: var(--yellow); color: var(--ink); }
.btn.green { background: #1f7a3d; color: var(--white); }
.btn.ghost { background: var(--white); color: var(--ink); border: 2px solid var(--ink); }
.btn.big { min-height: 60px; font-family: var(--display); font-size: 24px; text-transform: uppercase; font-weight: 400; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { flex-shrink: 0; }

.strip-link {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--yellow);
  color: var(--ink); border-radius: 14px; text-decoration: none; font-weight: 600; font-size: 15px;
}
.strip-link span.grow { flex: 1; }

/* Marcador */
.score { display: grid; grid-template-columns: 1fr 1fr; border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 0 var(--ink); }
.score > div { padding: 14px 16px; color: var(--white); display: flex; flex-direction: column; gap: 2px; }
.score .r { background: var(--red); }
.score .b { background: var(--blue); align-items: flex-end; }
.score .team { font-weight: 800; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; }
.score .pts { font-family: var(--display); font-size: 64px; line-height: 1; }

/* Paradas */
.stop-now { display: flex; gap: 14px; align-items: center; }
.num {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 24px; border: 2px solid var(--ink); background: var(--white);
}
.num.lg { width: 56px; height: 56px; font-size: 32px; }
.num.red { background: var(--red); color: var(--white); border-color: var(--red); }
.num.blue-o { border-color: var(--blue); color: var(--blue); }
.stop-title { font-family: var(--display); font-size: 30px; line-height: 1.05; }
.next { display: flex; gap: 14px; align-items: center; }
.kicker { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.kicker.blue { color: var(--blue); }
.kicker.red { color: var(--red); }

.route-item { background: var(--white); border-radius: 16px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.route-item.done { opacity: .6; }
.route-item.now { border: 3px solid var(--red); padding: 14px; }
.route-item .info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.icon-btn {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); background: var(--white); color: var(--ink);
}
.icon-btn.ink { background: var(--ink); color: var(--white); border-color: var(--ink); }

/* Avisos */
.notice { background: var(--white); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.notice time { font-size: 12px; color: var(--muted-2); }
.notice p { margin: 0; font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }

/* Distintivo */
.badge-row { display: flex; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.input {
  height: 48px; border: 2px solid var(--ink); border-radius: 12px; padding: 0 12px; background: var(--cream); width: 100%;
}
.input.badge { width: 96px; font-family: var(--display); font-size: 22px; }
textarea.input { height: auto; padding: 12px; resize: vertical; background: var(--white); }
.team-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1; }
.team-btn { min-height: 48px; border-radius: 12px; font-weight: 800; font-size: 15px; background: var(--white); }
.team-btn.g { color: var(--red); border: 2px solid var(--red); }
.team-btn.u { color: var(--blue); border: 2px solid var(--blue); }
.team-btn.g[aria-pressed="true"] { background: var(--red); color: var(--white); }
.team-btn.u[aria-pressed="true"] { background: var(--blue); color: var(--white); }

.photo-cta { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--blue); color: var(--white); border-radius: var(--radius); text-decoration: none; }
.photo-cta .t { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.surprise-cta {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 16px; border-radius: var(--radius); text-decoration: none;
  background: var(--red-dark); color: var(--white); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
}
.surprise-cta .marker { font-size: 26px; color: var(--yellow); }
.closing { margin: 8px 0 0; text-align: center; font-family: var(--marker); font-size: 30px; color: #c99a00; }

/* Programa */
.timeline { list-style: none; margin: 0; padding: 20px 16px; }
.timeline li { display: grid; grid-template-columns: 64px 20px minmax(0, 1fr); column-gap: 10px; }
.timeline .time { font-family: var(--display); font-size: 18px; text-align: right; padding-top: 2px; }
.timeline .rail { display: flex; flex-direction: column; align-items: center; }
.timeline .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); margin-top: 4px; flex-shrink: 0; }
.timeline .bar { width: 2px; flex: 1; background: var(--ink); }
.timeline li:last-child .bar { opacity: 0; }
.timeline .body { display: flex; flex-direction: column; gap: 4px; padding-bottom: 22px; }
.timeline .body strong { font-size: 17px; }
.timeline .body span { font-size: 14px; color: var(--muted); white-space: pre-line; }
.dot.red { background: var(--red); } .dot.blue { background: var(--blue); } .dot.yellow { background: var(--yellow); } .dot.ink { background: var(--ink); }

/* Menú */
.menu-sec h2 { display: flex; align-items: baseline; gap: 10px; }
.menu-sec h2 .display { font-size: 24px; }
.menu-sec ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.c-red { color: var(--red); } .c-blue { color: var(--blue); } .c-gold { color: var(--gold); }
.price { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--yellow); border-radius: var(--radius); padding: 14px 16px; }
.price .display { font-size: 30px; }

/* Fotos */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.upload-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 96px;
  border-radius: 16px; font-weight: 800; font-size: 15px; cursor: pointer; border: 2px solid var(--ink);
}
.upload-btn.ink { background: var(--ink); color: var(--white); }
.upload-btn.light { background: var(--white); color: var(--ink); }
.upload-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.progress { display: block; height: 6px; border-radius: 3px; background: #ece3cc; overflow: hidden; }
.progress > span { display: block; height: 6px; background: var(--blue); width: 0; transition: width .2s; }
.upload-status { display: flex; align-items: center; gap: 12px; background: var(--white); border-radius: 14px; padding: 12px 14px; }
.upload-status .grow { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.upload-status.err { border: 2px solid var(--red); }
.tabs { display: flex; gap: 8px; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--ink); background: var(--white); font-weight: 800; font-size: 14px; }
.chip[aria-selected="true"] { background: var(--ink); color: var(--white); }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.gallery button { aspect-ratio: 1 / 1; border: 0; padding: 0; border-radius: 6px; overflow: hidden; background: #d9cfb8; position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery .who { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 600; color: var(--white); background: rgba(29,26,22,.7); padding: 2px 6px; border-radius: 999px; }
.empty { text-align: center; padding: 24px 8px; color: var(--muted); }

.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(13,12,11,.96); display: flex; flex-direction: column; }
.lightbox .bar { display: flex; justify-content: space-between; align-items: center; padding: 12px; gap: 8px; padding-top: max(12px, env(safe-area-inset-top)); }
.lightbox .stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 8px; }
.lightbox .stage img { max-height: 100%; max-width: 100%; object-fit: contain; }
.lightbox .actions { display: flex; gap: 8px; padding: 12px; padding-bottom: max(16px, var(--safe-b)); justify-content: center; }
.lightbox .btn.ghost { background: transparent; color: var(--white); border-color: var(--white); }

/* Avisos (activar) */
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; }
.seg button { min-height: 44px; border: 0; background: var(--white); font-weight: 800; }
.seg button[aria-selected="true"] { background: var(--ink); color: var(--white); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: center; background: var(--white); border-radius: 14px; padding: 12px 14px; font-size: 15px; }
.steps .n { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--red); color: var(--white); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 20px; }
.status-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.status-list li { display: flex; align-items: center; gap: 10px; }
.status-list .mk { width: 22px; height: 22px; border-radius: 50%; background: #b5ab96; color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; }
.status-list .mk.ok { background: var(--ok); }
.status-list .mk.bad { background: var(--red); }

/* Info */
.info-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }

/* Barra de navegación */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--white); border-top: 2px solid var(--ink);
  height: calc(var(--nav-h) + var(--safe-b)); padding: 8px 8px calc(12px + var(--safe-b));
}
.nav ul { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; height: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; min-height: 44px; justify-content: flex-end; }
.nav a[aria-current="page"] { color: var(--red); font-weight: 800; }
.nav .cam { width: 56px; height: 56px; margin-top: -28px; border-radius: 50%; background: var(--red); border: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; color: var(--white); }

/* ---------- Capa de la sorpresa ---------- */
.surprise {
  position: fixed; inset: 0; z-index: 50; background: var(--red-dark); color: var(--white);
  display: flex; flex-direction: column; overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top)) 20px max(24px, var(--safe-b));
}
.surprise.playing { background: #0d0c0b; padding-left: 0; padding-right: 0; }
.surprise .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.surprise .top .btn { background: transparent; color: var(--white); border: 1px solid rgba(255,255,255,.5); min-height: 44px; }
.surprise h1 { font-family: var(--display); font-size: 52px; line-height: .95; text-transform: uppercase; }
.surprise .center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 16px 0; }
.surprise.playing .center { padding: 16px 0; }
.surprise .ready-btn {
  min-height: 120px; border: 4px solid var(--ink); border-radius: 24px; background: var(--yellow); color: var(--ink);
  font-family: var(--display); font-size: 38px; text-transform: uppercase; box-shadow: 0 6px 0 var(--ink);
}
.surprise .box { display: flex; flex-direction: column; gap: 12px; background: rgba(0,0,0,.25); border-radius: 20px; padding: 20px; }
.surprise .box.white { background: var(--white); color: var(--ink); align-items: center; text-align: center; }
.surprise .progress { height: 10px; background: rgba(255,255,255,.25); }
.surprise .progress > span { height: 10px; background: var(--yellow); }
.surprise .sound { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(0,0,0,.25); border-radius: 16px; padding: 12px 16px; margin: 0 0 8px; }
.surprise.playing .sound, .surprise.playing .status-line, .surprise.playing .note { margin-left: 16px; margin-right: 16px; }
.switch { width: 52px; height: 30px; accent-color: var(--yellow); }
.video-wrap { position: relative; width: 100%; background: #000; aspect-ratio: 1248 / 576; display: flex; align-items: center; justify-content: center; }
.video-wrap video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-wrap.yt { aspect-ratio: 16 / 9; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-wrap.peek { border-radius: 12px; overflow: hidden; }
/* YouTube no reproduce en reproductores de menos de 200×200 px. */
.video-wrap.yt.peek { aspect-ratio: auto; height: 220px; }
.video-wrap .overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: rgba(0,0,0,.55); text-align: center; padding: 8px; }
.countdown { font-family: var(--display); font-size: 110px; line-height: 1; color: var(--yellow); }
.status-line { display: flex; align-items: center; gap: 10px; background: #1d1a16; border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.status-line .led { width: 12px; height: 12px; border-radius: 50%; background: #4caf50; flex-shrink: 0; }
.status-line .led.warn { background: var(--yellow); }
.status-line .led.bad { background: var(--red); }
.note { font-size: 13px; opacity: .85; text-align: center; margin: 0; }

/* Toast in-app */
.toast {
  position: fixed; left: 12px; right: 12px; top: max(12px, env(safe-area-inset-top)); z-index: 70; max-width: 536px; margin: 0 auto;
  background: var(--ink); color: var(--white); border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start;
  box-shadow: 0 6px 24px rgba(0,0,0,.3);
}
.toast strong { display: block; }
.toast button { margin-left: auto; background: transparent; border: 0; color: var(--white); font-size: 20px; min-width: 32px; min-height: 32px; }

@media (min-width: 600px) {
  .hero img { height: 180px; }
}

/* ---------- Sorpresa a pantalla completa ---------- */
.surprise .when-play { display: none; }
.surprise .top { position: relative; z-index: 4; }
.sp-bottom { display: flex; flex-direction: column; gap: 8px; }
.surprise.playing { padding: 0; background: #000; overflow: hidden; }
.surprise.playing .center { padding: 0; }
.surprise.playing .video-wrap {
  position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; aspect-ratio: auto; background: #000;
}
.surprise.playing .video-wrap video { object-fit: contain; }
.surprise.playing .top {
  position: fixed; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; z-index: 4;
  display: flex; justify-content: space-between; pointer-events: none;
}
.surprise.playing .top .btn { pointer-events: auto; background: rgba(0,0,0,.55); border-color: rgba(255,255,255,.6); }
.surprise.playing #sp-close { width: 48px; height: 48px; padding: 0; border-radius: 50%; font-size: 22px; order: 2; }
.surprise.playing #sp-fs { order: 1; min-height: 40px; font-size: 13px; }
.surprise.playing .when-play { display: inline; }
.surprise.playing .when-idle { display: none; }
.surprise.playing .sp-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; padding: 24px 12px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,0)); transition: opacity .4s;
}
.surprise.playing .sp-bottom .note { display: none; }
.surprise.playing .sp-bottom .sound, .surprise.playing .sp-bottom .status-line { margin: 0; background: rgba(29,26,22,.85); }
.surprise.playing.calm .sp-bottom { opacity: 0; pointer-events: none; }
.surprise.playing .overlay { z-index: 2; }
.surprise:fullscreen { width: 100vw; height: 100vh; }

/* ---------- Instalar y bienvenida ---------- */
.install-cta {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius); text-decoration: none;
  background: var(--red); color: #fff; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
}
.install-cta .ic img { border-radius: 14px; border: 2px solid #fff; display: block; }
.install-cta .tx { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.install-cta .tx strong { font-family: var(--display); font-size: 24px; font-weight: 400; text-transform: uppercase; line-height: 1.05; }
.install-cta .tx span { font-size: 15px; }
.install-cta .go { font-size: 30px; font-weight: 800; }
.welcome {
  position: fixed; inset: 0; z-index: 80; background: var(--cream); overflow-y: auto;
  display: flex; align-items: center; justify-content: center; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}
.welcome .w-in { max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: 16px; text-align: center; align-items: center; }
.welcome .w-icon { border-radius: 22px; border: 3px solid var(--ink); }
.welcome h1 { font-family: var(--display); font-size: 44px; text-transform: uppercase; line-height: 1; }
.welcome p { margin: 0; font-size: 18px; }
.welcome .w-msg { font-weight: 700; color: var(--red); min-height: 1em; }
.welcome .w-skip { background: none; border: 0; color: var(--muted); font-size: 16px; text-decoration: underline; min-height: 44px; }
