:root {
  --bg-primary: #000000; /* pure black = transparent on additive display */
  --bg-secondary: #0a0a0f;
  --bg-tertiary: #14141f;
  --bg-card: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent-primary: #00d4ff;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --success: #00ff88;
  --warning: #ffaa00;
  --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;
}

/* --- 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: 16px;
  border: 2px solid transparent;
}
.card-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.card-subtitle { font-size: 14px; color: var(--text-secondary); line-height: 1.4; }

/* --- Verdict Hero --- */
.verdict {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--text-muted);
}
.verdict-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  border-radius: 50%;
  margin-bottom: 4px;
}
.verdict-label { font-size: 26px; font-weight: 700; }
.verdict-sub { font-size: 14px; color: var(--text-secondary); }

.verdict.safe { border-color: var(--success); }
.verdict.safe .verdict-icon { background: rgba(0, 255, 136, 0.18); color: var(--success); }
.verdict.safe .verdict-label { color: var(--success); }

.verdict.caution { border-color: var(--warning); }
.verdict.caution .verdict-icon { background: rgba(255, 170, 0, 0.18); color: var(--warning); }
.verdict.caution .verdict-label { color: var(--warning); }

.verdict.avoid { border-color: var(--danger); }
.verdict.avoid .verdict-icon { background: rgba(255, 68, 102, 0.18); color: var(--danger); }
.verdict.avoid .verdict-label { color: var(--danger); }

/* --- List Items --- */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  text-align: left;
  gap: 12px;
  border: 2px solid transparent;
}
.list-item:focus {
  outline: none;
  background: var(--bg-card);
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}
.list-item-icon { font-size: 22px; flex-shrink: 0; width: 32px; text-align: center; }
.list-item-content { flex: 1; min-width: 0; }
.list-item-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* --- Badges --- */
.badge-success { background: rgba(0, 255, 136, 0.2); color: var(--success); }
.badge-warning { background: rgba(255, 170, 0, 0.2); color: var(--warning); }
.badge-danger { background: rgba(255, 68, 102, 0.2); color: var(--danger); }

/* --- Loading Overlay --- */
.overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-tertiary);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 16px; color: var(--text-secondary); }

/* --- Error State --- */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  text-align: center;
}
.error-message { font-size: 16px; color: var(--text-secondary); }

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