
:root {
  --primary: #F12F12;
  --primary-dark: #c4250e;
  --accent-yellow: #FFD600;
  --accent-cyan: #00E5FF;
  --accent-purple: #7C4DFF;
  --bg: #1a1a2e;
  --bg-card: #252545;
  --bg-card-hover: #2e2e55;
  --text: #f0f0ff;
  --text-muted: #9999bb;
  --success: #00e676;
  --warning: #FFD600;
  --danger: #ff5252;
  --radius: 20px;
  --shadow: 0 8px 32px rgba(241, 47, 18, 0.25);
}

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

html, body {
  height: 100%;
  font-family: "Fredoka", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  background: linear-gradient(160deg, #1a1a2e 0%, #2a1040 50%, #1a1a2e 100%);
  min-height: 100dvh;
}

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; }

.screen { padding: 1.5rem 1rem 2rem; min-height: 100dvh; }

/* Login */
.loginHero { text-align: center; margin: 2rem 0 1.5rem; }
.loginLogo { border-radius: 28px; box-shadow: var(--shadow); margin-bottom: 1rem; }
.loginHero h1 { font-size: 2rem; color: var(--primary); text-shadow: 0 2px 12px rgba(241,47,18,.5); }
.tagline { color: var(--text-muted); margin-top: .5rem; font-size: .95rem; }

.pinForm {
  display: flex; flex-direction: column; gap: .75rem;
  max-width: 280px; margin: 1rem auto 0;
}

.pinInput {
  width: 100%; padding: .85rem 1rem;
  border: 2px solid var(--bg-card-hover); border-radius: var(--radius);
  background: var(--bg-card); color: var(--accent-cyan);
  font-family: inherit; font-size: 1.5rem; font-weight: 600;
  text-align: center; letter-spacing: .5rem;
  -moz-appearance: textfield;
}
.pinInput:focus {
  outline: none; border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 229, 255, .2);
}
.pinInput::-webkit-outer-spin-button,
.pinInput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.pinSubmit { width: 100%; }

.loginError { text-align: center; color: var(--danger); margin-top: 1rem; }

/* Top bar */
.topBar {
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem 0 1rem;
}
.topBar h1 { flex: 1; font-size: 1.5rem; color: var(--primary); }
.topIcon { border-radius: 10px; }
.streakBadge {
  background: linear-gradient(135deg, var(--primary), var(--accent-yellow));
  padding: .35rem .75rem; border-radius: 999px;
  font-weight: 700; font-size: .9rem; color: #1a1a2e;
}

/* Tabs */
.tabNav {
  display: flex; gap: .5rem; margin-bottom: 1.25rem;
  background: var(--bg-card); border-radius: var(--radius); padding: .35rem;
}
.tab {
  flex: 1; border: none; background: transparent; color: var(--text-muted);
  font-family: inherit; font-size: .95rem; font-weight: 600;
  padding: .6rem; border-radius: calc(var(--radius) - 4px); cursor: pointer;
  transition: background .15s, color .15s;
}
.tab.active { background: var(--primary); color: white; }

.tabPanel { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Cards */
.roastCard, .motivationCard {
  background: linear-gradient(135deg, var(--bg-card) 0%, #3a1855 100%);
  border: 2px solid var(--accent-purple);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin-bottom: 1.25rem; box-shadow: 0 4px 20px rgba(124,77,255,.2);
}
.roastLabel, .motivationLabel {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .06em;
  line-height: 1.35;
  color: var(--accent-purple); margin-bottom: .5rem; font-weight: 600;
}
.roastCard p, .motivationCard p { line-height: 1.5; font-size: .95rem; }

.slotCards { display: flex; flex-direction: column; gap: 1rem; }

.slotCard {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 1.25rem; border-left: 5px solid var(--primary);
  box-shadow: var(--shadow); transition: transform .2s;
  position: relative; overflow: hidden;
}
.slotCard.status-taken { border-left-color: var(--success); opacity: .85; }
.slotCard.status-pending { border-left-color: var(--warning); animation: pulse 2s infinite; }
.slotCard.status-overdue { border-left-color: var(--danger); }
.slotCard.status-snoozed { border-left-color: var(--accent-cyan); }
.slotCard.status-upcoming { border-left-color: var(--text-muted); opacity: .7; }
.slotCard.status-missed { border-left-color: var(--danger); opacity: .7; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(255,214,0,.15); }
  50% { box-shadow: 0 8px 32px rgba(255,214,0,.4); }
}

.slotCard.dopamin { animation: dopaminDrop .6s ease; }
@keyframes dopaminDrop {
  0% { transform: scale(1); }
  30% { transform: scale(1.06); }
  60% { transform: scale(.98); }
  100% { transform: scale(1); }
}

.slotHeader { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.slotLabel { font-size: 1.2rem; font-weight: 700; }
.slotTime { color: var(--text-muted); font-size: .9rem; }
.slotMeds { color: var(--accent-cyan); margin-bottom: .75rem; font-size: .95rem; }
.slotStatus {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; text-transform: uppercase;
}
.status-taken .slotStatus { background: rgba(0,230,118,.2); color: var(--success); }
.status-pending .slotStatus { background: rgba(255,214,0,.2); color: var(--warning); }
.status-overdue .slotStatus { background: rgba(255,82,82,.2); color: var(--danger); }
.status-snoozed .slotStatus { background: rgba(0,229,255,.2); color: var(--accent-cyan); }
.status-upcoming .slotStatus { background: rgba(153,153,187,.2); color: var(--text-muted); }
.status-missed .slotStatus { background: rgba(255,82,82,.15); color: var(--danger); }

.slotActions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }

.btn {
  border: none; border-radius: 999px; font-family: inherit;
  font-weight: 600; font-size: .95rem; padding: .7rem 1.25rem;
  cursor: pointer; transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.95); }
.btn-primary { background: var(--primary); color: white; flex: 1; }
.btn-secondary { background: var(--bg-card-hover); color: var(--text); }
.btn-accent { background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple)); color: white; width: 100%; }
.btn-danger { background: transparent; color: var(--danger); border: 2px solid var(--danger); width: 100%; }
.btn-snooze { background: rgba(0,229,255,.15); color: var(--accent-cyan); font-size: .85rem; padding: .5rem .9rem; }

/* Stats */
.statsRow { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
.statBox {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 1rem; text-align: center;
  border-top: 3px solid var(--primary);
}
.statNum { font-size: 1.75rem; font-weight: 700; color: var(--accent-yellow); }
.statLabel { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }

.sectionTitle { font-size: 1rem; color: var(--text-muted); margin-bottom: .75rem; }

/* Heatmap */
.heatmap {
  display: grid; grid-template-columns: repeat(15, 1fr); gap: 3px;
  margin-bottom: 2rem;
}
.heatCell {
  aspect-ratio: 1; border-radius: 4px; background: rgba(255,255,255,.06);
  cursor: default; transition: transform .1s;
}
.heatCell.good { background: var(--success); opacity: .85; }
.heatCell.partial { background: var(--warning); opacity: .7; }
.heatCell.bad { background: var(--danger); opacity: .7; }
.heatCell.none { background: rgba(255,255,255,.06); }
.heatCell:hover { transform: scale(1.3); z-index: 1; }

/* Settings */
.settingsGroup { margin-bottom: 1.5rem; }
.settingsGroup h2 { font-size: 1rem; margin-bottom: .5rem; color: var(--accent-cyan); }
.settingsHint { color: var(--text-muted); font-size: .85rem; margin-bottom: .75rem; line-height: 1.4; }
.settingsStatus { color: var(--text-muted); font-size: .85rem; margin-top: .5rem; }

/* Toast */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 2px solid var(--primary);
  border-radius: var(--radius); padding: .85rem 1.25rem;
  max-width: 90%; z-index: 1000; font-size: .9rem;
  box-shadow: var(--shadow); animation: slideUp .3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateX(-50%) translateY(20px); } }

/* Confetti */
.confetti {
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  background: radial-gradient(circle at 20% 50%, var(--primary) 0%, transparent 50%),
              radial-gradient(circle at 80% 30%, var(--accent-yellow) 0%, transparent 40%),
              radial-gradient(circle at 50% 80%, var(--accent-cyan) 0%, transparent 45%);
  opacity: 0; transition: opacity .3s;
}
.confetti.show { opacity: .6; animation: confettiFade .6s ease forwards; }
@keyframes confettiFade {
  0% { opacity: .7; }
  100% { opacity: 0; }
}

/* Easter egg overlay */
.easterEgg {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 2000;
}
.easterEgg[hidden] {
  display: none !important;
  pointer-events: none;
}
.easterEgg:not([hidden]) {
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .3s ease;
}
.easterEggInner {
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  border-radius: var(--radius); padding: 2rem; text-align: center;
  max-width: 85%; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.easterEggInner h2 { font-size: 1.5rem; margin-bottom: .75rem; }
.easterEggInner p { margin-bottom: 1.25rem; line-height: 1.5; }

/* PWA update banner */
.updateBanner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom));
  background: linear-gradient(135deg, var(--primary), #c41f1f);
  color: #fff; box-shadow: 0 -4px 20px rgba(0,0,0,.35);
  font-weight: 500;
}
.updateBanner[hidden] { display: none !important; }
.updateBanner .btn { flex-shrink: 0; padding: .5rem 1rem; font-size: .9rem; }
