/* =========================================================
   THE CELLULAR LONGEVITY & EPIGENETIC TIMER
   Design tokens live at the top so the whole palette can be
   retuned from one place.
   ========================================================= */

:root {
  --bg-deep: #0a0f12;
  --bg-panel: #0e1417;
  --bg-panel-raised: #121a1e;

  --accent-teal: #0e8388;
  --accent-emerald: #1fab89;
  --accent-mint: #e0f2f1;
  --accent-mint-dim: rgba(224, 242, 241, 0.55);

  --border-subtle: rgba(224, 242, 241, 0.08);
  --border-active: rgba(14, 131, 136, 0.55);

  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(120% 120% at 50% -10%, #101820 0%, var(--bg-deep) 55%);
  color: var(--accent-mint);
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 16px 48px;
}

.app {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* ===================== HEADER ===================== */

.app-header {
  text-align: center;
  padding-top: 8px;
}

.app-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent-mint);
}

.app-title span {
  display: block;
  font-size: 15px;
  font-weight: 400;
  color: var(--accent-mint-dim);
  margin-top: 4px;
}

.app-subtitle {
  margin: 10px 0 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(224, 242, 241, 0.35);
}

/* ===================== SESSION SELECT ===================== */

.session-select {
  display: flex;
  gap: 12px;
  width: 100%;
  transition: opacity 0.5s var(--ease-standard), max-height 0.5s var(--ease-standard), margin 0.5s var(--ease-standard);
  overflow: hidden;
}

.session-select.is-hidden {
  opacity: 0;
  max-height: 0;
  margin: -14px 0 0;
  pointer-events: none;
}

.session-btn {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 18px 8px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--accent-mint-dim);
  cursor: pointer;
  transition: border-color 0.25s var(--ease-standard), color 0.25s var(--ease-standard), transform 0.15s var(--ease-standard), background 0.25s var(--ease-standard);
}

.session-btn:hover {
  border-color: var(--border-active);
  color: var(--accent-mint);
}

.session-btn:active {
  transform: scale(0.97);
}

.session-btn.is-selected {
  background: linear-gradient(160deg, rgba(14, 131, 136, 0.22), rgba(31, 171, 137, 0.12));
  border-color: var(--accent-teal);
  color: var(--accent-mint);
}

.session-btn-time {
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
}

.session-btn-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.session-btn-badge {
  position: absolute;
  top: -9px;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-teal);
  color: #06181a;
  font-weight: 700;
}

/* ===================== VISUALIZER ===================== */

.visualizer {
  display: flex;
  justify-content: center;
  width: 100%;
}

.ring-wrap {
  position: relative;
  width: min(300px, 78vw);
  height: min(300px, 78vw);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Soft animated "breathing" glow behind the ring.
   6s cycle = roughly one natural inhale/exhale, used to pace respiration. */
.breathing-ring {
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent-teal), var(--accent-emerald), var(--accent-teal));
  filter: blur(22px);
  opacity: 0.35;
  animation: breathe 6s ease-in-out infinite;
}

@keyframes breathe {
  0%   { transform: scale(0.88); opacity: 0.22; }
  50%  { transform: scale(1.04); opacity: 0.5; }
  100% { transform: scale(0.88); opacity: 0.22; }
}

.breathing-ring.is-paused {
  animation-play-state: paused;
  opacity: 0.18;
}

/* Cooldown: same breathing motion, slowed down as the tone settles. */
.breathing-ring.is-cooldown {
  animation-duration: 12s;
  opacity: 0.2;
}

.progress-ring {
  position: relative;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring-track {
  fill: none;
  stroke: var(--border-subtle);
  stroke-width: 6;
}

.progress-ring-fill {
  fill: none;
  stroke: url(#ringGradientFallback);
  stroke: var(--accent-teal);
  stroke-width: 6;
  stroke-linecap: round;
  /* circumference = 2 * PI * 138 ≈ 867.08 */
  stroke-dasharray: 867.08;
  stroke-dashoffset: 867.08;
  transition: stroke-dashoffset 0.9s linear;
}

.timer-readout {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.timer-time {
  font-size: 52px;
  font-weight: 300;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-mint);
}

.timer-state {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-mint-dim);
}

/* ===================== CONTROLS ===================== */

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

.btn-primary {
  width: 100%;
  padding: 17px 20px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 999px;
  color: #06181a;
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-emerald));
  cursor: pointer;
  transition: transform 0.15s var(--ease-standard), opacity 0.25s var(--ease-standard), box-shadow 0.25s var(--ease-standard);
  box-shadow: 0 8px 24px rgba(14, 131, 136, 0.28);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary:not(:disabled):hover {
  box-shadow: 0 10px 30px rgba(14, 131, 136, 0.4);
}

.btn-primary:not(:disabled):active {
  transform: scale(0.98);
}

.btn-primary.is-active {
  background: linear-gradient(135deg, #103238, #14251f);
  color: var(--accent-mint);
  box-shadow: none;
  border: 1px solid var(--border-active);
}

.btn-reset {
  background: none;
  border: none;
  color: var(--accent-mint-dim);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 10px;
  opacity: 0;
  transition: opacity 0.6s var(--ease-standard);
}

.btn-reset.is-visible {
  opacity: 1;
}

.btn-reset:hover {
  color: var(--accent-mint);
}

/* ===================== DASHBOARD ===================== */

.dashboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.dashboard-title {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(224, 242, 241, 0.4);
}

.marker {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 4px;
  border-top: 1px solid var(--border-subtle);
  opacity: 0;
  transform: translateY(6px);
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.8s var(--ease-standard), transform 0.8s var(--ease-standard), max-height 0.8s var(--ease-standard), padding 0.8s var(--ease-standard);
}

.marker:first-child {
  border-top: none;
}

.marker.is-active {
  opacity: 1;
  transform: translateY(0);
  max-height: 160px;
  padding: 12px 4px;
}

.marker-icon {
  color: var(--accent-teal);
  font-size: 14px;
  line-height: 1.6;
  flex-shrink: 0;
}

.marker.is-active .marker-icon {
  color: var(--accent-emerald);
}

.marker-heading {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-mint);
  margin-bottom: 3px;
}

.marker-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--accent-mint-dim);
}

/* ===================== FOOTER ===================== */

.app-footer {
  text-align: center;
}

.app-footer p {
  margin: 0;
  font-size: 11px;
  color: rgba(224, 242, 241, 0.28);
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 380px) {
  .timer-time { font-size: 42px; }
  .session-btn-time { font-size: 22px; }
}
