/* ============================================================
 * CCKA (Knowledge Assessment) - vizuál
 * Rovnaká štruktúra a štýl ako psychometrická appka, farby v žltých/piesočných odtieňoch
 * okolo #E5DDC5 (farba produktu na webe). Vybraná odpoveď = silnejší odtieň žltej.
 * ============================================================ */

:root {
  --bg: #f9f4e4;
  --card-bg: #ffffff;
  --ink: #3a3420;
  --muted: #7d7456;

  /* piesková (základ #E5DDC5) */
  --sand-50: #fcfaf2;
  --sand-100: #f6f1df;
  --sand-200: #e5ddc5;      /* ZÁKLAD - farba produktu */
  --sand-300: #d8cca8;
  --sand-400: #c9b87f;

  /* žltá / zlatá - silnejšie odtiene tej istej farby */
  --gold-100: #fbf0c4;
  --gold-200: #f6e49a;
  --gold-400: #e8c64f;
  --gold-600: #c9a227;
  --gold-700: #a8860f;
  --gold-800: #5f4d0c;

  --pink: #d0557f;
  --line: #e9e1c8;
  --line-strong: #d8cca8;
  --error: #b3261e;
  --focus: #3b82f6;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 8px 28px rgba(120, 98, 20, .11), 0 1px 3px rgba(120, 98, 20, .08);
  --maxw: 780px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  font-family: ui-rounded, "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  line-height: 1.6;
  font-size: 16px;
  background:
    radial-gradient(620px 420px at -5% -5%, #f3e7b9 0%, transparent 70%),
    radial-gradient(720px 520px at 105% 12%, var(--sand-200) 0%, transparent 70%),
    radial-gradient(640px 480px at 40% 110%, #fbf1cf 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 18px 96px;
}

.card {
  background: var(--card-bg);
  border: 1px solid rgba(168, 134, 15, .22);
  border-radius: var(--radius);
  padding: 30px 30px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

h1 { font-size: 24px; line-height: 1.25; margin: 0 0 10px; color: var(--gold-800); }
.subtitle { color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.expired-card h1 { margin: 6px 0; }

/* ---------- intro ---------- */
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px 34px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 2px dashed var(--sand-300);
}
/* Logá sú orezané na viditeľný obsah; GBH je zámerne väčšie ako ICQAW */
.brand img { display: block; width: auto; max-width: 100%; }
.brand .brand-gbh { height: 84px; }
.brand .brand-icqaw { height: 52px; }

.intro-head { text-align: center; margin-bottom: 8px; }
.intro-head h1 { font-size: 22px; letter-spacing: .02em; }
#intro-subtitle { font-weight: 700; }

h2.section-heading {
  font-size: 17px;
  margin: 26px 0 8px;
  color: var(--gold-800);
  display: flex;
  align-items: center;
  gap: 10px;
}
h2.section-heading::before {
  content: "";
  width: 8px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--gold-400), var(--sand-300));
  flex-shrink: 0;
}
#intro-sections p { margin: 8px 0; }
#intro-sections ul, #intro-sections ol { margin: 8px 0 8px 22px; padding: 0; }
#intro-sections li { margin: 5px 0; }
#intro-sections li::marker { color: var(--gold-700); font-weight: 700; }
#intro-sections p.compact { margin: 0; }
#intro-sections a { color: var(--gold-800); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.kv-list { list-style: none; margin-left: 0 !important; }
.kv-list li { margin: 8px 0; padding: 8px 14px; background: var(--sand-100); border-radius: 12px; }
.kv-list .kv-label { font-weight: 700; color: var(--gold-800); }

.closing-bold {
  font-weight: 700;
  margin: 22px 0 0;
  padding: 14px 16px;
  background: var(--sand-100);
  border-left: 5px solid var(--gold-600);
  border-radius: 12px;
}
.required-note { color: var(--muted); font-size: 14px; margin-top: 0; }
.start-timer-note { margin: 16px 0 0; font-size: 14px; color: var(--muted); text-align: center; }

/* ---------- forms ---------- */
.field { margin: 18px 0; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--gold-800); }
.req { color: var(--pink); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.hint.center { text-align: center; margin-top: 14px; }

input[type=text], input[type=email], select {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: #fffdf6;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input[type=text]:hover, input[type=email]:hover, select:hover { border-color: var(--sand-400); }
input[type=text]:focus, input[type=email]:focus, select:focus {
  outline: none;
  border-color: var(--gold-600);
  box-shadow: 0 0 0 4px rgba(201, 162, 39, .26);
}

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  padding: 13px 26px;
  border: 2px solid var(--gold-600);
  border-radius: 999px;
  background: #fff;
  color: var(--gold-800);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  border-color: var(--gold-700);
  color: #3b2f08;
  box-shadow: 0 6px 16px rgba(168, 134, 15, .30);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(168, 134, 15, .38); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
#start-btn, #submit-btn, #code-btn { margin-top: 12px; width: 100%; font-size: 17px; }
.start-timer-note + #start-btn { margin-top: 10px; }

.error-text { color: var(--error); font-weight: 700; }

/* ---------- progress + časovač ---------- */
.progress-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 0 12px;
  margin-bottom: 4px;
}
.progress-inner {
  background: rgba(255, 255, 255, .95);
  border: 1px solid rgba(168, 134, 15, .28);
  border-radius: 22px;
  padding: 9px 16px 9px 16px;
  box-shadow: 0 4px 16px rgba(120, 98, 20, .12);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  gap: 18px;
}
/* logo vľavo hore v pevnej lište - ostáva viditeľné pri skrolovaní testu */
.bar-logo { display: block; height: 50px; width: auto; flex: 0 0 auto; }
.bar-progress { flex: 1 1 auto; min-width: 0; }
#progress-label { font-size: 14px; font-weight: 700; color: var(--gold-800); }
.progress-track {
  margin-top: 7px;
  height: 10px;
  background: var(--sand-100);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-700));
  border-radius: 999px;
  transition: width .25s ease;
}

/* odpočet zostávajúceho času - stále viditeľný v hornej lište */
.bar-timer {
  flex: 0 0 auto;
  text-align: center;
  line-height: 1.15;
  padding: 6px 14px 7px;
  min-width: 124px;
  border-radius: 16px;
  background: var(--sand-100);
  border: 1.5px solid var(--sand-300);
  transition: background .2s, border-color .2s;
}
.timer-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.timer-value {
  display: block;
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  color: var(--gold-800);
}
.bar-timer.warn { background: #fff0bd; border-color: #e0a800; }
.bar-timer.warn .timer-value { color: #7a4f00; }
.bar-timer.danger, .bar-timer.over { background: #fde3e0; border-color: #d9534f; }
.bar-timer.danger .timer-value, .bar-timer.over .timer-value { color: #a1261d; }
.bar-timer.danger .timer-value { animation: timer-pulse 1.4s ease-in-out infinite; }
@keyframes timer-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .bar-timer.danger .timer-value { animation: none; }
}
.timer-warning {
  margin: 8px 0 0;
  padding: 9px 16px;
  border-radius: 14px;
  background: #fff0bd;
  border: 1.5px solid #e0a800;
  color: #6b4600;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(120, 98, 20, .12);
}
.timer-warning.danger { background: #fde3e0; border-color: #d9534f; color: #8c1d16; }

/* ---------- question cards ---------- */
.q {
  position: relative;
  background: var(--card-bg);
  border: 1px solid rgba(168, 134, 15, .20);
  border-left: 7px solid var(--sand-400);
  border-radius: var(--radius);
  padding: 24px 26px 26px;
  margin: 0 0 22px;
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.q.answered { border-left-color: var(--gold-600); }
.q.answered::after {
  content: "\2713";
  position: absolute;
  top: 16px; right: 18px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--gold-700);
  color: #fff;
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.q.unanswered-flag {
  border-left-color: var(--error);
  background: #fff6f5;
  box-shadow: 0 0 0 3px rgba(179, 38, 30, .15), var(--shadow);
}

.q-header { margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.q-code {
  display: inline-block;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: .03em;
  color: #000;
  background: var(--sand-100);
  border: 1px solid var(--sand-300);
  padding: 4px 16px;
  border-radius: 999px;
}
.q-req { color: var(--pink); font-weight: 800; }

.q-text { margin: 0 0 16px; font-size: 17px; color: var(--ink); }
.q-text p { margin: 0; }
.q-text p + p { margin-top: 14px; }

.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  background: #fffdf6;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s, transform .1s;
}
.opt:hover { border-color: var(--sand-400); background: var(--sand-100); }
.opt:focus-within { outline: 3px solid rgba(59, 130, 246, .45); outline-offset: 1px; }
/* vybraná odpoveď = silnejšia žltá */
.opt.checked {
  border-color: var(--gold-600);
  background: var(--gold-200);
  box-shadow: 0 2px 10px rgba(168, 134, 15, .22);
}
.opt-text { flex: 1 1 auto; min-width: 0; }

/* vlastné radio */
.opt input[type=radio] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 22px; height: 22px;
  margin: 2px 0 0;
  border: 2px solid var(--gold-400);
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opt input[type=radio]::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
  transition: transform .12s;
}
.opt input[type=radio]:checked { border-color: var(--gold-700); background: var(--gold-700); }
.opt input[type=radio]:checked::before { transform: scale(1); }

/* ---------- question images (všetky v rámčekoch rovnakej veľkosti) ---------- */
.q-image-wrap { margin: 4px 0 18px; display: flex; justify-content: center; }
.q-image {
  display: block;
  width: 100%;
  max-width: 420px;
  height: 260px;
  object-fit: cover;
  object-position: center;
  border: 4px solid #fff;
  outline: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(120, 98, 20, .20);
  background: var(--sand-100);
  transition: transform .15s;
}

/* ---------- submit / states ---------- */
.submit-area { text-align: center; }

.spinner {
  width: 46px; height: 46px;
  border: 5px solid var(--sand-100);
  border-top-color: var(--gold-600);
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.assessment-code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  background: var(--sand-100);
  border: 1px dashed var(--gold-400);
  border-radius: 12px;
  padding: 10px 16px;
  display: inline-block;
}

/* ---------- súhlas (Participant Agreement and Consent Form) ---------- */
/* Karta vyplní okno: dokument sa skroluje vo vnútri, tlačidlo "I Agree" ostáva stále na očiach. */
/* na obrazovke so súhlasom sa spodná rezerva stránky (96 px pre otázky) nepotrebuje */
body.is-consent #app { padding-bottom: 28px; }
.consent-card {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  min-height: 470px;
  max-height: 1000px;
  margin-bottom: 0;
  padding-bottom: 24px;
}
.consent-card .brand { flex: 0 0 auto; padding-bottom: 14px; margin-bottom: 14px; }
.consent-card .brand .brand-gbh { height: 54px; }
.consent-card .brand .brand-icqaw { height: 34px; }

.consent-frame {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fffdf6;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.consent-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 28px 28px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.consent-scroll:focus-visible { outline: 3px solid rgba(59, 130, 246, .45); outline-offset: -3px; }
.consent-meter { flex: 0 0 auto; height: 6px; background: var(--sand-100); }
.consent-meter-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-700));
  transition: width .12s linear;
}
.consent-hint { flex: 0 0 auto; margin: 10px 0 0; text-align: center; font-size: 14px; color: var(--muted); min-height: 1.5em; }
.consent-hint:not(.done) { color: var(--gold-800); font-size: 17px; font-weight: 800; line-height: 1.35; text-transform: uppercase; }
.consent-hint.done { color: var(--gold-700); font-weight: 700; }
#consent-error { flex: 0 0 auto; margin: 6px 0 0; font-size: 14px; }
.consent-agree { flex: 0 0 auto; }

/* text dokumentu */
.consent-doc { font-size: 12px; line-height: 1.55; color: var(--ink); }
.consent-doc p { margin: 0 0 8px; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.consent-doc strong { color: var(--gold-800); }
.consent-doc a { color: var(--gold-700); font-weight: 700; overflow-wrap: anywhere; }
.consent-doc .nw { white-space: nowrap; }

.consent-doc .c-title {
  margin: 0 0 5px;
  font-size: 15px;
  letter-spacing: .03em;
  text-align: center;
  color: var(--gold-800);
}
.consent-doc .c-subtitle {
  margin: 0 0 10px;
  padding-bottom: 8px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 800;
  color: #8a6a1b;
  border-bottom: 2px solid var(--gold-400);
}
.consent-doc .c-notice {
  margin: 0 0 14px;
  padding: 9px 14px;
  background: var(--sand-100);
  border-left: 5px solid var(--gold-600);
  border-radius: 12px;
  font-style: italic;
}
.consent-doc .c-notice p { margin: 0; }
.consent-doc .c-notice strong { font-style: normal; }
.consent-doc .c-pre { margin: 14px 0 4px; font-size: 13px; color: var(--gold-800); }
.consent-doc .c-section {
  margin: 18px 0 7px;
  padding-bottom: 4px;
  font-size: 12.5px;
  letter-spacing: .02em;
  color: var(--gold-800);
  border-bottom: 2px solid var(--gold-400);
}
.consent-doc .c-sub { margin: 12px 0 4px; font-size: 12px; color: var(--gold-700); }
.consent-doc .c-note { font-size: 11px; font-style: italic; color: var(--muted); text-align: left; }
.consent-doc .c-item { display: flex; gap: .6em; }
.consent-doc .c-lab { flex: 0 0 1.9em; font-weight: 700; color: var(--gold-800); }
.consent-doc .c-txt { flex: 1 1 auto; min-width: 0; }

.consent-doc .c-list { margin: 3px 0 10px; padding-left: 20px; }
.consent-doc .c-list li { margin: 3px 0; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.consent-doc .c-list li::marker { color: var(--gold-700); }

.consent-doc .c-domains {
  margin: 10px 0 14px;
  border: 1px solid var(--sand-300);
  border-radius: 14px;
  overflow: hidden;
}
.consent-doc .c-domains-head {
  margin: 0;
  padding: 9px 14px;
  background: var(--gold-800);
  color: #fff;
  font-weight: 700;
  text-align: center;
}
.consent-doc .c-domains .c-list { margin: 0; padding: 12px 18px 12px 40px; background: #fff; }

/* tlačidlo "☑ I AGREE" pod dokumentom (zamknuté, kým človek nedoskroluje na koniec) */
.consent-agree {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 14px 18px;
  font: inherit;
  text-align: center;
  color: #fff;
  background: var(--gold-800);
  border: 2px solid var(--gold-800);
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(95, 77, 12, .30);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, opacity .15s;
}
.consent-agree:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(95, 77, 12, .38); }
.consent-agree:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.consent-agree:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.consent-agree .agree-title { display: block; font-size: 18px; font-weight: 800; letter-spacing: .06em; }
.consent-agree .agree-text { display: block; margin-top: 4px; font-size: 14px; font-style: italic; opacity: .92; }
.consent-agree .nw { white-space: nowrap; }
.consent-agree .c-check {
  display: inline-block;
  position: relative;
  width: 20px; height: 20px;
  margin-right: 10px;
  vertical-align: -3px;
  border: 2px solid #fff;
  border-radius: 5px;
}
.consent-agree .c-check::after {
  content: "";
  position: absolute;
  left: 4px; top: 0;
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

/* lokálne vývojové pomôcky (zobrazia sa len pri `npm run dev:nodb`) */
.dev-fill {
  position: fixed; left: 14px; bottom: 14px; z-index: 60;
  font: inherit; font-size: 13px; font-weight: 700;
  background: #2c3326; color: #fff; border: 0; border-radius: 10px;
  padding: 9px 14px; opacity: .85; cursor: pointer;
}
.dev-fill:hover { opacity: 1; }
.dev-note { margin-top: 14px; padding: 8px 12px; background: #fff6d9; border: 1px dashed #d4b24c; border-radius: 10px; font-size: 14px; }

/* nízke okná (menší notebook): menej "okolia", viac miesta pre text súhlasu */
@media (max-height: 720px) {
  .consent-card { min-height: 360px; padding-top: 16px; padding-bottom: 16px; }
  .consent-card .brand { padding-bottom: 8px; margin-bottom: 8px; }
  .consent-card .brand .brand-gbh { height: 40px; }
  .consent-card .brand .brand-icqaw { height: 26px; }
  .consent-hint { margin-top: 6px; font-size: 13px; }
  .consent-hint:not(.done) { font-size: 15px; }
  .consent-agree { padding: 8px 14px; margin-top: 8px; }
  .consent-agree .agree-title { font-size: 16px; }
  .consent-agree .agree-text { font-size: 12px; margin-top: 2px; }
}

@media (max-width: 560px) {
  #app { padding: 16px 12px 80px; }
  .card { padding: 22px 18px; }
  .q { padding: 20px 16px 22px; border-left-width: 6px; }
  .q.answered::after { top: 12px; right: 12px; }
  .brand .brand-gbh { height: 64px; }
  .brand .brand-icqaw { height: 40px; }
  .bar-logo { height: 30px; }
  .progress-inner { gap: 10px; padding: 8px 10px 8px 10px; }
  .bar-timer { min-width: 92px; padding: 4px 8px 5px; border-radius: 12px; }
  .timer-label { font-size: 9.5px; }
  .timer-value { font-size: 16px; }
  #progress-label { font-size: 12.5px; }
  .q-image { height: 200px; }
  .q-text { font-size: 16px; }

  body.is-consent #app { padding-bottom: 16px; }
  .consent-card { height: calc(100vh - 32px); height: calc(100dvh - 32px); padding: 16px 14px 18px; }
  .consent-card .brand { padding-bottom: 10px; margin-bottom: 10px; gap: 10px 22px; }
  .consent-card .brand .brand-gbh { height: 42px; }
  .consent-card .brand .brand-icqaw { height: 28px; }
  .consent-hint:not(.done) { font-size: 14px; }
  .consent-scroll { padding: 16px 16px 22px; }
  .consent-doc { font-size: 11.5px; }
  .consent-doc p, .consent-doc .c-list li { text-align: left; hyphens: manual; -webkit-hyphens: manual; }
  .consent-doc .c-title { font-size: 14px; }
  .consent-agree { padding: 11px 12px; margin-top: 10px; }
  .consent-agree .agree-title { font-size: 16px; }
  .consent-agree .agree-text { font-size: 12.5px; }
  .consent-doc .c-domains .c-list { padding-left: 34px; }
}
