* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0e1014;
  --card: #171a21;
  --border: #262b38;
  --text: #e9ecf3;
  --muted: #8a91a3;
  --accent: #6d7cff;
  --accent-dim: #3a4399;
  --green: #34d399;
  --red: #f87171;
}

html { color-scheme: dark; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 24px 16px 48px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 4px;
}

header h1 { font-size: 22px; font-weight: 700; }
.date { color: var(--muted); font-size: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

/* Таймер */

.timer-card {
  text-align: center;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  container-type: inline-size;
}

.timer-display {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, Menlo, monospace;
  font-size: min(19cqw, 30vh);
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.timer-display.live { color: var(--accent); }

.timer-status { color: var(--muted); font-size: 15px; margin: 12px 0 28px; }

#toggleBtn {
  width: 100%;
  max-width: 420px;
  align-self: center;
  padding: 18px 20px;
  border: none;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background .2s, transform .06s;
}

#toggleBtn:hover { background: #7f8dff; }
#toggleBtn:active { transform: scale(.98); }
#toggleBtn:disabled { opacity: .6; cursor: default; }
#toggleBtn.running { background: var(--red); }
#toggleBtn.running:hover { background: #f98a8a; }

/* Дневная цель */

.goal-header {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 10px;
}

.goal-header .label { color: var(--muted); }

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: #0f1218;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width .3s;
}

.progress-fill.done { background: var(--green); }

.goal-sub { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* Сессии */

section h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin-bottom: 12px;
}

#sessionList { list-style: none; }

.session {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.session:last-child { border-bottom: none; }

.session .del {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.session .del:hover { color: var(--red); background: rgba(248, 113, 113, .1); }

.empty { color: var(--muted); font-size: 14px; }

/* Статистика */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat { text-align: center; padding: 16px 12px; }

.stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Награды */

.rewards-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.rewards-header h2 { margin-bottom: 0; }

.rewards-summary { color: var(--muted); font-size: 13px; }
.rewards-summary b { color: var(--text); }

.rewards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.reward {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reward-days { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.reward-days small { font-size: 12px; font-weight: 400; color: var(--muted); }

.reward-title { font-size: 14px; }
.reward-state { font-size: 12px; color: var(--muted); }

.reward-progress {
  height: 4px;
  border-radius: 999px;
  background: #0f1218;
  overflow: hidden;
  margin-top: auto;
}

.reward-progress div { height: 100%; width: 0; border-radius: 999px; background: var(--accent); }

.reward.next { border-color: var(--accent); }

.reward.unlocked { border-color: rgba(52, 211, 153, .4); }
.reward.unlocked .reward-days { color: var(--green); }
.reward.unlocked .reward-state { color: var(--green); }

/* График */

.chart-area {
  position: relative;
  height: 160px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.goal-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(52, 211, 153, .55);
  pointer-events: none;
}

.col {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bar {
  width: 70%;
  max-width: 38px;
  height: 0;
  background: var(--accent-dim);
  border-radius: 4px 4px 0 0;
  transition: height .3s;
}

.col.today .bar { background: var(--accent); }
.bar.done { background: var(--green); }

.chart-labels {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.chart-labels span {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
