:root {
  --bg-primary: #000000; /* pure black = transparent on additive display, lets real world show through */
  --bg-secondary: #0a0a0f;
  --bg-tertiary: #14141f;
  --bg-card: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent-primary: #00d4ff;
  --accent-secondary: #00ff88;
  --accent-warm: #ff9f43;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --success: #00ff88;
  --warning: #ffaa00;
  --info: #00b4d8;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

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

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

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

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

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-secondary);
  gap: 12px;
  flex-shrink: 0;
}
.header h1 {
  font-size: 22px;
  font-weight: 600;
  flex: 1;
}
.header-meta {
  font-size: 13px;
  color: var(--text-secondary);
}
.back-btn {
  background: transparent;
  color: var(--text-primary);
  font-size: 22px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
}

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

.home-content {
  align-items: center;
  justify-content: center;
}

/* --- Focus States (critical for EMG/D-pad) --- */
.focusable {
  transition: all 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  min-height: 44px;
}
.focusable:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}

/* --- Navigation Bar --- */
.nav-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.nav-item {
  flex: 1;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.nav-item:focus { background: var(--bg-card); }
.nav-item.primary {
  background: var(--accent-primary);
  color: #0a0a0f;
}
.nav-item.primary:focus { background: #33ddff; }
.nav-item.danger {
  background: var(--danger);
  color: white;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 2px solid transparent;
  text-align: center;
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-primary);
}

/* --- Data Grid (2-column) --- */
.data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

/* --- Step Ring --- */
.ring-wrap {
  position: relative;
  width: 260px;
  height: 260px;
  flex-shrink: 0;
}
.ring-svg {
  width: 100%;
  height: 100%;
}
.ring-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 14;
}
.ring-fill {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 565.48;
  stroke-dashoffset: 565.48;
  transition: stroke-dashoffset 0.4s cubic-bezier(0.4, 0.04, 0.5, 1), stroke 0.3s ease;
}
.ring-fill.goal-reached {
  stroke: var(--success);
}
.ring-center {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.steps-value {
  font-size: 52px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.steps-label {
  font-size: 14px;
  color: var(--text-secondary);
}
.steps-percent {
  font-size: 13px;
  color: var(--accent-primary);
  margin-top: 4px;
}

/* --- Goal Settings --- */
.goal-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 8px;
}
.goal-number {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent-primary);
}
.goal-unit {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.goal-buttons { margin-bottom: 4px; }

/* --- Toast Notifications --- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  border: 1px solid var(--accent-primary);
  transition: transform 0.3s ease;
  z-index: 100;
  pointer-events: none;
  max-width: 480px;
  text-align: center;
}
.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }

/* --- Utility --- */
.hidden { display: none !important; }
