/* myadhd.dev — calm, low-stimulation dark theme */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
:root {
  --bg: #14141c;
  --bg2: #1b1b26;
  --card: #1e1e2a;
  --line: #2c2c3c;
  --text: #e6e6f0;
  --dim: #9c9cb4;
  --accent: #a78bfa;
  --accent-dim: #6d5aa8;
  --good: #7dd3a0;
  --warm: #f9c846;
  --radius: 18px;
}
body {
  font-family: ui-rounded, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; line-height: 1.6;
}
main { max-width: 760px; margin: 0 auto; padding: 0 20px 60px; }

/* sr-only for accessibility */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* skip link */
.skip-link {
  position: absolute; top: -100%; left: 16px; z-index: 1000;
  background: var(--accent); color: #fff; padding: 8px 16px; border-radius: 8px;
  text-decoration: none; font-weight: 700;
}
.skip-link:focus { top: 8px; }

/* header */
.top {
  max-width: 760px; margin: 0 auto; padding: 22px 20px 6px;
  display: flex; flex-direction: column; gap: 14px;
}
.logo { font-size: 1.5rem; font-weight: 800; color: var(--text); text-decoration: none; letter-spacing: -0.5px; }
.logo span { color: var(--accent); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  color: var(--dim); text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--bg2);
  transition: all 0.15s ease;
}
.tab:hover { color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tab.on { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }

/* tools */
.tool-head { margin: 34px 0 18px; }
h1 { font-size: 1.9rem; letter-spacing: -0.5px; }
.sub { color: var(--dim); margin-top: 6px; max-width: 40rem; }
.card {
  background: var(--card); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 24px;
}
.center { text-align: center; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row.center { justify-content: center; }
.row.gap { margin-top: 18px; justify-content: center; }
input[type="text"] {
  flex: 1 1 240px; font: inherit; color: var(--text);
  background: var(--bg2); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 16px; outline: none;
  transition: border-color 0.15s ease;
}
input[type="text"]:focus { border-color: var(--accent-dim); }
input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  font: inherit; font-weight: 700; cursor: pointer; color: #fff;
  background: var(--accent-dim); border: none; border-radius: 12px; padding: 12px 22px;
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--dim); }
.btn.ghost:hover { color: var(--text); border-color: var(--accent-dim); }

.chip {
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  color: var(--dim); background: var(--bg2); border: 1.5px solid var(--line);
  border-radius: 999px; padding: 7px 15px;
  transition: all 0.15s ease;
}
.chip:hover, .chip.on { color: var(--text); border-color: var(--accent-dim); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 22px; }

.tiny { color: var(--dim); font-size: .85rem; margin-top: 14px; }

/* welcome */
.welcome-q {
  font-size: 1.2rem; font-weight: 600; margin-bottom: 20px;
}
.welcome-picks {
  display: flex; flex-direction: column; gap: 10px;
  max-width: 360px; margin: 0 auto;
}
.welcome-btn {
  font-size: 1rem; text-align: left; padding: 14px 20px;
}

/* context bar (shows when timer is linked to a task step) */
.context-bar {
  background: var(--bg2); border: 1.5px solid var(--accent-dim);
  border-radius: 12px; padding: 10px 16px; margin-bottom: 12px;
  font-size: .9rem; color: var(--dim); text-align: center;
}
.context-bar strong { color: var(--text); margin-left: 6px; }

/* breaker */
.progress-wrap { height: 8px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin: 18px 0 6px; }
.progress { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.steps { list-style: none; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.steps li {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg2); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}
.steps li.active-step { border-color: var(--accent-dim); background: #22223a; }
.steps li .tick {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 2px; cursor: pointer;
  border: 2px solid var(--accent-dim); border-radius: 7px; background: transparent;
  transition: all 0.15s ease;
}
.steps li .tick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.steps li.done .tick { background: var(--good); border-color: var(--good); }
.steps li.done .txt { color: var(--dim); text-decoration: line-through; }
.steps li .txt { flex: 1; outline: none; }
.steps li .txt:focus { background: var(--bg); border-radius: 6px; }
.steps li .mins { flex: 0 0 auto; color: var(--accent); font-weight: 700; font-size: .85rem; margin-top: 3px; }
.steps li .step-actions {
  flex: 0 0 auto; display: flex; gap: 4px; margin-top: 1px;
}
.step-go {
  font: inherit; font-size: .75rem; font-weight: 700; cursor: pointer;
  color: var(--accent); background: transparent; border: 1.5px solid var(--accent-dim);
  border-radius: 8px; padding: 3px 10px; white-space: nowrap;
  transition: all 0.15s ease;
}
.step-go:hover { background: var(--accent-dim); color: #fff; }
.step-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.steps li.done .step-go { display: none; }

/* done message */
.done-msg {
  text-align: center; padding: 24px 0;
}
.done-text { font-size: 1.15rem; font-weight: 600; margin-bottom: 14px; }

/* timer */
.timer-wrap { position: relative; width: 240px; margin: 10px auto; }
.ring { width: 240px; height: 240px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--bg2); stroke-width: 10; }
.ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 628.3; stroke-dashoffset: 0;
  transition: stroke 0.3s ease;
}
.ring-fg.break-ring { stroke: var(--good); }
.timer-readout {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.timer-time { font-size: 2.6rem; font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.timer-phase { color: var(--dim); font-size: .9rem; font-weight: 600; }
.timer-phase.break { color: var(--good); }

/* completion overlay */
.completion-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 20, 28, 0.92);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.3s ease;
}
.completion-overlay[hidden] {
  display: none !important;
}
.completion-card {
  background: var(--card); border: 1.5px solid var(--accent-dim);
  border-radius: var(--radius); padding: 40px 32px;
  max-width: 400px; text-align: center;
  position: relative;
  animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.completion-emoji { font-size: 3rem; margin-bottom: 12px; }
.completion-title { font-size: 1.4rem; margin-bottom: 8px; }
.completion-stat { color: var(--dim); margin-bottom: 18px; }

/* next step prompt */
.next-step-prompt {
  text-align: center; padding: 24px 0;
  animation: fadeIn 0.3s ease;
}
.next-step-text {
  font-size: 1.15rem; font-weight: 600; margin: 8px 0 4px;
  color: var(--accent);
}

/* dopamine menu */
.menu-item {
  background: var(--bg2); border: 1.5px dashed var(--accent-dim); border-radius: 14px;
  padding: 26px 22px; margin: 8px auto; max-width: 34rem;
}
.menu-text { font-size: 1.15rem; font-weight: 600; }
#menu-streak { margin-top: 16px; }
.streak-num { color: var(--accent); font-weight: 800; }

/* one thing */
.now-label { color: var(--dim); text-transform: uppercase; letter-spacing: 2px; font-size: .8rem; margin-top: 8px; }
.now-text { font-size: 1.5rem; font-weight: 700; margin: 12px 0 20px; }
.now-source { margin-bottom: 16px; }

/* confetti canvas */
.confetti-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 200;
}

/* session stats */
.session-stats { margin-top: 12px; }

/* footer */
.foot {
  max-width: 760px; margin: 40px auto 0; padding: 24px 20px 40px;
  border-top: 1.5px solid var(--line); color: var(--dim); font-size: .92rem;
}
.foot .tiny { margin-top: 6px; }

/* keyboard shortcut hints */
.kbd-hint {
  font-size: .7rem; color: var(--dim); opacity: 0.6;
  margin-left: 6px;
}

/* animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes stepComplete {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.step-just-done {
  animation: stepComplete 0.3s ease;
}

/* Reduced motion: disable all animations and transitions */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 560px) {
  h1 { font-size: 1.55rem; }
  .timer-wrap, .ring { width: 200px; height: 200px; }
  .welcome-btn { font-size: .9rem; padding: 12px 16px; }
}


/* Unstuck Protocol */
.unstuck-trigger {
  position: fixed;
  bottom: 25px;
  right: 25px;
  padding: 12px 24px;
  border-radius: 50px;
  background: linear-gradient(135deg, #ff7e5f, #feb47b);
  color: #121212;
  font-size: 1.1em;
  font-weight: 800;
  border: none;
  box-shadow: 0 6px 16px rgba(255, 126, 95, 0.4);
  cursor: pointer;
  z-index: 100;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.unstuck-trigger:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px rgba(255, 126, 95, 0.6);
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}
.modal-overlay[hidden] {
  display: none !important;
}

.unstuck-card {
  background: var(--bg-card, #1e1e2e);
  padding: 40px;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  border: 1px solid var(--border, #313244);
  position: relative;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.close-modal, .modal-close {
  position: absolute;
  top: 15px; right: 20px;
  background: none; border: none; font-size: 28px;
  color: var(--text-muted, #a6adc8); cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s ease;
}
.close-modal:hover, .modal-close:hover {
  color: var(--text, #e6e6f0);
}
.unstuck-phase h2 { margin-top: 0; color: var(--text-main, #cdd6f4); margin-bottom: 15px; }
.unstuck-phase p { color: var(--text-main, #bac2de); margin-bottom: 25px; font-size: 1.1em; line-height: 1.4;}
.micro-suggestions { text-align: left; color: var(--text-muted, #a6adc8); margin: 0 auto 25px auto; display: inline-block;}
.micro-suggestions li { padding: 6px 0; font-size: 1.05em;}

/* Breathing Animation - Physiological Sigh */
.breathing-circle-container {
  height: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin: 30px 0;
}
.breathing-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(137, 180, 250, 0.4);
  border: 2px solid rgba(137, 180, 250, 0.8);
  animation: breathe 8s infinite cubic-bezier(0.4, 0, 0.2, 1);
}
#breathe-text {
  position: absolute;
  font-weight: bold;
  color: var(--text-main, #cdd6f4);
  font-size: 1.2em;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

@keyframes breathe {
  0% { transform: scale(1); }              /* Start Inhale */
  25% { transform: scale(1.6); }           /* First Inhale done (2s) */
  35% { transform: scale(1.55); }          /* Slight pause */
  45% { transform: scale(2.0); }           /* Second sharp inhale (peak) */
  50% { transform: scale(2.0); }           /* Brief hold */
  100% { transform: scale(1); }            /* Slow extended exhale (4s) */
}


.ring.pie-mode {
  transition: opacity 0.3s;
}

#ring-pie-path {
  transform-origin: 110px 110px;
  transition: d 1s linear;
}

#ring-pie-svg.alert-amber #ring-pie-path {
  fill: #f59e0b; /* Amber */
  animation: pulse-amber 4s infinite alternate;
}

@keyframes pulse-amber {
  0% { fill: #d97706; }
  100% { fill: #f59e0b; }
}



/* Ambient Doubling */
.ambient-pill {
  position: absolute;
  right: var(--spacing);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface0);
  border: 1px solid var(--surface1);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s;
  user-select: none;
}
.ambient-pill:hover, .ambient-pill:focus-visible {
  background: var(--surface1);
  color: var(--text-main);
}
.pill-dot {
  font-size: 0.6rem;
  animation: slow-pulse 4s ease-in-out infinite alternate;
}
@keyframes slow-pulse {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

.ambient-panel {
  position: absolute;
  right: var(--spacing);
  top: calc(100% + 4px);
  width: 320px;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ambient-panel[hidden] {
  display: none !important;
}
.ambient-panel-head {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--surface1);
}
.ambient-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 150px;
  overflow: hidden;
  position: relative;
}
.ambient-feed::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--surface0));
  pointer-events: none;
}
.feed-item {
  font-size: 0.85rem;
  color: var(--text-main);
  animation: slide-down 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
  transform: translateY(-10px);
}
@keyframes slide-down {
  to { transform: translateY(0); opacity: 1; }
}
.ambient-cheer {
  margin-top: 4px;
  background: var(--surface1);
  border: 1px solid var(--surface2);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.ambient-cheer:hover, .ambient-cheer:focus-visible {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.ambient-cheer:active {
  transform: scale(0.97);
}

@media (max-width: 900px) {
  .ambient-pill {
    position: static;
    transform: none;
    margin-left: auto;
  }
  .top {
    flex-wrap: wrap;
    gap: 12px;
  }
}

/* Morning Sweep */
.sweep-card {
  background: var(--bg-card, #1e1e2e);
  padding: 36px 28px;
  border-radius: 20px;
  max-width: 520px;
  width: 92%;
  border: 1px solid var(--border, #313244);
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  max-height: 85vh;
  overflow-y: auto;
}
.sweep-card h2 { font-size: 1.5rem; margin-bottom: 8px; }
.sweep-sub { color: var(--dim); font-size: .95rem; margin-bottom: 22px; line-height: 1.5; }
.sweep-items {
  list-style: none; text-align: left;
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 24px;
}
.sweep-items li {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 10px 14px;
  transition: opacity 0.6s ease, transform 0.6s ease, max-height 0.4s ease 0.3s;
  max-height: 80px; overflow: hidden;
}
.sweep-items li .sweep-text { flex: 1; font-size: .95rem; }
.sweep-items li .sweep-btn {
  flex: 0 0 auto; font: inherit; font-size: .75rem; font-weight: 700;
  cursor: pointer; border-radius: 8px; padding: 4px 12px;
  transition: all 0.15s ease; white-space: nowrap;
}
.sweep-keep {
  color: var(--good); background: transparent; border: 1.5px solid var(--good);
}
.sweep-keep:hover { background: var(--good); color: #14141c; }
.sweep-keep.kept { background: var(--good); color: #14141c; pointer-events: none; }
.sweep-release {
  color: var(--accent); background: transparent; border: 1.5px solid var(--accent-dim);
}
.sweep-release:hover { background: var(--accent-dim); color: #fff; }
.sweep-items li.released {
  opacity: 0; transform: translateY(-8px) scale(0.95);
  max-height: 0; padding: 0 14px; margin: 0; border-color: transparent;
}
.sweep-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@keyframes stardust {
  0% { opacity: 1; filter: blur(0); }
  60% { opacity: 0.3; filter: blur(2px); }
  100% { opacity: 0; filter: blur(6px); transform: translateY(-12px) scale(0.8); }
}
.sweep-dissolve { animation: stardust 0.6s ease forwards; }
