:root {
  --panel: #fbf3dd;
  --fg: #5d4a36;
  --muted: #a89680;
  --track: #e7dcc4;
  --border: #8a6a48;
  --accent: #7ec850;
  --leaf-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 4C9 5 4 10 4 17c0 1.7 1.3 3 3 3 7 0 12-5 12-16z'/%3E%3C/svg%3E");
  --tri-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 3l5 8H2zM19 13l5 8h-10z' fill='%23ffffff' fill-opacity='.12'/%3E%3C/svg%3E");
  --tri-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 3l5 8H2zM19 13l5 8h-10z' fill='%23000000' fill-opacity='.09'/%3E%3C/svg%3E");
}

/* time of day, like the game */
body[data-time="day"], body:not([data-time]) {
  --sky1: #a5dbf7; --sky2: #e4f5fe;
  --hill1: #93cd6e; --hill2: #7cbc57;
  --cloud: #ffffff; --stars: 0;
}
body[data-time="dawn"] {
  --sky1: #f6c9a8; --sky2: #fdf0da;
  --hill1: #7fb35f; --hill2: #6aa24e;
  --cloud: #fdeada; --stars: 0;
}
body[data-time="dusk"] {
  --sky1: #e8a1a8; --sky2: #f9dcB2;
  --hill1: #5f8f52; --hill2: #4f7a44;
  --cloud: #f3cfc0; --stars: 0;
}
body[data-time="night"] {
  --sky1: #16283f; --sky2: #0b1828;
  --hill1: #3c5e44; --hill2: #2f4a38;
  --cloud: rgba(255, 255, 255, .22); --stars: 1;
}

body[data-mode="focus"] { --accent: #7ec850; }
body[data-mode="short"] { --accent: #62b3e5; }
body[data-mode="long"]  { --accent: #f0a35e; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: linear-gradient(var(--sky1), var(--sky2));
  color: var(--fg);
  font-family: "Fredoka", "Baloo 2", ui-rounded, system-ui, sans-serif;
  display: grid;
  place-items: center;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 1s;
}

/* ---- scene ---- */

.scene { position: fixed; inset: 0; pointer-events: none; }

.stars {
  position: absolute;
  inset: 0 0 30vh 0;
  opacity: var(--stars);
  transition: opacity 1.2s;
  background-image:
    radial-gradient(2px 2px at 30px 40px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 90px 130px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 150px 60px, #fff, transparent),
    radial-gradient(2px 2px at 210px 170px, #fff, transparent),
    radial-gradient(1px 1px at 60px 200px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 190px 100px, #fff, transparent);
  background-size: 240px 240px;
  background-repeat: repeat;
}

.cloud {
  position: absolute;
  left: -160px;
  width: 92px; height: 30px;
  background: var(--cloud);
  border-radius: 999px;
  animation: drift linear infinite;
  transition: background 1s;
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.cloud::before { width: 44px; height: 44px; top: -22px; left: 16px; }
.cloud::after  { width: 30px; height: 30px; top: -14px; left: 48px; }

.c1 { top: 9vh;  animation-duration: 130s; }
.c2 { top: 18vh; animation-duration: 170s; animation-delay: -60s; transform: scale(.8); }
.c3 { top: 4vh;  animation-duration: 200s; animation-delay: -140s; transform: scale(1.2); }

@keyframes drift { to { transform: translateX(calc(100vw + 340px)); } }

.hill {
  position: absolute;
  left: -25vw; right: -25vw;
  border-radius: 50% 50% 0 0;
  transition: background 1s;
}
.hill.back {
  height: 32vh; bottom: 7vh;
  background-color: var(--hill1);
  background-image: var(--tri-light);
  background-size: 24px;
}
.hill.front {
  height: 26vh; bottom: -3vh;
  background-color: var(--hill2);
  background-image: var(--tri-dark);
  background-size: 24px;
}

.tree { position: absolute; bottom: 16vh; }
.t1 { left: 5vw; }
.t2 { right: 7vw; transform: scale(.82); }
.trunk {
  position: absolute;
  bottom: 0; left: 50%;
  width: 20px; height: 58px;
  transform: translateX(-50%);
  background: #8a6a48;
  border-radius: 8px 8px 4px 4px;
}
.canopy {
  position: absolute;
  bottom: 34px; left: 50%;
  width: 110px; height: 84px;
  transform: translateX(-50%);
  background: var(--hill2);
  border-radius: 50% 50% 46% 54% / 62% 60% 40% 38%;
  transition: background 1s;
}
.canopy::before, .canopy::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.canopy::before { width: 52px; height: 52px; top: -16px; left: 8px; }
.canopy::after  { width: 44px; height: 44px; top: -12px; right: 10px; }

/* ---- card (AC dialog panel) ---- */

.card {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border: 4px solid var(--border);
  border-radius: 30px;
  padding: 1.6rem 2.8rem 1.9rem;
  box-shadow:
    inset 0 0 0 3px rgba(138, 106, 74, .16),
    0 18px 36px rgba(60, 40, 20, .22);
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.35rem;
  user-select: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.leaf { width: 1.45rem; height: 1.45rem; }
.leaf path { fill: var(--accent); transition: fill .4s; }
.leaf .vein { fill: none; stroke: rgba(0, 0, 0, .18); }

.modes { display: flex; gap: .6rem; }

button {
  font: inherit;
  font-weight: 500;
  color: var(--muted);
  background: #fff9e8;
  border: 2px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  padding: .35rem 1.15rem;
  letter-spacing: .03em;
  transition: color .15s, background .2s, border-color .2s, transform .1s;
}

button:hover { color: var(--fg); border-color: var(--fg); }
button:active { transform: scale(.97); }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.mode.active {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
}
.mode.active:hover { color: #fff; }

.dial { position: relative; width: min(58vw, 260px); }

.dial svg { display: block; width: 100%; transform: rotate(-90deg); }

.dial circle { fill: none; stroke-width: 7; }

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

.ring-fg {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 578.05; /* 2π·92 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .35s linear, stroke .4s;
}

.time {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(3.2rem, 12vw, 4.4rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.controls { display: flex; gap: .9rem; align-items: baseline; }

.primary {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
  font-weight: 600;
  padding: .5rem 1.6rem;
}
.primary:hover { color: #fff; filter: brightness(.95); }

.dots { display: flex; gap: .6rem; min-height: .9rem; }

.dot {
  width: .9rem; height: .9rem;
  background: var(--track);
  -webkit-mask: var(--leaf-mask) center / contain no-repeat;
  mask: var(--leaf-mask) center / contain no-repeat;
}
.dot.done { background: var(--accent); }

.hint {
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .03em;
}

@media (max-width: 560px) {
  .card { padding: 1.4rem 1.4rem 1.7rem; }
  .tree { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cloud { animation: none; }
}
