@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Mono:wght@400;500&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f0f11;
  --surface: #18181c;
  --surface-2: #222228;
  --border: #2e2e36;
  --accent: #7c6aff;
  --accent-glow: rgba(124, 106, 255, 0.25);
  --green: #4ade80;
  --green-glow: rgba(74, 222, 128, 0.15);
  --text: #f0f0f5;
  --text-muted: #7a7a90;
  --pending: #fbbf24;
  --completed: #4ade80;
  --radius: 12px;
  --transition: 0.2s ease;
}

body {
  font-family: 'DM Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 16px 80px;
}

/* ── Header ── */
header {
  width: 100%;
  max-width: 680px;
  margin-bottom: 48px;
  text-align: center;
  position: relative;
}

header::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 360px;
  height: 260px;
  background: radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.badge {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, #fff 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 1;
}

/* ── Main Card ── */
main {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Add Task Box ── */
.add-task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.add-task-card label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.input-row {
  display: flex;
  gap: 10px;
}

#taskInput {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

#taskInput::placeholder {
  color: var(--text-muted);
}

#taskInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#addBtn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

#addBtn:hover {
  background: #9580ff;
  box-shadow: 0 0 16px var(--accent-glow);
}

#addBtn:active {
  transform: scale(0.97);
}

#addBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  gap: 12px;
}

.stat-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-chip .num {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.stat-chip .lbl {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-chip.chip-pending .num { color: var(--pending); }
.stat-chip.chip-done .num { color: var(--completed); }

/* ── Task List ── */
.task-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.task-list-header h2 {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#taskList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
}

/* ── Task Item ── */
.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
  animation: slideIn 0.25s ease both;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.task-item:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.task-item:active {
  transform: scale(0.99);
}

.task-item.completed {
  opacity: 0.6;
  border-color: transparent;
}

.task-item.completed:hover {
  opacity: 0.9;
  border-color: var(--completed);
}

/* Checkbox circle */
.check-circle {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: border-color var(--transition), background var(--transition);
}

.task-item.completed .check-circle {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 10px var(--green-glow);
}

.task-item.completed .check-circle::after {
  content: '✓';
  color: #0f0f11;
  font-weight: bold;
}

.task-title {
  flex: 1;
  font-size: 14px;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

.task-item.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-status-badge {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 500;
}

.status-pending {
  background: rgba(251, 191, 36, 0.1);
  color: var(--pending);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.status-completed {
  background: rgba(74, 222, 128, 0.1);
  color: var(--completed);
  border: 1px solid rgba(74, 222, 128, 0.25);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state .icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 13px;
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.02em;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  z-index: 999;
  white-space: nowrap;
}

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

/* ── Loading spinner ── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 32px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .stats-bar { flex-wrap: wrap; }
  .input-row { flex-direction: column; }
  #addBtn { width: 100%; }
}
