:root {
  --canvas: #f2f0e9;
  --surface: rgba(255, 255, 255, 0.74);
  --line: rgba(27, 42, 47, 0.12);
  --text: #182f2c;
  --muted: #66797d;
  --accent: #f1734d;
  --accent-strong: #ff8a65;
  --accent-ink: #fff8f1;
  --ocean: #316d64;
  --sage: #96bda9;
  --player-ink: #f4f0e6;
  --player-muted: #bdcfc6;
  --serif: "Palatino Linotype", "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --sans: Avenir Next, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100dvh;
  background-color: var(--canvas);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view {
  display: flex;
  flex: 1;
  width: 100%;
  flex-direction: column;
}

#home {
  padding: calc(env(safe-area-inset-top) + 16px) 24px calc(env(safe-area-inset-bottom) + 34px);
}

#player {
  padding: calc(env(safe-area-inset-top) + 18px) 24px calc(env(safe-area-inset-bottom) + 26px);
  background:
    linear-gradient(160deg, rgba(244, 183, 95, 0.12), rgba(49, 109, 100, 0.42) 45%, #132e29 88%),
    linear-gradient(180deg, #1d4b43, #0f1d1d);
  color: var(--player-ink);
}

body.playing {
  background: linear-gradient(180deg, #f9f2e1 0%, #dce9df 42%, #1d4b43 100%);
}

.hidden {
  display: none;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ocean);
  color: #f8fbf8;
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

.brand-copy {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.status-chip {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
  font-size: 12px;
}

.hero {
  position: relative;
  min-height: 296px;
  margin: 10px -24px 20px;
  overflow: hidden;
  border-radius: 0 0 24px 24px;
  isolation: isolate;
}

.hero-scene,
.hero-scene svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 248, 241, 0.2), rgba(255, 248, 241, 0.02) 45%, rgba(23, 48, 44, 0.38));
}

.hero-copy {
  position: relative;
  z-index: 1;
  padding: 24px 24px 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  margin: 0 0 12px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  color: #486764;
  font-size: 12px;
  font-weight: 600;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.3;
}

.hero-copy p:not(.eyebrow) {
  max-width: 280px;
  margin: 12px 0 0;
  color: #40565b;
  font-size: 14px;
  line-height: 1.6;
}

.session-card {
  padding: 22px 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(232, 245, 237, 0.66)),
    rgba(255, 255, 255, 0.62);
  box-shadow: 0 20px 44px rgba(24, 47, 44, 0.1);
}

.session-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.card-label {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.session-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.24;
}

.session-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.session-badge {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(150, 189, 169, 0.28);
  color: #356a5b;
  font-size: 12px;
  white-space: nowrap;
}

.phase-track {
  display: flex;
  align-items: center;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.phase-track li {
  position: relative;
  flex: 1;
  padding-top: 16px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.phase-track li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(49, 109, 100, 0.3);
  border-radius: 50%;
  background: #fff;
  transform: translateX(-50%);
}

.phase-track li + li::after {
  content: "";
  position: absolute;
  top: 4px;
  left: calc(-50% + 10px);
  right: calc(50% + 10px);
  height: 1px;
  background: rgba(49, 109, 100, 0.16);
}

.start-row {
  margin-top: 22px;
}

.primary {
  width: 100%;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(120deg, var(--accent), #d95d3e);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  box-shadow: 0 14px 30px rgba(241, 115, 77, 0.24);
}

.primary svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.primary:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}

.start-hint {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.setting-group {
  margin-top: 26px;
}

.section-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.segmented {
  display: flex;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(24, 47, 44, 0.05);
  overflow: hidden;
}

.segmented button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 13px 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button span {
  font-size: 16px;
  font-weight: 600;
}

.segmented button small {
  color: inherit;
  font-size: 11px;
  opacity: 0.68;
}

.segmented button[aria-checked="true"] {
  background: rgba(49, 109, 100, 0.09);
  color: var(--ocean);
}

.durations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.durations button {
  height: 106px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  box-shadow: 0 8px 24px rgba(24, 47, 44, 0.05);
}

.durations .num {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 600;
  line-height: 1.3;
}

.durations .unit {
  color: var(--muted);
  font-size: 11px;
}

.durations button[aria-checked="true"] {
  border-color: rgba(241, 115, 77, 0.54);
  background: linear-gradient(160deg, rgba(255, 214, 168, 0.34), rgba(255, 255, 255, 0.74));
}

.durations button[aria-checked="true"] .num {
  color: #cc5031;
}

.player-bar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 240, 230, 0.17);
  border-radius: 8px;
  background: transparent;
  color: var(--player-muted);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.session-meta {
  margin: 0;
  color: var(--player-muted);
  font-size: 14px;
  text-align: center;
}

.bar-spacer {
  width: 44px;
}

.player-eyebrow {
  margin: 28px 0 0;
  color: rgba(244, 183, 95, 0.9);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-align: center;
}

.dial-wrap {
  position: relative;
  width: min(78vw, 292px);
  aspect-ratio: 1;
  margin: auto;
  padding: 40px 0;
}

.halo {
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 170, 120, 0.22), rgba(255, 170, 120, 0) 72%);
  opacity: 0.4;
  transition: opacity 0.8s ease;
}

.halo.active {
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.35;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.7;
  }
}

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

.dial-track {
  fill: none;
  stroke: rgba(244, 240, 230, 0.13);
  stroke-width: 6;
}

.dial-progress {
  fill: none;
  stroke: url(#ring-gradient);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear;
}

.dial-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.phase {
  margin: 0;
  color: var(--player-muted);
  font-size: 13px;
}

.remaining {
  margin: 0;
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.remaining-label {
  margin: 0;
  color: var(--player-muted);
  font-size: 12px;
}

.controls {
  display: flex;
  justify-content: center;
  padding-top: 34px;
}

.play-btn {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--accent-strong), #d95d3e);
  color: var(--accent-ink);
  box-shadow: 0 20px 48px rgba(241, 115, 77, 0.26);
}

.play-btn svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.play-btn .icon-pause {
  display: block;
}

.play-btn .icon-play {
  display: none;
}

.play-btn.paused .icon-pause {
  display: none;
}

.play-btn.paused .icon-play {
  display: block;
}

.player-hint {
  margin: auto 0 0;
  padding-top: 28px;
  color: rgba(244, 240, 230, 0.48);
  font-size: 12px;
  text-align: center;
}

button {
  cursor: pointer;
}

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

@media (max-width: 370px) {
  h1 {
    font-size: 31px;
  }

  .phase-track li {
    font-size: 10px;
  }

  .durations button {
    height: 92px;
  }

  .durations .num {
    font-size: 32px;
  }

  .durations .unit {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .halo.active {
    animation: none;
    opacity: 0.45;
  }
}
