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

:root { --sa-ct-color: #6c63ff; }

#sa-root {
  font-family: 'Space Grotesk', sans-serif;
  background: #0a0a0f;
  color: #f0f0f5;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
  position: relative;
}

/* ── CIRCADIAN WAVE BACKGROUND ── */
.sa-bg-wave {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  background: #0a0a0f;
  overflow: hidden;
}
.sa-bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: sa-blob-drift 20s ease-in-out infinite;
  will-change: transform;
}
.sa-bg-blob:nth-child(1) {
  width: 500px; height: 500px;
  background: var(--sa-ct-color);
  top: -150px; left: -100px;
  animation-duration: 22s;
}
.sa-bg-blob:nth-child(2) {
  width: 350px; height: 350px;
  background: var(--sa-ct-color);
  bottom: 10%; right: -80px;
  animation-duration: 28s;
  animation-delay: -8s;
  animation-direction: reverse;
}
@keyframes sa-blob-drift {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(30px,-40px) scale(1.1); }
  66%      { transform: translate(-20px,30px) scale(0.9); }
}

#sa-root > * { position: relative; z-index: 1; }

/* ── NAV ── */
.sa-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}
.sa-nav a { color: #6c63ff; text-decoration: none; font-size: 0.9rem; font-weight: 600; }
.sa-nav a:last-child { color: #f0f0f5; font-size: 1rem; }

/* ── HERO ── */
.sa-hero {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1.5rem 0;
}
.sa-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sa-ct-color);
  margin-bottom: 0.75rem;
  font-weight: 600;
  transition: color 0.5s;
}
.sa-h1 {
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1rem;
  background: linear-gradient(135deg, #fff 0%, #c4b5fd 50%, var(--sa-ct-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: background 0.5s;
}
.sa-sub { color: #888899; font-size: 1rem; max-width: 480px; margin: 0 auto; line-height: 1.65; }

/* ── FLOATING SLEEP NOW ── */
#sa-sleep-now-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  background: rgba(108,99,255,0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 100px;
  padding: 0.7rem 1.3rem;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(108,99,255,0.4);
  transition: transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
}
#sa-sleep-now-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(108,99,255,0.55); }

.sa-sleep-now-popup {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 100;
  background: rgba(17,17,24,0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 1.2rem;
  width: 280px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.sa-now-title { font-size: 0.78rem; color: #888899; margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.sa-now-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
}
.sa-now-cycles { color: #888899; min-width: 55px; font-size: 0.75rem; }
.sa-now-wake { flex: 1; font-weight: 600; }
.sa-now-quality { font-size: 0.72rem; }

/* ── FORM ── */
.sa-form {
  background: rgba(17,17,24,0.8);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

/* Chronotype cards */
.sa-chrono-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 560px) { .sa-chrono-grid { grid-template-columns: repeat(2,1fr); } }

.sa-chrono-card {
  border: 2px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 1rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: rgba(10,10,15,0.5);
  position: relative;
  overflow: hidden;
}
.sa-chrono-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 100%, var(--sa-ct-color) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.sa-chrono-card:hover { border-color: rgba(255,255,255,0.18); transform: translateY(-2px); }
.sa-chrono-card.active {
  border-color: var(--sa-ct-color);
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 20px 40px -10px color-mix(in srgb, var(--sa-ct-color) 50%, transparent);
}
.sa-chrono-card.active::before { opacity: 0.15; }
.sa-chrono-card.active .sa-chrono-emoji { animation: sa-emoji-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes sa-emoji-bounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.sa-chrono-emoji { font-size: 2rem; display: block; margin-bottom: 0.35rem; position: relative; z-index: 1; }
.sa-chrono-name { font-size: 0.82rem; font-weight: 700; color: #f0f0f5; position: relative; z-index: 1; }
.sa-chrono-sub { font-size: 0.68rem; color: #888899; margin-top: 0.2rem; position: relative; z-index: 1; }

.sa-form-label {
  font-size: 0.78rem;
  color: #888899;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: block;
}

.sa-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 560px) { .sa-form-grid { grid-template-columns: 1fr; } }

.sa-field { display: flex; flex-direction: column; gap: 0.45rem; }
.sa-field label { font-size: 0.75rem; color: #888899; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.sa-field input, .sa-field select {
  background: rgba(10,10,15,0.8);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  color: #f0f0f5;
  font-size: 0.95rem;
  font-family: inherit;
  color-scheme: dark;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sa-field input:focus, .sa-field select:focus {
  outline: none;
  border-color: var(--sa-ct-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sa-ct-color) 15%, transparent);
}

/* Sleep Debt — liquid fill */
.sa-debt-wrap { margin-bottom: 1.5rem; }
.sa-debt-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.sa-debt-label-text { font-size: 0.75rem; color: #888899; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
#sa-debt-display { font-size: 1rem; font-weight: 700; color: #22c55e; transition: color 0.3s; }

.sa-debt-cup-wrap { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.sa-debt-cup {
  width: 48px; height: 60px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top: none;
  border-radius: 0 0 12px 12px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.sa-debt-liquid {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(180deg, rgba(108,99,255,0.6), #6c63ff);
  transition: height 0.4s ease, background 0.4s;
  height: 0%;
}

#sa-debt {
  flex: 1;
  accent-color: var(--sa-ct-color);
  cursor: pointer;
  height: 6px;
}
.sa-debt-scale { display: flex; justify-content: space-between; font-size: 0.65rem; color: #888899; margin-top: 0.3rem; }

/* Main button */
#sa-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--sa-ct-color), color-mix(in srgb, var(--sa-ct-color) 60%, #fff));
  color: #0a0a0f !important;
  -webkit-text-fill-color: #0a0a0f !important;
  border: none;
  border-radius: 12px;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: transform 0.15s, box-shadow 0.2s, background 0.5s;
  box-shadow: 0 4px 24px color-mix(in srgb, var(--sa-ct-color) 40%, transparent);
  position: relative;
  overflow: hidden;
}
#sa-btn::after {
  content: '';
  position: absolute;
  top: -50%; left: -60%;
  width: 60%; height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s;
}
#sa-btn:hover { transform: translateY(-2px); }
#sa-btn:hover::after { left: 160%; }
#sa-btn:disabled { opacity: 0.7; cursor: wait; }

/* ── OUTPUT ── */
.sa-hidden { display: none !important; }
#sa-output { margin-top: 0.5rem; }

/* Result header */
.sa-result-header {
  background: rgba(17,17,24,0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 1.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  animation: sa-fade-up 0.5s both;
}
.sa-chrono-badge {
  padding: 0.45rem 1.1rem;
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 700;
}
.sa-scores { display: flex; gap: 2rem; flex-wrap: wrap; }
.sa-score-item { text-align: center; }
.sa-score-num { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.sa-score-label { font-size: 0.68rem; color: #888899; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.2rem; }

/* Metrics grid */
.sa-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}
.sa-metric-card {
  background: rgba(17,17,24,0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 1.1rem;
  border-top: 3px solid var(--sa-accent, #6c63ff);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: sa-fade-up 0.5s both;
}
.sa-metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.4), 0 0 20px color-mix(in srgb, var(--sa-accent) 15%, transparent);
}
.sa-metric-icon { font-size: 1.4rem; margin-bottom: 0.5rem; }
.sa-metric-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sa-accent, #6c63ff); font-weight: 700; margin-bottom: 0.3rem; }
.sa-metric-value { font-size: 1.1rem; font-weight: 700; color: #f0f0f5; margin-bottom: 0.2rem; }
.sa-metric-sub { font-size: 0.7rem; color: #888899; line-height: 1.4; }

@keyframes sa-fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Sections */
.sa-section {
  background: rgba(17,17,24,0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 1.4rem;
  margin-bottom: 0.75rem;
  animation: sa-fade-up 0.5s both;
}
.sa-section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #888899; margin-bottom: 1rem; }

/* Sleep Architecture Visual */
.sa-arch-visual {
  display: flex;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1rem;
  gap: 2px;
}
.sa-arch-segment {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: all 0.5s ease;
}
.sa-arch-block {
  border-radius: 4px 4px 0 0;
  transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sa-phases { margin-bottom: 0.75rem; }
.sa-phase { margin-bottom: 0.9rem; }
.sa-phase-header { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.4rem; font-weight: 500; }
.sa-phase-bar-bg { background: rgba(255,255,255,0.05); border-radius: 100px; height: 8px; overflow: hidden; margin-bottom: 0.3rem; }
.sa-phase-bar-fill { height: 100%; border-radius: 100px; animation: sa-bar-grow 1s ease both; }
@keyframes sa-bar-grow { from { width: 0 !important; } }
.sa-phase-desc { font-size: 0.72rem; color: #888899; }
.sa-rem-note { background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.2); border-radius: 10px; padding: 0.75rem 1rem; font-size: 0.82rem; color: #7dd3fc; margin-top: 0.75rem; }

/* Nap grid */
.sa-nap-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.65rem; }
@media (max-width: 480px) { .sa-nap-grid { grid-template-columns: 1fr; } }
.sa-nap-card { background: rgba(10,10,15,0.6); border: 1px solid rgba(255,255,255,0.07); border-radius: 12px; padding: 1rem; text-align: center; transition: transform 0.2s; }
.sa-nap-card:hover { transform: translateY(-2px); }
.sa-nap-type { font-size: 0.72rem; font-weight: 700; color: #6c63ff; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.sa-nap-time { font-size: 0.8rem; color: #f0f0f5; font-weight: 600; margin-bottom: 0.25rem; }
.sa-nap-dur { font-size: 1.3rem; font-weight: 700; color: #a78bfa; margin-bottom: 0.25rem; }
.sa-nap-desc { font-size: 0.7rem; color: #888899; }

/* Sleep debt section */
.sa-debt-section { border-color: rgba(239,68,68,0.2); }
.sa-debt-info { display: flex; gap: 2rem; margin-bottom: 1rem; flex-wrap: wrap; }
.sa-debt-stat { text-align: center; }
.sa-debt-num { display: block; font-size: 2rem; font-weight: 700; color: #ef4444; }
.sa-debt-lbl { font-size: 0.7rem; color: #888899; text-transform: uppercase; letter-spacing: 0.07em; }
.sa-debt-tip { font-size: 0.82rem; color: #b0b0c0; line-height: 1.6; background: rgba(239,68,68,0.06); border-radius: 10px; padding: 0.75rem; }

/* Social jetlag */
.sa-sj-result { border: 1px solid; border-radius: 12px; padding: 1rem; display: flex; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.sa-sj-num { font-size: 2rem; font-weight: 700; }
.sa-sj-label { font-size: 0.88rem; font-weight: 600; color: #f0f0f5; }
.sa-sj-tip { font-size: 0.82rem; color: #b0b0c0; line-height: 1.6; }

/* Digital sunset */
.sa-sunset-list { display: flex; flex-direction: column; gap: 0.5rem; }
.sa-sunset-item { display: flex; align-items: center; gap: 1rem; padding: 0.65rem 0.85rem; background: rgba(10,10,15,0.6); border-radius: 8px; transition: background 0.2s; }
.sa-sunset-item:hover { background: rgba(10,10,15,0.9); }
.sa-sunset-time { font-weight: 700; color: #f59e0b; min-width: 80px; font-size: 0.9rem; }
.sa-sunset-action { font-size: 0.85rem; color: #b0b0c0; }

/* Tips */
.sa-tips { display: flex; flex-direction: column; gap: 0.5rem; }
.sa-tip { font-size: 0.85rem; color: #b0b0c0; padding: 0.55rem 0.85rem; background: rgba(108,99,255,0.06); border-radius: 8px; border-left: 2px solid var(--sa-ct-color); transition: background 0.2s; }
.sa-tip:hover { background: rgba(108,99,255,0.1); }

/* Chronotype compare */
.sa-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
@media (max-width:480px) { .sa-compare { grid-template-columns: 1fr; } }
.sa-compare-item { background: rgba(10,10,15,0.6); border-radius: 10px; padding: 0.75rem; font-size: 0.8rem; color: #b0b0c0; border-left: 2px solid rgba(255,255,255,0.08); }
.sa-compare-item strong { color: #f0f0f5; display: block; margin-bottom: 0.2rem; }

/* Energy timeline */
.sa-timeline-wrap { }
.sa-timeline-bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; background: rgba(255,255,255,0.03); border-radius: 10px; padding: 10px 8px 0; }
.sa-timeline-bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 4px; animation: sa-bar-rise 0.8s ease both; }
@keyframes sa-bar-rise { from { height: 0 !important; } }
.sa-timeline-labels { display: flex; gap: 2px; margin-top: 6px; }
.sa-timeline-label { flex: 2; font-size: 0.58rem; color: #888899; text-align: center; }
.sa-timeline-legend { display: flex; gap: 1rem; margin-top: 0.75rem; flex-wrap: wrap; }
.sa-tl-legend-item { display: flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; color: #888899; }
.sa-tl-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* SEO */
.sa-seo { border-top: 1px solid rgba(255,255,255,0.06); margin-top: 3rem; padding-top: 2rem; }
.sa-seo h2 { font-size: 1.2rem; font-weight: 700; color: #f0f0f5; margin: 0 0 1rem; }
.sa-seo h3 { font-size: 0.95rem; font-weight: 600; color: #f0f0f5; margin: 1.5rem 0 0.5rem; }
.sa-seo p { font-size: 0.88rem; color: #888899; line-height: 1.75; margin: 0 0 0.75rem; }
.sa-faq-item { border-bottom: 1px solid rgba(255,255,255,0.05); padding: 0.9rem 0; }
.sa-faq-q { font-size: 0.88rem; font-weight: 600; color: #f0f0f5; margin-bottom: 0.35rem; }
.sa-faq-a { font-size: 0.82rem; color: #888899; line-height: 1.7; }

/* ── CHRONOTYPE COMPARE ── */
.sa-compare-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
@media(max-width:500px){ .sa-compare-grid { grid-template-columns: repeat(2,1fr); } }
.sa-compare-card {
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  padding: 0.85rem 0.5rem;
  text-align: center;
  transition: transform 0.2s;
}
.sa-compare-card:hover { transform: translateY(-2px); }
.sa-compare-current { border-width: 2px !important; }
.sa-compare-emoji { font-size: 1.6rem; display: block; margin-bottom: 0.3rem; }
.sa-compare-name { font-size: 0.72rem; font-weight: 700; margin-bottom: 0.3rem; }
.sa-compare-bed { font-size: 0.68rem; color: #888899; margin-bottom: 0.2rem; }
.sa-compare-energy { font-size: 0.65rem; color: #888899; }
.sa-compare-insight {
  background: rgba(108,99,255,0.07);
  border-left: 2px solid #6c63ff;
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  font-size: 0.82rem;
  color: #b0b0c0;
  line-height: 1.55;
}

/* ── SHARE ── */
.sa-share { text-align: center; }
.sa-share-label {
  font-size: 0.75rem;
  color: #888899;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.sa-share-btns { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.sa-share-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.55rem 1.1rem; border-radius: 100px;
  font-size: 0.82rem; font-weight: 600; font-family: inherit;
  text-decoration: none; cursor: pointer; border: none;
  transition: transform 0.15s, opacity 0.15s;
}
.sa-share-btn:hover { transform: translateY(-2px); opacity: 0.9; }
.sa-share-tw { background: #000; color: #fff; }
.sa-share-tg { background: #229ED9; color: #fff; }
.sa-share-wa { background: #25D366; color: #fff; }
