* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f4f6f9;
  color: #1f2937;
  line-height: 1.5;
  padding: 16px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

/* Intro Splash Screen */
.splash-overlay {
  position: fixed;
  inset: 0;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.45s ease;
  cursor: pointer;
}

.splash-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-content {
  text-align: center;
  animation: splashPop 0.6s ease-out forwards;
}

.splash-label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 10px;
}

.splash-logo {
  width: 80vw;
  max-width: 480px;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 20px;
}

@keyframes splashPop {
  0% { opacity: 0; transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

.container {
  max-width: 480px;
  margin: 0 auto;
}

.card {
  background: #ffffff;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

h1 {
  font-size: 1.5rem;
  color: #111827;
  margin-bottom: 4px;
}

h2 {
  font-size: 1.15rem;
  color: #111827;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 12px;
}

/* Horizontal Unit Dietetik Logo */
.unit-logo-box {
  margin: 10px 0 16px 0;
  text-align: center;
}

.unit-logo {
  width: 100%;
  max-width: 100%;
  max-height: 270px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* PDPA & Disclaimer Box */
.notice-box {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  padding: 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #1e3a8a;
  margin-bottom: 18px;
}

.notice-box p {
  margin-top: 6px;
}

/* Forms & Buttons */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.checkbox-group input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover {
  background: #15803d;
}

.btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.btn-outline {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.error-text {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 10px;
  text-align: center;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge {
  background: #111827;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Campfire & Streak Animation */
.streak-card {
  text-align: center;
}

.campfire-wrapper {
  margin: 8px auto;
  display: flex;
  justify-content: center;
}

.flame-group {
  transform-origin: 60px 80px;
  animation: flicker 1.4s infinite alternate ease-in-out;
}

@keyframes flicker {
  0% { transform: scale(1) rotate(-1deg); }
  50% { transform: scale(1.04) rotate(1deg); }
  100% { transform: scale(0.98) rotate(-0.5deg); }
}

.tier-1 .flame-outer,
.tier-2 .flame-outer { fill: #ff6b00; }
.tier-1 .flame-inner,
.tier-2 .flame-inner { fill: #ffd000; }

.tier-3 .flame-outer { fill: #2563eb; }
.tier-3 .flame-inner { fill: #93c5fd; }

.tier-4 .flame-outer { fill: #dc2626; }
.tier-4 .flame-inner { fill: #fca5a5; }

.tier-5 .flame-outer { fill: #7c3aed; }
.tier-5 .flame-inner { fill: #ddd6fe; }

.weekly-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 6px 0;
}

.w-star {
  font-size: 1.4rem;
  color: #d1d5db;
  transition: color 0.3s ease;
}

.w-star.lit {
  color: #f59e0b;
}

.streak-number {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
}

.tier-text {
  font-size: 0.85rem;
  color: #6b7280;
}

/* Calendar Grid */
.calendar-header {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.month-dropdown {
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
}

.weekdays-grid,
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
}

.weekdays-grid {
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 8px;
}

.day-box {
  aspect-ratio: 1 / 1;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  background: #ffffff;
  position: relative;
}

.day-empty-pad {
  border: none;
  background: transparent;
}

.day-disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

.day-today {
  border: 2px solid #16a34a;
  background: #f0fdf4;
  color: #166534;
  cursor: pointer;
}

.day-today:hover {
  background: #dcfce7;
}

.day-done {
  border: 1px solid #f59e0b;
  background: #fffbeb;
  cursor: pointer;
  padding: 2px;
}

.calendar-hint {
  font-size: 0.78rem;
  color: #6b7280;
  text-align: center;
  margin-top: 12px;
}

/* Bottom Creator Watermark */
.creator-footer {
  max-width: 480px;
  margin: 8px auto 16px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0.85;
}

.creator-text {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #6b7280;
}

.creator-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 10px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-content {
  background: #ffffff;
  border-radius: 14px;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.question-block {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.question-block legend {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0 4px;
}

.question-block label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  margin-top: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.score-pill {
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.status-msg {
  font-weight: 600;
  margin-bottom: 12px;
}

.advice-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.advice-list {
  margin-top: 8px;
  padding-left: 20px;
}

.advice-list li {
  margin-bottom: 8px;
}

.advice-list li:last-child {
  margin-bottom: 0;
}