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

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2333;
  --bg-hover: #21262d;
  --border: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --yellow: #d29922;
  --bronze: #cd7f32;
  --silver: #9e9e9e;
  --gold: #ffd700;
  --platinum: #b8a9d4;
  --argentina-blue: #75aadb;
  --argentina-white: #ffffff;
  --messi-gold: #f5d742;
}

body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
  max-width: min(1400px, 95vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(12px, 2vw, 32px);
  height: 52px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-brand-icon { font-size: 1.3rem; }

.nav-brand-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-hover);
  font-weight: 600;
}

.nav-cta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid rgba(88,166,255,0.25);
  transition: all 0.15s ease;
}

.nav-cta:hover {
  background: rgba(88,166,255,0.08);
  border-color: rgba(88,166,255,0.5);
}

/* ── Header Badge ── */
.header-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  border: 1px solid rgba(88,166,255,0.3);
  padding: 3px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
  background: rgba(88,166,255,0.06);
}

.header-byline {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ── Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(255,215,0,0.2); }
  50% { box-shadow: 0 0 20px rgba(255,215,0,0.5); }
}
@keyframes starPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100px) rotate(720deg); opacity: 0; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-in {
  animation: fadeInUp 0.5s ease-out both;
}
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.10s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.20s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.30s; }
.animate-in:nth-child(7) { animation-delay: 0.35s; }
.animate-in:nth-child(8) { animation-delay: 0.40s; }
.animate-in:nth-child(9) { animation-delay: 0.45s; }
.animate-in:nth-child(10) { animation-delay: 0.50s; }

.star-pop {
  animation: starPop 0.4s ease-out both;
}

/* ── Layout ── */
.container {
  max-width: min(1400px, 95vw);
  margin: 0 auto;
  padding: clamp(12px, 2vw, 32px);
}

/* ── Header ── */
.header {
  text-align: center;
  padding: clamp(24px, 5vh, 48px) 0 clamp(16px, 3vh, 32px);
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--messi-gold), var(--argentina-blue), var(--messi-gold));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

.header .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 6px;
}

.header-byline .messi-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--argentina-blue), #ffffff, var(--argentina-blue));
  color: #1a1a2e;
  padding: 1px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.75rem;
}

.header .week-label {
  display: inline-block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 20px;
  font-size: 0.8rem;
  margin-top: 10px;
  color: var(--text-secondary);
}

/* ── Loading ── */
.loading {
  text-align: center;
  padding: 80px 48px;
  color: var(--text-secondary);
}

.loading .spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--messi-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading .loading-text {
  margin-top: 16px;
  font-size: 0.85rem;
}

/* ── Stats Bar ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover {
  border-color: var(--text-secondary);
  transform: translateY(-1px);
}

.stat-card .stat-icon {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Weekly Tracker ── */
.section-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 24px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  transition: opacity 0.3s, transform 0.2s, border-color 0.3s;
  animation: fadeInUp 0.5s ease-out both;
}

.day-card:hover {
  transform: translateY(-2px);
}

.day-card .day-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.day-card .day-date {
  font-size: 0.65rem;
  color: var(--text-secondary);
  opacity: 0.6;
  margin-bottom: 8px;
}

.day-card .sport-icons {
  font-size: 1.1rem;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  padding: 4px;
}

.day-card .activity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s;
  margin: 1px 0;
}

.day-card .activity:hover {
  background: var(--bg-hover);
}

.day-card .activity .label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.day-card .activity input[type="checkbox"] {
  appearance: none;
  width: 15px;
  height: 15px;
  border: 2px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s;
}

.day-card .activity input[type="checkbox"]:checked {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 6px rgba(63,185,80,0.4);
}

.day-card .activity input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: -2px;
  left: 1px;
  font-size: 11px;
  color: #fff;
  font-weight: 700;
}

.day-card .activity.optional {
  opacity: 0.55;
  font-style: italic;
}

.day-card .activity.optional input[type="checkbox"]:checked {
  opacity: 1;
}

.day-card .stickers-display {
  margin-top: 10px;
  font-size: 1rem;
  min-height: 20px;
  display: flex;
  justify-content: center;
  gap: 2px;
}

.day-card .stickers-display .star-wrapper {
  display: inline-block;
}

.day-card .stickers-display .star-wrapper .empty-star {
  opacity: 0.15;
}

.day-card.inactive {
  opacity: 0.35;
}

.day-card.past .activity {
  cursor: default;
  opacity: 0.5;
}

.day-card.past .activity:hover {
  background: transparent;
}

.day-card.past input[type="checkbox"] {
  pointer-events: none;
  opacity: 0.3;
}

.day-card.future {
  opacity: 0.25;
}

.day-card.future .activity {
  cursor: default;
}

.day-card.future input[type="checkbox"] {
  pointer-events: none;
}

.day-card.today {
  border-color: var(--messi-gold);
  box-shadow: 0 0 0 1px var(--messi-gold), 0 0 12px rgba(245,215,66,0.1);
  animation: pulseGlow 2s ease-in-out infinite;
}

.day-card.complete {
  border-color: var(--green);
  background: linear-gradient(135deg, var(--bg-card), rgba(63,185,80,0.06));
}

.day-card .progress-ring {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-bottom: 8px;
}

.day-card .progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s;
}

.day-card .progress-dot.done {
  background: var(--green);
}

/* ── Weekend Cards ── */
.weekend-card {
  background: linear-gradient(135deg, #1a1a3e, #1c2333);
  border-color: #4a3a7a;
}

.weekend-card .day-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.weekend-badge {
  display: inline-block;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.weekend-notes {
  width: 100%;
  min-height: 70px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 10px;
  resize: vertical;
  margin-top: 8px;
  transition: border-color 0.2s;
}

.weekend-notes:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 8px rgba(168,85,247,0.2);
}

.weekend-notes::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.weekend-sticker-picker {
  margin-top: 8px;
  text-align: center;
}

.weekend-sticker-picker label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.sticker-buttons {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.sticker-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.sticker-btn:hover {
  border-color: #a855f7;
  color: #a855f7;
}

.sticker-btn.selected {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

.weekend-save-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.weekend-save-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.weekend-save-btn:active {
  transform: translateY(0);
}

.weekend-notes-display {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: left;
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  line-height: 1.4;
}

.weekend-image-wrapper {
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(168,85,247,0.3);
}

.weekend-image {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Award Progress ── */
.award-section {
  margin-top: 16px;
  background: linear-gradient(135deg, var(--bg-card), rgba(255,215,0,0.03));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  animation: fadeInUp 0.5s ease-out both;
  animation-delay: 0.1s;
}

.award-section h3 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.award-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.award-segment {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.2;
  transition: all 0.4s;
  position: relative;
  overflow: hidden;
}

.award-segment::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.award-segment.unlocked {
  opacity: 1;
}

.award-segment.unlocked::before {
  opacity: 1;
}

.award-segment.current {
  opacity: 1;
  box-shadow: 0 0 16px rgba(255,215,0,0.3);
  transform: scale(1.03);
}

.award-segment.current::after {
  content: '⬇';
  position: absolute;
  bottom: -16px;
  font-size: 0.7rem;
}

.segment-bronze { background: linear-gradient(135deg, #a0652e, var(--bronze)); color: #fff; }
.segment-silver { background: linear-gradient(135deg, #7a7a7a, var(--silver)); color: #fff; }
.segment-gold { background: linear-gradient(135deg, #b8860b, var(--gold)); color: #1a1a1a; }
.segment-platinum { background: linear-gradient(135deg, #5a4a7a, var(--platinum)); color: #1a1a1a; }

.next-tier {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--messi-gold);
  text-align: center;
  padding: 8px;
  background: rgba(245,215,66,0.06);
  border-radius: 8px;
}

/* ── Custom Goals ── */
.goals-section {
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  animation: fadeInUp 0.5s ease-out both;
  animation-delay: 0.2s;
}

.goals-section h3 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.goal-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  border-radius: 6px;
  padding: 10px;
  margin: 0 -6px;
}

.goal-item:last-child {
  border-bottom: none;
  margin-bottom: -6px;
}

.goal-item:hover {
  background: var(--bg-hover);
}

.goal-item .goal-icon {
  font-size: 1.6rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  flex-shrink: 0;
}

.goal-item .goal-info {
  flex: 1;
  min-width: 0;
}

.goal-item .goal-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.goal-item .goal-reward {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.goal-item .goal-progress {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.goal-item .goal-progress.locked {
  color: var(--yellow);
  background: rgba(210,153,34,0.1);
}

.goal-item .goal-progress.unlocked {
  color: var(--green);
  background: rgba(63,185,80,0.1);
}

.goal-item .goal-progress.locked.editing {
  padding: 2px 4px;
}

.goal-sticker-input {
  width: 48px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--yellow);
  color: var(--yellow);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  outline: none;
}

.goal-delete-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.goal-item:hover .goal-delete-btn {
  opacity: 1;
}

.goal-delete-btn:hover {
  background: rgba(255,80,80,0.15);
  color: #ff5050;
}

.add-goal-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.add-goal-form input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.add-goal-form input:focus {
  border-color: var(--yellow);
}

.add-goal-form input[type="number"] {
  flex: 0 0 90px;
}

.add-goal-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: var(--yellow);
  color: #1a1a2e;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.add-goal-btn:hover {
  opacity: 0.85;
}

/* ── Drawings Section ── */
.drawings-section {
  margin-top: clamp(20px, 3vh, 40px);
  animation: fadeInUp 0.5s ease-out both;
  animation-delay: 0.3s;
}

.drawings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.drawings-header h3 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.drawings-header .authenticity-badge {
  font-size: 0.65rem;
  color: var(--messi-gold);
  background: rgba(245,215,66,0.08);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.drawings-section .drawing-intro {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-style: italic;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border-left: 3px solid var(--messi-gold);
  border-radius: 0 8px 8px 0;
}

.drawings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.drawing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.drawing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border-color: var(--text-secondary);
}

.drawing-card .drawing-img-wrapper {
  position: relative;
  overflow: hidden;
  height: 170px;
}

.drawing-card .drawing-img-wrapper::after {
  content: '🔍';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.25s;
}

.drawing-card:hover .drawing-img-wrapper::after {
  opacity: 1;
}

.drawing-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.drawing-card:hover img {
  transform: scale(1.05);
}

.drawing-card .drawing-caption {
  padding: 12px 14px;
}

.drawing-card .drawing-title {
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 2px;
}

.drawing-card .drawing-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: pointer;
  animation: fadeInUp 0.2s ease-out;
}

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.lightbox .lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background 0.2s;
}

.lightbox .lightbox-close:hover {
  background: rgba(255,255,255,0.15);
}

.lightbox .lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: #ccc;
  backdrop-filter: blur(4px);
}

.lightbox .lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: 10px;
  transition: background 0.2s;
}

.lightbox .lightbox-nav:hover { background: rgba(255,255,255,0.12); }
.lightbox .lightbox-nav--prev { left: 20px; }
.lightbox .lightbox-nav--next { right: 20px; }

/* ── Confetti ── */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 200;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  top: -10px;
  animation: confettiFall 2s ease-out forwards;
}

/* ── Error ── */
.error {
  text-align: center;
  padding: 64px 48px;
  animation: fadeInUp 0.3s ease-out;
}

.error .error-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.error #error-message {
  font-size: 1.1rem;
  font-weight: 600;
  color: #f85149;
}

.error .error-detail {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 8px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.error .retry-btn {
  margin-top: 16px;
  padding: 10px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.error .retry-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  margin-top: clamp(24px, 4vh, 48px);
  padding: 40px clamp(12px, 2vw, 32px) 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.footer-inner {
  max-width: min(1400px, 95vw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
}

.footer-col { line-height: 1.7; }

.footer-title {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.footer-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  max-width: 300px;
}

.footer-link {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.72rem;
  transition: color 0.15s;
  padding: 2px 0;
}

.footer-link:hover {
  color: var(--text-primary);
}

.footer-small {
  display: block;
  font-size: 0.65rem;
  color: var(--text-secondary);
  opacity: 0.6;
  margin-top: 4px;
}

.footer-bottom {
  text-align: center;
  padding: 20px 0;
  margin-top: 32px;
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  color: var(--text-secondary);
  opacity: 0.6;
}

/* ── Large Screens ── */
@media (min-width: 1200px) {
  .container {
    max-width: min(1600px, 92vw);
  }
  .header h1 {
    font-size: 2.8rem;
  }
  .header .subtitle {
    font-size: 1rem;
  }
  .header .week-label {
    font-size: 0.9rem;
    padding: 8px 28px;
  }
  .stats-bar {
    gap: 16px;
  }
  .stat-card {
    padding: 24px 20px;
  }
  .stat-card .stat-value {
    font-size: 2rem;
  }
  .stat-card .stat-icon {
    font-size: 1.6rem;
  }
  .stat-card .stat-label {
    font-size: 0.8rem;
  }
  .week-grid {
    gap: 14px;
  }
  .day-card {
    padding: 20px 14px;
  }
  .day-card .day-name {
    font-size: 0.9rem;
  }
  .day-card .activity {
    font-size: 0.82rem;
    padding: 6px 10px;
  }
  .day-card .activity input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }
  .day-card .activity input[type="checkbox"]:checked::after {
    font-size: 14px;
  }
  .day-card .stickers-display {
    font-size: 1.2rem;
    gap: 4px;
  }
  .day-card .progress-dot {
    width: 8px;
    height: 8px;
  }
  .award-section {
    padding: 28px 24px;
  }
  .award-section h3 {
    font-size: 0.9rem;
  }
  .award-segment {
    height: 40px;
    font-size: 0.85rem;
  }
  .section-title {
    font-size: 0.95rem;
    margin: 32px 0 12px;
  }
  .goals-section {
    padding: 28px 24px;
  }
  .goals-section h3 {
    font-size: 0.9rem;
  }
  .goal-item .goal-icon {
    font-size: 2rem;
    width: 48px;
    height: 48px;
  }
  .goal-item .goal-name {
    font-size: 1rem;
  }
  .goal-item .goal-reward {
    font-size: 0.82rem;
  }
  .goal-item .goal-progress {
    font-size: 0.82rem;
  }
  .add-goal-form {
    flex-wrap: wrap;
  }
  .add-goal-form input[type="number"] {
    flex: 0 0 80px;
  }
  .drawings-grid {
    gap: 20px;
  }
  .drawing-img-wrapper {
    height: 220px;
  }
  .drawing-card .drawing-title {
    font-size: 0.95rem;
  }
  .drawing-card .drawing-desc {
    font-size: 0.8rem;
  }
  .footer {
    padding: 40px 32px;
    font-size: 0.8rem;
  }
}

/* ── History Section ── */
.history-section {
  margin-top: 16px;
  animation: fadeInUp 0.5s ease-out both;
  animation-delay: 0.25s;
}

.history-section-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 24px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.milestone-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 12px 0;
  overflow-x: auto;
}

.milestone-node {
  text-align: center;
  flex-shrink: 0;
  min-width: 70px;
}

.milestone-node .milestone-icon {
  font-size: 1.1rem;
}

.milestone-node .milestone-name {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.milestone-node .milestone-date {
  font-size: 0.58rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.milestone-node.achieved .milestone-date {
  color: var(--green);
}

.milestone-node.pending .milestone-date {
  opacity: 0.6;
}

.milestone-line {
  flex: 1;
  min-width: 20px;
  height: 2px;
  background: var(--border);
}

.milestone-line.done {
  background: var(--green);
}

.history-milestone-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-top: 12px;
}

.goals-unlocked-link {
  text-align: center;
  margin-top: 10px;
  padding: 8px;
  cursor: pointer;
}

.unlocked-link-text {
  font-size: 0.78rem;
  color: var(--green);
  transition: opacity 0.2s;
}

.unlocked-link-text:hover {
  opacity: 0.8;
}

.milestone-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 12px 0;
  overflow-x: auto;
}

.milestone-node {
  text-align: center;
  flex-shrink: 0;
  min-width: 70px;
}

.milestone-node .milestone-icon {
  font-size: 1.1rem;
}

.milestone-node .milestone-name {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.milestone-node .milestone-date {
  font-size: 0.58rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.milestone-node.achieved .milestone-date {
  color: var(--green);
}

.milestone-node.pending .milestone-date {
  opacity: 0.6;
}

.milestone-line {
  flex: 1;
  min-width: 20px;
  height: 2px;
  background: var(--border);
}

.milestone-line.done {
  background: var(--green);
}

.history-milestone-section,
.history-weekly-section,
.history-day-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-top: 12px;
}

/* ── History Date Range Picker ── */

.history-date-picker {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-top: 12px;
}

.history-range-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-range-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.history-date-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
}

.history-date-input:focus {
  outline: none;
  border-color: var(--accent);
}

.history-go-btn {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
}

.history-go-btn:hover {
  opacity: 0.85;
}

/* ── History Aggregate Results ── */

.history-results {
  margin-top: 12px;
}

.history-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.history-aggregate-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.history-aggregate-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  text-align: center;
}

.history-aggregate-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--messi-gold);
}

.history-aggregate-stat-label {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.history-aggregate-range {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 6px;
  background: rgba(245, 215, 66, 0.04);
  border-radius: 6px;
}

.history-unlocked-goals-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-top: 12px;
}

.history-unlocked-goals-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-unlocked-goal {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(63, 185, 80, 0.08), rgba(63, 185, 80, 0.02));
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-radius: 10px;
}

.history-unlocked-goal-icon {
  font-size: 1.1rem;
}

.history-unlocked-goal-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.history-unlocked-goal-threshold {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.history-unlocked-goal-check {
  font-size: 0.9rem;
}

.history-entries-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-top: 12px;
}

.history-entry-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.history-entry-row:last-child {
  border-bottom: none;
}

.history-entry-date {
  min-width: 50px;
  text-align: center;
  flex-shrink: 0;
}

.history-entry-day {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
}

.history-entry-datestr {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.history-entry-activities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.history-entry-stickers {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--messi-gold);
  flex-shrink: 0;
}

.history-chip {
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
}

.chip-done {
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
}

.chip-missed {
  background: rgba(139, 148, 158, 0.1);
  color: var(--text-secondary);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }
  .week-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .drawings-grid {
    grid-template-columns: 1fr;
  }
  .header h1 {
    font-size: 1.5rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .week-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
  }
  .day-card .activity {
    font-size: 0.65rem;
  }
}
