:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}

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

html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { width: 100%; height: 100%; position: relative; }

.screen {
  width: 100%; height: 100%; position: absolute; top: 0; left: 0;
  display: flex; flex-direction: column;
  padding: 28px 32px;
  gap: 16px;
}
.screen.hidden { display: none; }

.focusable {
  transition: transform 0.12s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
}
.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}
.hidden { display: none !important; }

/* Header */
.app-header { text-align: center; flex: 0 0 auto; }
.title { font-size: 40px; font-weight: 800; letter-spacing: 4px; }
.screen-title { font-size: 30px; font-weight: 800; letter-spacing: 4px; color: var(--accent); }
.subtitle { font-size: 20px; color: var(--text-secondary); margin-top: 4px; }

/* Progress ring (conic) */
.ring {
  position: relative;
  width: 240px; height: 240px;
  border-radius: 50%;
  --ring-color: var(--accent);
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), var(--bg-tertiary) 0);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  color: var(--text-primary);
  font-family: inherit;
}
.ring::before {
  content: '';
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: var(--bg-primary);
}
.ring.complete { --ring-color: var(--accent-secondary); }
.ring-inner { position: relative; z-index: 1; text-align: center; }
.big-num { font-size: 84px; font-weight: 800; line-height: 1; }
.ring.complete .big-num { color: var(--accent-secondary); }
.ring-sub { font-size: 18px; color: var(--text-secondary); margin-top: 6px; letter-spacing: 1px; }

.ring-tap {
  width: 300px; height: 300px;
  -webkit-tap-highlight-color: transparent;
}
.ring-tap .big-num { font-size: 110px; }
.ring-tap .ring-sub { font-size: 20px; color: var(--accent); font-weight: 600; }
.ring-tap.complete .ring-sub { color: var(--accent-secondary); }

.ring.pop { animation: pop 0.18s ease; }
@keyframes pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Home */
.home-body {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
}
.streak-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  color: var(--accent-secondary);
  font-size: 20px; font-weight: 600;
  padding: 10px 22px;
  border-radius: 999px;
}

/* Counter */
.counter-body {
  flex: 1 1 auto;
  display: flex; align-items: center; justify-content: center;
}
.counter-controls { display: flex; gap: 16px; flex: 0 0 auto; }
.counter-controls .btn { flex: 1; }

/* Buttons */
.btn {
  width: 100%;
  min-height: 72px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 22px; font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.btn-primary {
  min-height: 88px;
  background: var(--accent);
  color: #001018;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 1px;
}
.btn-accent {
  background: var(--accent-secondary);
  color: #002414;
  font-weight: 800;
}
.btn:focus { transform: translateY(-1px); }

.home-nav { display: flex; flex-direction: column; gap: 14px; flex: 0 0 auto; }
.btn-row { display: flex; gap: 14px; }
.btn-row .btn { flex: 1; }

/* Goal */
.goal-body {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 36px;
}
.stepper { display: flex; align-items: center; gap: 24px; }
.step-btn {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--accent);
  font-size: 52px; font-weight: 700; line-height: 1;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center;
}
.goal-value {
  font-size: 96px; font-weight: 800;
  min-width: 180px; text-align: center;
}
.presets { display: flex; gap: 14px; }
.chip {
  min-width: 80px; height: 64px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 24px; font-weight: 700;
  font-family: inherit;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
}
.chip.selected { background: var(--bg-tertiary); color: var(--accent); }

/* Stats */
.stats-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 24px; justify-content: center; }
.stat-cards { display: flex; gap: 14px; }
.stat-card {
  flex: 1;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 18px 8px;
  text-align: center;
}
.stat-num { font-size: 44px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 16px; color: var(--text-secondary); margin-top: 4px; }

.chart {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 10px;
  height: 200px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar {
  width: 70%;
  min-height: 4px;
  background: var(--accent);
  border-radius: 6px 6px 0 0;
  transition: height 0.2s ease;
}
.bar.met { background: var(--accent-secondary); }
.bar-label { font-size: 15px; color: var(--text-secondary); }
.bar-val { font-size: 14px; color: var(--text-muted); }
