:root {
  --ocean-teal: #0F4C5C;
  --ocean-teal-dark: #09323D;
  --seafoam: #E3F2FD;
  --seafoam-border: #BBDEFB;
  --warm-sand: #F8F9FA;
  --coral-accent: #E36414;
  --coral-soft: #FFF0E6;
  --surface-white: #FFFFFF;
  --text-primary: #102A32;
  --text-secondary: #4A6572;
  --text-muted: #78909C;
  --shadow-soft: 0 6px 20px rgba(15, 76, 92, 0.08);
  --shadow-header: 0 2px 12px rgba(15, 76, 92, 0.12);
  --shadow-nav: 0 -4px 16px rgba(15, 76, 92, 0.08);
  --radius-lg: 1rem;
  --radius-md: 0.75rem;
  --radius-pill: 9999px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;

  /* Mobile-first container width & bottom nav height */
  --app-max-width: 420px;
  --nav-height: 4.5rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  font-family: var(--font-sans);
  background-color: var(--warm-sand);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

.app-container {
  width: 100%;
  max-width: var(--app-max-width);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background-color: var(--warm-sand);
  padding-bottom: calc(var(--nav-height) + 1rem);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Camera Scanner Modal (Full-Screen) */
.camera-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(9, 50, 61, 0.96);
  backdrop-filter: blur(8px);
  z-index: 300;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  color: var(--surface-white);
  text-align: center;
}

.camera-modal.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.camera-modal-content {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.camera-modal-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.camera-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--surface-white);
  letter-spacing: -0.01em;
}

.camera-close-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.14);
  color: var(--surface-white);
  border: 1px solid rgba(227, 242, 253, 0.3);
  border-radius: var(--radius-pill);
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.camera-close-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.camera-viewport {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 300px;
  border-radius: 1.25rem;
  border: 2px solid rgba(227, 242, 253, 0.45);
  position: relative;
  overflow: hidden;
  background: #062129;
  box-shadow: 0 0 36px rgba(227, 100, 20, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-reticle-overlay {
  position: absolute;
  inset: 1.25rem;
  border: 2px dashed rgba(227, 242, 253, 0.65);
  border-radius: 1rem;
  pointer-events: none;
}

.camera-status-text {
  font-size: 0.84rem;
  color: var(--seafoam);
  opacity: 0.92;
  max-width: 320px;
  line-height: 1.4;
}

.camera-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 0.25rem;
}

.simulate-scan-btn {
  appearance: none;
  background-color: var(--coral-accent);
  color: var(--surface-white);
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.875rem 1.25rem;
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(227, 100, 20, 0.4);
  transition: background-color 0.18s ease, transform 0.12s ease;
}

.simulate-scan-btn:hover {
  background-color: #d1580f;
}

.simulate-scan-btn:active {
  transform: scale(0.98);
}

/* Success / Verification Animation Overlay */
.scan-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(9, 50, 61, 0.9);
  backdrop-filter: blur(6px);
  z-index: 350;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  color: var(--surface-white);
  text-align: center;
}

.scan-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.scan-reticle {
  width: 210px;
  aspect-ratio: 1 / 1;
  border-radius: 1.5rem;
  border: 2px solid rgba(227, 242, 253, 0.4);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle, rgba(227, 100, 20, 0.22) 0%, rgba(15, 76, 92, 0.5) 100%);
  box-shadow: 0 0 40px rgba(227, 100, 20, 0.4);
  margin-bottom: 1.25rem;
}

.scan-reticle svg {
  width: 40%;
  height: 40%;
  animation: popScale 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes popScale {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.scan-pulse-ring {
  position: absolute;
  width: 72%;
  height: 72%;
  border-radius: 50%;
  border: 3px solid var(--coral-accent);
  animation: pulseRing 1.2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.scan-laser-line {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--coral-accent) 50%, transparent 100%);
  box-shadow: 0 0 12px var(--coral-accent);
  animation: laserSweep 1.5s ease-in-out infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.65); opacity: 0.95; }
  100% { transform: scale(1.35); opacity: 0; }
}

@keyframes laserSweep {
  0% { top: 14%; }
  50% { top: 86%; }
  100% { top: 14%; }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--ocean-teal) 0%, var(--ocean-teal-dark) 100%);
  color: var(--surface-white);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.6875rem;
  min-width: 0;
}

.brand-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background-color: rgba(227, 242, 253, 0.14);
  border: 1px solid rgba(227, 242, 253, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--seafoam);
}

.brand-logo svg {
  width: 60%;
  height: 60%;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--surface-white);
  line-height: 1.15;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--seafoam);
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.125rem;
}

.points-badge {
  background-color: var(--coral-accent);
  color: var(--surface-white);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(227, 100, 20, 0.35);
  transition: transform 0.2s ease;
}

.points-badge.pulse {
  transform: scale(1.15);
}

.app-main {
  flex: 1;
  padding: 1.25rem 1.125rem;
}

.screen-section {
  display: none;
  animation: fadeIn 0.22s ease-out;
}

.screen-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-card {
  background-color: var(--surface-white);
  border: 1px solid var(--seafoam-border);
  border-radius: var(--radius-lg);
  padding: 1.375rem 1.125rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1rem;
}

.section-eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--coral-accent);
  background-color: var(--coral-soft);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.625rem;
}

.section-heading {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ocean-teal);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.section-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  background-color: var(--seafoam);
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-md);
  border-left: 0.25rem solid var(--ocean-teal);
  margin-bottom: 1rem;
}

.scan-action-box {
  background: linear-gradient(135deg, rgba(15, 76, 92, 0.04) 0%, rgba(227, 242, 253, 0.4) 100%);
  border: 2px dashed var(--seafoam-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

.primary-btn {
  appearance: none;
  background-color: var(--coral-accent);
  color: var(--surface-white);
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(227, 100, 20, 0.35);
  transition: background-color 0.18s ease, transform 0.12s ease;
}

.primary-btn:hover {
  background-color: #d1580f;
}

.primary-btn:active {
  transform: scale(0.98);
  background-color: #cb5610;
}

.toast-banner {
  background-color: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #A5D6A7;
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  gap: 0.625rem;
  animation: slideDown 0.25s ease-out;
}

.toast-banner.show {
  display: flex;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  margin-top: 0.75rem;
  padding-left: 0.5rem;
}

.timeline-item {
  display: flex;
  gap: 0.875rem;
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 0.9375rem;
  top: 2rem;
  bottom: -1rem;
  width: 2px;
  background-color: var(--seafoam-border);
}

.timeline-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--seafoam);
  color: var(--ocean-teal);
  border: 2px solid var(--seafoam-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 800;
  z-index: 2;
}

.timeline-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.timeline-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ocean-teal);
}

.timeline-detail {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.batch-meta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.875rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: var(--warm-sand);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
}

.points-wallet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: linear-gradient(135deg, var(--ocean-teal) 0%, var(--ocean-teal-dark) 100%);
  color: var(--surface-white);
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(15, 76, 92, 0.15);
}

.wallet-label {
  font-size: 0.78rem;
  color: var(--seafoam);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wallet-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--surface-white);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.rewards-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.reward-card {
  border: 1px solid var(--seafoam-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background-color: var(--warm-sand);
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.reward-card.affordable {
  background-color: var(--surface-white);
  border-color: #90CAF9;
}

.reward-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.625rem;
}

.reward-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ocean-teal);
  line-height: 1.3;
}

.reward-cost-pill {
  background-color: var(--coral-soft);
  color: var(--coral-accent);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.reward-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.redeem-btn {
  appearance: none;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.6875rem 1rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background-color: var(--ocean-teal);
  color: var(--surface-white);
  transition: background-color 0.18s ease, transform 0.12s ease;
}

.redeem-btn:active:not(:disabled) {
  transform: scale(0.98);
  background-color: var(--ocean-teal-dark);
}

.redeem-btn:disabled {
  background-color: #CFD8DC;
  color: #546E7A;
  cursor: not-allowed;
  box-shadow: none;
}

.redemption-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.625rem;
}

.redemption-item {
  background-color: var(--warm-sand);
  border: 1px solid var(--seafoam-border);
  border-radius: 0.625rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.redemption-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: var(--coral-accent);
  flex-shrink: 0;
}

.impact-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.metric-card {
  background-color: var(--warm-sand);
  border: 1px solid var(--seafoam-border);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.metric-card.featured {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--ocean-teal) 0%, var(--ocean-teal-dark) 100%);
  border-color: var(--ocean-teal);
  color: var(--surface-white);
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.125rem;
  box-shadow: 0 4px 12px rgba(15, 76, 92, 0.16);
}

.metric-icon-box {
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 0.625rem;
  background-color: var(--seafoam);
  color: var(--ocean-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-card.featured .metric-icon-box {
  width: 2.75rem;
  height: 2.75rem;
  background-color: rgba(227, 242, 253, 0.16);
  color: var(--seafoam);
  border: 1px solid rgba(227, 242, 253, 0.28);
}

.metric-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.metric-card.featured .metric-label {
  color: var(--seafoam);
}

.metric-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ocean-teal);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.metric-card.featured .metric-value {
  font-size: 1.5rem;
  color: var(--surface-white);
}

.goal-card-box {
  background-color: var(--warm-sand);
  border: 1px solid var(--seafoam-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.goal-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ocean-teal);
  line-height: 1.3;
}

.goal-stats {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--coral-accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.progress-track {
  width: 100%;
  height: 0.75rem;
  background-color: var(--seafoam);
  border: 1px solid var(--seafoam-border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  width: 3%;
  background: linear-gradient(90deg, var(--ocean-teal) 0%, var(--coral-accent) 100%);
  border-radius: var(--radius-pill);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.goal-caption {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.coop-explainer-card {
  background-color: var(--coral-soft);
  border: 1px solid rgba(227, 100, 20, 0.28);
  border-radius: var(--radius-md);
  padding: 0.9375rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.coop-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  background-color: var(--coral-accent);
  color: var(--surface-white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.coop-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
}

.reset-btn {
  appearance: none;
  background-color: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--seafoam-border);
  border-radius: var(--radius-pill);
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  min-height: 2.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.reset-btn:hover {
  background-color: var(--seafoam);
  color: var(--ocean-teal);
  border-color: var(--ocean-teal);
}

.reset-btn:active {
  transform: scale(0.98);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-max-width);
  height: var(--nav-height);
  background-color: var(--surface-white);
  border-top: 1px solid var(--seafoam-border);
  box-shadow: var(--shadow-nav);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  z-index: 100;
  padding: 0.375rem 0.5rem;
}

.nav-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 3rem;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.nav-tab:active {
  transform: scale(0.97);
}

.nav-tab.active {
  color: var(--ocean-teal);
  background-color: var(--seafoam);
  font-weight: 700;
}

.nav-tab.active .nav-icon {
  color: var(--coral-accent);
}

.nav-icon {
  width: 1.375rem;
  height: 1.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  transition: color 0.18s ease;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

/* Desktop View / PC Responsiveness (Screens wider than 768px) */
@media (min-width: 768px) {
  html, body {
    background-color: #1e293b;
  }

  body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
  }

  .app-container {
    max-width: 420px;
    min-height: 820px;
    margin: auto;
    border-radius: 1.5rem;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
    padding-bottom: 0;
  }

  .app-header {
    border-top-left-radius: 1.5rem;
    border-top-right-radius: 1.5rem;
  }

  .bottom-nav {
    position: sticky;
    bottom: 0;
    left: auto;
    transform: none;
    max-width: 100%;
    border-bottom-left-radius: 1.5rem;
    border-bottom-right-radius: 1.5rem;
  }
}
