:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #1f2330;
  --muted: #5b6475;
  --brand: #0f6dff;
  --brand-strong: #0452c9;
  --ok: #007a4d;
  --err: #b00020;
  --border: #d8deea;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at top right, #eef4ff, #f9fafc 45%, #f5f7fb);
  color: var(--text);
}
.container { width: min(1080px, 92%); margin: 0 auto; }
.narrow { max-width: 640px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.row-gap { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.site-header, .site-footer { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-footer { border-top: 1px solid var(--border); border-bottom: none; margin-top: 2rem; }
.site-header .container, .site-footer .container { padding: 1rem 0; }
.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.logo-image {
  display: block;
  width: min(320px, 48vw);
  max-width: 100%;
  height: auto;
}

nav a { margin-left: 1rem; color: var(--text); text-decoration: none; }

.site-disclaimer {
  margin-top: 1.5rem;
  padding: 0.9rem 0;
  background: rgba(255, 255, 255, 0.8);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.site-disclaimer p {
  margin: 0.35rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.app-main { padding: 1.5rem 0 2rem; }
.hero { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.2rem; }
.pill-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.pill { background: #eaf1ff; color: #1448aa; border-radius: 999px; padding: 0.35rem 0.7rem; font-size: 0.9rem; }

.card-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }

.btn {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}
.btn.secondary { background: #fff; color: var(--brand-strong); }
.btn.primary { background: var(--brand-strong); border-color: var(--brand-strong); }

.filter-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.filter-form input, .test-controls select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem;
  background: #fff;
}

.test-controls { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.meta-row { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--muted); }

.test-header {
  margin-bottom: 1rem;
  background: color-mix(in srgb, var(--surface) 94%, #ffffff 6%);
}

.test-header h1 {
  margin: 0;
  line-height: 1.2;
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
}

.test-header .lead {
  margin: 0.75rem 0 0;
  font-size: 1.22rem;
  line-height: 1.45;
}

.test-header .seo-description {
  margin: 0.85rem 0 0;
  padding: 0.85rem 1rem;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 84%, var(--brand) 16%);
  line-height: 1.55;
}

.test-header .meta-row {
  margin: 0 0 0.8rem;
  gap: 0.6rem;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}

.meta-chip strong {
  color: var(--text);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.intro,
.instructions {
  margin: 0.9rem 0;
}

#test-app { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.progress { margin-bottom: 0.8rem; }
.progress-bar { width: 100%; height: 12px; border-radius: 999px; background: #e7edf8; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #1f8bff, #00b7a5); }
.option-list { display: grid; gap: 0.6rem; }
.option-btn { width: 100%; text-align: left; background: #fff; color: var(--text); border: 1px solid var(--border); }
.option-btn.correct { border-color: var(--ok); background: #ebfff5; }
.option-btn.incorrect { border-color: var(--err); background: #ffecef; }
.fill-answer-block { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.fill-input {
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
}
.feedback { border-left: 4px solid var(--brand); background: #f1f6ff; padding: 0.7rem; margin-top: 0.8rem; }

.question-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.report-error-inline-btn {
  margin-left: auto;
}

@media (max-width: 768px) {
  .site-header .container {
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .logo-image {
    width: min(260px, 72vw);
  }

  .btn { width: 100%; text-align: center; }
  .test-controls { align-items: stretch; }
  .test-header .lead {
    font-size: 1.08rem;
  }
}

/* Modo sin distracciones: solo se mantiene visible el test y su accion principal. */
.focus-mode-controls {
  margin: 1rem 0 0.7rem;
}

body.focus-mode .site-header,
body.focus-mode .site-footer,
body.focus-mode .site-disclaimer,
body.focus-mode .test-header,
body.focus-mode .intro,
body.focus-mode .instructions,
body.focus-mode .test-controls,
body.focus-mode .related {
  display: none;
}

body.focus-mode .app-main {
  padding: 0;
}

body.focus-mode .container {
  width: min(1240px, 98%);
}

body.focus-mode .focus-mode-controls {
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 0;
  padding: 0.75rem 0;
  background: #f7f8fb;
}

body.focus-mode #test-app {
  min-height: 88vh;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.header-search {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.header-search input {
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: #fff;
}

.header-search button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .header-search {
    width: 100%;
  }

  .header-search input {
    flex: 1;
    min-width: 0;
  }
}
