* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f5f7;
  --card: rgba(255, 255, 255, 0.78);
  --text: #111827;
  --muted: #6b7280;
  --line: rgba(17, 24, 39, 0.1);
  --blue: #007aff;
  --green: #34c759;
  --yellow: #ffcc00;
  --gray: #d1d5db;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(0, 122, 255, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(52, 199, 89, 0.16), transparent 30%),
    var(--bg);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.hero-card,
.stats-grid,
.premium-home-card,
.legend-card,
.malla-wrap {
  margin-bottom: 18px;
}

.hero-card {
  position: relative;
  z-index: 15;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
.subtitle {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 64px);
  letter-spacing: -0.06em;
}

.subtitle {
  max-width: 650px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
}

.app-menu {
  position: relative;
  z-index: 30;
  align-self: flex-start;
}

.login-trigger {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  color: white;
  background: #111827;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.login-trigger:hover {
  transform: translateY(-2px);
  background: #374151;
}

.login-trigger.logged {
  background: var(--green);
}

.menu-trigger {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
  cursor: pointer;
}

.menu-trigger span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #111827;
}

.menu-popover {
  position: absolute;
  top: 56px;
  right: 0;
  z-index: 100;
  display: none;
  width: 250px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.menu-popover.open {
  display: grid;
  gap: 6px;
}

.menu-popover button {
  border: 0;
  border-radius: 16px;
  padding: 13px 14px;
  color: #111827;
  background: transparent;
  text-align: left;
  font-weight: 850;
  cursor: pointer;
}

.menu-popover button span {
  float: right;
  border-radius: 999px;
  padding: 3px 7px;
  color: white;
  background: #7b2cbf;
  font-size: 10px;
  font-weight: 950;
}

.menu-popover button:hover {
  background: rgba(0, 122, 255, 0.1);
}

.progress-widget {
  position: relative;
  width: 150px;
  height: 150px;
  flex: 0 0 auto;
}

.progress-ring {
  width: 150px;
  height: 150px;
  transform: rotate(-90deg);
}

.progress-track,
.progress-value {
  fill: none;
  stroke-width: 12;
}

.progress-track {
  stroke: rgba(17, 24, 39, 0.08);
}

.progress-value {
  stroke: var(--green);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.6s ease;
}

.progress-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.progress-center strong {
  font-size: 34px;
  letter-spacing: -0.05em;
}

.progress-center span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card,
.legend-card,
.malla-wrap {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(20px);
}

.stat-card {
  padding: 18px;
  border-radius: 26px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.premium-home-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border: 1px solid rgba(123, 44, 191, 0.22);
  border-radius: 30px;
  padding: 22px;
  background: linear-gradient(135deg, rgba(123, 44, 191, 0.13), rgba(0, 122, 255, 0.1), rgba(255, 255, 255, 0.78));
  box-shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(20px);
}

.premium-home-card h2 {
  margin: 0;
  max-width: 640px;
  font-size: 30px;
  letter-spacing: -0.05em;
}

.premium-home-card p:not(.eyebrow) {
  margin: 8px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-weight: 700;
}

.premium-home-price {
  min-width: 170px;
  border-radius: 24px;
  padding: 18px;
  color: white;
  background: #111827;
  text-align: center;
}

.premium-home-price span,
.premium-home-price small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 850;
}

.premium-home-price strong {
  display: block;
  margin: 4px 0;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.premium-home-cta {
  margin-top: 16px;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  color: white;
  background: linear-gradient(135deg, #7b2cbf, #007aff);
  box-shadow: 0 14px 28px rgba(123, 44, 191, 0.24);
  font-weight: 950;
  cursor: pointer;
}

.legend-card {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px;
  border-radius: 26px;
}

.legend-item {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.pendiente-dot { background: white; border: 1px solid var(--gray); }
.cursando-dot { background: var(--yellow); }
.aprobado-dot { background: var(--green); }
.bloqueado-dot { background: #9ca3af; }

#boton-relaciones,
#boton-reiniciar {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 850;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

#boton-relaciones {
  margin-left: auto;
  color: #111827;
  background: rgba(0, 122, 255, 0.12);
}

#boton-relaciones.activo {
  color: white;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(0, 122, 255, 0.24);
}

#boton-reiniciar {
  color: white;
  background: #111827;
}

#boton-relaciones:hover,
#boton-reiniciar:hover {
  transform: translateY(-2px);
}

#boton-reiniciar:hover {
  background: #374151;
}

.malla-wrap {
  overflow-x: auto;
  padding: 16px;
  border-radius: 30px;
}

.malla {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, minmax(150px, 1fr));
  gap: 12px;
  min-width: 1540px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 13px 10px;
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, #111827, #374151);
  text-align: center;
  font-size: 14px;
  font-weight: 900;
}

.ramo {
  position: relative;
  min-height: 104px;
  padding: 14px 12px 34px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, border-color 0.18s ease;
}

.ramo:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.14);
}

.ramo::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}

.ramo-name {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.22;
}

.sigla,
.creditos {
  position: absolute;
  z-index: 1;
  bottom: 10px;
  font-size: 10px;
  font-weight: 900;
}

.sigla {
  left: 12px;
  color: rgba(17, 24, 39, 0.56);
}

.creditos {
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
}

.ramo.pendiente {
  border-color: rgba(0, 122, 255, 0.22);
}

.ramo.pendiente::before {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.08), transparent);
  opacity: 1;
}

.ramo.cursando {
  border-color: rgba(255, 204, 0, 0.9);
  color: #5c3b00;
}

.ramo.cursando::before {
  background: linear-gradient(135deg, rgba(255, 204, 0, 0.46), rgba(255, 236, 153, 0.35));
  opacity: 1;
}

.ramo.aprobado {
  border-color: rgba(52, 199, 89, 0.95);
  color: #064e3b;
}

.ramo.aprobado::before {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.56), rgba(167, 243, 208, 0.45));
  opacity: 1;
}

.ramo.aprobado::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 1;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green);
  font-weight: 950;
  animation: pop 0.28s ease;
}

.ramo.bloqueado {
  color: #9ca3af;
  background: rgba(243, 244, 246, 0.72);
  border-style: dashed;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.68;
}

.ramo.bloqueado:hover {
  transform: none;
  box-shadow: none;
}

.malla.relacion-activa .ramo:not(.relacion-foco):not(.relacion-prereq):not(.relacion-desbloquea):not(.placeholder) {
  opacity: 0.24;
  transform: scale(0.98);
}

.ramo.relacion-foco {
  z-index: 4;
  border-color: rgba(0, 122, 255, 0.95);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.16), 0 22px 44px rgba(0, 122, 255, 0.22);
  transform: translateY(-6px) scale(1.03);
}

.ramo.relacion-prereq {
  z-index: 3;
  border-color: rgba(175, 82, 222, 0.95);
  box-shadow: 0 0 0 4px rgba(175, 82, 222, 0.15), 0 18px 36px rgba(175, 82, 222, 0.16);
}

.ramo.relacion-prereq::before {
  background: linear-gradient(135deg, rgba(175, 82, 222, 0.32), rgba(255, 255, 255, 0.3));
  opacity: 1;
}

.ramo.relacion-desbloquea {
  z-index: 3;
  border-color: rgba(52, 199, 89, 0.95);
  box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.15), 0 18px 36px rgba(52, 199, 89, 0.16);
}

.ramo.relacion-desbloquea::before {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.3), rgba(255, 255, 255, 0.28));
  opacity: 1;
}

.ramo.relacion-prereq::after,
.ramo.relacion-desbloquea::after {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 5px 8px;
  border-radius: 999px;
  color: white;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.02em;
}

.ramo.relacion-prereq::after {
  content: "REQ";
  background: #af52de;
}

.ramo.relacion-desbloquea::after {
  content: "ABRE";
  background: var(--green);
}

.ramo.placeholder {
  background: transparent;
  border: 0;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  background: rgba(17, 24, 39, 0);
  pointer-events: none;
  transition: background 0.2s ease;
}

.drawer.open {
  background: rgba(17, 24, 39, 0.26);
  pointer-events: auto;
}

.drawer-panel {
  width: min(420px, calc(100% - 24px));
  height: calc(100% - 24px);
  margin: 12px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  transform: translateX(110%);
  transition: transform 0.24s ease;
}

.drawer.open .drawer-panel {
  transform: translateX(0);
}

.tool-modal {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0);
  pointer-events: none;
  transition: background 0.2s ease;
}

.tool-modal.open {
  background: rgba(17, 24, 39, 0.28);
  pointer-events: auto;
}

.tool-panel {
  width: min(880px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow-y: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  transform: translateY(18px) scale(0.98);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.tool-modal.open .tool-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0);
  pointer-events: none;
  transition: background 0.2s ease;
}

.auth-modal.open {
  background: rgba(17, 24, 39, 0.3);
  pointer-events: auto;
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  transform: translateY(18px) scale(0.98);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.auth-modal.open .auth-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.auth-copy,
.auth-note {
  color: var(--muted);
  line-height: 1.45;
}

.auth-copy {
  margin: 0 0 18px;
  font-weight: 650;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.06);
  margin-bottom: 18px;
}

.auth-tabs button {
  border: 0;
  border-radius: 999px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.auth-tabs button.active {
  color: #111827;
  background: white;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #111827;
  font-size: 13px;
  font-weight: 900;
}

.auth-form input {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: #f8fafc;
  font: inherit;
  font-weight: 750;
  outline: none;
}

.auth-form input:focus {
  border-color: rgba(0, 122, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

.auth-name-field {
  display: none;
}

.auth-name-field.visible {
  display: grid;
}

.auth-submit,
.demo-login {
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  font-weight: 950;
  cursor: pointer;
}

.auth-submit {
  margin-top: 4px;
  color: white;
  background: var(--blue);
}

.demo-login {
  width: 100%;
  margin-top: 12px;
  color: #111827;
  background: rgba(52, 199, 89, 0.16);
}

.dev-payment-btn {
  display: none;
  width: 100%;
  margin-top: 10px;
  border: 1px dashed rgba(124, 58, 237, 0.45);
  border-radius: 16px;
  padding: 12px 16px;
  color: #5b21b6;
  background: rgba(124, 58, 237, 0.08);
  font-weight: 950;
  cursor: pointer;
}

.dev-payment-btn.visible {
  display: block;
}

.auth-note {
  margin: 12px 0 0;
  color: #6b7280;
  font-size: 13px;
  font-weight: 750;
}

.auth-version {
  margin-top: 6px;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 800;
}

.auth-error {
  min-height: 18px;
  margin: 0;
  color: #dc2626;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.35;
}

.tool-view {
  display: none;
}

.tool-view.active {
  display: block;
}

.tool-view h2 {
  margin-bottom: 10px;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.assistant-box {
  display: grid;
  gap: 12px;
}

.assistant-messages {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(245, 245, 247, 0.82);
}

.assistant-message {
  max-width: 86%;
  border-radius: 18px;
  padding: 12px 14px;
  line-height: 1.45;
  font-weight: 750;
}

.assistant-message.bot {
  justify-self: start;
  background: white;
}

.assistant-message.user {
  justify-self: end;
  color: white;
  background: var(--blue);
}

.assistant-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.assistant-form input {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: #f8fafc;
  font: inherit;
  font-weight: 800;
}

.assistant-form button {
  border: 0;
  border-radius: 18px;
  padding: 14px 18px;
  color: white;
  background: #111827;
  font-weight: 950;
  cursor: pointer;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.strategy-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background: rgba(245, 245, 247, 0.86);
}

.strategy-card.highlight {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.12), rgba(255, 255, 255, 0.84));
}

.strategy-card.warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(255, 255, 255, 0.84));
}

.strategy-card.danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.14), rgba(255, 255, 255, 0.84));
}

.strategy-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.strategy-card strong {
  display: block;
  margin: 6px 0;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.strategy-card p {
  margin: 0;
  color: #374151;
  line-height: 1.45;
  font-weight: 700;
}

.tool-copy {
  max-width: 680px;
  margin: 0 0 18px;
  color: var(--muted);
  font-weight: 650;
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.05fr);
  gap: 32px;
  align-items: stretch;
}

.calculator-form {
  padding: 4px 2px;
}

.notas-lista {
  display: grid;
  gap: 12px;
}

.nota-row {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) 82px 98px;
  gap: 10px;
  align-items: center;
}

.nota-row label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: #030712;
  font-weight: 900;
}

.delete-note-btn {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #475569;
  background: rgba(148, 163, 184, 0.16);
  cursor: pointer;
}

.nota-row input,
.exam-grid input,
.percent-input {
  border: 1px solid #dfe3ea;
  border-radius: 12px;
  background: #fbfcfe;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.nota-row input,
.exam-grid input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  color: #667085;
  font: inherit;
  font-weight: 850;
  text-align: right;
  outline: none;
}

.nota-row input:focus,
.exam-grid input:focus,
.percent-input:focus-within {
  border-color: rgba(124, 58, 237, 0.58);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.percent-input {
  display: grid;
  grid-template-columns: 1fr 40px;
  overflow: hidden;
}

.percent-input input {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.percent-input span {
  display: grid;
  place-items: center;
  border-left: 1px solid #dfe3ea;
  background: #f0f2f6;
  font-weight: 950;
}

.calculator-actions-row {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 18px;
}

.add-grade-btn {
  border: 0;
  border-radius: 9px;
  padding: 9px 13px;
  color: white;
  background: #16823a;
  box-shadow: 0 5px 12px rgba(22, 130, 58, 0.24);
  font-weight: 950;
  cursor: pointer;
}

.simple-average-toggle {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  margin-bottom: 26px;
  font-size: 12px;
  font-weight: 900;
}

.simple-average-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #7b2cbf;
}

.exam-copy {
  max-width: 450px;
  margin: 0 0 16px;
  color: #111827;
  font-size: 15px;
  line-height: 1.45;
}

.exam-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 98px;
  gap: 12px 18px;
  align-items: center;
}

.exam-grid label {
  color: #030712;
  font-weight: 900;
}

.calculator-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.clear-btn,
.calculate-btn {
  min-width: 108px;
  border: 0;
  border-radius: 10px;
  padding: 13px 18px;
  font-weight: 950;
  cursor: pointer;
}

.clear-btn {
  color: #111827;
  background: white;
  box-shadow: inset 0 0 0 1px #e5e7eb, 0 3px 8px rgba(15, 23, 42, 0.08);
}

.calculate-btn {
  color: white;
  background: #7b2cbf;
  box-shadow: 0 8px 18px rgba(123, 44, 191, 0.28);
}

.calculator-result {
  min-height: 420px;
  padding: 28px;
  border: 1px solid #f5c542;
  border-radius: 10px;
  background: #fffbea;
}

.calculator-result h3 {
  margin: 0 0 12px;
  color: #030712;
  font-size: 18px;
  font-weight: 500;
}

.calculator-result p {
  margin: 0;
  color: #030712;
  font-size: 14px;
  line-height: 1.45;
}

.risk-card {
  margin-top: 22px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.risk-card span,
.radar-summary span,
.premium-hero span,
.plan-compare span,
.premium-grid span,
.price-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.risk-card strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.risk-card.low strong {
  color: #15803d;
}

.risk-card.medium strong {
  color: #b45309;
}

.risk-card.high strong {
  color: #b91c1c;
}

.radar-layout {
  display: grid;
  gap: 16px;
}

.radar-selector {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.radar-selector label {
  grid-column: 1 / -1;
  color: #111827;
  font-size: 13px;
  font-weight: 900;
}

.radar-selector select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: #f8fafc;
  font: inherit;
  font-weight: 800;
}

.radar-selector button,
.price-card button {
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  color: white;
  background: #7b2cbf;
  font-weight: 950;
  cursor: pointer;
}

.radar-summary,
.premium-grid,
.plan-compare,
.premium-hero {
  display: grid;
  gap: 12px;
}

.radar-summary,
.premium-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.premium-hero,
.plan-compare {
  grid-template-columns: 1.35fr 0.85fr;
  margin-bottom: 14px;
}

.radar-summary div,
.premium-grid article,
.premium-hero > div,
.plan-compare article,
.impact-item,
.price-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background: rgba(245, 245, 247, 0.82);
}

.premium-hero > div:first-child {
  background: linear-gradient(135deg, rgba(123, 44, 191, 0.13), rgba(0, 122, 255, 0.1));
}

.premium-hero strong {
  display: block;
  margin-top: 8px;
  color: #111827;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.premium-hero p,
.plan-compare p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.premium-price {
  display: grid;
  align-content: center;
  text-align: center;
  background: #111827 !important;
}

.premium-price span,
.premium-price p {
  color: rgba(255, 255, 255, 0.72);
}

.premium-price strong {
  color: white;
  font-size: 52px;
}

.plan-compare article {
  background: white;
}

.plan-compare .featured-plan {
  border-color: rgba(123, 44, 191, 0.35);
  background: linear-gradient(135deg, rgba(123, 44, 191, 0.12), rgba(52, 199, 89, 0.1));
}

.plan-compare ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #374151;
  line-height: 1.65;
  font-weight: 750;
}

.radar-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 36px;
  letter-spacing: -0.06em;
}

.impact-list {
  display: grid;
  gap: 10px;
}

.impact-item strong,
.premium-grid strong,
.price-card strong {
  display: block;
  margin-top: 6px;
  color: #111827;
  font-size: 18px;
}

.impact-item p,
.premium-grid p,
.price-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.price-card {
  margin-top: 16px;
  background: linear-gradient(135deg, rgba(123, 44, 191, 0.12), rgba(0, 122, 255, 0.1));
}

.price-card strong {
  font-size: 34px;
  letter-spacing: -0.05em;
}

.price-card button {
  margin-top: 14px;
}

.simulator-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.simulator-controls label {
  display: grid;
  gap: 7px;
  color: #111827;
  font-size: 13px;
  font-weight: 900;
}

.simulator-controls input,
.simulator-controls select {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: #f8fafc;
  font: inherit;
  font-weight: 800;
}

.simulator-controls .sim-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(245, 245, 247, 0.86);
}

.simulator-controls .sim-check input {
  width: 18px;
  height: 18px;
  accent-color: #7b2cbf;
}

.simulator-controls button {
  grid-column: 1 / -1;
  border: 0;
  border-radius: 18px;
  padding: 14px 16px;
  color: white;
  background: #7b2cbf;
  font-weight: 950;
  cursor: pointer;
}

.simulator-summary {
  margin: 0 0 14px;
  padding: 13px 15px;
  border-radius: 18px;
  color: #374151;
  background: rgba(0, 122, 255, 0.08);
  font-weight: 800;
  line-height: 1.4;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.plan-card {
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 18px;
  background: rgba(245, 245, 247, 0.88);
}

.plan-card.safe {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.14), rgba(255, 255, 255, 0.8));
}

.plan-card.balance {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.14), rgba(255, 255, 255, 0.8));
}

.plan-card.aggressive {
  background: linear-gradient(135deg, rgba(123, 44, 191, 0.14), rgba(255, 255, 255, 0.8));
}

.plan-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plan-card h3 {
  margin: 6px 0 4px;
  font-size: 26px;
  letter-spacing: -0.05em;
}

.plan-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.4;
}

.plan-card ul {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.plan-card li {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
}

.plan-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.plan-meta strong {
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(17, 24, 39, 0.08);
  font-size: 12px;
}

.grade-form {
  display: grid;
  grid-template-columns: 1fr 120px 120px auto;
  gap: 10px;
  margin: 18px 0;
}

.grade-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: rgba(245, 245, 247, 0.92);
  font: inherit;
  font-weight: 750;
  outline: none;
}

.grade-form input:focus {
  border-color: rgba(0, 122, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

.grade-form button {
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  color: white;
  background: var(--blue);
  font-weight: 900;
  cursor: pointer;
}

.grade-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.grade-summary div,
.evaluacion-item,
.sala-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(245, 245, 247, 0.78);
}

.grade-summary span,
.evaluacion-item span,
.sala-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.grade-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 30px;
  letter-spacing: -0.05em;
}

.evaluaciones-lista,
.salas-lista {
  display: grid;
  gap: 10px;
}

.evaluacion-item,
.sala-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.evaluacion-item strong,
.sala-item strong {
  display: block;
  margin-top: 4px;
}

.map-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: stretch;
}

.campus-map {
  position: relative;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 30px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.22) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.22) 1px, transparent 1px),
    radial-gradient(circle at 28% 34%, rgba(0, 122, 255, 0.28), transparent 18%),
    radial-gradient(circle at 72% 58%, rgba(52, 199, 89, 0.28), transparent 22%),
    linear-gradient(135deg, #dbeafe, #f0fdf4);
  background-size: 38px 38px, 38px 38px, auto, auto, auto;
}

.pdf-map {
  min-height: 520px;
  background: #f8fafc;
}

.pdf-map iframe {
  width: 100%;
  height: 100%;
  min-height: 520px;
  border: 0;
  background: white;
}

.map-actions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 8px;
}

.map-actions a {
  border-radius: 999px;
  padding: 10px 13px;
  color: white;
  background: rgba(17, 24, 39, 0.9);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.22);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.map-pin {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 999px 999px 999px 8px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(0, 122, 255, 0.28);
  font-weight: 950;
  transform: rotate(-45deg);
}

.pin-a { top: 24%; left: 28%; }
.pin-b { top: 54%; left: 62%; background: var(--green); }
.pin-c { top: 68%; left: 34%; background: #af52de; }

.map-pin {
  font-size: 15px;
}

.evaluacion-item button,
.sala-item button {
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  color: #991b1b;
  background: rgba(239, 68, 68, 0.1);
  font-weight: 850;
  cursor: pointer;
}

.room-form {
  grid-template-columns: 1fr 1fr auto;
  margin-top: 0;
}

.drawer-close {
  float: right;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.drawer h2 {
  margin-bottom: 18px;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.detail-list {
  display: grid;
  gap: 12px;
}

.detail-list div {
  padding: 14px;
  border-radius: 20px;
  background: rgba(245, 245, 247, 0.92);
}

.detail-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-list strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -14px;
  width: 10px;
  height: 16px;
  border-radius: 4px;
  animation: fall 1.4s ease-in forwards;
}

@keyframes pop {
  from { transform: scale(0.2); }
  to { transform: scale(1); }
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(620deg);
    opacity: 0;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 16px;
  }

  body {
    font-size: 15px;
  }

  .hero-card {
    align-items: flex-start;
    flex-direction: column;
    border-radius: 26px;
  }

  .hero-actions {
    width: 100%;
    justify-content: space-between;
  }

  .premium-home-card {
    align-items: stretch;
    flex-direction: column;
  }

  .premium-home-card h2 {
    font-size: 24px;
    line-height: 1.05;
  }

  .premium-home-cta,
  .premium-home-price,
  #boton-pago-pro,
  #boton-pago-plan {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    padding: 14px;
  }

  .stat-card strong {
    font-size: 28px;
  }

  .malla-wrap {
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .malla {
    min-width: 760px;
  }

  .tool-panel,
  .auth-card,
  .drawer-panel {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    border-radius: 24px;
    padding: 18px;
  }

  .tool-panel h2,
  .auth-card h2,
  .drawer h2 {
    font-size: 26px;
    line-height: 1.05;
  }

  #boton-reiniciar {
    width: 100%;
    margin-left: 0;
  }

  #boton-relaciones {
    width: 100%;
    margin-left: 0;
  }

  .grade-form,
  .room-form,
  .grade-summary,
  .calculator-layout,
  .radar-selector,
  .radar-summary,
  .premium-grid,
  .premium-hero,
  .plan-compare,
  .simulator-controls,
  .plans-grid,
  .strategy-grid,
  .map-layout {
    grid-template-columns: 1fr;
  }

  .nota-row,
  .exam-grid {
    grid-template-columns: 1fr;
  }

  .calculator-buttons {
    justify-content: stretch;
  }

  .clear-btn,
  .calculate-btn {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .app-shell {
    gap: 12px;
    padding: 10px;
  }

  .hero-card {
    padding: 18px;
  }

  .hero-card h1 {
    font-size: 32px;
    line-height: 0.95;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions button,
  .auth-submit,
  .demo-login {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .legend-card {
    display: grid;
    grid-template-columns: 1fr;
  }

  .premium-home-price strong,
  .premium-price strong {
    font-size: 40px;
  }

  .calculator-buttons {
    flex-direction: column;
  }

  .clear-btn,
  .calculate-btn {
    width: 100%;
  }
}
