:root {
  --pink: #ec4899;
  --pink-deep: #db2777;
  --lav: #8b5cf6;
  --ink: #3d2a38;
  --card: rgba(255, 255, 255, 0.86);
}

* { box-sizing: border-box; }

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

body {
  font-family: 'Nunito', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, #ffe0f0 0%, transparent 46%),
    radial-gradient(circle at 82% 84%, #ebe0ff 0%, transparent 48%),
    linear-gradient(160deg, #fff6fb 0%, #ffeaf6 52%, #f4ecff 100%);
  min-height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

.stage {
  position: relative;
  z-index: 1;
  width: min(92vw, 430px);
  padding: 34px 28px 30px;
  border-radius: 34px;
  background: var(--card);
  border: 1px solid #f9d3e7;
  box-shadow: 0 30px 60px -30px rgba(190, 24, 93, 0.5), inset 0 2px 0 #fff;
  backdrop-filter: blur(14px);
  text-align: center;
}

.head h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0.14em;
  font-weight: 800;
  background: linear-gradient(120deg, var(--pink-deep), #a21caf);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.head h1 span { margin-left: 4px; }
.sub { margin: 8px 0 24px; font-size: 13.5px; color: #8a6b7c; letter-spacing: 0.02em; }

.dial-wrap { position: relative; width: 240px; height: 240px; margin: 0 auto 22px; }

.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #fde4f1; stroke-width: 14; }
.ring-fg {
  fill: none;
  stroke: url(#none);
  stroke: var(--pink);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 653.45;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.9s linear, stroke 0.4s ease;
  filter: drop-shadow(0 0 8px rgba(236, 72, 153, 0.4));
}

.dial {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
}
.time {
  font-size: 52px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1;
}
.mode { font-size: 13px; font-weight: 800; letter-spacing: 0.3em; color: var(--pink); text-indent: 0.3em; }

.modes { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.mode-btn {
  border: 1.5px solid #fbd5e8;
  background: #fff;
  color: #8a6b7c;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.mode-btn:hover { border-color: #f9a8d4; color: var(--pink-deep); transform: translateY(-1px); }
.mode-btn.is-on {
  background: linear-gradient(135deg, var(--pink-deep), #a21caf);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 20px -10px rgba(190, 24, 93, 0.9);
}

.actions { display: flex; gap: 12px; justify-content: center; }
.btn {
  font: inherit;
  font-weight: 800;
  font-size: 16px;
  padding: 13px 30px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  min-height: 46px;
}
.btn:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }
.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--pink-deep), #a21caf);
  box-shadow: 0 16px 26px -14px rgba(190, 24, 93, 0.95), inset 0 2px 0 rgba(255,255,255,0.28);
}
.btn.primary:hover { transform: translateY(-2px); }
.btn.ghost { background: #fff; color: var(--pink-deep); border: 2px solid #fbd5e8; }
.btn.ghost:hover { background: #fff6fb; transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }

.done { margin: 18px 0 0; font-size: 14px; font-weight: 800; color: var(--pink-deep); }

body.is-break .ring-fg { stroke: var(--lav); }
body.is-break .mode { color: var(--lav); }

@media (max-width: 380px) {
  .dial-wrap { width: 200px; height: 200px; }
  .time { font-size: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .ring-fg { transition: none; }
  #petals { display: none; }
}
