/* ═══════════════════════════════════════════════════════════════════════════
   Pool Safety Scanner — Premium CSS
   Glassmorphism · Dark Blue/Teal · Mobile-First
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700;900&family=Space+Grotesk:wght@400;500;700&display=swap');

/* ── Variables ──────────────────────────────────────────────────────────── */
.pss-app {
  --pss-bg-deep:    #050d1a;
  --pss-bg-mid:     #071528;
  --pss-bg-card:    rgba(255,255,255,0.04);
  --pss-border:     rgba(0,200,255,0.12);
  --pss-border-h:   rgba(0,200,255,0.35);
  --pss-accent:     #00c8ff;
  --pss-accent2:    #0077b6;
  --pss-accent3:    #48cae4;
  --pss-glow:       rgba(0,200,255,0.25);
  --pss-high:       #ff4757;
  --pss-medium:     #ffa502;
  --pss-low:        #2ed573;
  --pss-text:       #e0eaff;
  --pss-muted:      #7a90b0;
  --pss-radius:     16px;
  --pss-radius-sm:  10px;
  --pss-shadow:     0 8px 32px rgba(0,0,0,.45);
  --pss-blur:       blur(20px);
  font-family: 'DM Sans', system-ui, sans-serif;
}

/* ── Reset / Base ───────────────────────────────────────────────────────── */
.pss-app *, .pss-app *::before, .pss-app *::after { box-sizing: border-box; margin: 0; padding: 0; }

.pss-app {
  min-height: 600px;
  background: linear-gradient(135deg, #050d1a 0%, #071e3d 40%, #0a2a4a 70%, #071528 100%);
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  padding: 0;
  isolation: isolate;
}

/* Ambient glow */
.pss-app::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(0,200,255,.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 90%, rgba(0,119,182,.1) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Screens ────────────────────────────────────────────────────────────── */
.pss-screen {
  display: none;
  animation: pssSlideIn .4s cubic-bezier(.22,1,.36,1) both;
  position: relative;
  z-index: 1;
  padding: 40px 32px;
  min-height: 600px;
}
.pss-screen--active { display: block; }

@media (max-width: 540px) {
  .pss-screen { padding: 28px 18px; }
}

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

/* ══ WELCOME SCREEN ══════════════════════════════════════════════════════ */
#pss-welcome {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  padding: 60px 32px 50px;
}
#pss-welcome.pss-screen--active { display: flex; }

.pss-welcome-inner { max-width: 560px; width: 100%; }

.pss-logo-badge {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--pss-accent2), var(--pss-accent));
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  box-shadow: 0 0 0 8px var(--pss-glow), var(--pss-shadow);
  animation: pssBadgePulse 3s ease-in-out infinite;
}
@keyframes pssBadgePulse {
  0%,100% { box-shadow: 0 0 0 8px var(--pss-glow), var(--pss-shadow); }
  50%      { box-shadow: 0 0 0 16px rgba(0,200,255,.08), var(--pss-shadow); }
}

.pss-tagline-pill {
  display: inline-block;
  background: rgba(0,200,255,.12);
  border: 1px solid var(--pss-border);
  border-radius: 40px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pss-accent);
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.pss-welcome-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.18;
  color: var(--pss-text);
  margin-bottom: 18px;
}
.pss-accent { color: var(--pss-accent); }

.pss-welcome-subtitle {
  font-size: 17px;
  color: var(--pss-muted);
  line-height: 1.65;
  margin-bottom: 32px;
  max-width: 480px;
  margin-left: auto; margin-right: auto;
}
.pss-welcome-subtitle strong { color: var(--pss-text); }

.pss-welcome-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--pss-bg-card);
  border: 1px solid var(--pss-border);
  border-radius: var(--pss-radius);
  backdrop-filter: var(--pss-blur);
  padding: 20px;
  margin-bottom: 32px;
}
.pss-stat { text-align: center; flex: 1; }
.pss-stat-num  { display: block; font-size: 28px; font-weight: 900; color: var(--pss-accent); }
.pss-stat-label{ font-size: 12px; color: var(--pss-muted); font-weight: 500; }
.pss-stat-divider { width: 1px; height: 40px; background: var(--pss-border); flex-shrink: 0; }

.pss-welcome-note {
  font-size: 12px;
  color: var(--pss-muted);
  margin-top: 14px;
}

/* Decorative pool graphic */
.pss-pool-graphic {
  position: relative;
  width: 180px; height: 180px;
  margin: 32px auto 0;
  display: flex; align-items: center; justify-content: center;
}
.pss-water-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(0,200,255,.2);
  animation: pssRipple 3s ease-out infinite;
}
.pss-water-ring--1 { width: 80px;  height: 80px;  animation-delay: 0s; }
.pss-water-ring--2 { width: 130px; height: 130px; animation-delay: .8s; }
.pss-water-ring--3 { width: 180px; height: 180px; animation-delay: 1.6s; }
@keyframes pssRipple {
  0%   { opacity: .8; transform: scale(.9); }
  100% { opacity: 0;  transform: scale(1.05); }
}
.pss-shield-icon { font-size: 48px; z-index: 1; }

/* ══ BUTTONS ═════════════════════════════════════════════════════════════ */
.pss-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--pss-radius-sm);
  cursor: pointer;
  padding: 13px 24px;
  transition: all .22s cubic-bezier(.22,1,.36,1);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.pss-btn--primary {
  background: linear-gradient(135deg, var(--pss-accent2) 0%, var(--pss-accent) 100%);
  color: #000;
  box-shadow: 0 4px 20px rgba(0,200,255,.3);
}
.pss-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,200,255,.45);
}
.pss-btn--primary:active { transform: translateY(0); }
.pss-btn--ghost {
  background: var(--pss-bg-card);
  border: 1px solid var(--pss-border);
  color: var(--pss-text);
  backdrop-filter: var(--pss-blur);
}
.pss-btn--ghost:hover {
  border-color: var(--pss-border-h);
  background: rgba(255,255,255,.07);
}
.pss-btn--ghost:disabled { opacity: .38; cursor: not-allowed; }
.pss-btn--lg  { font-size: 17px; padding: 16px 32px; border-radius: 12px; }
.pss-btn--sm  { font-size: 13px; padding: 9px 18px; }
.pss-btn--full { width: 100%; justify-content: center; }

/* ══ PROGRESS HEADER ═════════════════════════════════════════════════════ */
.pss-progress-header {
  margin-bottom: 32px;
}
.pss-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--pss-muted);
  font-weight: 500;
}
.pss-section-pill {
  background: rgba(0,200,255,.12);
  border: 1px solid var(--pss-border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--pss-accent);
  letter-spacing: .5px;
  text-transform: uppercase;
}
.pss-progress-track {
  height: 6px;
  background: rgba(255,255,255,.06);
  border-radius: 99px;
  overflow: hidden;
}
.pss-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pss-accent2), var(--pss-accent));
  border-radius: 99px;
  transition: width .5s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 0 10px rgba(0,200,255,.6);
}

/* ══ QUESTION CARDS ══════════════════════════════════════════════════════ */
.pss-questions-wrap {
  min-height: 320px;
}
.pss-question-card {
  display: none;
  animation: pssSlideIn .35s cubic-bezier(.22,1,.36,1) both;
}
.pss-question-card--active { display: block; }

.pss-question-header {
  margin-bottom: 24px;
}
.pss-q-section-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--pss-accent);
  margin-bottom: 10px;
  display: block;
}
.pss-question-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 600;
  color: var(--pss-text);
  line-height: 1.35;
}
.pss-question-note {
  font-size: 12px;
  color: var(--pss-muted);
  margin-top: 6px;
}

/* Card choices */
.pss-choices {
  display: grid;
  gap: 10px;
}
.pss-choices--2 { grid-template-columns: 1fr 1fr; }
.pss-choices--3 { grid-template-columns: 1fr 1fr 1fr; }
.pss-choices--auto { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

@media (max-width: 480px) {
  .pss-choices--3, .pss-choices--auto { grid-template-columns: 1fr 1fr; }
}

.pss-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 14px;
  background: var(--pss-bg-card);
  border: 1.5px solid var(--pss-border);
  border-radius: var(--pss-radius);
  cursor: pointer;
  transition: all .2s cubic-bezier(.22,1,.36,1);
  backdrop-filter: var(--pss-blur);
  text-align: center;
  user-select: none;
}
.pss-choice:hover {
  border-color: var(--pss-border-h);
  background: rgba(0,200,255,.06);
  transform: translateY(-2px);
}
.pss-choice--selected {
  border-color: var(--pss-accent) !important;
  background: rgba(0,200,255,.12) !important;
  box-shadow: 0 0 0 3px rgba(0,200,255,.15);
}
.pss-choice-icon { font-size: 28px; line-height: 1; }
.pss-choice-label { font-size: 14px; font-weight: 600; color: var(--pss-text); }
.pss-choice-sub   { font-size: 11px; color: var(--pss-muted); }

/* Toggle (Yes/No) */
.pss-toggle-wrap {
  display: flex;
  gap: 12px;
}
.pss-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  background: var(--pss-bg-card);
  border: 1.5px solid var(--pss-border);
  border-radius: var(--pss-radius);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: var(--pss-text);
  transition: all .2s cubic-bezier(.22,1,.36,1);
  backdrop-filter: var(--pss-blur);
  user-select: none;
}
.pss-toggle:hover { border-color: var(--pss-border-h); background: rgba(255,255,255,.07); }
.pss-toggle--yes.pss-toggle--selected  { border-color: var(--pss-low);  background: rgba(46,213,115,.12); color: var(--pss-low); }
.pss-toggle--no.pss-toggle--selected   { border-color: var(--pss-high); background: rgba(255,71,87,.12);  color: var(--pss-high); }

/* Slider */
.pss-slider-wrap { padding: 10px 0 20px; }
.pss-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--pss-muted);
  margin-bottom: 10px;
}
.pss-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: rgba(255,255,255,.1);
  outline: none;
  cursor: pointer;
}
.pss-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pss-accent2), var(--pss-accent));
  box-shadow: 0 0 0 4px rgba(0,200,255,.25), 0 2px 8px rgba(0,0,0,.3);
  cursor: pointer;
  transition: box-shadow .15s;
}
.pss-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 8px rgba(0,200,255,.2), 0 2px 8px rgba(0,0,0,.3);
}
.pss-slider-value {
  text-align: center;
  font-size: 32px;
  font-weight: 900;
  color: var(--pss-accent);
  margin-top: 12px;
  line-height: 1;
}
.pss-slider-value-label { font-size: 13px; color: var(--pss-muted); font-weight: 400; }

/* Validation message */
.pss-validation-msg {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(255,71,87,.12);
  border: 1px solid rgba(255,71,87,.3);
  border-radius: var(--pss-radius-sm);
  color: #ff6b7a;
  font-size: 13px;
  font-weight: 500;
}
.pss-validation-msg--show { display: block; }

/* ══ QUIZ NAV ════════════════════════════════════════════════════════════ */
.pss-quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 36px;
  gap: 12px;
}
.pss-nav-dots {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
  flex: 1;
}
.pss-nav-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  transition: all .25s;
}
.pss-nav-dot--done    { background: var(--pss-accent2); }
.pss-nav-dot--current { background: var(--pss-accent); width: 18px; border-radius: 3px; box-shadow: 0 0 6px var(--pss-accent); }

/* ══ EMAIL CAPTURE ════════════════════════════════════════════════════════ */
#pss-email-screen {
  display: none;
  align-items: center;
  justify-content: center;
}
#pss-email-screen.pss-screen--active { display: flex; }

.pss-email-wrap {
  max-width: 480px;
  width: 100%;
  text-align: center;
}
.pss-email-icon {
  font-size: 56px;
  margin-bottom: 16px;
  animation: pssBounce 2s ease-in-out infinite;
}
@keyframes pssBounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.pss-email-title    { font-family: 'Space Grotesk', sans-serif; font-size: 28px; font-weight: 700; color: var(--pss-text); margin-bottom: 10px; }
.pss-email-subtitle { font-size: 16px; color: var(--pss-muted); line-height: 1.6; margin-bottom: 28px; }
.pss-email-options  { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-bottom: 20px; }

.pss-email-form {
  background: var(--pss-bg-card);
  border: 1px solid var(--pss-border);
  border-radius: var(--pss-radius);
  backdrop-filter: var(--pss-blur);
  padding: 24px;
  margin-top: 16px;
  text-align: left;
  animation: pssSlideIn .3s ease both;
}
.pss-form-row { margin-bottom: 16px; }
.pss-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--pss-muted);
  margin-bottom: 7px;
  letter-spacing: .3px;
}
.pss-input {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255,255,255,.05);
  border: 1.5px solid var(--pss-border);
  border-radius: var(--pss-radius-sm);
  color: var(--pss-text);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
}
.pss-input:focus  { border-color: var(--pss-accent); box-shadow: 0 0 0 3px rgba(0,200,255,.12); }
.pss-input::placeholder { color: var(--pss-muted); }

.pss-form-row--check { display: flex; align-items: flex-start; gap: 12px; }
.pss-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 13px;
  color: var(--pss-muted);
  line-height: 1.5;
}
.pss-checkbox { position: absolute; opacity: 0; width: 0; height: 0; }
.pss-checkbox-custom {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 5px;
  border: 1.5px solid var(--pss-border);
  background: rgba(255,255,255,.04);
  transition: all .15s;
  position: relative;
  top: 1px;
}
.pss-checkbox:checked + .pss-checkbox-custom {
  background: var(--pss-accent);
  border-color: var(--pss-accent);
}
.pss-checkbox:checked + .pss-checkbox-custom::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 12px;
  font-weight: 700;
}
.pss-link { color: var(--pss-accent); text-decoration: underline; }
.pss-form-error {
  padding: 10px 14px;
  background: rgba(255,71,87,.12);
  border: 1px solid rgba(255,71,87,.3);
  border-radius: var(--pss-radius-sm);
  color: #ff6b7a;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ══ RESULTS ═════════════════════════════════════════════════════════════ */
.pss-score-hero {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.pss-score-ring-wrap {
  position: relative;
  flex-shrink: 0;
  width: 140px; height: 140px;
}
.pss-score-ring {
  width: 140px; height: 140px;
  transform: rotate(-90deg);
}
.pss-ring-bg   { fill: none; stroke: rgba(255,255,255,.06); stroke-width: 10; }
.pss-ring-fill {
  fill: none;
  stroke: var(--pss-accent);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.4s cubic-bezier(.22,1,.36,1), stroke .4s;
  filter: drop-shadow(0 0 6px var(--pss-accent));
}
.pss-score-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.pss-score-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 40px;
  font-weight: 900;
  color: var(--pss-text);
  line-height: 1;
}
.pss-score-pct { font-size: 18px; color: var(--pss-muted); }

.pss-score-meta { flex: 1; min-width: 180px; }
.pss-risk-badge {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 40px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.pss-risk-badge--high   { background: rgba(255,71,87,.2);   color: var(--pss-high);   border: 1px solid rgba(255,71,87,.4); }
.pss-risk-badge--medium { background: rgba(255,165,2,.2);   color: var(--pss-medium); border: 1px solid rgba(255,165,2,.4); }
.pss-risk-badge--low    { background: rgba(46,213,115,.2);  color: var(--pss-low);    border: 1px solid rgba(46,213,115,.4); }
.pss-score-summary { font-size: 17px; color: var(--pss-muted); line-height: 1.5; font-weight: 400; }

/* Warning banner */
.pss-warning-banner {
  padding: 16px 20px;
  border-radius: var(--pss-radius-sm);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  margin-bottom: 24px;
  backdrop-filter: var(--pss-blur);
}
.pss-warning-banner--high   { background: rgba(255,71,87,.12);  border: 1px solid rgba(255,71,87,.3);  color: #ff8a94; }
.pss-warning-banner--medium { background: rgba(255,165,2,.10);  border: 1px solid rgba(255,165,2,.3);  color: #ffc248; }
.pss-warning-banner--low    { background: rgba(46,213,115,.10); border: 1px solid rgba(46,213,115,.3); color: #5fffa0; }

/* Result cards */
.pss-result-card {
  background: var(--pss-bg-card);
  border: 1px solid var(--pss-border);
  border-radius: var(--pss-radius);
  backdrop-filter: var(--pss-blur);
  padding: 24px;
  margin-bottom: 20px;
}
.pss-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.pss-card-icon  { font-size: 22px; }
.pss-card-header h3 { font-size: 16px; font-weight: 700; color: var(--pss-text); }

.pss-child-risk-text {
  font-size: 15px;
  color: var(--pss-muted);
  line-height: 1.7;
  font-style: italic;
  border-left: 3px solid var(--pss-accent);
  padding-left: 16px;
}

/* Checklist */
.pss-checklist-section { margin-bottom: 18px; }
.pss-checklist-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding: 5px 10px;
  border-radius: 6px;
  display: inline-block;
}
.pss-checklist-section--critical    .pss-checklist-section-title { color: var(--pss-high);   background: rgba(255,71,87,.12); }
.pss-checklist-section--recommended .pss-checklist-section-title { color: var(--pss-medium); background: rgba(255,165,2,.1); }
.pss-checklist-section--enhanced    .pss-checklist-section-title { color: var(--pss-low);    background: rgba(46,213,115,.1); }

.pss-checklist-items { list-style: none; padding: 0; }
.pss-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,.025);
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,.04);
  transition: background .15s;
}
.pss-checklist-item:hover { background: rgba(255,255,255,.05); }
.pss-checklist-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.pss-checklist-section--critical    .pss-checklist-dot { background: var(--pss-high); }
.pss-checklist-section--recommended .pss-checklist-dot { background: var(--pss-medium); }
.pss-checklist-section--enhanced    .pss-checklist-dot { background: var(--pss-low); }
.pss-checklist-item-title { font-size: 14px; font-weight: 600; color: var(--pss-text); margin-bottom: 2px; }
.pss-checklist-item-desc  { font-size: 12px; color: var(--pss-muted); line-height: 1.5; }

/* CTA */
.pss-cta-section {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--pss-border);
}
.pss-cta-btn { box-shadow: 0 4px 24px rgba(0,200,255,.35) !important; }

.pss-footer-note {
  text-align: center;
  font-size: 11px;
  color: var(--pss-muted);
  margin-top: 24px;
  opacity: .7;
  line-height: 1.6;
}

/* ══ PRINT / DOWNLOAD ════════════════════════════════════════════════════ */
@media print {
  .pss-app { background: white !important; color: black !important; }
  .pss-screen { display: none !important; }
  #pss-results { display: block !important; padding: 0 !important; }
  .pss-cta-section, .pss-quiz-nav, .pss-progress-header { display: none !important; }
}
