:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #5d687a;
  --border: #dbe3ee;
  --accent: #1f6f78;
  --accent-strong: #15565d;
  --accent-soft: #e8f4f5;
  --success: #1f7a4d;
  --danger: #b42318;
  --warning: #9a6700;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #edf4f7 0, var(--bg) 220px);
  color: var(--text);
}

button, input { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 520px);
  gap: 28px;
  align-items: center;
  padding: 18px clamp(20px, 4vw, 64px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(219, 227, 238, 0.9);
  backdrop-filter: blur(12px);
}

.brand-wrap { display: flex; gap: 14px; align-items: center; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  box-shadow: 0 8px 20px rgba(31, 111, 120, 0.25);
}
.eyebrow { margin: 0 0 2px; color: var(--accent); font-weight: 750; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: 22px; line-height: 1.1; }

.progress-wrap { width: 100%; }
.progress-label { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #e5ebf2; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }

.page-shell { width: min(940px, calc(100% - 32px)); margin: 42px auto; }
.survey-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.section-head { padding: clamp(24px, 4vw, 42px) clamp(22px, 5vw, 58px) 22px; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, #fff, #f8fbfc); }
.section-kicker { margin: 0 0 8px; color: var(--accent); font-weight: 750; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; }
.section-title { margin: 0; font-size: clamp(25px, 4vw, 34px); line-height: 1.15; }
.section-subtitle { max-width: 720px; margin: 12px 0 0; color: var(--muted); line-height: 1.6; }

.intro-panel { margin: 26px clamp(22px, 5vw, 58px) 0; padding: 22px; border-radius: 14px; background: var(--accent-soft); border: 1px solid #c8e3e6; }
.intro-panel h3 { margin: 0 0 10px; font-size: 18px; }
.intro-panel p { margin: 8px 0; line-height: 1.62; }
.intro-panel ul { margin: 12px 0 0; padding-left: 22px; line-height: 1.6; }

.questions { padding: 8px clamp(22px, 5vw, 58px) 28px; }
.question { padding: 28px 0; border-bottom: 1px solid var(--border); }
.question:last-child { border-bottom: 0; }
.question-number { display: inline-block; margin-bottom: 10px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.question-title { margin: 0; font-size: 18px; line-height: 1.48; }
.required-star { color: var(--danger); }
.question-help { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

.options { display: grid; gap: 10px; margin-top: 18px; }
.option {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.option:hover { border-color: #9fc1c5; background: #fbfefe; transform: translateY(-1px); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.option input { margin-top: 3px; accent-color: var(--accent); flex: 0 0 auto; }
.option-label { line-height: 1.45; }

.scale-grid { display: grid; grid-template-columns: repeat(5, minmax(92px, 1fr)); gap: 9px; margin-top: 18px; }
.scale-option { min-height: 94px; display: flex; flex-direction: column; justify-content: center; text-align: center; align-items: center; padding: 12px 8px; }
.scale-value { display: block; margin-bottom: 6px; font-size: 20px; font-weight: 800; color: var(--accent-strong); }
.scale-text { font-size: 12px; line-height: 1.35; color: var(--muted); }
.scale-extras { display: grid; gap: 9px; margin-top: 10px; }

.error-text { min-height: 18px; margin: 10px 0 0; color: var(--danger); font-size: 13px; font-weight: 650; }
.question.invalid .option, .question.invalid .scale-grid { border-color: transparent; }
.question.invalid { scroll-margin-top: 120px; }

.actions { display: flex; justify-content: space-between; gap: 14px; padding: 22px clamp(22px, 5vw, 58px) 30px; border-top: 1px solid var(--border); background: var(--surface-soft); }
.btn { min-height: 46px; padding: 11px 20px; border: 1px solid transparent; border-radius: 11px; font-weight: 750; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 7px 18px rgba(31,111,120,.22); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-secondary { background: #fff; border-color: var(--border); color: var(--text); }

.notice { margin: 16px 0; padding: 15px 17px; border-radius: 12px; line-height: 1.55; }
.notice.error { color: #7a271a; background: #fef3f2; border: 1px solid #fecdca; }
.notice.success { color: #085d3a; background: #ecfdf3; border: 1px solid #abefc6; }
.notice.warning { color: #7a4f00; background: #fffaeb; border: 1px solid #fedf89; }

.end-screen { padding: clamp(36px, 7vw, 72px) clamp(24px, 5vw, 60px); text-align: center; }
.end-icon { display: grid; place-items: center; width: 72px; height: 72px; margin: 0 auto 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 34px; font-weight: 850; }
.end-screen h2 { margin: 0 0 14px; font-size: 30px; }
.end-screen p { max-width: 650px; margin: 10px auto; color: var(--muted); line-height: 1.65; }
.receipt { display: inline-block; margin-top: 14px; padding: 9px 13px; border-radius: 10px; background: var(--surface-soft); border: 1px solid var(--border); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }

.site-footer { width: min(940px, calc(100% - 32px)); margin: 0 auto 42px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.55; }

@media (max-width: 760px) {
  .site-header { position: static; grid-template-columns: 1fr; gap: 15px; padding: 15px 18px; }
  .page-shell { width: min(100% - 20px, 940px); margin: 18px auto 28px; }
  .scale-grid { grid-template-columns: 1fr; }
  .scale-option { min-height: auto; flex-direction: row; justify-content: flex-start; text-align: left; gap: 12px; }
  .scale-value { margin: 0; min-width: 24px; }
  .actions { position: sticky; bottom: 0; z-index: 4; }
  .btn { flex: 1; }
}


/* v1.9: widoczne i dostępne ujawnianie pytań warunkowych */
.question.newly-revealed {
  animation: receptomed-reveal 1.6s ease-out;
  outline: 3px solid rgba(16, 124, 132, 0.22);
  outline-offset: 4px;
}

@keyframes receptomed-reveal {
  0% { background: rgba(16, 124, 132, 0.14); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .question.newly-revealed {
    animation: none;
  }
}
