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

/* ── Responsive scale tokens ── */
:root {
  --state-size: clamp(2.2rem, 8vw, 3.2rem);
  --card-pad-v: clamp(18px, 4vw, 28px);
  --card-pad-h: clamp(16px, 4vw, 24px);
}

/* ── Light mode (default) ── */
:root {
  color-scheme: light;

  /* Brand */
  --brand: #009245;

  /* Neutral base — true neutral, no blue or warm cast */
  --bg:     #f5f5f5;
  --card:   #ffffff;
  --text:   #1a1a1a;
  --muted:  #555555;
  --border: #e0e0e0;
  --subtle: #a0a0a0;

  --badge-bg:      rgba(0, 0, 0, 0.09);
  --surface-track: rgba(0, 0, 0, 0.06);
  --shadow-sm:     rgba(0, 0, 0, 0.10);

  /* Decision accent colors — used for text and left accent only */
  --green:  #009245;
  --orange: #c2410c;
  --amber:  #92400e;

  /* Activity level label colors */
  --level-good: #009245;
  --level-mid:  #92400e;
  --level-low:  #b91c1c;

  --radius: 14px;
  --max-w:  600px;
}

/* ── Dark mode ── */
[data-theme="dark"] {
  color-scheme: dark;

  /* Brand — same logo green (~4.5:1 on charcoal, WCAG AA) */
  --brand: #009245;

  /* Neutral base — true charcoal, zero blue cast */
  --bg:     #161616;
  --card:   #212121;
  --text:   #f0f0f0;
  --muted:  #9e9e9e;
  --border: #333333;
  --subtle: #666666;

  --badge-bg:      rgba(255, 255, 255, 0.13);
  --surface-track: rgba(255, 255, 255, 0.08);
  --shadow-sm:     rgba(0, 0, 0, 0.40);

  /* Decision accent colors — lighter for readability on dark */
  --green:  #4ade80;
  --orange: #fb923c;
  --amber:  #fbbf24;

  /* Activity level colors */
  --level-good: #4ade80;
  --level-mid:  #fbbf24;
  --level-low:  #f87171;
}

/* ── Base ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 16px 14px 40px;
}

@media (min-width: 480px) {
  body { padding: 20px 20px 44px; }
}

@media (min-width: 768px) {
  body { padding: 32px 32px 64px; }
}

@media (min-width: 1024px) {
  body { padding: 48px 40px 80px; }
}

.container {
  width: 100%;
  max-width: var(--max-w);
}

@media (min-width: 1024px) {
  .container { max-width: 680px; }
}

@media (min-width: 1440px) {
  .container { max-width: 720px; }
}

/* ── Page header ── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.page-question {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.01em;
  margin: 0;
}

/* Theme toggle — pill button, icon via ::before */
.theme-toggle {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 7px 13px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
  user-select: none;
  min-height: 36px;
  min-width: 44px;
}

.theme-toggle:hover { border-color: var(--muted); color: var(--text); }
.theme-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Show moon in light mode (click = go dark), sun in dark mode (click = go light) */
[data-theme="light"] .theme-toggle::before { content: '☽'; }
[data-theme="dark"]  .theme-toggle::before { content: '☀'; }

/* ── Result card ── */
.result-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-pad-v) var(--card-pad-h) calc(var(--card-pad-v) - 6px);
  margin-bottom: 16px;
  transition: background 0.2s, border-color 0.2s;
  overflow-wrap: break-word;
  word-break: break-word;
}

@media (min-width: 768px) {
  .result-card { margin-bottom: 20px; }
}

.result-card.now  { border-left: 3px solid var(--green); }
.result-card.soon { border-left: 3px solid var(--orange); }
.result-card.wait { border-left: 3px solid var(--amber); }

/* 1. Big state word — highest visual priority */
.state {
  font-size: var(--state-size);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1;
  margin-bottom: 4px;
}

.now  .state { color: var(--green); }
.soon .state { color: var(--orange); }
.wait .state { color: var(--amber); }

/* 2. Specific timing ("Post now" / "Wait ~12 hours") */
.sub-decision {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 18px;
}

/* 3. One-line reason */
.reason {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 14px;
}

/* 4. Best / peak window */
.window-line {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 20px;
}

.window-line strong {
  color: var(--text);
  font-weight: 600;
}

.window-note {
  font-size: 0.82rem;
  color: var(--muted);
}

/* 5. Activity level + badge row */
.detail-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
  gap: 8px;
}

/* Activity level label — colored, weighted by importance */
.level-peak,
.level-high     { color: var(--level-good); font-weight: 700; }
.level-medium   { color: var(--level-mid);  font-weight: 700; }
.level-low,
.level-very-low { color: var(--level-low);  font-weight: 700; }

/* Score / improvement badge */
.score-badge {
  background: var(--badge-bg);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* Bold the numeric part inside the badge for extra emphasis */
.score-badge strong {
  font-weight: 800;
}

/* Decision-colored badge: tinted bg + colored number per state */
.now  .score-badge { background: rgba(0, 146, 69, 0.14); }
.soon .score-badge { background: rgba(194, 65, 12, 0.14); }
.wait .score-badge { background: rgba(146, 64, 14, 0.14); }

.now  .score-badge strong { color: var(--green); }
.soon .score-badge strong { color: var(--orange); }
.wait .score-badge strong { color: var(--amber); }

/* 6. Disclaimer — smallest, least important */
.disclaimer {
  font-size: 0.72rem;
  color: var(--subtle);
  line-height: 1.45;
  margin-top: 12px;
}

/* ── Controls ── */
.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

@media (min-width: 480px) {
  .controls { grid-template-columns: 1fr 1fr; }
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%234b5563' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 11px 30px 11px 11px;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  width: 100%;
  min-height: 44px;
  transition: border-color 0.15s;
}

select:hover { border-color: var(--muted); }
select:focus { outline: 2px solid var(--brand); outline-offset: 2px; border-color: transparent; }

/* Dark mode: neutral-gray chevron */
[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239ca3af' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
}

/* Hint */
.hint {
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 14px;
}

/* ── Timing / flexibility control ── */
.timing-group {
  margin-bottom: 18px;
}

.flex-control {
  display: flex;
  gap: 3px;
  background: var(--surface-track);
  border-radius: 8px;
  padding: 3px;
}

.flex-btn {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 10px 4px;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.flex-btn.active {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px var(--shadow-sm);
}

.flex-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

/* ── Timestamp ── */
.timestamp {
  font-size: 0.7rem;
  color: var(--subtle);
  text-align: center;
}

/* ── Footer ── */
.site-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 3px 6px;
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.6;
}

.footer-dot {
  color: var(--border);
  font-size: 0.8rem;
}

.footer-tagline {
  margin-top: 5px;
  font-size: 0.68rem;
  color: var(--subtle);
}

/* ── Smooth scroll ── */
html {
  scroll-behavior: smooth;
}

/* ── Top navigation ── */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ── Hero subtitle ── */
.hero {
  margin-bottom: 20px;
}

.hero-headline {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 5px;
}

.hero-sub {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

@media (max-width: 480px) {
  .hero-headline { font-size: 1.05rem; }
  .hero-sub      { font-size: 0.82rem; }
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--brand);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.nav-brand:hover { opacity: 0.75; }

.nav-logo {
  flex-shrink: 0;
  height: 18px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-links a {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
}

.nav-links a:hover { color: var(--text); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lang-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  cursor: default;
  user-select: none;
  padding: 4px 2px;
}

/* Hide center nav links on very small screens */
@media (max-width: 420px) {
  .nav-links { display: none; }
}

/* ── Language selector ── */
.lang-select {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--card);
  background-image: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  letter-spacing: 0.04em;
  width: auto;
  min-height: unset;
  transition: border-color 0.15s, background-color 0.15s;
  font-family: inherit;
}

.lang-select:hover {
  border-color: var(--muted);
  background-color: var(--bg);
}

.lang-select:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-color: transparent;
}

/* Option popup — works in Firefox; Chrome/Safari use color-scheme from :root */
.lang-select option {
  background-color: var(--card);
  color: var(--text);
}

/* Suppress the global dark-mode chevron inherited by all selects */
[data-theme="dark"] .lang-select {
  background-image: none;
}

/* ── Content sections (homepage inline, kept for compatibility) ── */
.content-section {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 16px;
}

.content-section h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

.faq-item {
  margin-bottom: 18px;
}

.faq-item:last-child {
  margin-bottom: 0;
}

.faq-q {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.faq-a {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
}

.section-body {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
}

.section-body + .section-body {
  margin-top: 10px;
}

.section-body a {
  color: var(--brand);
  text-decoration: none;
}

.section-body a:hover {
  text-decoration: underline;
}

/* ── Standalone content pages ── */
.page-body {
  padding-top: 4px;
}

.page-heading {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 22px;
}

/* ── Footer nav links ── */
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 8px;
  margin-bottom: 10px;
}

.footer-nav a {
  font-size: 0.73rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-nav a:hover { color: var(--text); }

.footer-nav a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Active page indicator in nav */
.nav-links a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}
