:root {
  color-scheme: light;
  --bg: #f2f6f3;
  --panel: #ffffff;
  --text: #1c2521;
  --muted: #68756f;
  --line: #d9e4dc;
  --accent: #1f6f55;
  --accent-dark: #13533f;
  --accent-soft: #e7f3ee;
  --danger: #9e2f3f;
  --shadow: 0 14px 32px rgba(28, 37, 33, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(31, 111, 85, 0.09), transparent 28rem),
    linear-gradient(180deg, #fbfdfb 0%, var(--bg) 42%);
  color: var(--text);
}

button {
  font: inherit;
}

.app {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 18px;
}

.icon-btn,
.text-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(28, 37, 33, 0.06);
}

small,
.hint,
.elapsed {
  color: var(--muted);
}

.hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 18px 14px;
  display: grid;
  justify-items: center;
  gap: 6px;
  box-shadow: var(--shadow);
}

.count {
  display: grid;
  justify-items: center;
  gap: 0;
}

.count span {
  font-size: 72px;
  line-height: 1;
  font-weight: 900;
  color: var(--accent-dark);
}

.count small {
  font-size: 14px;
  font-weight: 800;
}

.elapsed {
  margin: 2px 0 6px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.hero-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.hero-meta div {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.hero-meta span {
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
}

.hero-meta small {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.smoke-btn {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: white;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(19, 83, 63, 0.22);
}

.primary-action {
  margin-top: 14px;
}

.smoke-btn:active {
  transform: translateY(1px);
  background: var(--accent-dark);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 14px;
}

.stats div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 104px;
  padding: 16px 14px;
  display: grid;
  align-content: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(28, 37, 33, 0.05);
}

.stats span {
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
}

.stats small {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.list-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(28, 37, 33, 0.04);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.section-head span {
  font-size: 16px;
  font-weight: 900;
}

.text-btn {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--danger);
  font-weight: 800;
  font-size: 13px;
}

.backfill-wrap {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.backfill-wrap summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
  list-style: none;
  padding: 4px 0;
}

.backfill-wrap summary::-webkit-details-marker {
  display: none;
}

.backfill-wrap summary::before {
  content: "+ ";
}

.backfill-wrap[open] summary::before {
  content: "− ";
}

.backfill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.backfill input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: white;
  color: var(--text);
  font: inherit;
  min-width: 0;
}

.add-btn {
  color: var(--accent-dark);
}

.record-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.record-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 8px 2px;
}

.record-list li:last-child {
  border-bottom: 0;
}

.record-idx {
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 14px;
  min-width: 32px;
}

.record-date {
  color: var(--text);
  font-size: 15px;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 22px 0;
}

.trend {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(28, 37, 33, 0.04);
}

.trend-avg {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.week-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 8px;
  height: 120px;
  margin-top: 8px;
}

.bar-col {
  display: grid;
  grid-template-rows: 16px 1fr 18px;
  align-items: end;
  justify-items: center;
  height: 100%;
  gap: 2px;
}

.bar-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.bar {
  width: 60%;
  min-height: 3px;
  background: var(--line);
  border-radius: 4px 4px 0 0;
  align-self: end;
  transition: height 0.3s ease;
}

.bar-today .bar {
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
}

.bar-today .bar-num {
  color: var(--accent-dark);
}

.bar-day {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.bar-today .bar-day {
  color: var(--accent-dark);
  font-weight: 900;
}

@media (max-width: 520px) {
  .app {
    padding: 12px;
  }

  .topbar {
    margin-bottom: 10px;
  }

  h1 {
    font-size: 26px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .stats {
    gap: 8px;
    margin-bottom: 10px;
  }

  .stats div {
    min-height: 82px;
    padding: 10px 8px;
  }

  .stats span {
    font-size: 23px;
  }

  .stats small {
    font-size: 13px;
  }

  .smoke-btn {
    min-height: 52px;
    font-size: 17px;
  }

  .text-btn {
    white-space: nowrap;
  }

  .backfill input {
    font-size: 14px;
  }
}
