:root {
  --bg: #FBF4EA;
  --surface: #FFFFFF;
  --border: #EBDFCE;
  --text: #2E2420;
  --text-soft: #8A7C6D;
  --accent: #E2764F;
  --accent-strong: #C85F3B;
  --accent-soft: #F6DECB;
  --accent-2: #6FA287;
  --accent-2-soft: #DFF0E6;
  --shadow: 0 12px 30px -12px rgba(120, 90, 60, 0.25);
  --radius-pill: 999px;
  --radius-lg: 28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', 'Avenir Next', 'Segoe UI', sans-serif;
  overflow-x: hidden;
}

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}
.glow-a {
  top: -120px;
  left: -100px;
  width: 420px;
  height: 420px;
  background: rgba(226, 118, 79, 0.28);
}
.glow-b {
  top: -80px;
  right: -120px;
  width: 460px;
  height: 460px;
  background: rgba(111, 162, 135, 0.24);
}

#app {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.site-header { margin-bottom: 40px; }

.brand {
  font-family: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  font-weight: 600;
  font-size: clamp(32px, 6vw, 44px);
  margin: 0;
  letter-spacing: -0.01em;
}

.made-by {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 8px 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, color .15s ease;
}
.made-by:hover { border-color: var(--accent); color: var(--accent-strong); }

.made-by-handle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}

.tagline {
  margin: 14px 0 0;
  color: var(--text-soft);
  font-size: 15px;
}

.controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
}

.mode-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px;
  box-shadow: var(--shadow);
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-family: inherit;
  font-weight: 600;
  font-size: 14.5px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mode-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.mode-hint {
  color: var(--text-soft);
  font-size: 14px;
  margin: 0;
  max-width: 420px;
}

.stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.status-label {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-strong);
  margin: 0 0 18px;
}

.topic-display {
  font-family: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  font-weight: 500;
  font-size: clamp(34px, 7vw, 64px);
  line-height: 1.08;
  margin: 0 0 48px;
  max-width: 640px;
  min-height: 1.2em;
  --tick-dur: 140ms;
}

.topic-display.is-spinning {
  color: var(--text-soft);
}

.topic-display.tick-pulse {
  animation: reelTick var(--tick-dur) cubic-bezier(.22,.68,.32,1);
}

@keyframes reelTick {
  0% { transform: translateY(-16px); opacity: 0.25; filter: blur(2px); }
  65% { transform: translateY(1px); opacity: 1; filter: blur(0); }
  100% { transform: translateY(0); opacity: 1; filter: blur(0); }
}

.topic-display.just-landed {
  animation: landed .42s ease;
}

@keyframes landed {
  0% { transform: scale(0.94); }
  55% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

.btn:disabled,
.icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--radius-pill);
  padding: 15px 26px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(226, 118, 79, 0.6);
}
.btn-primary:hover { background: var(--accent-strong); }

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent-strong); }

.btn-block { width: 100%; }

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn:hover { color: var(--accent-strong); border-color: var(--accent); }

/* Timer overlay */
.timer-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(46, 36, 32, 0.35);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.timer-overlay:not([hidden]) { display: flex; }

.timer-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px -20px rgba(60, 40, 20, 0.35);
  padding: 36px 28px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.timer-category {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-strong);
  margin: 0 0 18px;
}

.reflect-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.reflect-tab {
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
}

.reflect-tab.is-active {
  border-color: var(--accent-2);
  color: var(--accent-2);
  background: var(--accent-2-soft);
}

.reflect-hint {
  color: var(--text-soft);
  font-size: 13.5px;
  margin: 0 0 26px;
  min-height: 1.2em;
}

.timer-circle-wrap {
  position: relative;
  width: 220px;
  height: 220px;
  margin-bottom: 22px;
}

.timer-svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.timer-track {
  fill: none;
  stroke: var(--accent-soft);
  stroke-width: 10;
}

.timer-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 628.3;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.timer-time {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  font-weight: 500;
  font-size: 52px;
  color: var(--text);
}

.timer-instruction {
  font-family: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  font-style: italic;
  font-size: 20px;
  color: var(--text);
  margin: 0 0 24px;
}

.btn-close {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--accent);
  text-decoration: underline;
  margin-top: 10px;
}

/* Settings overlay */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(46, 36, 32, 0.35);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.settings-overlay:not([hidden]) { display: flex; }

.settings-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px -20px rgba(60, 40, 20, 0.35);
  padding: 32px 28px;
  text-align: left;
}

.settings-card h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 24px;
  margin: 0 0 6px;
}

.settings-sub {
  color: var(--text-soft);
  font-size: 13.5px;
  margin: 0 0 26px;
}

.slider-block { margin-bottom: 24px; }

.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.slider-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-strong);
}

.slider-value { font-weight: 700; font-size: 15px; }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  color: var(--text-soft);
  font-size: 12px;
  margin-top: 4px;
}

.slider-note {
  color: var(--text-soft);
  font-size: 12px;
  margin: 6px 0 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  margin-bottom: 22px;
  cursor: pointer;
}
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--accent); }

.settings-saved {
  color: var(--text-soft);
  font-size: 12.5px;
  margin: 0 0 18px;
}

@media (max-width: 480px) {
  .timer-circle-wrap { width: 190px; height: 190px; }
  .timer-time { font-size: 44px; }
}
