*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.15);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --text: #0f172a;
    --text-dim: #64748b;
    --accent-glow: rgba(99, 102, 241, 0.12);
    --green-dim: rgba(34, 197, 94, 0.1);
    --yellow-dim: rgba(234, 179, 8, 0.1);
    --red-dim: rgba(239, 68, 68, 0.08);
    --blue-dim: rgba(59, 130, 246, 0.1);
  }
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* -- Layout -- */
.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.header {
  padding: 16px 20px 8px;
  text-align: center;
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 20px;
  -webkit-overflow-scrolling: touch;
}

/* -- Nav -- */
.nav {
  display: flex;
  gap: 4px;
  padding: 8px 20px;
  padding-bottom: calc(12px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.nav button {
  flex: 1;
  padding: 10px 6px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav button.active {
  background: var(--accent);
  color: white;
}

/* -- Countdown banner -- */
.countdown-banner {
  text-align: center;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(168,139,250,0.15));
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius);
}

.countdown-days {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.countdown-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.countdown-progress {
  margin-top: 8px;
  height: 6px;
  background: var(--surface-hover);
  border-radius: 3px;
  overflow: hidden;
}

.countdown-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border-radius: 3px;
  transition: width 0.3s;
}

/* -- Streak badge -- */
.streak {
  text-align: center;
  padding: 12px 0;
}

.streak-count {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -2px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.streak-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 500;
}

/* -- Section headers -- */
.section-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin: 16px 0 8px;
  padding-left: 2px;
}

/* -- Spray buttons -- */
.spray-buttons {
  display: flex;
  gap: 10px;
}

.spray-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  border: 2px solid var(--surface-hover);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.spray-btn:active { transform: scale(0.97); }

.spray-btn .icon { font-size: 24px; line-height: 1; }

.spray-btn .label-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.spray-btn .label-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.spray-btn .check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--surface-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.spray-btn.done {
  border-color: var(--green);
  background: var(--green-dim);
}

.spray-btn.done .check {
  border-color: var(--green);
  background: var(--green);
}

.spray-btn.done .check::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2.5px solid white;
  border-bottom: 2.5px solid white;
  transform: rotate(-45deg) translateY(-1px);
}

.spray-btn.done .label-sub {
  color: var(--green);
  font-weight: 600;
}

/* -- Today's workout card -- */
.today-workout-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 2px solid var(--surface-hover);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.today-workout-card:active { transform: scale(0.98); }

.today-workout-card.completed {
  border-color: var(--green);
  background: var(--green-dim);
}

.workout-type-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: white;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.workout-card-info { flex: 1; }

.workout-card-info .title {
  font-size: 16px;
  font-weight: 700;
}

.workout-card-info .subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.workout-card-arrow {
  font-size: 18px;
  color: var(--text-dim);
}

/* -- Supplement checklist -- */
.supplement-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.supplement-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.supplement-item:active { transform: scale(0.98); }

.supplement-item.checked {
  background: var(--green-dim);
}

.supplement-check {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--surface-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.supplement-item.checked .supplement-check {
  border-color: var(--green);
  background: var(--green);
}

.supplement-item.checked .supplement-check::after {
  content: '';
  width: 8px;
  height: 5px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg) translateY(-1px);
}

.supplement-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}

.supplement-dose {
  font-size: 12px;
  color: var(--text-dim);
}

/* -- Daily check-in -- */
.checkin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 6px;
}

.checkin-row label {
  font-size: 14px;
  font-weight: 600;
  min-width: 60px;
}

.checkin-row input[type="number"] {
  flex: 1;
  background: var(--surface-hover);
  border: none;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  max-width: 100px;
}

.checkin-row input[type="number"]:focus {
  outline: 2px solid var(--accent);
}

.energy-buttons {
  display: flex;
  gap: 6px;
}

.energy-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid var(--surface-hover);
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.energy-btn.selected {
  border-color: var(--accent);
  background: var(--accent-glow);
}

/* -- Workout week view -- */
.week-header {
  text-align: center;
  margin-bottom: 16px;
}

.week-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.week-header .phase-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

.week-schedule {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.week-day-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.week-day-row:active { transform: scale(0.98); }

.week-day-row.today-row {
  border: 2px solid var(--accent);
}

.week-day-row.completed {
  opacity: 0.7;
}

.week-day-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 32px;
}

.week-day-type {
  font-size: 14px;
  font-weight: 700;
  flex: 1;
}

.week-day-status {
  font-size: 14px;
}

/* -- Workout detail -- */
.workout-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.back-btn {
  background: var(--surface);
  border: none;
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.workout-detail-title {
  flex: 1;
}

.workout-detail-title h2 {
  font-size: 18px;
  font-weight: 700;
}

.workout-detail-title .subtitle {
  font-size: 13px;
  color: var(--text-dim);
}

.exercise-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
}

.exercise-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.exercise-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--surface-hover);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-dim);
}

.exercise-name {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}

.exercise-prescription {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.exercise-notes {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
  padding-left: 34px;
}

.exercise-sets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-left: 34px;
}

.set-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-hover);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
}

.set-input-group .set-label {
  color: var(--text-dim);
  font-weight: 600;
  min-width: 18px;
}

.set-input-group input {
  width: 40px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  text-align: center;
  padding: 2px;
}

.set-input-group input:focus {
  outline: none;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
}

.set-input-group .set-x {
  color: var(--text-dim);
  font-size: 11px;
}

.exercise-last-time {
  font-size: 11px;
  color: var(--text-dim);
  padding-left: 34px;
  margin-top: 6px;
}

.complete-workout-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.2s;
}

.complete-workout-btn:active { transform: scale(0.98); opacity: 0.9; }

.complete-workout-btn.completed {
  background: var(--green);
}

/* -- Progress view -- */
.progress-section {
  margin-bottom: 20px;
}

.progress-section h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-container {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  height: 180px;
  position: relative;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.strength-gains {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.strength-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 12px;
}

.strength-row .lift-name {
  font-size: 14px;
  font-weight: 600;
  min-width: 90px;
}

.strength-row .lift-progress {
  flex: 1;
  height: 6px;
  background: var(--surface-hover);
  border-radius: 3px;
  overflow: hidden;
}

.strength-row .lift-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}

.strength-row .lift-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  min-width: 50px;
  text-align: right;
}

.compliance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.compliance-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
}

.compliance-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
}

.compliance-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 500;
}

/* Undo toast */
.undo-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  opacity: 0;
  transition: all 0.3s;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.undo-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.undo-toast button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

/* -- History -- */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.month-nav button {
  background: var(--surface);
  border: none;
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.month-nav .month-title {
  font-size: 17px;
  font-weight: 700;
}

.month-pct {
  text-align: center;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--text-dim);
}

.month-pct span {
  font-weight: 700;
  color: var(--text);
  font-size: 20px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 24px;
}

.cal-header {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  padding-bottom: 4px;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  position: relative;
}

.cal-day.both { background: var(--green); color: white; }
.cal-day.partial { background: var(--yellow); color: #78350f; }
.cal-day.missed { background: var(--surface); color: var(--text-dim); }
.cal-day.future { opacity: 0.3; }
.cal-day.today { box-shadow: 0 0 0 2px var(--accent); }

.cal-day .photo-dot {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.cal-day.both .photo-dot { background: white; }
.cal-day.partial .photo-dot { background: #78350f; }

/* -- Stats -- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 500;
}

/* -- Settings -- */
.settings-group {
  margin-bottom: 20px;
}

.settings-group h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 6px;
}

.setting-row label {
  font-size: 15px;
  font-weight: 600;
}

.setting-row input[type="time"],
.setting-row input[type="date"] {
  background: var(--surface-hover);
  border: none;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
}

.setting-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  margin-bottom: 6px;
}

.setting-btn.danger { color: var(--red); }

.install-banner {
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.5;
}

.install-banner strong {
  display: block;
  margin-bottom: 4px;
}

@media (display-mode: standalone) {
  .install-banner { display: none; }
}

/* -- Photos -- */
.photos-section { margin-top: 12px; }

.photos-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.photo-strip::-webkit-scrollbar { display: none; }

.photo-thumb {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid var(--surface-hover);
}

.add-photo-btn {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  border: 2px dashed var(--surface-hover);
  background: transparent;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.add-photo-btn:active { background: var(--surface); }

.photo-uploading {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  border: 2px solid var(--accent);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-uploading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 3px solid var(--surface-hover);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.photo-thumb-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.photo-thumb-wrap .photo-thumb {
  width: 100%;
  height: 100%;
}

.photo-upload-overlay {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.photo-progress-text { color: white; font-size: 13px; font-weight: 700; }

.photo-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: var(--accent);
  border-radius: 0 0 10px 10px;
  transition: width 0.2s;
}

.photo-failed-overlay {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: rgba(239,68,68,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  color: white;
  font-weight: 700;
}

.pending-count {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-left: 6px;
}

/* -- Gallery modal -- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gallery-modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.gallery-modal h3 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
}

.gallery-close {
  margin-top: 12px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--surface-hover);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* -- Fullscreen viewer -- */
.fullscreen-viewer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 300;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s;
}

.photo-zoom-container {
  flex: 1;
  overflow: hidden;
  touch-action: none;
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-zoom-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
}

.fullscreen-bar {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  padding-top: calc(12px + var(--safe-top));
  background: rgba(0,0,0,0.5);
}

.fullscreen-bar button {
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 16px;
  -webkit-tap-highlight-color: transparent;
}

.fullscreen-bar button:active { opacity: 0.6; }
.fullscreen-bar .delete-btn { color: var(--red); }
.fullscreen-bar .delete-confirm { color: white; background: var(--red); border-radius: 8px; }

/* -- Role selection -- */
.role-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 16px;
  min-height: 60vh;
}

.role-screen h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.role-screen p { color: var(--text-dim); font-size: 14px; margin-bottom: 12px; }

.role-btn {
  width: 100%;
  max-width: 300px;
  padding: 20px;
  border: 2px solid var(--surface-hover);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.role-btn:active { transform: scale(0.97); }
.role-btn .role-sub { font-size: 13px; font-weight: 500; color: var(--text-dim); margin-top: 4px; }

/* -- Partner view -- */
.partner-status { text-align: center; padding: 20px 0; }
.partner-status h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.partner-status .date-label { font-size: 14px; color: var(--text-dim); margin-bottom: 20px; }

.status-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 2px solid var(--surface-hover);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 10px;
}

.status-card.done { border-color: var(--green); background: var(--green-dim); }
.status-card .icon { font-size: 28px; }
.status-card .status-text { flex: 1; font-size: 16px; font-weight: 600; }
.status-card .status-badge { font-size: 20px; }

.linked-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--green-dim);
  border: 1px solid var(--green);
  border-radius: 12px;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--green);
}

/* Celebration */
.celebration {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  z-index: 400;
  animation: celebratePop 1.5s ease-out forwards;
  pointer-events: none;
}

@keyframes celebratePop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1) translateY(-40px); }
}

.last-updated {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 16px;
}

.storage-warning {
  background: var(--yellow-dim);
  border: 1px solid var(--yellow);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--yellow);
}

.week-trend {
  text-align: center;
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-dim);
  background: var(--surface);
  border-radius: 10px;
}

.week-trend .trend-value { font-weight: 700; color: var(--text); }
.week-trend .trend-up { color: var(--green); }
.week-trend .trend-down { color: var(--red); }

/* -- No-data placeholder -- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.empty-state .emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
  line-height: 1.5;
}
