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

:root {
  --black: #0d0d0d;
  --gray-800: #2a2a2a;
  --gray-600: #555555;
  --gray-400: #999999;
  --gray-200: #e0e0e0;
  --gray-100: #f4f4f4;
  --white: #ffffff;
  --brand-navy: #1f2d40;
  --brand-navy-hover: #2a3c54;
  --green: #2d8a4e;
  --green-light: #e8f5ec;
  --amber: #c9920a;
  --amber-light: #fef6e4;
  --red: #c0392b;
  --red-light: #fdecea;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--gray-100);
  color: var(--black);
  min-height: 100dvh;
  line-height: 1.5;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.screen--home {
  justify-content: flex-start;
  padding-top: clamp(3rem, 12vh, 6rem);
}

.screen--question {
  justify-content: flex-start;
  padding-top: 2.5rem;
}

.screen--result {
  padding-top: 2rem;
}

/* ── Buttons ── */

.btn {
  appearance: none;
  border: none;
  font-family: var(--font);
  font-size: 1.0625rem;
  font-weight: 600;
  padding: 1rem 2rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 3px solid var(--gray-400);
  outline-offset: 2px;
}

/* ── Role selection ── */

.title {
  font-size: clamp(2.75rem, 9vw, 4.5rem);
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  line-height: 1.05;
}

/* ── escuelia branding ── */

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.brand__logo {
  height: 48px;
  width: auto;
  display: block;
}

.brand__link {
  display: inline-flex;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.brand__link:hover {
  opacity: 0.7;
}

.brand--footer {
  gap: 0.45rem;
  margin: 3rem 0 0.5rem;
  opacity: 0.7;
}

.brand--footer .brand__logo {
  height: 24px;
}

.brand__by {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: -0.01em;
}

/* Result screen footer: "by" + clickable wordmark.
   Uses a transparent-background PNG so it sits directly on the light UI,
   small and without a dark button. */
.result-by {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 3rem 0 0.5rem;
}

.result-by__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: -0.01em;
}

.result-by__logo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  padding: 0.2rem;
  border-radius: 8px;
  transition: opacity 0.15s ease;
}

.result-by__logo-btn:hover {
  opacity: 0.7;
}

.result-by__logo {
  width: 120px;
  max-width: 45vw;
  height: auto;
  display: block;
}

.subtitle {
  font-size: clamp(1rem, 3vw, 1.2rem);
  color: var(--gray-600);
  text-align: center;
  margin-bottom: 3rem;
  max-width: 420px;
  line-height: 1.5;
}

.role-grid {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  width: 100%;
}

.role-btn {
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--black);
  text-align: center;
}

.role-btn:hover {
  background: var(--black);
  color: var(--white);
}

/* ── Progress ── */

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--black);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.progress {
  font-size: 0.8125rem;
  color: var(--gray-400);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  align-self: flex-start;
}

.question-text {
  font-size: clamp(1.375rem, 4.5vw, 2rem);
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin-bottom: 2.5rem;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Likert ── */

.likert {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.likert-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 22rem;
}

.likert-option {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  width: 100%;
}

.likert-option:hover {
  border-color: var(--gray-400);
}

.likert-option--selected {
  border-color: var(--black);
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
}

.likert-option input {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--gray-400);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  pointer-events: none;
  transition: border-color 0.15s, background 0.15s;
}

.likert-option input:checked {
  border-color: var(--black);
  background: var(--black);
  box-shadow: inset 0 0 0 3px var(--white);
}

.likert-option-text {
  font-size: 0.9375rem;
  color: var(--gray-600);
  line-height: 1.3;
  flex: 1;
  pointer-events: none;
}

.likert-option--selected .likert-option-text {
  color: var(--black);
  font-weight: 600;
}

.question-nav {
  width: 100%;
  max-width: 22rem;
  display: flex;
  justify-content: flex-end;
  margin-top: 1.75rem;
  align-self: center;
}

.btn--next {
  background: var(--green);
  color: var(--white);
  border: none;
  padding: 0.875rem 2rem;
  border-radius: var(--radius-sm);
}

.btn--next:hover:not(:disabled) {
  background: #247a42;
}

.btn--next:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn--next.hidden {
  display: none;
}

/* ── Results ── */

.result-score {
  font-size: clamp(3rem, 10vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.result-label {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.75rem;
}

.result-description {
  font-size: 1rem;
  color: var(--gray-600);
  text-align: center;
  line-height: 1.6;
  margin-bottom: 2.5rem;
  max-width: 520px;
}

.thermometer {
  width: 100%;
  margin-bottom: 2.5rem;
}

.thermometer-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.thermometer-labels span:first-child,
.thermometer-label--growth {
  color: var(--green);
}

.thermometer-labels span:last-child,
.thermometer-label--fixed {
  color: var(--red);
}

.thermometer-track {
  position: relative;
  height: 14px;
  background: linear-gradient(
    to right,
    var(--green) 0%,
    #7cb87a 25%,
    var(--amber) 50%,
    #e07a5f 75%,
    var(--red) 100%
  );
  border-radius: 7px;
}

.thermometer-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  background: var(--white);
  border: 3px solid var(--black);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: left 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.thermometer-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.thermometer-scale .scale--growth {
  color: var(--green);
}

.thermometer-scale .scale--mixed {
  color: var(--amber);
}

.thermometer-scale .scale--fixed {
  color: var(--red);
}

/* ── Email section ── */

.email-section {
  width: 100%;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.email-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--black);
}

.email-checkbox input {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--black);
  cursor: pointer;
}

.email-field {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.email-field.hidden {
  display: none;
}

.input {
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.875rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  color: var(--black);
  width: 100%;
  transition: border-color 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--black);
  background: var(--white);
}

.email-send-btn {
  align-self: flex-start;
}

.email-status {
  font-size: 0.875rem;
  min-height: 1.25rem;
}

.email-status--success {
  color: var(--gray-600);
}

.email-status--error {
  color: #b00020;
}

/* ── CTA section ── */

.cta-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.cta-copy {
  margin: 0;
  color: var(--gray-800);
  line-height: 1.5;
  max-width: 38ch;
}

.cta-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Action buttons ── */

.btn--dark {
  background: var(--black);
  color: var(--white);
}

.btn--dark:hover:not(:disabled) {
  background: var(--gray-800);
}

.btn--dark:disabled {
  opacity: 0.4;
  cursor: default;
}

/* CTA "Ver formaciones de escuelia" reuses btn--dark layout but uses the
   brand navy instead of black, so it stands out as the primary action. */
.cta-btn.btn--dark {
  background: var(--brand-navy);
}

.cta-btn.btn--dark:hover:not(:disabled) {
  background: var(--brand-navy-hover);
}

.btn--outline {
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--gray-200);
}

.btn--outline:hover {
  border-color: var(--black);
}

.restart-btn {
  margin-top: 0.5rem;
}

.title--sm {
  font-size: clamp(2rem, 7vw, 3rem);
}

.subtitle--error {
  color: var(--red);
}

.admin-link {
  margin-top: 2rem;
  color: var(--gray-600);
  font-size: 0.9375rem;
  text-decoration: none;
}

.admin-link:hover {
  color: var(--black);
}

.session-badge {
  font-size: 0.8125rem;
  color: var(--gray-400);
  letter-spacing: 0.04em;
  margin-bottom: 1.5rem;
}

.session-badge--lg {
  font-size: 1rem;
  color: var(--gray-600);
  font-weight: 600;
}

.done-message {
  font-size: 0.9375rem;
  color: var(--green);
  text-align: center;
  margin-top: 1rem;
}

.host-section {
  width: 100%;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-200);
  text-align: center;
}

.host-section__label {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: 0.875rem;
}

.host-section__btn {
  width: 100%;
  max-width: 22rem;
}

.form-error {
  font-size: 0.875rem;
  color: var(--red);
  line-height: 1.5;
  padding: 0.75rem 1rem;
  background: var(--red-light);
  border-radius: var(--radius-sm);
}

.form-error.hidden {
  display: none;
}

/* ── Admin ── */

.screen--admin {
  max-width: 560px;
}

.screen--dashboard {
  max-width: 960px;
  align-items: stretch;
  justify-content: flex-start;
  padding-top: 1.5rem;
}

.admin-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.qr-wrap {
  background: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 2px solid var(--gray-200);
  margin: 1.5rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 260px;
}

.qr-loading {
  font-size: 0.875rem;
  color: var(--gray-400);
}

.qr-image {
  display: block;
}

.qr-hint {
  font-size: 0.875rem;
  color: var(--gray-600);
  text-align: center;
  margin-bottom: 0.75rem;
}

.link-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.input--readonly {
  font-size: 0.8125rem;
  color: var(--gray-600);
}

.admin-actions {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.btn--sm {
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
}

.btn--danger {
  color: var(--red);
  border-color: var(--red-light);
}

.btn--danger:hover {
  border-color: var(--red);
  color: var(--red);
}

.dash-header {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-bottom: 2rem;
}

.dash-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: 1;
}

.dash-sub {
  font-size: 0.875rem;
  color: var(--gray-400);
  width: 100%;
}

.live-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.06em;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.dash-content {
  width: 100%;
}

.dash-loading {
  color: var(--gray-400);
  text-align: center;
  padding: 2rem;
}

.dash-footer {
  width: 100%;
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}

.dash-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  min-width: 120px;
  flex: 1;
}

.stat-card--sm {
  min-width: 100px;
  flex: 0 1 auto;
}

.stat-card__num {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-card__lbl {
  font-size: 0.8125rem;
  color: var(--gray-600);
}

.dash-section {
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.dash-section__title {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.dash-section__hint {
  font-size: 0.8125rem;
  color: var(--gray-400);
  margin-bottom: 1rem;
}

.thermometer--lg {
  margin-bottom: 0;
}

.thermometer-avg {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.75rem;
}

.dist-bars {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.dist-row {
  display: grid;
  grid-template-columns: 7rem 1fr 4.5rem;
  align-items: center;
  gap: 0.75rem;
}

.dist-row__label {
  font-size: 0.875rem;
  font-weight: 600;
}

.dist-row__track {
  height: 10px;
  background: var(--gray-100);
  border-radius: 5px;
  overflow: hidden;
}

.dist-row__fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.dist-bar--growth {
  background: var(--green);
}

.dist-bar--mixed {
  background: var(--amber);
}

.dist-bar--fixed {
  background: var(--red);
}

.dist-row__count {
  font-size: 0.8125rem;
  color: var(--gray-600);
  text-align: right;
}

.hist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.hist-card {
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
}

.hist-card__title {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.625rem;
}

.hist-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
}

.hist-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 2px;
}

.hist-col__bar {
  width: 100%;
  background: var(--gray-800);
  border-radius: 2px 2px 0 0;
  min-height: 0;
  transition: height 0.4s ease;
}

.hist-col__val {
  font-size: 0.625rem;
  color: var(--gray-600);
  line-height: 1;
}

.hist-col__lbl {
  font-size: 0.5625rem;
  color: var(--gray-400);
}

.participants-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 280px;
  overflow-y: auto;
}

.participant-row {
  display: grid;
  grid-template-columns: 2rem 6rem 3rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8125rem;
  padding: 0.5rem 0.75rem;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gray-400);
}

.participant-row--growth {
  border-left-color: var(--green);
}

.participant-row--mixed {
  border-left-color: var(--amber);
}

.participant-row--fixed {
  border-left-color: var(--red);
}

.participant-row__n {
  color: var(--gray-400);
  font-weight: 600;
}

.participant-row__avg {
  font-weight: 700;
}

.participant-row__label {
  color: var(--gray-600);
}

.participant-row__email {
  font-size: 0.75rem;
  color: var(--gray-400);
}

@media (max-width: 600px) {
  .dist-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .dist-row__count {
    text-align: left;
  }

  .participant-row {
    grid-template-columns: 1fr 1fr;
  }
}
