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

/* ─── Variables ────────────────────────────────────────── */
:root {
  --bg:      #F7F5F2;
  --accent:  #6B8F71;
  --accent-d:#577a5d;
  --text:    #2D2D2D;
  --muted:   #6b7280;
  --track:   #1A1A1A;
  --white:   #FFFFFF;
  --shadow:  rgba(0, 0, 0, 0.06);
  --border:  #e5e0d8;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
}

h1, h2, h3 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  line-height: 1.2;
}

a { color: inherit; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Buttons ──────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 28px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.1s;
  user-select: none;
}

.btn-primary:hover  { background: var(--accent-d); }
.btn-primary:active { transform: scale(0.97); }

.btn-xl {
  font-size: 18px;
  padding: 16px 48px;
  border-radius: 12px;
  min-width: 180px;
}

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 16px;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--white);
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.modal p {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.modal p strong { color: var(--text); }

.modal .btn-primary {
  margin-top: 8px;
  width: 100%;
  justify-content: center;
}

/* ─── Hero ─────────────────────────────────────────────── */
.hero {
  padding: 96px 0 80px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  margin-bottom: 20px;
}

.hero .subtitle {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 40px;
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Tool ─────────────────────────────────────────────── */
.tool-section {
  padding: 56px 0;
  background: var(--white);
}

.track-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

/* ─── Fullscreen button ────────────────────────────────── */
.btn-fs {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.btn-fs:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Fullscreen mode (native API) ────────────────────── */
.tool-section:fullscreen,
.tool-section:-webkit-full-screen {
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tool-section:fullscreen .controls,
.tool-section:-webkit-full-screen .controls { display: none !important; }
.tool-section:fullscreen #rating-block,
.tool-section:-webkit-full-screen #rating-block { display: none !important; }
.tool-section:fullscreen .container,
.tool-section:-webkit-full-screen .container {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; padding: 0;
}
.tool-section:fullscreen .track-wrapper,
.tool-section:-webkit-full-screen .track-wrapper { margin: 0; gap: 0; }
.tool-section:fullscreen .track,
.tool-section:-webkit-full-screen .track {
  width: 90vw; max-width: none; height: 18vh; border-radius: 20px;
}
.tool-section:fullscreen .btn-fs,
.tool-section:-webkit-full-screen .btn-fs {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; color: rgba(255,255,255,0.5);
  font-size: 13px; width: auto;
  padding: 6px 14px;
  font-family: inherit;
}

/* ─── Fullscreen mode (class fallback) ─────────────────── */
.tool-section.fs-active {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tool-section.fs-active .controls { display: none !important; }
.tool-section.fs-active #rating-block { display: none !important; }
.tool-section.fs-active .container {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; padding: 0;
}
.tool-section.fs-active .track-wrapper { margin: 0; gap: 0; }
.tool-section.fs-active .track {
  width: 90vw; max-width: none; height: 18vh; border-radius: 20px;
}
.tool-section.fs-active .btn-fs {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; color: rgba(255,255,255,0.5);
  font-size: 13px; width: auto;
  padding: 6px 14px;
  font-family: inherit;
}

.track {
  width: 88vw;
  max-width: 880px;
  height: 120px;
  background: var(--track);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}

.dot {
  position: absolute;
  width: 32px;
  height: 32px;
  top: calc(50% - 16px);
  left: 0;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(107, 143, 113, 0.8), 0 0 36px rgba(107, 143, 113, 0.3);
  will-change: transform;
  transform: translateX(0);
  transition: opacity 0.2s;
}

/* ─── Controls ─────────────────────────────────────────── */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 32px;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ctrl-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ─── Speed slider ─────────────────────────────────────── */
.speed-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 200px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(107,143,113,0.5);
  transition: transform 0.1s;
}

.speed-slider::-webkit-slider-thumb:active { transform: scale(1.2); }

.speed-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 6px rgba(107,143,113,0.5);
}

.speed-marks {
  display: flex;
  justify-content: space-between;
  width: 200px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.segmented {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.seg-btn {
  background: transparent;
  border: none;
  border-right: 1.5px solid var(--border);
  padding: 7px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.seg-btn:last-child { border-right: none; }
.seg-btn:hover:not(.active) { background: #f0ede8; }
.seg-btn.active { background: var(--accent); color: #fff; }

.timer-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.timer-row {
  display: flex;
  gap: 24px;
  align-items: flex-end;
}

.stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.timer {
  font-family: 'DM Serif Display', serif;
  font-size: 36px;
  color: var(--text);
  min-width: 72px;
  text-align: center;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* ─── Rating ───────────────────────────────────────────── */
.rating-block {
  background: var(--bg);
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  display: none;
}

.rating-block.visible { display: block; }

.rating-label {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 16px;
}

.rating-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.r-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, transform 0.1s;
}

.r-btn:hover  { background: var(--accent); color: #fff; }
.r-btn:active { transform: scale(0.92); }
.r-btn.selected { background: var(--accent); color: #fff; }

.rating-history {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

/* ─── Color swatches ───────────────────────────────────── */
.color-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18);
}

.color-swatch:hover  { transform: scale(1.18); }
.color-swatch.active { box-shadow: 0 0 0 2.5px var(--accent); transform: scale(1.1); }

/* ─── Goal control ─────────────────────────────────────── */
.goal-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.goal-select,
.goal-input {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  cursor: pointer;
  outline: none;
}

.goal-input {
  width: 64px;
  text-align: center;
  cursor: text;
}

.goal-done {
  margin-top: 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

.goal-done.hidden { display: none; }

.time-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-btn {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.preset-btn:hover:not(.active) { background: #f0ede8; }
.preset-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ─── Common section spacing ───────────────────────────── */
.protocol-section,
.how-section,
.cases-section,
.faq-section,
.disclaimer-section {
  padding: 80px 0;
}

.how-section  { background: var(--white); }

section h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  text-align: center;
  margin-bottom: 48px;
}

/* ─── Protocol steps ───────────────────────────────────── */
.steps {
  list-style: none;
  max-width: 620px;
  margin: 0 auto 28px;
}

.steps li {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.hint {
  max-width: 620px;
  margin: 0 auto;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* ─── Cards ────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.cases-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.card {
  background: var(--white);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 2px 16px var(--shadow);
}

.how-section .card {
  box-shadow: none;
  border: 1.5px solid var(--border);
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.card p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

/* ─── FAQ ──────────────────────────────────────────────── */
.faq-list {
  max-width: 640px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-q {
  width: 100%;
  background: none;
  border: none;
  padding: 20px 0;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.faq-q::after {
  content: '+';
  font-size: 22px;
  font-weight: 300;
  color: var(--accent);
  flex-shrink: 0;
  line-height: 1;
  transition: transform 0.2s;
}

.faq-item.open .faq-q::after { transform: rotate(45deg); }

.faq-a {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.faq-item.open .faq-a { max-height: 200px; }

.faq-a p {
  padding-bottom: 20px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

/* ─── Disclaimer ───────────────────────────────────────── */
.disclaimer-section {
  background: var(--white);
  border-top: 1px solid var(--border);
}

.disclaimer-section h2 {
  text-align: left;
  font-size: 1.4rem;
  margin-bottom: 20px;
}

.disclaimer-section p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
  max-width: 640px;
  line-height: 1.7;
}

/* ─── Footer ───────────────────────────────────────────── */
footer {
  background: var(--track);
  color: #888;
  padding: 28px 0;
  font-size: 13px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

footer a { color: #aaa; text-decoration: none; }
footer a:hover { color: #fff; }
footer strong { color: #ccc; }

/* ─── Mobile ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 60px 0 48px; }
  section h2 { margin-bottom: 32px; }

  .controls {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .track { height: 96px; }
  .timer { font-size: 28px; }

  .rating-dots { gap: 4px; }
  .r-btn { width: 36px; height: 36px; font-size: 12px; }

  .modal { padding: 28px 20px; }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
}
