:root {
  color-scheme: light;
  --ink: #1b2024;
  --muted: #647276;
  --paper: #f7f4ed;
  --panel: #fffdf7;
  --line: #d9ded6;
  --green: #1f8a70;
  --green-dark: #126451;
  --rose: #d95757;
  --blue: #315f9a;
  --sun: #e1aa31;
  --leaf: #c4dcc5;
  --shadow: 0 20px 60px rgba(27, 32, 36, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100svh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(31, 138, 112, 0.13) 0 22%, transparent 22%),
    linear-gradient(315deg, rgba(217, 87, 87, 0.12) 0 18%, transparent 18%),
    repeating-linear-gradient(90deg, rgba(27, 32, 36, 0.035) 0 1px, transparent 1px 30px),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
.home-link:focus-visible {
  outline: 3px solid rgba(217, 87, 87, 0.42);
  outline-offset: 3px;
}

.shell {
  width: min(100%, 980px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
}

.home-link,
.brand-mark,
.tool-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.home-link {
  color: var(--ink);
  background: rgba(255, 253, 247, 0.82);
  border: 1px solid rgba(27, 32, 36, 0.09);
  box-shadow: 0 10px 24px rgba(27, 32, 36, 0.08);
}

.home-link svg,
button svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  flex: 0 0 auto;
  color: var(--sun);
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(27, 32, 36, 0.14);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-pill {
  min-width: 82px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.8);
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 850;
  text-align: center;
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(286px, 0.9fr);
  gap: 14px;
  align-items: stretch;
}

.timer-card,
.reset-card {
  border: 1px solid rgba(27, 32, 36, 0.1);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.9);
  box-shadow: var(--shadow);
}

.timer-card {
  min-height: 596px;
  padding: 24px;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 18px;
}

.meter-wrap {
  min-height: 332px;
  display: grid;
  place-items: center;
}

.meter {
  --progress: 0;
  width: min(100%, 368px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    conic-gradient(var(--green) calc(var(--progress) * 1%), rgba(27, 32, 36, 0.09) 0),
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(196, 220, 197, 0.32));
  box-shadow:
    inset 0 0 0 1px rgba(27, 32, 36, 0.08),
    0 28px 50px rgba(31, 138, 112, 0.16);
}

.shell[data-phase="reset"] .meter {
  background:
    conic-gradient(var(--rose) calc(var(--progress) * 1%), rgba(27, 32, 36, 0.09) 0),
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(217, 87, 87, 0.12));
  box-shadow:
    inset 0 0 0 1px rgba(27, 32, 36, 0.08),
    0 28px 50px rgba(217, 87, 87, 0.14);
}

.meter-inner {
  width: calc(100% - 42px);
  aspect-ratio: 1;
  padding: 22px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border-radius: 50%;
  border: 1px solid rgba(27, 32, 36, 0.08);
  background: var(--panel);
  text-align: center;
}

.meter-inner span {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 850;
}

.meter-inner strong {
  font-variant-numeric: tabular-nums;
  font-size: clamp(3.1rem, 9vw, 4.35rem);
  line-height: 1;
  letter-spacing: 0;
}

.meter-inner em {
  max-width: 220px;
  min-height: 1.4em;
  color: var(--blue);
  font-size: 0.95rem;
  font-style: normal;
  font-weight: 800;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 52px 52px;
  gap: 10px;
}

.primary-btn,
.tool-btn,
.preset {
  min-height: 52px;
  border-radius: 8px;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

.primary-btn:hover,
.tool-btn:hover,
.preset:hover {
  transform: translateY(-1px);
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fffdf7;
  background: var(--ink);
  box-shadow: 0 14px 26px rgba(27, 32, 36, 0.18);
  font-weight: 900;
}

.tool-btn {
  color: var(--ink);
  border: 1px solid rgba(27, 32, 36, 0.12);
  background: #eef4eb;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.preset {
  min-width: 0;
  padding: 11px 8px;
  display: grid;
  place-items: center;
  gap: 2px;
  color: var(--ink);
  border: 1px solid rgba(27, 32, 36, 0.12);
  background: #ffffff;
}

.preset span {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset strong {
  font-size: 1rem;
}

.preset.is-active {
  color: #fffdf7;
  border-color: var(--green);
  background: var(--green);
}

.preset.is-active span {
  color: rgba(255, 253, 247, 0.8);
}

.reset-card {
  padding: 18px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
}

.figure-panel {
  min-height: 214px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(27, 32, 36, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(49, 95, 154, 0.08), transparent 70%),
    #f4f8ef;
}

.figure {
  width: min(100%, 260px);
  height: auto;
}

.figure path,
.figure circle {
  vector-effect: non-scaling-stroke;
}

.desk,
.desk-leg,
.chair,
.chair-leg {
  fill: #d8e2d1;
}

.head {
  fill: var(--sun);
  stroke: var(--ink);
  stroke-width: 4;
}

.spine,
.shoulder,
.arm,
.halo {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 6;
}

.left {
  stroke: var(--green);
}

.right {
  stroke: var(--rose);
}

.halo {
  stroke: var(--blue);
  stroke-width: 3;
  stroke-dasharray: 5 7;
}

.slider-stack {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

output {
  color: var(--ink);
}

input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  height: 7px;
  margin: 0;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--rose));
}

input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  appearance: none;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 4px 10px rgba(27, 32, 36, 0.22);
}

input[type="range"]::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 4px 10px rgba(27, 32, 36, 0.22);
}

.cue-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.cue-list li {
  min-height: 46px;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 9px;
  align-items: center;
  border: 1px solid rgba(27, 32, 36, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.cue-list li::before {
  content: attr(data-index);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fffdf7;
  background: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
}

.cue-list li.is-active {
  color: var(--ink);
  border-color: rgba(31, 138, 112, 0.4);
  background: rgba(196, 220, 197, 0.42);
}

.cue-list li.is-active::before {
  background: var(--green);
}

@media (max-width: 780px) {
  .shell {
    justify-content: start;
    padding: 14px;
  }

  .topbar {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }

  .home-link,
  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .status-pill {
    min-width: 70px;
    padding-inline: 8px;
  }

  .stage {
    grid-template-columns: 1fr;
  }

  .timer-card {
    min-height: auto;
    padding: 18px;
  }

  .meter-wrap {
    min-height: 278px;
  }

  .meter {
    width: min(100%, 310px);
  }

  .figure-panel {
    min-height: 176px;
  }
}

@media (max-width: 430px) {
  .topbar {
    grid-template-columns: 40px 1fr;
  }

  .status-pill {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .button-row {
    grid-template-columns: 1fr 48px 48px;
  }

  .preset-grid {
    grid-template-columns: 1fr;
  }
}

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