/* Estilo visual CREEZCO (base: test DISC Líderes Delfos).
   Patrick Hand para títulos, botones y etiquetas; Caveat para notas a mano; Hanken Grotesk para leer.
   Tinta azul sobre papel crema, tarjetas con borde de tinta y sombra dura desplazada. */
:root {
  color-scheme: light;
  --ink: #1e3a5f;
  --ink2: #16304f;
  --paper: #f4efe4;
  --card: #fdfbf4;
  --muted: #6b7a8c;
  --dash: rgba(30, 58, 95, 0.28);
  --rojo: #b6452c;
  --amarillo: #c08a1f;
  --verde: #4f8068;
  --azul: #3f6b8c;
  /* Texto secundario pequeño: un punto más oscuro que --muted para que se lea bien a 13-14px. */
  --soft: #55657a;
  --line: rgba(30, 58, 95, 0.2);
  --line-strong: rgba(30, 58, 95, 0.42);
  --track: rgba(30, 58, 95, 0.1);
  --danger: var(--rojo);
  --success: var(--verde);
  --hand: "Patrick Hand", "Segoe Print", cursive;
  --note: "Caveat", "Segoe Print", cursive;
  --text: "Hanken Grotesk", system-ui, sans-serif;
  --shadow: 3px 4px 0 rgba(30, 58, 95, 0.14);
  --shadow-btn: 3px 4px 0 rgba(30, 58, 95, 0.25);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); background: var(--paper);
  font-family: var(--text); font-size: 15.5px; line-height: 1.62; -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(30, 58, 95, 0.03) 0, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(30, 58, 95, 0.03) 0, transparent 40%);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-underline-offset: 3px; }
strong { font-weight: 700; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed; z-index: 100; top: 0.5rem; left: 0.5rem; transform: translateY(-160%);
  padding: 0.7rem 1rem; background: var(--card); color: var(--ink); border: 1.6px solid var(--ink); border-radius: 12px;
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 3px; }

/* ---------- Marca ---------- */
.wordmark {
  margin: 0; padding-left: 10px; font-family: var(--hand); font-size: 44px; font-weight: 400;
  letter-spacing: 10px; line-height: 1.05; text-align: center; color: var(--ink);
}
.byline {
  margin: 0.15rem 0 0; padding-left: 6px; font-family: var(--hand); font-size: 15px;
  letter-spacing: 6px; text-align: center; text-transform: uppercase; opacity: 0.85;
}
/* Divisor de onda tipo tilde debajo de la marca */
.wave {
  width: 92px; height: 14px; margin: 10px auto 18px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 92 14'%3E%3Cpath d='M2 8c8-7 15-7 22 0s15 7 22 0 15-7 22 0 14 6 22 0' fill='none' stroke='%231e3a5f' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.eyebrow {
  margin: 0.4rem 0 0.35rem; font-family: var(--hand); font-size: 14px; letter-spacing: 4px;
  text-align: center; text-transform: uppercase; opacity: 0.75;
}
h1, h2, h3, .h { font-family: var(--hand); font-weight: 400; letter-spacing: 1.5px; line-height: 1.2; }
.subtitle, .note-line { font-family: var(--note); font-weight: 600; font-size: 22px; line-height: 1.25; color: var(--muted); }

/* ---------- Portada ---------- */
.cover { min-height: 100svh; display: grid; place-items: start center; padding: 2.4rem 20px 2.5rem; }
.cover-inner { width: min(100%, 560px); text-align: center; }
.cover h1 { margin: 0.2rem 0 0.6rem; font-size: 30px; }
.cover-lead { margin: 0 auto 1.2rem; max-width: 30rem; font-size: 15.5px; line-height: 1.65; }

.card {
  position: relative; margin: 18px 0; padding: 20px 18px; text-align: left;
  border: 1.6px solid var(--ink); border-radius: 14px; background: var(--card); box-shadow: var(--shadow);
}
/* Variante "cinta": franjita azul translúcida pegada arriba al centro */
.card.tape::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 74px; height: 18px;
  transform: translateX(-50%) rotate(-2deg); border-radius: 2px; background: rgba(30, 58, 95, 0.1);
}

.field { margin-bottom: 1.1rem; text-align: left; }
.field label { display: block; margin-bottom: 0.1rem; font-family: var(--hand); font-size: 18px; letter-spacing: 1px; }
.field input {
  display: block; width: 100%; padding: 10px 2px; font-family: var(--text); font-size: 16px; color: var(--ink);
  background: transparent; border: none; border-bottom: 2px solid var(--ink); border-radius: 0; outline: none;
}
.field input:focus-visible { border-bottom-color: var(--amarillo); box-shadow: 0 2px 0 var(--amarillo); }
.field .optional { font-family: var(--text); font-size: 13px; letter-spacing: 0; color: var(--soft); }
.field-hint { display: block; margin-top: 0.35rem; color: var(--soft); font-size: 13px; line-height: 1.45; }

.privacy-box, .reto { margin: 1rem 0; padding: 12px 15px; border-radius: 10px; background: rgba(30, 58, 95, 0.06); text-align: left; }
.privacy-box h2, .reto h2, .reto h3 { margin: 0 0 0.3rem; font-size: 19px; letter-spacing: 1px; }
.privacy-box p { margin: 0.4rem 0; font-size: 14.5px; line-height: 1.6; }
.consent-row { display: grid; grid-template-columns: 1.35rem 1fr; align-items: start; gap: 0.65rem; margin: 1rem 0 1.2rem; font-size: 14.5px; text-align: left; }
.consent-row input { width: 1.2rem; height: 1.2rem; margin-top: 0.2rem; accent-color: var(--ink); }
.consent-row label { cursor: pointer; }
.form-error { color: var(--rojo); font-weight: 700; text-align: left; }
.cover-note { margin: 1.1rem 0 0; }

/* ---------- Test ---------- */
.app-shell { width: min(100%, 560px + 40px); margin: 0 auto; padding: 0 20px; }
.site-header { padding: 2rem 0 1rem; text-align: center; }
.site-header h1 { margin: 0.2rem 0 0.6rem; font-size: 30px; }
.intro { margin: 0 auto; font-size: 15.5px; line-height: 1.65; }

main { padding: 0 0 1.5rem; }
.progress-section {
  position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 0.8rem; margin: 0 -20px 1rem; padding: 0.7rem 20px; border-bottom: 1.4px dashed var(--dash);
  background: rgb(244 239 228 / 95%); backdrop-filter: blur(4px);
}
.progress-section progress {
  width: 100%; height: 12px; appearance: none; -webkit-appearance: none;
  border: 1.4px solid var(--ink); border-radius: 999px; background: var(--card); overflow: hidden;
}
.progress-section progress::-webkit-progress-bar { background: var(--card); }
.progress-section progress::-webkit-progress-value { background: var(--ink); }
.progress-section progress::-moz-progress-bar { background: var(--ink); }
.progress-section output { min-width: 4.6rem; font-family: var(--hand); font-size: 17px; letter-spacing: 1px; text-align: right; }

.questions { margin: 0; padding: 0; list-style: none; }
.question-row { margin: 0 0 18px; }
.question-card {
  min-width: 0; margin: 0; padding: 18px 18px 16px; border: 1.6px solid var(--ink);
  border-radius: 14px; background: var(--card); box-shadow: var(--shadow);
}
.question-card legend { float: left; width: 100%; padding: 0; }
.question-card legend + * { clear: both; }
.question-number { display: block; margin-bottom: 0.25rem; font-family: var(--hand); font-size: 14px; letter-spacing: 3px; text-transform: uppercase; opacity: 0.75; }
.question-text { display: block; margin-bottom: 0.85rem; font-size: 16px; font-weight: 600; line-height: 1.45; }
.rating-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.rating-option { position: relative; min-width: 0; cursor: pointer; }
.rating-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.rating-option span:not(.sr-only) {
  display: grid; min-height: 46px; place-items: center; padding: 0.2rem;
  border: 1.6px solid var(--ink); border-radius: 10px; background: var(--paper);
  font-family: var(--hand); font-size: 21px; color: var(--ink);
  transition: background-color 120ms, color 120ms, transform 120ms, box-shadow 120ms;
}
.rating-option:hover span:not(.sr-only) { background: rgba(30, 58, 95, 0.08); }
.rating-option input:checked + span:not(.sr-only) { background: var(--ink); color: var(--paper); box-shadow: 2px 3px 0 rgba(30, 58, 95, 0.25); transform: translate(-1px, -1px); }
.rating-option input:focus-visible + span:not(.sr-only) { outline: 3px solid var(--amarillo); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.4rem; color: var(--soft); font-size: 13px; }
.reveal-panel { margin: 1.4rem 0 0; padding: 1.3rem 0 0.4rem; border-top: 1.4px dashed var(--dash); text-align: center; }

/* ---------- Botones ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.9rem; padding: 10px 18px;
  font-family: var(--hand); font-size: 19px; letter-spacing: 2px; line-height: 1.1;
  color: var(--paper); background: var(--ink); border: 1.6px solid var(--ink); border-radius: 12px;
  box-shadow: var(--shadow-btn); cursor: pointer; text-decoration: none;
  transition: transform 100ms, box-shadow 100ms;
}
.button:hover:not(:disabled) { background: var(--ink2); }
.button:active:not(:disabled) { transform: translate(2px, 3px); box-shadow: 1px 1px 0 rgba(30, 58, 95, 0.25); }
.button:disabled { cursor: not-allowed; opacity: 0.45; box-shadow: none; }
.button-large { display: flex; width: 100%; min-height: 3.2rem; padding: 13px 18px; font-size: 20px; }
.button-small { min-height: 2.4rem; padding: 6px 13px; font-size: 16px; letter-spacing: 1px; box-shadow: 2px 3px 0 rgba(30, 58, 95, 0.2); }
.button-ghost { background: var(--card); color: var(--ink); }
.button-ghost:hover:not(:disabled) { background: rgba(30, 58, 95, 0.08); }
.button-danger { border-color: var(--rojo); background: var(--rojo); color: var(--card); }
.button-danger:hover:not(:disabled) { background: #9a3a25; }

/* ---------- Resultados ---------- */
.results { margin: 0.5rem 0 1.5rem; text-align: center; }
.results > .eyebrow { margin-top: 0; }
.result-title { margin: 0.1rem 0 0.2rem; font-size: 30px; }
.result-intro { margin: 0.1rem auto 0.8rem; max-width: 30rem; font-family: var(--note); font-weight: 600; font-size: 22px; line-height: 1.25; color: var(--muted); }
.save-status { min-height: 1.5rem; margin: 0.4rem 0; color: var(--verde); font-weight: 600; }
.save-status.error { color: var(--rojo); }
.chart-wrap { max-width: 22rem; margin: 0 auto 0.6rem; }
.chart-svg { display: block; width: 100%; height: auto; }
.score-list { margin: 0.6rem 0 1rem; text-align: left; }
.score-row { margin-bottom: 1rem; }
.score-label { display: flex; justify-content: space-between; align-items: baseline; gap: 0.7rem; margin-bottom: 0.3rem; }
.score-name { font-family: var(--hand); font-size: 20px; letter-spacing: 2px; text-transform: uppercase; }
.score-value { white-space: nowrap; font-size: 14px; color: var(--soft); }
.dominant-tag { margin-left: 0.5rem; padding: 0 0.55rem; border: 1.4px solid var(--ink); border-radius: 999px; font-size: 14px; letter-spacing: 1px; text-transform: none; }
.score-track { height: 14px; overflow: hidden; border: 1.4px solid var(--ink); border-radius: 999px; background: var(--card); }
.score-fill { height: 100%; background: var(--ink); }
.results hr { height: 0; margin: 1.4rem 0; border: 0; border-top: 1.4px dashed var(--dash); }
.readings { display: grid; gap: 18px; text-align: left; }
.reading, .general-reading {
  position: relative; padding: 20px 18px; border: 1.6px solid var(--ink); border-radius: 14px;
  background: var(--card); box-shadow: var(--shadow);
}
.reading h3 { margin: 0 0 0.35rem; font-size: 22px; }
.reading p, .general-reading p { margin: 0.4rem 0; font-size: 15px; line-height: 1.62; }
.reading .reflection-question { margin-top: 0.7rem; font-family: var(--note); font-weight: 600; font-size: 22px; line-height: 1.25; }
.general-reading { margin-top: 22px; text-align: left; }
.general-reading::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 74px; height: 18px;
  transform: translateX(-50%) rotate(-2deg); border-radius: 2px; background: rgba(30, 58, 95, 0.1);
}
.general-reading h3 { margin: 0 0 0.4rem; font-size: 24px; text-align: center; }
.bridge { margin: 18px 0 1.2rem; padding: 12px 15px; border-radius: 10px; background: rgba(30, 58, 95, 0.06); text-align: left; }
.bridge h3 { margin: 0 0 0.3rem; font-size: 19px; }
.bridge p { margin: 0.35rem 0; font-size: 15px; }
.actions { display: grid; gap: 12px; }
.actions .button { width: 100%; }
.print-date { color: var(--soft); font-size: 13px; }

.site-footer { padding: 1.4rem 0 2.2rem; border-top: 1.4px dashed var(--dash); color: var(--soft); font-size: 13.5px; text-align: center; }
.site-footer p { max-width: 34rem; margin: 0.5rem auto; }
.site-footer .footer-mark { margin: 0.2rem 0 0.6rem; color: var(--ink); font-family: var(--note); font-weight: 600; font-size: 30px; }

@media (max-width: 420px) {
  .wordmark { font-size: 38px; letter-spacing: 8px; padding-left: 8px; }
  .cover h1, .site-header h1, .result-title { font-size: 27px; }
  .rating-options { gap: 6px; }
  .question-card { padding: 16px 14px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
@media print {
  body { background: white; color: black; }
  .skip-link, .cover, .site-header, .progress-section, .questions, .reveal-panel, .actions, .site-footer, .save-status, #retry-save { display: none !important; }
  .app-shell { width: 100%; max-width: none; padding: 0; }
  main { padding: 0; }
  .results { display: block !important; margin: 0; }
  .reading, .general-reading, .bridge { break-inside: avoid; box-shadow: none; }
  .score-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .print-date { display: block; margin-top: 1rem; }
}

/* ---------- Panel administrativo (usa esta misma hoja) ---------- */
.admin-body { min-height: 100vh; }
.admin-header { padding: 1rem; border-bottom: 1.4px dashed var(--dash); text-align: center; }
.admin-brand { display: inline-flex; align-items: center; gap: 0.85rem; color: var(--ink); text-decoration: none; }
.admin-brand .wordmark { font-size: 30px; letter-spacing: 7px; }
.admin-brand .byline { margin: 0; }
.admin-main { width: min(100% - 2rem, 76rem); margin: 1.5rem auto 3rem; }
.admin-main h1 { font-size: clamp(26px, 4vw, 32px); }
.admin-login { width: min(100%, 30rem); margin: 4vh auto; }
.panel { position: relative; padding: 20px 18px; border: 1.6px solid var(--ink); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.panel h1, .panel h2 { margin-top: 0; }
.admin-login .field input, .admin-tools .field input {
  padding: 10px 2px; border: none; border-bottom: 2px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink);
}
.admin-message { min-height: 1.5rem; margin: 0.7rem 0; color: var(--verde); font-weight: 600; }
.admin-message.error { color: var(--rojo); }
.dashboard-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.dashboard-heading h1 { margin: 0; }
.dashboard-heading p { margin: 0.25rem 0; }
.dashboard-heading .eyebrow { margin: 0; text-align: left; }
.metrics-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.metric-card { min-width: 0; padding: 1rem; border: 1.6px solid var(--ink); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.metric-card h2 { margin: 0; color: var(--soft); font-size: 16px; letter-spacing: 1px; }
.metric-value { margin: 0.35rem 0 0; font-family: var(--hand); font-size: 34px; }
.metric-text { font-size: 22px; }
.submissions-panel { margin: 1.2rem 0; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.section-heading h2 { margin: 0; }
.section-heading p { margin: 0.2rem 0 0; color: var(--soft); }
.search-form { margin: 1rem 0; }
.search-form label { display: block; margin-bottom: 0.35rem; font-family: var(--hand); font-size: 17px; letter-spacing: 1px; }
.search-controls { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.search-controls input {
  flex: 1 1 16rem; padding: 8px 2px; border: none; border-bottom: 2px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink);
}
.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; text-align: left; }
.table-wrap th, .table-wrap td { padding: 0.65rem 0.55rem; border-bottom: 1.4px dashed var(--dash); vertical-align: top; }
.table-wrap th { font-family: var(--hand); font-weight: 400; font-size: 16px; letter-spacing: 1px; background: rgba(30, 58, 95, 0.06); }
.table-secondary { display: block; color: var(--soft); font-size: 0.85rem; }
.table-scores { min-width: 13rem; font-size: 0.86rem; }
.table-date { min-width: 10rem; font-size: 0.88rem; }
.table-actions { min-width: 10rem; white-space: nowrap; }
.table-actions .button { margin: 0.15rem; }
.empty-state { padding: 1rem; color: var(--soft); text-align: center; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 0.8rem; margin-top: 1rem; }
.admin-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; }
.admin-tools .field small, .admin-login .field small { display: block; margin-top: 0.3rem; color: var(--soft); font-size: 13px; }
.admin-back { margin: 1rem 0; text-align: center; }
.detail-dialog {
  width: min(92vw, 54rem); max-height: 88vh; padding: 1.1rem; overflow: auto;
  border: 1.6px solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink);
}
.detail-dialog::backdrop { background: rgb(22 48 79 / 60%); }
.dialog-heading { position: sticky; top: -1.1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: -1.1rem -1.1rem 1rem; padding: 0.75rem 1rem; border-bottom: 1.4px dashed var(--dash); background: var(--paper); }
.dialog-heading h2 { margin: 0; font-size: 24px; }
.detail-identity { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 0.8rem; }
.detail-identity dt { font-weight: 700; }
.detail-identity dd { margin: 0; overflow-wrap: anywhere; }
.detail-answers { padding-left: 1.5rem; }
.detail-answers li { padding: 0.55rem 0; border-bottom: 1.4px dashed var(--dash); }
.detail-answers p { margin: 0.2rem 0; }
.detail-answer-meta { color: var(--soft); font-weight: 700; }

@media (max-width: 760px) {
  .admin-main { width: min(100% - 1rem, 76rem); margin-top: 0.8rem; }
  .metrics-grid { grid-template-columns: 1fr; gap: 0.7rem; }
  .metric-card { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
  .metric-value { font-size: 26px; text-align: right; }
  .admin-tools { grid-template-columns: 1fr; }
  .dashboard-heading { align-items: flex-start; }
}
@media (max-width: 520px) {
  .section-heading { align-items: flex-start; flex-direction: column; }
  .table-wrap th, .table-wrap td { padding: 0.5rem 0.4rem; }
  .table-wrap table { min-width: 46rem; }
  .admin-brand { display: block; }
  .admin-brand .byline { margin-top: 0.2rem; }
  .detail-identity { grid-template-columns: 1fr; gap: 0; }
  .detail-identity dd { margin-bottom: 0.5rem; }
}
