:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #222633;
  --border: #2a2f3f;
  --text: #e6e8ee;
  --text-dim: #8b93a7;
  --accent: #ffa116;
  --easy: #00b8a3;
  --medium: #ffc01e;
  --hard: #ff375f;
  --done: #2fbb5e;
}

* { box-sizing: border-box; margin: 0; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 16px 64px;
  line-height: 1.5;
}

header { margin-bottom: 28px; }

h1 { font-size: 1.6rem; letter-spacing: -0.02em; }

.subtitle { color: var(--text-dim); font-size: 0.9rem; margin: 4px 0 16px; }

.progress-wrap { display: flex; align-items: center; gap: 12px; }

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.25s ease;
}

#progress-text { font-size: 0.85rem; color: var(--text-dim); min-width: 56px; text-align: right; }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
  align-items: center;
}

.pace-wrap { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.pace-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.75rem;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
}

.pace-btn:hover { color: var(--text); }
.pace-btn.active { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 700; }

#reset-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
}

#reset-btn:hover { color: var(--hard); border-color: var(--hard); }

.day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.day-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.day-header:hover { background: var(--surface-hover); }

.day-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--accent);
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
}

.day-topic { font-weight: 600; font-size: 0.95rem; flex: 1; min-width: 0; }

.day-date {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-left: 8px;
  white-space: nowrap;
}

.day-count { font-size: 0.8rem; color: var(--text-dim); white-space: nowrap; }

.chevron {
  color: var(--text-dim);
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.day.open .chevron { transform: rotate(90deg); }

.problems { display: none; border-top: 1px solid var(--border); }

.day.open .problems { display: block; }

.problem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.problem:last-child { border-bottom: none; }

.problem:hover { background: var(--surface-hover); }

.problem input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--done);
  cursor: pointer;
  flex-shrink: 0;
}

.problem .title {
  flex: 1;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}

.problem a.title:hover { color: var(--accent); text-decoration: underline; }

.problem.done .title { color: var(--text-dim); text-decoration: line-through; }

.problem.missed { opacity: 0.55; }

.problem.missed .title { color: var(--text-dim); }

.problem input[type="checkbox"]:disabled { cursor: default; }

.missed-tag { color: var(--hard) !important; }

.problem .desc {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  text-decoration: none;
  margin-top: 2px;
}

.problem.done .desc { text-decoration: none; }

.note {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.72rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  transition: color 0.15s, border-color 0.15s;
}

.note:hover { color: var(--accent); border-color: var(--accent); }

.note.clicked {
  animation: pop 0.35s ease;
  color: var(--done);
  border-color: var(--done);
}

@keyframes pop {
  50% { transform: scale(1.3); }
}

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.82rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
  max-width: 90vw;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.topic-tag {
  font-size: 0.68rem;
  color: var(--text-dim);
  flex-shrink: 0;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diff, .task-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.diff.E { color: var(--easy); background: rgba(0, 184, 163, 0.12); }
.diff.M { color: var(--medium); background: rgba(255, 192, 30, 0.12); }
.diff.H { color: var(--hard); background: rgba(255, 55, 95, 0.12); }

.task-badge { color: var(--accent); background: rgba(255, 161, 22, 0.12); }

footer {
  margin-top: 32px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
}
