:root {
  color-scheme: dark;
  --bg: #101413;
  --panel: #18211f;
  --panel-2: #202b29;
  --text: #f3f7ef;
  --muted: #a8b4ab;
  --line: #35413d;
  --accent: #d7ff68;
  --accent-2: #55d6be;
  --danger: #ff6b5f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(85, 214, 190, 0.18), transparent 34rem),
    linear-gradient(180deg, #111817 0%, var(--bg) 100%);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

.app {
  width: min(100%, 760px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
  align-content: start;
}

.timer-panel,
.editor-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(24, 33, 31, 0.88);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
}

.timer-panel {
  padding: 18px;
}

.editor-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.top-row,
.controls,
.stats,
.field-grid {
  display: grid;
  gap: 10px;
}

.top-row {
  grid-template-columns: 1fr 48px;
  align-items: start;
}

.eyebrow,
h1,
small,
p {
  margin: 0;
}

.eyebrow,
label span,
.clock small,
.stats small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin-top: 2px;
  font-size: 2rem;
  line-height: 1;
}

.icon-button,
.primary,
.secondary {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.icon-button {
  background: var(--panel-2);
  color: var(--accent);
  border: 1px solid var(--line);
  font-size: 1.25rem;
}

.clock-wrap {
  width: min(78vw, 340px);
  aspect-ratio: 1;
  margin: 22px auto 18px;
  display: grid;
  place-items: center;
  position: relative;
}

.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg,
.ring-fg {
  fill: none;
  stroke-width: 7;
}

.ring-bg {
  stroke: rgba(255, 255, 255, 0.1);
}

.ring-fg {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 333;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.2s linear, stroke 0.2s ease;
}

.clock {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 8px;
}

.clock span {
  font-variant-numeric: tabular-nums;
  font-size: clamp(4rem, 22vw, 6.8rem);
  font-weight: 900;
  line-height: 0.9;
}

.stats {
  grid-template-columns: repeat(3, 1fr);
}

.stats div {
  min-width: 0;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

.stats span {
  display: block;
  font-size: 1.45rem;
  font-weight: 900;
}

.controls {
  grid-template-columns: 1fr 0.7fr;
  margin-top: 14px;
}

.offline-status {
  min-height: 1.1rem;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.primary {
  background: var(--accent);
  color: #151712;
  font-size: 1.15rem;
}

.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

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

label {
  display: grid;
  gap: 7px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111715;
  color: var(--text);
  outline: none;
}

input {
  min-height: 48px;
  padding: 0 12px;
  font-size: 1.15rem;
  font-weight: 800;
}

textarea {
  min-height: 136px;
  padding: 12px;
  line-height: 1.45;
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(85, 214, 190, 0.2);
}

.movement-list {
  display: grid;
  gap: 8px;
}

.movement {
  display: grid;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-weight: 750;
}

.movement-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.movement b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(215, 255, 104, 0.14);
  color: var(--accent);
  font-size: 0.86rem;
}

.movement img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #f0f1ef;
}

.movement-with-image {
  padding: 10px;
}

.running .ring-fg {
  stroke: var(--accent-2);
}

.done .ring-fg {
  stroke: var(--danger);
}

.alerting .timer-panel {
  animation: stopPulse 0.8s ease-in-out 4;
}

.alerting .clock small {
  color: var(--danger);
}

@keyframes stopPulse {
  0%,
  100% {
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(255, 107, 95, 0.38), 0 18px 54px rgba(0, 0, 0, 0.28);
  }
}

@media (min-width: 720px) {
  .app {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
    padding-top: 28px;
  }

  .timer-panel {
    position: sticky;
    top: 24px;
  }
}
