:root {
  --bg-0: #0e1512;
  --bg-1: #12201a;
  --ink: #eaf4ee;
  --ink-soft: #9fb6ab;
  --line: rgba(255, 255, 255, 0.08);

  /* mood palette */
  --thriving: #57d9a3;
  --content: #7fd1c4;
  --tired: #e6c66a;
  --wilting: #e08a6a;
  --accent: var(--thriving);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, Segoe UI,
    Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(
      120% 120% at 50% 0%,
      var(--bg-1) 0%,
      var(--bg-0) 60%
    )
    fixed;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 22px 22px 48px;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--ink-soft);
  font-size: 15px;
}

.streak {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  padding: 5px 11px;
  border-radius: 999px;
}

.buddy-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
}

/* ---------- the buddy ---------- */
.buddy {
  width: 260px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 22px 38px rgba(0, 0, 0, 0.45));
  animation: bob 4.5s ease-in-out infinite;
  transition: filter 0.6s ease;
}

.buddy-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* fade slightly during the mood swap so the image change feels gentle */
  transition: opacity 0.35s ease;
}
.buddy.swapping .buddy-img {
  opacity: 0;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* ---------- mood states (drive energy-bar/button accent + bob speed) ---------- */
.buddy[data-mood="thriving"] {
  --accent: var(--thriving);
}
.buddy[data-mood="content"] {
  --accent: var(--content);
  animation-duration: 5.5s;
}
.buddy[data-mood="tired"] {
  --accent: var(--tired);
  animation-duration: 7s;
}
.buddy[data-mood="wilting"] {
  --accent: var(--wilting);
  animation-duration: 9s;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.4));
}

.mood-line {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

/* ---------- focus length picker ---------- */
.focus-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.focus-label,
.focus-unit {
  letter-spacing: 0.2px;
}
.focus-picker button {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.focus-picker button:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.focus-picker button.active {
  color: #07140e;
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- energy bar ---------- */
.energy {
  width: 100%;
  max-width: 320px;
}

.energy-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 7px;
}

.energy-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.energy-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.8s ease, background 0.8s ease;
}

.hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 12px 0 0;
  min-height: 1.2em;
}

/* ---------- break button ---------- */
.break-btn {
  margin-top: 4px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  color: #07140e;
  background: var(--accent);
  padding: 14px 30px;
  border-radius: 999px;
  transition: transform 0.15s ease, background 0.8s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 26px rgba(87, 217, 163, 0.25);
}
.break-btn:hover {
  transform: translateY(-2px);
}
.break-btn:active {
  transform: translateY(0);
}

.nudge-toggle {
  margin-top: 2px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.nudge-toggle:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.nudge-toggle.on {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent);
}

.community {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

/* ---------- breathing overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(120% 120% at 50% 40%, #102019, #060b08 80%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: fade 0.5s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.breathe-scene {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.breathe-orb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9af5cf, #3fae87);
  box-shadow: 0 0 60px rgba(87, 217, 163, 0.5);
  transform: scale(0.6);
  transition: transform 4s ease-in-out, box-shadow 4s ease-in-out;
}
.breathe-orb.inhale {
  transform: scale(1.25);
  box-shadow: 0 0 100px rgba(87, 217, 163, 0.75);
}

.breathe-text {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.3px;
}
.breathe-sub {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: -14px 0 0;
}

.done-early {
  margin-top: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font: inherit;
  font-size: 14px;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.done-early:hover {
  border-color: var(--accent);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}
