:root {
  color-scheme: light dark;
  --bg: #eef7f4;
  --bg-2: #d9ece7;
  --text: #10201f;
  --muted: #5d6f6c;
  --glass: rgba(255, 255, 255, 0.58);
  --glass-border: rgba(255, 255, 255, 0.68);
  --shadow: 0 24px 80px rgba(17, 67, 62, 0.16);
  --accent: #0f766e;
  --accent-2: #22c55e;
  --danger: #dc2626;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071312;
  --bg-2: #102220;
  --text: #e9fffb;
  --muted: #9bb4ae;
  --glass: rgba(16, 34, 32, 0.62);
  --glass-border: rgba(255, 255, 255, 0.16);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
  --accent: #2dd4bf;
  --accent-2: #86efac;
  --danger: #fb7185;
}

:root[data-theme="light"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #071312;
    --bg-2: #102220;
    --text: #e9fffb;
    --muted: #9bb4ae;
    --glass: rgba(16, 34, 32, 0.62);
    --glass-border: rgba(255, 255, 255, 0.16);
    --shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
    --accent: #2dd4bf;
    --accent-2: #86efac;
    --danger: #fb7185;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(45, 212, 191, 0.28), transparent 28rem),
    radial-gradient(circle at 86% 4%, rgba(132, 204, 22, 0.2), transparent 24rem),
    linear-gradient(145deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
}

button,
input,
select {
  font: inherit;
}

button,
a,
select,
input {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 7vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.glass {
  border: 1px solid var(--glass-border);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.35);
  -webkit-backdrop-filter: blur(26px) saturate(1.35);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
  gap: 18px;
  align-items: stretch;
}

.timer-panel,
.stats-panel,
.settings-card {
  border-radius: 28px;
  padding: 22px;
}

.timer-panel {
  display: grid;
  gap: 18px;
  place-items: center;
}

.timer-wrap {
  position: relative;
  width: min(78vw, 380px);
  aspect-ratio: 1;
}

.progress-ring {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 20px 28px rgba(15, 118, 110, 0.18));
  transform: rotate(-90deg);
}

.track,
.progress {
  fill: none;
  stroke-width: 18;
}

.track {
  stroke: color-mix(in srgb, var(--muted) 22%, transparent);
}

.progress {
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease, stroke 0.25s ease;
}

.timer-core {
  position: absolute;
  inset: 15%;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--glass) 75%, transparent);
  border: 1px solid var(--glass-border);
}

.timer-core strong {
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 1;
}

.range {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.stage-pill {
  margin-top: 10px;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

button,
.file-button,
.tabs a {
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
  background: color-mix(in srgb, var(--glass) 90%, transparent);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.primary,
.secondary,
.icon-button,
.file-button {
  min-height: 44px;
  padding: 0 18px;
}

.primary {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--glass-border));
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 800;
}

.danger {
  background: linear-gradient(135deg, var(--danger), #f97316);
}

.secondary.small {
  min-height: 36px;
  padding-inline: 14px;
  font-size: 0.9rem;
}

.field {
  display: grid;
  gap: 8px;
  width: 100%;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.field input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 0 12px;
  color: var(--text);
  background: color-mix(in srgb, var(--glass) 88%, transparent);
}

.is-hidden {
  display: none;
}

.stats-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.stat-row,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stat-row {
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 24%, transparent);
}

.stat-row span,
.section-title p,
.settings-card p,
.history-item span,
.modal small,
.disclaimer {
  color: var(--muted);
}

.stat-row strong {
  font-size: 1.3rem;
}

.tabs {
  position: sticky;
  top: 8px;
  z-index: 4;
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 18px auto 28px;
  padding: 8px;
  border-radius: 999px;
  width: fit-content;
  background: color-mix(in srgb, var(--glass) 72%, transparent);
  backdrop-filter: blur(24px);
}

.tabs a {
  display: inline-grid;
  min-height: 38px;
  place-items: center;
  padding: 0 16px;
  text-decoration: none;
}

.section {
  margin-top: 30px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-title h2,
.section-title p {
  margin-bottom: 0;
}

.stage-list,
.history-list,
.settings-grid {
  display: grid;
  gap: 12px;
}

.stage-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stage-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 14px;
  border-radius: 20px;
  text-align: left;
}

.stage-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: 0 0 0 6px color-mix(in srgb, currentColor 12%, transparent);
}

.info {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-weight: 900;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 20px;
}

.history-item strong,
.history-item span {
  display: block;
}

.empty {
  margin: 0;
  padding: 18px;
  border-radius: 20px;
}

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

.settings-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.file-button {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  overflow: hidden;
  position: relative;
  font-weight: 800;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.disclaimer {
  margin: 30px auto 0;
  max-width: 760px;
  text-align: center;
  font-size: 0.86rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
}

.modal {
  width: min(460px, 100%);
  border-radius: 28px;
  padding: 24px;
}

.modal p {
  line-height: 1.55;
}

.modal .primary {
  width: 100%;
  margin-top: 20px;
}

@media (max-width: 820px) {
  .hero-grid,
  .stage-list,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding-inline: 12px;
  }

  .timer-panel,
  .stats-panel,
  .settings-card {
    border-radius: 22px;
    padding: 16px;
  }

  .tabs {
    width: 100%;
  }

  .tabs a {
    flex: 1;
    padding-inline: 10px;
  }

  .history-item {
    align-items: flex-start;
    flex-direction: column;
  }
}
