/* KP Awards — estilo "Frutiger Aero": escritorio de Windows XP + ventanas tipo Windows Live Messenger */

/* Selawik: fuente libre de Microsoft (OFL) equivalente a Segoe UI. Si el equipo tiene Segoe UI, se usa esa. */
@font-face { font-family: "Selawik"; src: url(xp/fuentes/selawk.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Selawik"; src: url(xp/fuentes/selawksb.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Selawik"; src: url(xp/fuentes/selawkb.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --tinta: #1e395b;
  --tinta-suave: #3b5e8a;
  --gris: #6d84a3;
  --borde: #6f97c4;
  --borde-suave: #a9c4e2;
  --error: #c4391f;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body.escritorio {
  font-family: "Segoe UI", "Selawik", Tahoma, sans-serif;
  font-size: 15px;
  color: var(--tinta);
  background: #3a8ee6 url(xp/fondo-xp.jpg) center bottom / cover no-repeat fixed;
  -webkit-tap-highlight-color: transparent;
}

.oculto { display: none !important; }

/* Zona de trabajo: deja espacio para la barra de tareas */
.zona {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  /* abajo: barra de tareas (42px) + etiqueta "Powered by Netlify" del plan gratis */
  padding: 14px 12px 96px;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
}
.zona.centrada { justify-content: center; }

/* ---------- Barra de tareas ---------- */
/* En celulares con "zona segura" abajo (iPhone con barra de inicio) la barra crece hacia abajo:
   los íconos quedan en los 42px de arriba y el espacio extra se pinta del azul oscuro del borde. */
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: 42px; height: calc(42px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #1941a5 linear-gradient(#3168d5 0%, #4993e6 8%, #2157d7 40%, #1941a5 100%) top / 100% 42px no-repeat;
  display: flex; align-items: flex-start;
}
.barra > * { flex-shrink: 0; }
.barra .app { margin-top: 5px; }
.inicio {
  height: 42px; padding: 0 14px 0 10px; border-radius: 0 14px 14px 0;
  background: linear-gradient(#56b04a, #3c9a33 50%, #2f8728);
  display: flex; align-items: center; box-shadow: inset -2px 0 4px rgba(0,0,0,.3);
}
.inicio img { width: 27px; height: 24px; object-fit: contain; filter: drop-shadow(1px 1px 1px rgba(0,0,0,.5)); }
.app {
  margin-left: 4px; width: 40px; height: 32px; border-radius: 3px;
  background: linear-gradient(#3c81f3, #2a6ae0); border: 1px solid #1745a8;
  display: flex; align-items: center; justify-content: center;
}
.app.activa { background: #1e52b7; box-shadow: inset 1px 1px 3px #000; }
.app img { width: 21px; height: 21px; object-fit: contain; }
.app img.pato { object-fit: cover; object-position: 51% 50%; border-radius: 3px; }
.reloj {
  margin-left: auto; height: 42px; padding: 0 10px; color: #fff; font-size: 13px;
  background: linear-gradient(#0c9ef0, #1290e8 50%, #0b77d6); border-left: 1px solid #0a3c8c;
  display: flex; align-items: center;
}

/* ---------- Ventana: marco de Windows XP (Luna) con contenido estilo Messenger ---------- */
.ventana {
  position: relative; z-index: 3;
  width: min(380px, 100%);
  border-radius: 8px 8px 0 0; overflow: hidden;
  background: linear-gradient(#ffffff, #f3f8fd);
  border: 3px solid #0831d9; border-top: 0;
  box-shadow: inset 0 0 0 1px #166aee, 0 8px 24px rgba(0,30,80,.45);
}
.ventana.alta {
  display: flex; flex-direction: column;
  max-height: calc(100vh - 14px - 96px);
  max-height: calc(100dvh - 14px - 96px);
  max-height: calc(100dvh - 14px - 96px - env(safe-area-inset-bottom, 0px));
}
.titulo {
  height: 30px; padding: 0 4px 0 7px; display: flex; align-items: center; gap: 6px; flex: none;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #0997ff 0%, #0053ee 8%, #0050ee 40%, #0066ff 88%, #0066ff 93%, #005bff 95%, #003dd7 96%, #003dd7 100%);
  color: #fff; font-family: "Trebuchet MS", "Segoe UI", "Selawik", sans-serif; font-weight: 700; font-size: 13px;
  text-shadow: 1px 1px #0f1089;
}
.titulo img { width: 18px; height: 18px; object-fit: cover; object-position: 51% 50%; border-radius: 3px; }
.titulo span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctl {
  width: 22px; height: 22px; border-radius: 3px; border: 1px solid #fff; margin-left: 2px; flex: none;
  background: radial-gradient(circle at 90% 90%, #0054e9 0%, #2263d5 55%, #4479e4 70%, #a3bbec 90%, #ffffff 100%);
  color: #fff; font-family: Tahoma, sans-serif; font-size: 13px; font-weight: 700; line-height: 1; text-shadow: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
.ctl.min { align-items: flex-end; padding-bottom: 4px; }
.ctl.min::before { content: ""; width: 8px; height: 3px; background: #fff; }
.ctl.max::before { content: ""; width: 9px; height: 8px; border: 1px solid #fff; border-top-width: 3px; }
.ctl.x { background: radial-gradient(circle at 90% 90%, #cc4600 0%, #dc6527 55%, #cd7546 70%, #ffccb2 90%, #ffffff 100%); font-size: 14px; }
.cuerpo { padding: 18px 20px 20px; }
.pie {
  flex: none; padding: 10px; display: flex; gap: 8px; justify-content: flex-end;
  border-top: 1px solid #c8d9ee; background: linear-gradient(#f3f8fd, #e3eef9);
}
.centro { text-align: center; }
.gris { color: var(--gris); font-size: 13px; }
.titular { font-size: 23px; font-weight: 700; margin: 10px 0 0; line-height: 1.2; }
.titular .anio { color: #fff; background: linear-gradient(#e2533a, #c4391f); padding: 0 8px; border-radius: 4px; }
.texto { font-size: 15px; color: var(--tinta-suave); margin: 8px 0 0; line-height: 1.4; }
.error { min-height: 20px; margin: 10px 0 0; color: var(--error); font-size: 14px; font-weight: 600; text-align: center; }

/* Marco de foto con anillo verde ("Disponible") */
.marco {
  display: inline-block; padding: 3px; border-radius: 10px; flex: none; line-height: 0;
  background: linear-gradient(#d6f9b8, #7bd855 45%, #3ea52a 55%, #8ee36b);
  box-shadow: 0 0 6px rgba(70,190,50,.55), inset 0 1px 0 rgba(255,255,255,.8);
}
.marco img, .marco .ini {
  display: block; border-radius: 7px; border: 1px solid #fff; object-fit: cover; background: #fff;
}
.marco .ini {
  display: flex; align-items: center; justify-content: center; line-height: 1;
  background: linear-gradient(#f4f8ff, #c9dcf7); color: #0a4fd8; font-weight: 700;
}
.marco.logo img { object-position: 51% 50%; }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-block; padding: 8px 18px; border-radius: 4px; font: inherit; font-size: 15px; color: var(--tinta);
  border: 1px solid #7aa3d4; cursor: pointer;
  background: linear-gradient(#ffffff 0%, #eef5fc 48%, #d9e8f7 52%, #eaf3fc 100%);
  box-shadow: inset 0 1px 0 #fff;
}
.btn.principal { border-color: #3d79bf; box-shadow: 0 0 0 1px #a8cff5, inset 0 1px 0 #fff; font-weight: 600; }
.btn:active:not(:disabled) { background: linear-gradient(#d9e8f7, #eef5fc); }
.btn:disabled { color: #9aaccc; border-color: #c3d3e6; box-shadow: none; cursor: default; }
.campo {
  width: 100%; padding: 10px; border: 1px solid #9db9db; border-radius: 3px; background: #fff;
  font-family: inherit; font-weight: 600; font-size: 20px; letter-spacing: 3px;
  text-align: center; text-transform: uppercase; color: var(--tinta);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.12); outline: none;
}
.campo:focus { border-color: #3d79bf; box-shadow: 0 0 0 2px #a8cff5, inset 0 1px 2px rgba(0,0,0,.12); }
.campo::placeholder { color: #b5c4d8; letter-spacing: 2px; }
.etiqueta { display: block; margin: 16px 0 6px; text-align: left; color: var(--gris); font-size: 13px; }
.estado-ini { margin-top: 8px; text-align: left; font-size: 13px; color: var(--gris); }
.estado-ini b { color: #3a9a24; font-weight: 600; }

/* ---------- Encabezado de categoría ---------- */
.cabecera { display: flex; gap: 10px; align-items: center; padding: 12px; flex: none; }
.cabecera .nombre { font-size: 18px; font-weight: 700; line-height: 1.2; }
.progreso { height: 10px; margin: 0 12px; border-radius: 5px; background: #dfe9f5; border: 1px solid var(--borde-suave); overflow: hidden; flex: none; }
.progreso div { height: 100%; width: 0; background: linear-gradient(#a9e6ff, #3fa9ef 50%, #1f8ad8); transition: width .35s; }
.grupo { padding: 10px 12px 2px; font-size: 13px; font-weight: 600; flex: none; }
.lista { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 0 6px; list-style: none; margin: 0; }
.ayuda { padding: 6px 14px; color: var(--gris); font-size: 13px; }

/* ---------- Nominado como contacto ---------- */
.contacto {
  display: flex; align-items: center; gap: 11px; width: calc(100% - 12px); margin: 3px 6px; padding: 7px 9px;
  border-radius: 4px; border: 1px solid transparent; background: transparent;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.contacto .marco { padding: 2px; border-radius: 8px; }
.contacto .marco img, .contacto .marco .ini { width: 42px; height: 42px; border-radius: 6px; font-size: 14px; }
.contacto .nom { font-weight: 600; font-size: 16px; }
.contacto .est { font-size: 12px; color: var(--gris); font-style: italic; }
.contacto .med { margin-left: auto; font-size: 24px; min-width: 28px; text-align: right; }
.contacto.oro { background: linear-gradient(#fff6d6, #ffe89a); border-color: #e2bf4d; }
.contacto.sel { background: linear-gradient(#eef6fe, #d6e8fb); border-color: #8fb6e3; }
.contacto:active { filter: brightness(.97); }

/* ---------- Resumen ---------- */
.res-item {
  margin: 6px 8px; padding: 8px 10px; border-radius: 5px; cursor: pointer;
  border: 1px solid #c8d9ee; background: #fff;
}
.res-item:active { background: #eef6fe; }
.res-cat { font-size: 13px; font-weight: 600; color: var(--tinta-suave); }
.res-sel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; font-size: 15px; }
.lugar { display: inline-flex; align-items: center; gap: 4px; }
.lugar .med { line-height: 1; }
.l1 { font-weight: 700; font-size: 16px; }
.l1 .med { font-size: 28px; }
.l2 .med { font-size: 22px; }
.l3 .med { font-size: 18px; }

/* ---------- Fotos rebotando (pantalla de inicio) ---------- */
#flotantes { position: fixed; inset: 0 0 42px 0; bottom: calc(42px + env(safe-area-inset-bottom, 0px)); pointer-events: none; z-index: 2; overflow: hidden; }
.flotante { position: absolute; left: 0; top: 0; will-change: transform; }
.flotante img { width: 46px; height: 46px; }

/* ---------- Notificación ---------- */
.toast {
  position: fixed; right: 8px; bottom: 96px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); width: 230px; z-index: 15;
  border-radius: 7px; overflow: hidden; border: 1px solid var(--borde);
  background: linear-gradient(#ffffff, #e9f2fb); box-shadow: 0 4px 14px rgba(0,30,80,.45);
  animation: subir .5s ease-out;
}
.toast .cab { height: 24px; padding: 0 8px; display: flex; align-items: center; gap: 6px; font-size: 12px;
  background: linear-gradient(#e7f1fb, #c9def4); border-bottom: 1px solid var(--borde-suave); }
.toast .cab img { width: 14px; height: 14px; object-fit: cover; object-position: 51% 50%; }
@keyframes subir { from { transform: translateY(120%); opacity: 0; } }

/* ---------- Confeti ---------- */
.confeti {
  position: fixed; top: -16px; width: 8px; height: 14px; border-radius: 2px; z-index: 30; pointer-events: none;
  animation: caer linear forwards; box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
@keyframes caer { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Organizador ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px; margin: 4px 4px 0 0; padding: 3px 9px; border-radius: 10px;
  background: linear-gradient(#eef6fe, #d6e8fb); border: 1px solid #8fb6e3; font-size: 13px; font-weight: 600;
}
.tabla { width: 100%; border-collapse: collapse; margin: 6px 0 16px; font-size: 14px; background: #fff; }
.tabla th { text-align: left; color: var(--gris); font-size: 11px; font-weight: 600; padding: 4px; border-bottom: 1px solid var(--borde-suave); }
.tabla td { padding: 6px 4px; border-top: 1px solid #e3ecf6; }
.tabla tr.gana td { background: linear-gradient(#fff6d6, #ffe89a); font-weight: 700; }
.empate { background: #3fa9ef; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; margin-left: 6px; border-radius: 8px; }
.subtitulo { font-size: 17px; font-weight: 700; margin: 14px 0 2px; }

.cargando { opacity: .65; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .flotante, .confeti { display: none; }
  .toast { animation: none; }
  .progreso div { transition: none; }
}

/* ---------- Ventana de confirmación ---------- */
.dialogo-fondo {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 20, 60, .35);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.dialogo { width: min(330px, 100%); animation: aparecer .15s ease-out; }
.dialogo-botones { margin-top: 18px; display: flex; gap: 10px; justify-content: center; }
@keyframes aparecer { from { transform: scale(.94); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dialogo { animation: none; } }

/* ---------- Clips: botón Ver y reproductor ---------- */
.ver {
  margin-left: auto; flex: none; padding: 4px 9px; border-radius: 4px; font-size: 13px; font-weight: 600;
  color: #fff; border: 1px solid #1f5fb8;
  background: linear-gradient(#6cb6ff 0%, #3a8ee6 48%, #1f74d6 52%, #3f95ea 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.ver + .med { margin-left: 6px; min-width: 24px; }
.reproductor { width: min(560px, 100%); }
.reproductor video { display: block; width: 100%; max-height: 60vh; background: #000; }
.reproductor .error { margin: 8px 12px; }
.reproductor .pie { justify-content: center; }
