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

* { 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', Roboto, sans-serif;
  font-feature-settings: 'tnum';
}

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

.screen {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
}

.screen.hidden, .hidden { display: none !important; }

.focusable {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 20px;
  font-weight: 500;
}

.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
  transform: scale(1.02);
}

/* Top bar */
.bar {
  height: 64px;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--bg-tertiary);
  flex-shrink: 0;
}

.bar h1, .bar h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.title { display: flex; align-items: center; gap: 10px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.clock {
  font-size: 18px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.spacer { width: 80px; }

.back-btn {
  background: transparent;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  color: var(--text-secondary);
  min-height: 44px;
  min-width: 80px;
}

.back-btn:focus { color: var(--text-primary); background: var(--bg-card); }

/* Active timer strip on home */
.active-strip {
  margin: 16px 20px 0;
  padding: 18px 22px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--bg-tertiary);
}

.active-strip.running {
  background: linear-gradient(135deg, #0d2030 0%, #0a1a25 100%);
  border-color: var(--accent);
}

.active-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  color: var(--text-secondary);
}

.active-strip.running .active-label { color: var(--text-primary); }

.pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
}

.active-strip.running .pulse {
  background: var(--accent-secondary);
  box-shadow: 0 0 12px var(--accent-secondary);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.active-time {
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.active-strip.running .active-time { color: var(--accent); }

/* Main content */
.content {
  flex: 1;
  padding: 16px 20px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.content::-webkit-scrollbar { width: 0; }

.section-label {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Project list */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  min-height: 64px;
  width: 100%;
  text-align: left;
  gap: 14px;
}

.project-row.active {
  background: linear-gradient(135deg, #102530 0%, #0c1c25 100%);
  border-color: rgba(0, 212, 255, 0.4);
}

.project-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.project-emoji {
  font-size: 26px;
  width: 36px;
  text-align: center;
}

.project-name {
  font-size: 19px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.project-today {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.project-today.zero { color: var(--text-muted); }

.project-running-tag {
  font-size: 11px;
  color: var(--accent-secondary);
  font-weight: 700;
  letter-spacing: 1px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
  color: var(--text-secondary);
  gap: 8px;
}

.empty-icon {
  font-size: 48px;
  color: var(--text-muted);
}

.empty-text { font-size: 20px; color: var(--text-primary); }
.empty-hint { font-size: 15px; color: var(--text-muted); }

/* Footer */
.footer {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-primary);
  border-top: 1px solid var(--bg-tertiary);
  flex-shrink: 0;
}

.nav-btn {
  flex: 1;
  height: 56px;
  border-radius: var(--radius-md);
  font-size: 18px;
  font-weight: 600;
  background: var(--bg-card);
}

/* Detail screen */
.detail-content { gap: 18px; padding-top: 20px; }

.timer-block {
  text-align: center;
  padding: 24px 0 12px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  margin-bottom: 4px;
}

.timer-display {
  font-size: 64px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  color: var(--text-primary);
  line-height: 1;
}

.timer-block.running .timer-display { color: var(--accent); }

.timer-state {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.timer-block.running .timer-state { color: var(--accent-secondary); }

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

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  border: 1px solid var(--bg-tertiary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.big-btn {
  height: 72px;
  border-radius: var(--radius-md);
  font-size: 24px;
  font-weight: 600;
  background: var(--accent);
  color: #00121a;
  letter-spacing: 1px;
}

.big-btn.stop { background: var(--danger); color: #fff; }

.danger-btn {
  height: 54px;
  border-radius: var(--radius-md);
  font-size: 16px;
  background: var(--bg-card);
  color: var(--danger);
  border: 2px solid transparent;
}

.danger-btn:focus { border-color: var(--danger); box-shadow: 0 0 20px rgba(255, 68, 102, 0.4); }

.cancel-btn {
  height: 54px;
  border-radius: var(--radius-md);
  font-size: 18px;
  background: var(--bg-card);
  color: var(--text-primary);
  flex: 1;
}

/* Add project */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preset-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  font-size: 17px;
  text-align: left;
  min-height: 56px;
}

.preset-btn .emoji { font-size: 24px; }

.preset-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Summary */
.grand-total-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  text-align: center;
}

.grand-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.grand-value {
  font-size: 42px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-row {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 17px;
}

.summary-row-name { display: flex; align-items: center; gap: 10px; }
.summary-row-name .emoji { font-size: 20px; }

.summary-row-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
}

.summary-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.summary-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-secondary) 100%);
  border-radius: 3px;
}

.summary-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 16px;
}

/* Confirm dialog */
.confirm-content {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 30px;
  gap: 16px;
}

.confirm-icon {
  font-size: 56px;
  color: var(--warn);
}

.confirm-title {
  font-size: 28px;
  font-weight: 600;
}

.confirm-msg {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}
