:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --ink: #22251f;
  --muted: #697063;
  --panel: #fffdf8;
  --line: #ded8ca;
  --accent: #227c70;
  --accent-dark: #15594f;
  --accent-soft: #d9efe9;
  --warm: #eaa84b;
  --danger: #b64c4c;
  --shadow: 0 18px 45px rgba(50, 55, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(34, 124, 112, 0.11), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 28px;
}

.top-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 2px 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.15rem, 12vw, 3.35rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  line-height: 1.2;
}

.lead {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.today-pill {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 2px;
  min-width: 74px;
  min-height: 74px;
  border: 1px solid rgba(34, 124, 112, 0.22);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--accent-dark);
  font-weight: 900;
  justify-content: center;
}

.today-pill span:first-child {
  font-size: 1.7rem;
}

.progress-area,
.quick-add,
.challenge-panel,
.habit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.progress-area {
  padding: 16px;
}

.progress-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-copy strong {
  font-size: 1.03rem;
}

.progress-copy span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.progress-track {
  overflow: hidden;
  height: 10px;
  margin-top: 14px;
  border-radius: 999px;
  background: #e7e1d4;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--warm));
  transition: width 180ms ease;
}

.challenge-panel {
  margin-top: 14px;
  padding: 16px;
}

.challenge-days {
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 850;
}

.challenge-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.challenge-stats div {
  min-height: 64px;
  border: 1px solid rgba(34, 124, 112, 0.18);
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
}

.challenge-stats span {
  color: var(--accent-dark);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.challenge-stats small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.hundred-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  margin-top: 14px;
}

.day-cell {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid #ded8ca;
  border-radius: 5px;
  background: #f0eadf;
  color: #7a7468;
  font-size: clamp(0.52rem, 2.4vw, 0.72rem);
  font-weight: 800;
  line-height: 1;
}

.day-cell.done {
  border-color: rgba(34, 124, 112, 0.3);
  background: var(--accent);
  color: #ffffff;
}

.day-cell.today {
  border: 2px solid var(--warm);
}

.day-cell.future {
  opacity: 0.48;
}

.quick-add {
  margin-top: 14px;
  padding: 16px;
}

.habit-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 13px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 124, 112, 0.14);
}

.primary-button,
.ghost-button,
.delete-button,
.check-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  min-height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 850;
}

.habit-section {
  margin-top: 20px;
}

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

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(34, 124, 112, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.habit-list {
  display: grid;
  gap: 10px;
}

.habit-card {
  display: grid;
  grid-template-columns: 44px 1fr 38px;
  align-items: center;
  gap: 10px;
  min-height: 76px;
  padding: 12px;
}

.habit-card.done {
  background: var(--accent-soft);
  border-color: rgba(34, 124, 112, 0.26);
}

.check-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: white;
}

.check-mark {
  width: 16px;
  height: 9px;
  border-bottom: 3px solid transparent;
  border-left: 3px solid transparent;
  transform: rotate(-45deg) translate(1px, -1px);
}

.habit-card.done .check-button {
  background: var(--accent);
}

.habit-card.done .check-mark {
  border-color: white;
}

.habit-copy {
  min-width: 0;
}

.anchor {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
  line-height: 1.35;
}

.action {
  margin-top: 3px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.delete-button {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: transparent;
  color: var(--danger);
  font-size: 1.35rem;
  line-height: 1;
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 34px;
  }
}
