@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Nunito:wght@400;500;600;700;800;900&display=swap');

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

:root {
  --granat: #1B4F8A;
  --granat-dark: #153d6b;
  --amber: #F5A623;
  --amber-dark: #d48b15;
  --jasny-blekut: #E8F4FD;
  --tlo: #F8F9FC;
  --karta: #FFFFFF;
  --tekst: #1A2332;
  --tekst-jasny: #6B7A8D;
  --sukces: #27AE60;
  --ostrzezenie: #E67E22;
  --niebezpieczenstwo: #E74C3C;
  --border: #E2E8F0;
  --radius: 16px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--tlo);
  color: var(--tekst);
  min-height: 100vh;
  line-height: 1.6;
}

.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

.header {
  background: var(--granat);
  color: white;
  text-align: center;
  padding: 20px 16px 16px;
  box-shadow: 0 4px 20px rgba(27,79,138,.25);
}

.header-logo { font-family: 'DM Serif Display', serif; font-size: 2rem; letter-spacing: -.5px; line-height: 1; }
.header-logo span { color: var(--amber); }
.header-sub { font-size: .85rem; opacity: .8; margin-top: 4px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }

.container { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; flex: 1; }

.screen { display: none; animation: fadeIn .35s ease; }
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

h1, h2 { font-family: 'DM Serif Display', serif; color: var(--granat); line-height: 1.2; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: 8px; }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); margin-bottom: 8px; }

.subtitle { color: var(--tekst-jasny); font-size: 1rem; font-weight: 600; margin-bottom: 28px; }

/* ─── RODO INFO BOX ─── */
.rodo-info-box {
  background: var(--jasny-blekut);
  border-left: 4px solid var(--granat);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 28px;
}

.rodo-info-box .rodo-icon { font-size: 1.3rem; margin-bottom: 6px; }

.rodo-info-box .rodo-title {
  font-family: 'DM Serif Display', serif;
  color: var(--granat);
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.rodo-info-box .rodo-text {
  font-size: .85rem;
  font-weight: 600;
  color: var(--tekst);
  line-height: 1.6;
  white-space: pre-line;
}

/* ─── CARDS ─── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.card {
  background: var(--karta);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  cursor: pointer;
  transition: all .2s ease;
  text-align: center;
  user-select: none;
}

.card:hover, .card:focus-visible {
  border-color: var(--granat);
  box-shadow: 0 8px 32px rgba(27,79,138,.15);
  transform: translateY(-3px);
  outline: none;
}

.card .card-icon { font-size: 2.5rem; margin-bottom: 12px; line-height: 1; }
.card .card-title { font-family: 'DM Serif Display', serif; font-size: 1.3rem; color: var(--granat); margin-bottom: 4px; }
.card .card-desc { font-weight: 700; color: var(--amber); font-size: .9rem; }
.card .card-sub { color: var(--tekst-jasny); font-size: .82rem; margin-top: 6px; font-weight: 600; }

.cards-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 24px 0; }

.area-card {
  background: var(--karta);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  cursor: pointer;
  transition: all .2s ease;
  text-align: center;
  user-select: none;
}

.area-card:hover, .area-card:focus-visible {
  border-color: var(--amber);
  box-shadow: 0 8px 32px rgba(245,166,35,.2);
  transform: translateY(-3px);
  outline: none;
}

.area-card .area-icon { font-size: 2rem; margin-bottom: 8px; }
.area-card .area-title { font-family: 'DM Serif Display', serif; font-size: 1.1rem; color: var(--granat); font-weight: 400; }

.disclaimer-small { text-align: center; color: var(--tekst-jasny); font-size: .8rem; font-weight: 600; margin-top: 12px; padding: 0 8px; }

/* ─── PROGRESS ─── */
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.progress-label { font-weight: 700; color: var(--granat); font-size: .95rem; }
.progress-count { font-weight: 800; color: var(--amber); font-size: .95rem; }

.progress-bar-wrap { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 28px; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, var(--granat), var(--amber)); border-radius: 999px; transition: width .4s cubic-bezier(.4,0,.2,1); }

/* ─── QUESTION ─── */
.question-card { background: var(--karta); border-radius: var(--radius); padding: 28px 24px; margin-bottom: 20px; border: 2px solid var(--border); box-shadow: 0 2px 12px rgba(0,0,0,.04); }
.question-intro { background: var(--jasny-blekut); border-left: 4px solid var(--granat); border-radius: 8px; padding: 14px 16px; font-size: .9rem; font-weight: 600; color: var(--granat); margin-bottom: 20px; }
.question-text { font-size: 1.1rem; font-weight: 700; color: var(--tekst); margin-bottom: 20px; line-height: 1.5; }
.options-list { display: flex; flex-direction: column; gap: 10px; }

.option-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border: 2px solid var(--border); border-radius: 12px;
  background: white; cursor: pointer; text-align: left; transition: all .15s ease;
  font-family: 'Nunito', sans-serif; font-size: .95rem; font-weight: 600; color: var(--tekst); width: 100%;
}

.option-btn:hover { border-color: var(--granat); background: var(--jasny-blekut); transform: translateX(4px); }
.option-btn.selected { border-color: var(--granat); background: var(--granat); color: white; }
.option-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; transition: all .15s; }
.option-btn.selected .option-dot { background: white; border-color: white; }

/* ─── CONSENT SECTION ─── */
.consent-section {
  background: var(--karta);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.consent-section h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.2rem;
  color: var(--granat);
  margin-bottom: 14px;
}

.check-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--jasny-blekut);
  border: 2px solid var(--granat);
  border-radius: 8px;
  color: var(--granat);
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: .85rem;
  padding: 7px 14px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all .15s;
}

.check-all-btn:hover { background: var(--granat); color: white; }

.consent-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.consent-item:last-of-type { border-bottom: none; }

.consent-item input[type=checkbox] {
  width: 20px; height: 20px;
  accent-color: var(--granat);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}

.consent-item label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--tekst);
  line-height: 1.45;
  cursor: pointer;
}

.consent-item label .req { color: var(--niebezpieczenstwo); font-weight: 900; }
.consent-item label .opt { color: var(--tekst-jasny); font-size: .8rem; font-weight: 700; }

.consent-footnote {
  font-size: .8rem;
  color: var(--tekst-jasny);
  font-weight: 600;
  margin-top: 14px;
  line-height: 1.5;
}

/* ─── EMAIL SECTION ─── */
.email-section { background: var(--karta); border: 2px solid var(--border); border-radius: var(--radius); padding: 28px 24px; margin-top: 4px; }
.email-section h3 { font-family: 'DM Serif Display', serif; font-size: 1.3rem; color: var(--granat); margin-bottom: 6px; }
.email-section p { color: var(--tekst-jasny); font-size: .9rem; font-weight: 600; margin-bottom: 20px; }

.input-group { margin-bottom: 16px; }
.input-group label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; color: var(--tekst); }

.input-field { width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: 10px; font-family: 'Nunito', sans-serif; font-size: .95rem; color: var(--tekst); transition: border-color .15s; outline: none; }
.input-field:focus { border-color: var(--granat); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px; border-radius: 12px;
  font-family: 'Nunito', sans-serif; font-size: 1rem; font-weight: 800;
  cursor: pointer; transition: all .2s ease; border: none; text-decoration: none;
}

.btn-primary { background: var(--granat); color: white; box-shadow: 0 4px 16px rgba(27,79,138,.3); }
.btn-primary:hover:not(:disabled) { background: var(--granat-dark); box-shadow: 0 8px 24px rgba(27,79,138,.4); transform: translateY(-2px); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-outline { background: transparent; color: var(--granat); border: 2px solid var(--granat); }
.btn-outline:hover { background: var(--jasny-blekut); }
.btn-full { width: 100%; justify-content: center; margin-top: 20px; }

/* ─── RESULT SCREEN ─── */
.result-header { text-align: center; margin-bottom: 20px; }
.result-area { color: var(--tekst-jasny); font-size: 1rem; font-weight: 700; margin-top: 6px; }

.score-bar-wrap { background: var(--karta); border: 2px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.score-nums { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 10px; font-size: .95rem; }
.score-bar-bg { height: 18px; background: var(--border); border-radius: 999px; overflow: hidden; }
.score-bar-fg { height: 100%; border-radius: 999px; transition: width 1s cubic-bezier(.4,0,.2,1); }
.score-bar-fg.niski   { background: linear-gradient(90deg,#27AE60,#2ecc71); }
.score-bar-fg.umiarkowany { background: linear-gradient(90deg,#E67E22,#F5A623); }
.score-bar-fg.wysoki  { background: linear-gradient(90deg,#c0392b,#E74C3C); }

.badge { display: inline-block; padding: 6px 20px; border-radius: 999px; font-weight: 900; font-size: .85rem; letter-spacing: 1px; text-transform: uppercase; margin-top: 12px; }
.badge.niski        { background: #d5f5e3; color: #1e8449; }
.badge.umiarkowany  { background: #fef3cd; color: #935e0b; }
.badge.wysoki       { background: #fde8e8; color: #922b21; }

.interpretation-box { background: var(--karta); border: 2px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; font-weight: 600; line-height: 1.6; color: var(--tekst); }

.rec-box { border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.rec-box.niski       { background: #d5f5e3; border: 2px solid #a9dfbf; }
.rec-box.umiarkowany { background: #fef9ec; border: 2px solid #fad99d; }
.rec-box.wysoki      { background: #fde8e8; border: 2px solid #f1948a; }
.rec-box p { font-weight: 700; margin-bottom: 16px; }

.calendly-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 24px; background: var(--granat); color: white;
  border-radius: 12px; font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .95rem;
  text-decoration: none; transition: all .2s; box-shadow: 0 4px 16px rgba(27,79,138,.3);
}

.rec-box.wysoki .calendly-btn { background: var(--niebezpieczenstwo); font-size: 1.05rem; padding: 16px 28px; box-shadow: 0 4px 20px rgba(231,76,60,.35); }
.calendly-btn:hover { opacity: .9; transform: translateY(-2px); }

/* ─── RESULT DISCLAIMERS ─── */
.result-disclaimer-box {
  background: #fff3cd;
  border: 2px solid #F5A623;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 16px 0;
  line-height: 1.55;
}

.result-disclaimer-box .disc-title {
  font-weight: 900;
  font-size: 1rem;
  color: #664d03;
  margin-bottom: 8px;
}

.result-disclaimer-box .disc-text {
  font-size: .88rem;
  font-weight: 600;
  color: #664d03;
}

.crisis-phones-box {
  background: #fee2e2;
  border: 2px solid #fca5a5;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 12px 0 20px;
  text-align: center;
}

.crisis-phones-box .cp-title {
  font-weight: 800;
  color: #991b1b;
  font-size: .95rem;
  margin-bottom: 8px;
}

.crisis-phones-box .cp-numbers {
  font-size: 1rem;
  font-weight: 800;
  color: #7f1d1d;
  line-height: 1.8;
}

.crisis-phones-box .cp-sub {
  font-size: .8rem;
  font-weight: 700;
  color: #991b1b;
  margin-top: 6px;
}

/* ─── INLINE CRISIS ALERT ─── */
.crisis-alert {
  background: #fde8e8;
  border: 2px solid var(--niebezpieczenstwo);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 16px 0;
  font-weight: 700;
  color: var(--niebezpieczenstwo);
  font-size: .95rem;
  line-height: 1.5;
}

/* ─── CRISIS MODAL ─── */
.crisis-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.82);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.crisis-modal-overlay.active { display: flex; }

.crisis-modal-card {
  background: white;
  border-radius: 20px;
  padding: 36px 28px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
  animation: modalIn .3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

.crisis-modal-icon { font-size: 3rem; margin-bottom: 12px; line-height: 1; }
.crisis-modal-title { font-family: 'DM Serif Display', serif; color: var(--granat); font-size: 1.8rem; margin-bottom: 14px; }
.crisis-modal-text { font-size: .95rem; font-weight: 600; color: var(--tekst); margin-bottom: 24px; line-height: 1.6; }

.crisis-modal-phones { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }

.crisis-phone-btn {
  display: block;
  padding: 16px 20px;
  border-radius: 14px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
  transition: all .15s;
  background: var(--niebezpieczenstwo);
  color: white;
  box-shadow: 0 4px 16px rgba(231,76,60,.35);
}

.crisis-phone-btn small { display: block; font-size: .8rem; font-weight: 600; opacity: .9; margin-top: 3px; }
.crisis-phone-btn:hover { opacity: .9; transform: translateY(-2px); }

.btn-continue-crisis {
  background: #e5e7eb;
  color: #374151;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: all .15s;
}

.btn-continue-crisis:hover { background: #d1d5db; }

/* ─── BACK + MISC ─── */
.back-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--tekst-jasny); font-weight: 700; font-size: .9rem; cursor: pointer; border: none; background: none; padding: 0; margin-bottom: 20px; font-family: 'Nunito', sans-serif; transition: color .15s; }
.back-btn:hover { color: var(--granat); }

.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.4); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── ADMIN ─── */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: .82rem; }
.admin-table th, .admin-table td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.admin-table th { background: var(--granat); color: white; font-weight: 700; }
.admin-table tr:nth-child(even) { background: var(--tlo); }

/* ─── LOADING ─── */
#loading-overlay { display: none; position: fixed; inset: 0; background: rgba(255,255,255,.7); backdrop-filter: blur(4px); z-index: 100; align-items: center; justify-content: center; flex-direction: column; gap: 16px; font-weight: 700; color: var(--granat); }
#loading-overlay.show { display: flex; }
.loading-ring { width: 48px; height: 48px; border: 5px solid var(--jasny-blekut); border-top-color: var(--granat); border-radius: 50%; animation: spin .8s linear infinite; }

/* ─── SAFETY FOOTER ─── */
.safety-footer { background: var(--jasny-blekut); border: 2px solid #bee3f8; border-radius: var(--radius); padding: 18px 20px; margin-top: 20px; text-align: center; font-size: .9rem; font-weight: 700; color: var(--granat); line-height: 1.7; }
.safety-footer .phones { font-size: 1rem; margin: 6px 0 4px; }
.safety-footer .always { color: var(--tekst-jasny); font-size: .8rem; }

/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {
  .cards-grid { grid-template-columns: 1fr; }
  .question-card { padding: 20px 16px; }
  .container { padding: 20px 12px 48px; }
  .crisis-modal-phones { flex-direction: column; }
}
