/* style.css */
:root {
  color-scheme: dark;
  --bg: #08101f;
  --bg-deep: #050a14;
  --panel: rgba(17, 29, 52, 0.62);
  --panel-solid: #111d35;
  --line: rgba(220, 221, 255, 0.12);
  --text: #f7f5ff;
  --muted: #aeb5cd;
  --quiet: #747d9d;
  --lavender: #c7a6ff;
  --pink: #f3a3c9;
  --mint: #8ee6d6;
  --warm: #f8d88f;
  --shadow: 0 25px 70px rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f0f2fc;
  --bg-deep: #e4e9f8;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #ffffff;
  --line: rgba(66, 59, 112, 0.13);
  --text: #20243b;
  --muted: #626984;
  --quiet: #878da5;
  --lavender: #7658c8;
  --pink: #c45e91;
  --mint: #277f77;
  --warm: #b4801f;
  --shadow: 0 25px 70px rgba(70, 77, 124, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 27%, rgba(118, 85, 210, 0.18), transparent 27rem),
    radial-gradient(circle at 5% 90%, rgba(41, 145, 151, 0.12), transparent 25rem),
    var(--bg);
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background 500ms ease, color 300ms ease;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

#sky {
  position: fixed;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 760;
  letter-spacing: -0.05em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: flex;
  width: 27px;
  height: 27px;
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lavender), var(--pink));
  box-shadow: 0 5px 18px color-mix(in srgb, var(--lavender) 35%, transparent);
}

.brand-mark i {
  display: block;
  width: 3px;
  border-radius: 4px;
  background: #fff;
}

.brand-mark i:nth-child(1) {
  height: 7px;
  opacity: 0.7;
}

.brand-mark i:nth-child(2) {
  height: 12px;
}

.brand-mark i:nth-child(3) {
  height: 9px;
  opacity: 0.86;
}

.top-actions {
  display: flex;
  gap: 5px;
}

.icon-btn {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--panel);
  border-color: var(--line);
}

.icon-btn:active {
  transform: scale(0.91);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.enabled {
  color: var(--mint);
}

.icon-btn:not(.enabled) .sound-wave {
  opacity: 0.25;
}

.hero {
  padding: clamp(42px, 9vh, 82px) 7px 27px;
  text-align: center;
  animation: rise 650ms both ease-out;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--lavender);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  line-height: 1.4;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.65rem, 11vw, 4.7rem);
  font-weight: 400;
  letter-spacing: -0.07em;
  line-height: 0.95;
}

.hero h1 em {
  color: var(--pink);
  font-weight: 400;
}

.subtitle {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 3.7vw, 1.08rem);
  line-height: 1.55;
}

.focus-card {
  padding: 17px 14px 18px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: rise 700ms 90ms both ease-out;
}

.mode-tabs {
  display: flex;
  width: min(100%, 345px);
  margin: 0 auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-deep) 36%, transparent);
}

.mode-tab {
  min-height: 42px;
  flex: 1;
  border: 0;
  border-radius: 11px;
  color: var(--quiet);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 750;
  cursor: pointer;
  transition: background 220ms ease, color 220ms ease, box-shadow 220ms ease;
}

.mode-tab.active {
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: 0 3px 13px rgba(0, 0, 0, 0.16);
}

.timer-stage {
  display: grid;
  justify-items: center;
  padding: 24px 0 14px;
}

.orb-wrap {
  position: relative;
  display: grid;
  width: min(70vw, 270px);
  aspect-ratio: 1;
  place-items: center;
}

.timer-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.ring-track,
.ring-progress {
  fill: none;
  stroke-width: 2.5;
}

.ring-track {
  stroke: var(--line);
}

.ring-progress {
  stroke: var(--mint);
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--mint) 60%, transparent));
  transition: stroke-dashoffset 250ms linear;
}

.orb {
  position: relative;
  display: grid;
  width: 78%;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background:
    radial-gradient(circle at 31% 26%, rgba(255, 255, 255, 0.55), transparent 4%),
    radial-gradient(circle at 38% 31%, rgba(255, 205, 231, 0.7), transparent 18%),
    radial-gradient(circle at 70% 67%, rgba(105, 242, 221, 0.48), transparent 35%),
    linear-gradient(140deg, #9c72dd, #5b519f 55%, #306f87);
  box-shadow:
    inset -15px -20px 50px rgba(11, 24, 64, 0.42),
    inset 9px 8px 30px rgba(255, 255, 255, 0.25),
    0 15px 56px rgba(124, 89, 211, 0.35);
  transition: transform 600ms ease, box-shadow 600ms ease;
}

.orb::before {
  position: absolute;
  width: 125%;
  height: 45%;
  content: "";
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transform: rotate(-34deg) translateY(-55px);
  filter: blur(5px);
}

.orb::after {
  position: absolute;
  inset: -60%;
  content: "";
  background: conic-gradient(from 30deg, transparent, rgba(255, 255, 255, 0.15), transparent 28%);
  animation: shimmer 9s linear infinite;
}

.orb-wrap.is-active .orb {
  transform: scale(1.035);
  box-shadow:
    inset -15px -20px 50px rgba(11, 24, 64, 0.42),
    inset 9px 8px 30px rgba(255, 255, 255, 0.25),
    0 0 0 10px rgba(171, 141, 255, 0.05),
    0 20px 75px rgba(151, 109, 243, 0.55);
  animation: breathe 4s ease-in-out infinite;
}

.orb-core {
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 67%);
}

.orb-glow {
  position: absolute;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: #fff;
  opacity: 0.14;
  filter: blur(19px);
  transform: translate(-35%, -35%);
}

.timer-readout {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 5px;
  text-align: center;
  text-shadow: 0 2px 14px rgba(21, 17, 52, 0.4);
}

#time {
  color: #fff;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(2rem, 9vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.1em;
}

#timerLabel {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.53rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.main-button {
  display: inline-flex;
  min-width: 173px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.19);
  border-radius: 999px;
  color: #33265a;
  background: linear-gradient(120deg, #e4d2ff, #a9eedf);
  box-shadow: 0 10px 30px rgba(70, 53, 130, 0.22);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.main-button:hover {
  filter: brightness(1.06);
  box-shadow: 0 14px 37px rgba(70, 53, 130, 0.3);
  transform: translateY(-2px);
}

.main-button:active {
  transform: translateY(1px) scale(0.98);
}

.main-button.is-active {
  color: var(--text);
  background: color-mix(in srgb, var(--panel-solid) 90%, var(--lavender));
}

.play-icon {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}

.main-button.is-active .play-icon {
  width: 10px;
  height: 12px;
  margin-left: 0;
  border: 0;
  border-right: 3px solid currentColor;
  border-left: 3px solid currentColor;
}

.reset-button {
  min-height: 44px;
  margin-top: 6px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  color: var(--quiet);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}

.reset-button:hover {
  color: var(--text);
  background: var(--line);
}

.reset-button[hidden] {
  display: none;
}

.duration-row {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 2px;
}

.duration {
  min-width: 56px;
  min-height: 44px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--quiet);
  background: transparent;
  font-size: 0.85rem;
  font-weight: 780;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease, border 180ms ease;
}

.duration small {
  font-size: 0.61rem;
  font-weight: 700;
  opacity: 0.7;
}

.duration:hover,
.duration.active {
  border-color: var(--line);
  color: var(--text);
  background: color-mix(in srgb, var(--panel-solid) 50%, transparent);
}

.duration.custom {
  min-width: 44px;
  font-size: 1.3rem;
  font-weight: 400;
}

.intention-section {
  padding: 25px 5px 17px;
  animation: rise 700ms 150ms both ease-out;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.section-heading label {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 750;
}

.section-heading span {
  color: var(--quiet);
  font-size: 0.66rem;
}

.intention-input-wrap {
  display: flex;
  min-height: 55px;
  align-items: center;
  gap: 10px;
  padding: 0 10px 0 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  transition: border 180ms ease, box-shadow 180ms ease;
}

.intention-input-wrap:focus-within {
  border-color: color-mix(in srgb, var(--lavender) 65%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--lavender) 11%, transparent);
}

.spark {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 13px var(--pink);
}

.intention-input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 0.9rem;
}

.intention-input-wrap input::placeholder {
  color: var(--quiet);
}

.intention-input-wrap button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 1.35rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, background 180ms ease;
}

.intention-input-wrap button.visible {
  opacity: 1;
  pointer-events: auto;
}

.intention-input-wrap button:hover {
  background: var(--line);
}

.today-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 19px;
  border: 1px solid color-mix(in srgb, var(--lavender) 20%, var(--line));
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--lavender) 15%, transparent), transparent 50%),
    var(--panel);
  animation: rise 700ms 210ms both ease-out;
}

.today-copy {
  min-width: 0;
}

.today-copy .eyebrow {
  margin-bottom: 6px;
  font-size: 0.58rem;
}

.today-copy strong {
  display: block;
  color: var(--text);
  font-size: 0.98rem;
}

.today-copy strong span {
  color: var(--mint);
}

.today-copy p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.petals {
  position: relative;
  width: 84px;
  height: 76px;
  flex: 0 0 auto;
}

.petal {
  --a: calc(var(--i) * 51.42deg);
  position: absolute;
  top: 29px;
  left: 33px;
  width: 21px;
  height: 37px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 21px 21px 5px 21px;
  background: color-mix(in srgb, var(--quiet) 20%, transparent);
  opacity: 0.45;
  transform: rotate(var(--a)) translateY(-17px) scale(0.82);
  transform-origin: 9px 55px;
  transition: background 500ms ease, transform 500ms cubic-bezier(.2, .8, .3, 1), opacity 500ms ease;
}

.petal.grown {
  background: linear-gradient(145deg, var(--pink), var(--lavender));
  box-shadow: 0 2px 14px color-mix(in srgb, var(--lavender) 28%, transparent);
  opacity: 1;
  transform: rotate(var(--a)) translateY(-17px) scale(1);
}

.petals::after {
  position: absolute;
  top: 32px;
  left: 36px;
  width: 15px;
  height: 15px;
  content: "";
  border-radius: 50%;
  background: var(--warm);
  box-shadow: 0 0 15px color-mix(in srgb, var(--warm) 55%, transparent);
}

.bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 2px 0;
  animation: rise 700ms 280ms both ease-out;
}

.text-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.text-button:hover {
  color: var(--text);
  background: var(--line);
}

.text-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quote {
  color: var(--quiet);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.74rem;
  font-style: italic;
  text-align: right;
}

dialog {
  width: min(calc(100% - 34px), 400px);
  border: 1px solid var(--line);
  border-radius: 26px;
  color: var(--text);
  background: var(--panel-solid);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.45);
}

dialog::backdrop {
  background: rgba(4, 7, 19, 0.64);
  backdrop-filter: blur(8px);
}

.dialog-card {
  position: relative;
  padding: 28px;
}

.dialog-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.05em;
}

.dialog-card > p:not(.eyebrow) {
  margin: 10px 0 23px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.dialog-close {
  position: absolute;
  top: 13px;
  right: 13px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
}

.dialog-close:hover {
  background: var(--line);
}

.number-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

#customMinutes {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  color: var(--text);
  background: var(--bg);
  font-size: 1.15rem;
}

.apply-button,
.celebration-card button {
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
  border: 0;
  border-radius: 14px;
  color: #302553;
  background: linear-gradient(120deg, #dfceff, #a7ecdc);
  font-weight: 800;
  cursor: pointer;
}

.celebration {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  visibility: hidden;
  background: rgba(4, 7, 19, 0);
  backdrop-filter: blur(0);
  transition: background 350ms ease, backdrop-filter 350ms ease, visibility 350ms;
}

.celebration.show {
  visibility: visible;
  background: rgba(4, 7, 19, 0.6);
  backdrop-filter: blur(12px);
}

.celebration-card {
  position: relative;
  width: min(100%, 385px);
  padding: 37px 28px 27px;
  border: 1px solid rgba(255, 255, 255, 0.19);
  border-radius: 27px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(198, 163, 255, 0.32), transparent 48%),
    var(--panel-solid);
  box-shadow: 0 26px 100px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 400ms ease 80ms, transform 400ms cubic-bezier(.2, .9, .3, 1) 80ms;
}

.celebration.show .celebration-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.celebration-star {
  display: block;
  margin-bottom: 15px;
  color: var(--warm);
  font-size: 2.1rem;
  text-shadow: 0 0 22px var(--warm);
}

.celebration-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: -0.06em;
}

.celebration-card > p:not(.eyebrow) {
  margin: 11px auto 5px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.burst-particle {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 12px var(--c);
  pointer-events: none;
  animation: burst var(--d) ease-out forwards;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1.025);
  }

  50% {
    transform: scale(1.055);
  }
}

@keyframes shimmer {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes burst {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }

  100% {
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.1);
    opacity: 0;
  }
}

@media (min-width: 650px) {
  .app-shell {
    padding-right: 34px;
    padding-left: 34px;
  }

  .focus-card {
    padding: 20px 30px 22px;
  }

  .intention-section {
    padding-right: 15px;
    padding-left: 15px;
  }

  .today-card {
    padding: 21px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
