:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --panel: #151518;
  --panel-2: #1c1c20;
  --border: #2a2a2f;
  --text: #f2f2f4;
  --muted: #8a8a92;
  --accent: #5ee89c;
  --accent-dim: #2d5e46;
  --danger: #e85e5e;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: env(safe-area-inset-top);
}

.brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--muted);
}

.loading {
  text-align: center;
  color: var(--muted);
  margin-top: 40px;
}

/* Hero */
.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.day-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.day-count {
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.day-count span {
  color: var(--muted);
  font-size: 32px;
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2d8b5f, var(--accent));
  transition: width 0.5s ease;
}

.milestone {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  min-height: 18px;
}

/* Stats grid */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat .value {
  font-size: 22px;
  font-weight: 700;
}

.stat .label {
  font-size: 12px;
  color: var(--muted);
}

/* Complete button */
.complete-btn {
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  border: none;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: #05170e;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.complete-btn:active {
  transform: scale(0.98);
}

.complete-btn.done {
  background: var(--panel-2);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}

.complete-btn.finish {
  background: var(--text);
  color: #0a0a0c;
}

/* Completion banner */
.banner {
  background: linear-gradient(160deg, #163524, var(--panel));
  border: 1px solid var(--accent-dim);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.banner .big {
  font-size: 26px;
  font-weight: 800;
}

.banner .sub {
  color: var(--muted);
  font-size: 14px;
}

/* Calendar grid */
.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.cell {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
}

.cell.done {
  background: var(--accent);
  color: #05170e;
  border-color: var(--accent);
  font-weight: 700;
}

.cell.today {
  border-color: var(--accent);
  color: var(--accent);
}

.cell.future {
  opacity: 0.4;
}

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item .range {
  font-size: 13px;
  color: var(--muted);
}

.history-item .result {
  font-size: 14px;
  font-weight: 700;
}

.history-item .result.win {
  color: var(--accent);
}

.empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 8px 0;
}
