@font-face {
  font-family: 'UNCAGE-Bold';
  src: url('../fonts/UNCAGE-Bold.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-primary:    #F2F2F7;
  --bg-card:       #FFFFFF;
  --bg-card-2:     #F5F5F5;
  --accent:        #ADFF2F;
  --accent-dark:   #7ABF00;
  --accent-dim:    rgba(173,255,47,0.15);
  --accent-glow:   rgba(173,255,47,0.35);
  --text-1:        #1C1C1E;
  --text-2:        #8E8E93;
  --text-3:        #C7C7CC;
  --border:        rgba(0,0,0,0.07);
  --border-bright: rgba(173,255,47,0.5);
  --radius:        16px;
  --radius-sm:     10px;
  --trans:         0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-card:   0 2px 20px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-accent: 0 4px 24px rgba(173,255,47,0.35);
  --font-display:  'UNCAGE-Bold', sans-serif;
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  background: transparent;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--trans), transform var(--trans);
  z-index: 1;
}
.screen.active { display: flex; opacity: 1; transform: translateY(0); }

/* Dark screens keep their background */
#screen-loading, #screen-generating {
  background: #0A0A0A;
}
#screen-welcome {
  background: #ffffff;
}

.screen-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 100px;
  -webkit-overflow-scrolling: touch;
}
.screen-scroll::-webkit-scrollbar { display: none; }

h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; }

.section-title {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin: 20px 0 10px;
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 0;
  flex-shrink: 0;
  background: var(--bg-primary);
}

.btn-back {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 20px;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans);
  box-shadow: var(--shadow-card);
}
.btn-back:active { border-color: var(--accent); }

/* ── Global SVG icon helper ── */
.logo-icon svg, .generating-emoji svg, .modal-emoji svg,
.reminder-icon svg, .water-icon svg,
.today-workout-icon svg, .exercise-emoji svg,
.history-item-icon svg, .nav-icon svg,
.survey-question-emoji svg, .opt-emoji svg,
.icon-sm svg, .icon-md svg {
  display: block; width: 100%; height: 100%;
}

/* ── LOADING ── */
#screen-loading { align-items: center; justify-content: center; color: #fff; }

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.logo-icon {
  width: 72px; height: 72px;
  color: var(--accent);
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px var(--accent));
}

.logo-title {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #fff;
}

.logo-sub {
  color: #888;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.spinner {
  width: 36px; height: 36px;
  border: 2px solid rgba(173,255,47,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-top: 8px;
}

/* ── GENERATING ── */
#screen-generating { align-items: center; justify-content: center; color: #fff; }

.generating-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 32px;
  text-align: center;
}

.generating-emoji {
  width: 80px; height: 80px;
  color: var(--accent);
  animation: bounce 1s infinite;
  filter: drop-shadow(0 0 24px var(--accent));
}

.generating-content h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
}
.generating-content p { color: #888; font-size: 14px; }

.generating-dots { display: flex; gap: 8px; margin-top: 8px; }
.generating-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotpulse 1.4s infinite;
}
.generating-dots span:nth-child(2) { animation-delay: 0.2s; opacity: 0.7; }
.generating-dots span:nth-child(3) { animation-delay: 0.4s; opacity: 0.4; }

/* ── ANIMATIONS ── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes float   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes bounce  { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-12px) scale(1.05); } }
@keyframes dotpulse { 0%,80%,100% { transform: scale(0.6); opacity: 0.3; } 40% { transform: scale(1.3); opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeInUp     { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.slide-in-right { animation: slideInRight 0.3s cubic-bezier(0.4,0,0.2,1) both; }
.fade-in-up     { animation: fadeInUp 0.35s cubic-bezier(0.4,0,0.2,1) both; }

.loading-placeholder { color: var(--text-3); font-size: 14px; padding: 20px; text-align: center; }

/* ── WELCOME ── */
#screen-welcome {
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: #fff;
}

.welcome-bg-glow {
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(173,255,47,0.07) 0%, transparent 65%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.welcome-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  gap: 0;
}

.welcome-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: welcomeFloat 3.5s ease-in-out infinite;
  transition: transform 0.15s ease;
}
.welcome-logo-wrap:active { transform: scale(0.96); }

.welcome-svg {
  width: 250px;
  height: auto;
}

.welcome-app-name {
  font-family: 'Bebas Neue', 'Impact', sans-serif;
  font-size: 72px;
  font-weight: 400;
  color: #000000;
  letter-spacing: 6px;
  text-transform: uppercase;
  line-height: 1;
}

.welcome-app-sub {
  font-family: 'UNCAGE-Bold', sans-serif;
  font-size: 13px;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 3px;
}

.welcome-tap-hint {
  position: absolute;
  bottom: 56px;
  font-family: 'UNCAGE-Bold', sans-serif;
  font-size: 12px;
  color: #000000;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  animation: blinkHint 2.2s ease-in-out infinite;
}

@keyframes welcomeFloat {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}
@keyframes blinkHint {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.2; }
}
@keyframes welcomeExitAnim {
  0%   { opacity: 1; transform: scale(1) translateY(0); }
  35%  { opacity: 1; transform: scale(1.08) translateY(-4px); }
  100% { opacity: 0; transform: scale(0.92) translateY(-24px); }
}

#screen-welcome.welcome-exit {
  animation: welcomeExitAnim 0.48s ease-in forwards !important;
  transition: none !important;
}

/* ── READY ── */
#screen-ready {
  background: #FFFFFF;
  color: #000000;
  align-items: center;
  justify-content: center;
  transition: none !important;
  opacity: 1 !important;
  transform: none !important;
  clip-path: circle(0% at 50% 50%);
}
#screen-ready.active {
  animation: readyReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes readyReveal {
  0%   { clip-path: circle(0% at 50% 50%); }
  100% { clip-path: circle(150% at 50% 50%); }
}
.ready-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 32px 24px;
  text-align: center;
  animation: readyContentIn 0.55s ease both;
  animation-delay: 0.35s;
}
@keyframes readyContentIn {
  from { opacity: 0; transform: translateY(28px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ready-icon {
  width: 80px; height: 80px;
  background: rgba(173,255,47,0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #3a8a00;
}
.ready-icon svg { width: 40px; height: 40px; }
.ready-heading {
  font-family: 'UNCAGE-Bold', sans-serif;
  font-size: 72px;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 2px;
  color: #000000;
  text-transform: uppercase;
}
.ready-sub {
  font-size: 14px;
  color: #555555;
  max-width: 260px;
  line-height: 1.5;
}
.ready-cta {
  margin-top: 16px;
  background: #000000 !important;
  color: #ADFF2F !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 320px;
}
