:root {
  --navy: #0D2240;
  --burg: #7B303E;
  --gold: #D2AF57;
  --bg: #F7F5F1;
  --text: #1A1A2E;
  --muted: #6B7280;
  --card: #FFFFFF;
  --radius: 14px;
  --ok: #166534;
  --ok-bg: #ecfdf5;
  --ok-border: #bbf7d0;
  --warn: #92400e;
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}

body::before {
  content: '';
  position: fixed;
  left: 0; top: 0;
  width: 5px; height: 100%;
  background: linear-gradient(180deg, var(--gold), var(--burg), var(--navy));
  z-index: 50;
}

.paes-topbar {
  background: var(--navy);
  min-height: 60px;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--gold);
}

.paes-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.paes-brand .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--gold);
}

.paes-topbar-sub {
  color: rgba(255,255,255,0.55);
  font-size: 0.75rem;
}

.paes-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2rem) 4rem;
}

.paes-wrap-narrow { max-width: 480px; }

.paes-hero { margin-bottom: 1.5rem; }

.eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--burg);
  margin-bottom: 0.5rem;
}

.paes-hero h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  color: var(--navy);
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.lead {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 42ch;
}

.paes-card {
  background: var(--card);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px rgba(13,34,64,0.05);
}

.paes-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.4rem;
}

.paes-form input[type="text"] {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--navy);
  text-align: center;
}

.paes-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(210,175,87,0.25);
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.45rem 0 1.1rem;
  text-align: center;
}

.btn-primary {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: var(--navy);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:hover { background: #16355f; }

.privacy {
  margin-top: 1.25rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  border-top: 1px solid #eee;
  padding-top: 1rem;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

/* ------------------------------------------------------------
   Página de resultados (Notas.asp)
   ------------------------------------------------------------ */

.paes-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--burg);
  text-decoration: none;
  margin-bottom: 1.1rem;
}

.paes-back:hover { text-decoration: underline; }

.rut-line {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.15rem;
}

.rut-line strong { color: var(--navy); }

.section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  color: var(--navy);
  margin-bottom: 0.9rem;
}

/* Tabla de resultados */
.paes-tabla-wrap {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(13, 34, 64, 0.08);
  box-shadow: 0 6px 24px rgba(13, 34, 64, 0.08);
}

.paes-tabla {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}

.paes-tabla thead tr {
  background: linear-gradient(135deg, var(--navy) 0%, #16355f 100%);
}

.paes-tabla th {
  color: #fff;
  text-align: center;
  padding: 0.95rem 1rem;
  font-weight: 600;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 3px solid var(--gold);
}

.paes-tabla td {
  padding: 1rem;
  text-align: center;
  color: var(--text);
}

.paes-tabla tbody tr:nth-child(odd) { background: #ffffff; }
.paes-tabla tbody tr:nth-child(even) { background: #faf8f4; }
.paes-tabla tbody tr:hover { background: rgba(210, 175, 87, 0.14); }
.paes-tabla tbody tr:not(:last-child) td { border-bottom: 1px solid rgba(13, 34, 64, 0.06); }

.ensayo-nombre {
  font-weight: 700;
  color: var(--navy);
}

.correctas-chip {
  display: inline-block;
  background: rgba(13, 34, 64, 0.07);
  color: var(--navy);
  padding: 0.3em 0.9em;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.puntaje-valor {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--burg);
}

/* Comentario final */
.comentario-box {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1.15rem 1.3rem;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.55;
  margin-top: 1.4rem;
}

.comentario-box .icono { font-size: 1.5rem; line-height: 1; }

.comentario-box strong {
  display: block;
  margin-bottom: 0.2rem;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.08rem;
}

.comentario-sube    { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.comentario-baja    { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.comentario-estable { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.comentario-na      { background: #f1f5f9; color: var(--muted); border: 1px solid #e2e8f0; }

/* Resumen: tarjetas de estadisticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.stat-item {
  background: linear-gradient(160deg, #ffffff, #faf8f4);
  border: 1px solid rgba(13, 34, 64, 0.08);
  border-radius: 12px;
  padding: 0.95rem 0.75rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(13, 34, 64, 0.08);
}

.stat-item-highlight {
  background: linear-gradient(160deg, #fff9ec, #fdf3dc);
  border-color: rgba(210, 175, 87, 0.4);
}

.stat-label {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.stat-value {
  display: block;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 900;
  font-size: 1.55rem;
  color: var(--navy);
}

.stat-value-gold { color: var(--burg); }

/* Grafico de evolucion */
.chart-wrap {
  overflow-x: auto;
  padding-top: 1.5rem;
  margin-top: 0.25rem;
  border-top: 1px solid rgba(13, 34, 64, 0.07);
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: clamp(0.5rem, 2.5vw, 1.3rem);
  height: 150px;
  min-width: min-content;
}

.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  flex: 1 0 44px;
}

.chart-value {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.35rem;
  white-space: nowrap;
}

.chart-bar {
  width: 100%;
  max-width: 32px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #c2cede, #93a7c2);
  transition: height 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-bar-current {
  background: linear-gradient(180deg, var(--gold), var(--burg));
}

.chart-label {
  margin-top: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

/* Fila del ensayo mas reciente */
.fila-actual td { background: rgba(210, 175, 87, 0.08); }

.badge-actual {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Entrada suave de las tarjetas */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.paes-hero, .paes-card {
  animation: fadeInUp 0.5s ease both;
}

.paes-hero { animation-delay: 0s; }
.paes-card:nth-of-type(1) { animation-delay: 0.06s; }
.paes-card:nth-of-type(2) { animation-delay: 0.12s; }
.paes-card:nth-of-type(3) { animation-delay: 0.18s; }
