:root {
  --bg-top: #f6efe1;
  --bg-bottom: #dcc2a7;
  --panel: rgba(255, 249, 239, 0.88);
  --text-main: #2f241f;
  --text-soft: #6a554b;
  --accent: #c55c3d;
  --accent-deep: #893b26;
  --line: rgba(93, 58, 41, 0.14);
  --shadow: 0 24px 70px rgba(72, 41, 29, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 28%),
    radial-gradient(circle at bottom right, rgba(197, 92, 61, 0.18), transparent 22%),
    linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(8px);
}

body::before {
  width: 280px;
  height: 280px;
  top: -70px;
  right: -80px;
  background: rgba(255, 255, 255, 0.45);
}

body::after {
  width: 240px;
  height: 240px;
  bottom: -70px;
  left: -60px;
  background: rgba(197, 92, 61, 0.14);
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
}

.panel {
  width: min(100%, 520px);
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: var(--accent-deep);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.05;
  font-family: Georgia, "Times New Roman", serif;
}

.description {
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.6;
}

.timer-card {
  margin-top: 28px;
  padding: 28px 24px;
  text-align: center;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 245, 236, 0.92));
  border: 1px solid var(--line);
}

.phase-label,
.subtext {
  margin: 0;
  color: var(--text-soft);
}

#phaseName {
  margin: 8px 0 14px;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.countdown {
  font-size: clamp(4rem, 12vw, 6rem);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.subtext {
  margin-top: 12px;
}

.controls {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stats {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.stat-box {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
}

.stat-title {
  display: block;
  color: var(--text-soft);
  font-size: 0.94rem;
}

.stat-box strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

button {
  padding: 14px 16px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(72, 41, 29, 0.12);
}

button:active {
  transform: translateY(0);
}

button.primary {
  color: #fff8f1;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.rhythm {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.rhythm-step {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.rhythm-step span {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  font-weight: 700;
  color: var(--accent-deep);
  background: rgba(197, 92, 61, 0.14);
}

.rhythm-step p {
  margin: 12px 0 0;
  font-weight: 700;
}

.rhythm-step.active {
  border-color: rgba(197, 92, 61, 0.3);
  background: rgba(197, 92, 61, 0.12);
}

@media (max-width: 560px) {
  .app {
    place-items: start center;
    padding:
      max(16px, env(safe-area-inset-top))
      14px
      max(16px, env(safe-area-inset-bottom))
      14px;
  }

  .panel {
    padding: 18px 14px 16px;
    border-radius: 22px;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 0.72rem;
  }

  h1 {
    font-size: 2.15rem;
  }

  .description {
    margin-top: 10px;
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .timer-card {
    margin-top: 16px;
    padding: 20px 16px;
    border-radius: 20px;
  }

  #phaseName {
    margin: 6px 0 10px;
    font-size: 1.9rem;
  }

  .countdown {
    font-size: 4.2rem;
  }

  .subtext {
    margin-top: 10px;
    font-size: 0.95rem;
  }

  .controls {
    margin-top: 14px;
    gap: 8px;
  }

  button {
    padding: 12px 10px;
    font-size: 0.95rem;
  }

  .stats {
    margin-top: 14px;
    gap: 10px;
  }

  .stat-box {
    padding: 14px;
    border-radius: 16px;
  }

  .stat-title {
    font-size: 0.88rem;
  }

  .stat-box strong {
    margin-top: 6px;
    font-size: 1.8rem;
  }

  .rhythm {
    margin-top: 16px;
    gap: 10px;
    grid-template-columns: 1fr;
  }
}
