:root {
  /* Paleta zinc + acentos naranja (inspirada en el dashboard de Usach Premium) */
  --bg: #09090b;            /* zinc-950 */
  --bg-tint: rgba(249, 115, 22, .12);
  --card: rgba(24, 24, 27, .65);   /* zinc-900/65 */
  --card-solid: #18181b;    /* zinc-900 */
  --card-border: rgba(63, 63, 70, .5); /* zinc-700/50 */
  --field: #18181b;
  --field-border: #3f3f46;  /* zinc-700 */
  --text: #f4f4f5;          /* zinc-100 */
  --muted: #a1a1aa;         /* zinc-400 */
  --muted-2: #71717a;       /* zinc-500 */
  --accent: #f97316;        /* orange-500 */
  --accent-strong: #ea580c; /* orange-600 */
  --accent-light: #fb923c;  /* orange-400 */
  --success: #22c55e;       /* green-500 */
  --danger: #f87171;        /* red-400 */
  --radius-lg: 16px;
  --radius-md: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--bg-tint), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
}
main { max-width: 880px; margin: 0 auto; padding: 32px 16px 64px; }

/* ---- Hero ---- */
.hero { text-align: center; margin-bottom: 28px; }
.hero .logo {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 20px;
  margin: 0 auto 14px;
  display: block;
  box-shadow: 0 0 0 1px var(--card-border), 0 18px 40px -12px rgba(249, 115, 22, .45);
}
.hero .eyebrow {
  margin: 0 0 6px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-light);
}
.hero h1 {
  margin: 0 0 6px;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.hero .sub { margin: 0; color: var(--muted); }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  backdrop-filter: blur(8px);
}

/* ---- Countdown ---- */
.countdown { position: relative; overflow: hidden; text-align: center; }
.countdown::after {
  content: "";
  position: absolute;
  bottom: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  opacity: .12;
  pointer-events: none;
}
.cd-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 14px;
}
.cd-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.cd-unit {
  padding: 14px 8px;
  border-radius: var(--radius-md);
  background: var(--card-solid);
  border: 1px solid var(--card-border);
}
.cd-num {
  display: block;
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-strong));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cd-tag {
  display: block;
  margin-top: 8px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.cd-target { margin: 16px 0 0; color: var(--muted); font-size: .88rem; }
.cd-done {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-light);
  padding: 8px 0;
}

/* ---- Form ---- */
label { display: block; font-weight: 600; margin-bottom: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
input, select, button {
  font-size: 1rem;         /* >= 16px en todos → iOS no hace zoom */
  border-radius: var(--radius-md);
  border: 1px solid var(--field-border);
  padding: 12px 14px;
  background: var(--field);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}
input { flex: 1 1 220px; min-width: 0; }
input::placeholder { color: var(--muted-2); }
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, .25);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a1a1aa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 25px -8px rgba(249, 115, 22, .5);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
button:hover { filter: brightness(1.05); box-shadow: 0 14px 30px -8px rgba(249, 115, 22, .6); transform: translateY(-1px); }
button:active { transform: translateY(0) scale(.98); }

/* ---- Result ---- */
.result { margin-top: 16px; padding: 16px; border-radius: var(--radius-md); font-size: 1.05rem; }
.result.ok { background: rgba(34, 197, 94, .12); border: 1px solid rgba(34, 197, 94, .5); }
.result.err { background: rgba(248, 113, 113, .12); border: 1px solid rgba(248, 113, 113, .5); }
.result .sala { font-size: 1.9rem; font-weight: 800; color: var(--success); display: block; margin: 4px 0; }
.result .meta { color: var(--muted); font-size: .92rem; }
.privacy { color: var(--muted); font-size: .85rem; margin: 14px 0 0; }

/* ---- Listado ---- */
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.list-head h2 { margin: 0 0 4px; font-size: 1.2rem; font-weight: 700; }
.count { color: var(--muted); font-size: .9rem; }
.filters { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.filters input { flex: 1 1 180px; min-width: 0; }
.filters select { flex: 1 1 140px; min-width: 0; }
.table-wrap {
  max-height: 460px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
thead th {
  position: sticky; top: 0; background: var(--card-solid);
  text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--card-border);
  font-weight: 600; color: var(--muted); white-space: nowrap;
}
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--card-border); }
tbody tr:hover { background: rgba(249, 115, 22, .06); }
tbody tr.hit { background: rgba(34, 197, 94, .16); }
td.sala-cell { font-weight: 700; white-space: nowrap; color: var(--accent-light); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

footer { text-align: center; color: var(--muted-2); font-size: .8rem; margin-top: 8px; }

/* ---- Responsive: teléfonos (≤ 600px) ---- */
@media (max-width: 600px) {
  main { padding: 20px 12px 48px; }

  .hero .logo { width: 72px; height: 72px; border-radius: 16px; }
  .hero h1 { font-size: 1.4rem; }

  .card { padding: 16px; }

  /* Countdown: 2 columnas en pantallas chicas */
  .cd-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .cd-num { font-size: 2rem; }

  /* Formulario: input + botón en columna */
  .row { flex-direction: column; }
  .row input, .row button { width: 100%; flex: none; }

  /* Filtros: columna completa */
  .filters { flex-direction: column; }
  .filters input, .filters select { width: 100%; flex: none; }

  /* Tabla: oculta columna Carrera para evitar scroll horizontal */
  .table-wrap { max-height: 340px; }
  table { font-size: .85rem; }
  thead th { padding: 9px 10px; }
  tbody td { padding: 8px 10px; }
  thead th:nth-child(2),
  tbody td:nth-child(2) { display: none; }

  /* Resultado: número de sala más grande pero compacto */
  .result .sala { font-size: 1.6rem; }
}

/* ---- Responsive: pantallas muy pequeñas (≤ 360px) ---- */
@media (max-width: 360px) {
  .hero h1 { font-size: 1.2rem; }
  .cd-num { font-size: 1.7rem; }
  .cd-tag { font-size: .65rem; }
}

/* ---- Estadísticas (/stats) ---- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 14px;
  border-radius: var(--radius-md);
  background: var(--card-solid);
  border: 1px solid var(--card-border);
}
.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent-light), var(--accent-strong));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-label { font-size: .8rem; color: var(--muted); }

.bars { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.bar { display: flex; flex-direction: column; gap: 6px; }
.bar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.bar-label { font-size: .9rem; font-weight: 600; }
.bar-val { font-size: .85rem; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-pct { color: var(--muted); font-weight: 400; }
.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  min-width: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-light), var(--accent-strong));
  transition: width .6s cubic-bezier(.22, 1, .36, 1);
}

@media (max-width: 600px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 1.6rem; }
}
