@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400;1,600&family=DM+Sans:wght@300;400;500&display=swap');

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

:root {
  --navy: #1B2B4B;
  --pink: #E91E8C;
  --green: #4CAF50;
  --cream: #FAF8F5;
  --border: #EDE9E3;
  --muted: #999;
  --runner-bg: #0d1f3c;
}

html, body {
  height: 100%;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

#gut-app {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 500px) {
  #gut-app {
    min-height: 700px;
    max-height: 860px;
    border-radius: 24px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.5);
    overflow: hidden;
  }
  html, body { padding: 24px; }
}

/* ── Screens: hidden by default, shown when active ── */
/* Simple display:none approach — no absolute positioning, no stacking issues */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

.screen.active {
  display: flex;
}

/* Fade-in animation on active screens */
@keyframes screenIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.screen.active {
  animation: screenIn 0.28s ease forwards;
}

/* ── Header — 3-column grid, works at any width ── */
.header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(27,43,75,0.08);
  background: var(--cream);
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 50px;
  flex-shrink: 0;
}

.header-left  { display: flex; align-items: center; justify-content: flex-start; min-width: 0; }
.header-mid   { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.header-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.header-mid img { height: 24px; width: auto; display: block; }

/* ── Pill ── */
.pill {
  background: var(--navy);
  color: white;
  font-size: 10px;
  font-weight: 500;
  padding: 4px 9px;
  border-radius: 20px;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Buttons ── */
.mute-btn { background: none; border: none; cursor: pointer; font-size: 18px; padding: 4px 8px; opacity: 0.5; line-height: 1; }

.back-btn {
  background: none; border: none; cursor: pointer; font-size: 13px;
  color: var(--navy); font-family: 'DM Sans', sans-serif;
  display: flex; align-items: center; gap: 4px;
  opacity: 0.55; padding: 4px 0;
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
}

.btn-primary {
  background: var(--pink); color: white; border: none;
  border-radius: 50px; padding: 17px 24px;
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500;
  cursor: pointer; transition: transform 0.15s, opacity 0.15s;
  width: 100%; -webkit-tap-highlight-color: transparent;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { background: #D5D0C8; cursor: not-allowed; color: var(--cream); }

.btn-secondary {
  background: white; color: var(--navy); border: 1.5px solid var(--navy);
  border-radius: 50px; padding: 15px 24px;
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; width: 100%; -webkit-tap-highlight-color: transparent;
}
.btn-secondary:active { transform: scale(0.97); }

.btn-wa {
  background: #25D366; color: white; border: none; border-radius: 50px;
  padding: 17px 24px; font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 500; cursor: pointer; width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.btn-wa:active { transform: scale(0.97); }

.btn-ig {
  background: white; color: var(--navy); border: 1.5px solid var(--navy);
  border-radius: 50px; padding: 15px 24px; font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 500; cursor: pointer; width: 100%;
  -webkit-tap-highlight-color: transparent;
}
.btn-ig:active { transform: scale(0.97); }

/* ── Typography ── */
.serif { font-family: 'Cormorant Garamond', serif; }

.time-stamp {
  font-size: 12px; font-weight: 500; color: var(--pink);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px;
}

/* ── Option cards ── */
.option-card {
  background: white; border: 1.5px solid var(--border); border-radius: 16px;
  padding: 14px 15px; cursor: pointer; display: flex; align-items: flex-start;
  gap: 12px; transition: border-color 0.2s; position: relative;
  -webkit-tap-highlight-color: transparent;
}
.option-card:active { opacity: 0.85; }
.option-card.selected { border-color: var(--pink); background: #FFF5FB; }
.option-emoji { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.option-title { font-size: 14px; font-weight: 500; color: var(--navy); margin-bottom: 2px; line-height: 1.3; }
.option-sub { font-size: 12px; color: var(--muted); line-height: 1.5; }
.option-check {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; background: var(--pink);
  display: none; align-items: center; justify-content: center;
  color: white; font-size: 11px;
}
.option-card.selected .option-check { display: flex; }

/* ── Avatar cards ── */
.avatar-card {
  background: white; border: 2px solid var(--border); border-radius: 18px;
  padding: 22px 12px; cursor: pointer; text-align: center; flex: 1;
  -webkit-tap-highlight-color: transparent;
}
.avatar-card:active { opacity: 0.85; }
.avatar-card.selected { border-color: var(--pink); background: #FFF5FB; }
.avatar-emoji { font-size: 40px; display: block; margin-bottom: 10px; }
.avatar-label { font-size: 13px; font-weight: 500; color: var(--navy); }

/* ── Name input ── */
.name-input {
  width: 100%; padding: 15px 20px; border: 1.5px solid var(--border);
  border-radius: 50px; font-family: 'DM Sans', sans-serif; font-size: 16px;
  color: var(--navy); background: white; outline: none; -webkit-appearance: none;
}
.name-input:focus { border-color: var(--pink); }
.name-input::placeholder { color: #C8C3BA; }

/* ── Runner screens ── */
.runner-header {
  background: var(--runner-bg); padding: 12px 18px 8px;
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.runner-label { font-size: 11px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.1em; }
.orb-count { font-size: 13px; font-weight: 500; color: var(--green); }
.timer-bar-wrap { height: 3px; background: rgba(255,255,255,0.15); margin: 0 18px 10px; }
.timer-bar-fill { height: 3px; background: var(--pink); transition: width 0.1s linear; }

/* ── Flash overlay ── */
.flash-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: rgba(20,80,40,0.95);
  opacity: 0; pointer-events: none; transition: opacity 0.4s; z-index: 5;
  padding: 28px 24px; text-align: center;
}
.flash-overlay.visible { opacity: 1; }
.flash-tag { font-size: 11px; color: rgba(255,255,255,0.7); letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 10px; border: 1px solid rgba(255,255,255,0.25); padding: 4px 14px; border-radius: 20px; }
.flash-main { font-family: 'Cormorant Garamond', serif; font-size: 28px; color: white; line-height: 1.25; margin-bottom: 10px; font-style: italic; }
.flash-sub { font-size: 13px; color: rgba(255,255,255,0.75); line-height: 1.6; max-width: 270px; }

/* ── Summary overlay ── */
.summary-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: rgba(13,31,60,0.97);
  opacity: 0; pointer-events: none; transition: opacity 0.4s; z-index: 6;
  padding: 32px 28px; text-align: center; overflow-y: auto;
}
.summary-overlay.visible { opacity: 1; pointer-events: all; }
.summary-label-top { font-size: 11px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 16px; }
.summary-score { font-family: 'Cormorant Garamond', serif; font-size: 72px; color: var(--green); font-weight: 600; line-height: 1; margin-bottom: 4px; }
.summary-of { font-size: 13px; color: rgba(255,255,255,0.4); margin-bottom: 24px; text-transform: uppercase; letter-spacing: 0.08em; }
.summary-bar-wrap { width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; margin-bottom: 24px; }
.summary-bar-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 1.2s cubic-bezier(0.4,0,0.2,1); width: 0%; }
.summary-msg { font-size: 14px; color: rgba(255,255,255,0.8); line-height: 1.65; margin-bottom: 14px; }
.summary-hint { font-size: 12px; color: var(--pink); line-height: 1.55; margin-bottom: 28px; padding: 10px 16px; background: rgba(233,30,140,0.1); border-radius: 10px; border: 1px solid rgba(233,30,140,0.2); }

/* ── Pre-runner overlay ── */
.prerunner-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: var(--runner-bg);
  z-index: 8; padding: 36px 28px; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.35s;
}
.prerunner-overlay.visible { opacity: 1; pointer-events: all; }
.prerunner-icon { font-size: 44px; margin-bottom: 18px; }
.prerunner-title { font-family: 'Cormorant Garamond', serif; font-size: 26px; color: white; margin-bottom: 14px; line-height: 1.3; font-style: italic; }
.prerunner-body { font-size: 14px; color: rgba(255,255,255,0.65); line-height: 1.7; margin-bottom: 24px; max-width: 290px; }
.tap-hint { display: flex; gap: 12px; margin-bottom: 24px; width: 100%; max-width: 280px; }
.tap-hint-item { flex: 1; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 12px 8px; text-align: center; }
.tap-hint-arrow { font-size: 20px; margin-bottom: 6px; }
.tap-hint-label { font-size: 11px; color: rgba(255,255,255,0.5); line-height: 1.4; }
.prerunner-countdown { font-size: 13px; color: rgba(255,255,255,0.35); letter-spacing: 0.06em; }

/* ── Plate builder ── */
.plate-section { margin-bottom: 16px; }
.plate-section-label { font-size: 12px; font-weight: 500; color: var(--navy); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; }
.plate-options { display: flex; gap: 7px; flex-wrap: wrap; }
.plate-chip {
  padding: 7px 12px; border-radius: 50px; border: 1.5px solid var(--border);
  background: white; font-size: 12px; color: var(--navy); cursor: pointer;
  transition: all 0.2s; -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.plate-chip:active { opacity: 0.8; }
.plate-chip.selected { border-color: var(--pink); background: #FFF5FB; color: var(--pink); font-weight: 500; }
#plate-items span { transition: opacity 0.3s ease, transform 0.2s ease; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }

/* ── Persona card ── */
.persona-card { width: 100%; border-radius: 24px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.persona-card-header { padding: 28px 24px 20px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.persona-card-body { background: white; padding: 20px 24px; }
.persona-card-footer { background: #F8F6F2; padding: 16px 24px 20px; }
.stat-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stat-bar-label { font-size: 11px; color: var(--muted); width: 72px; flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-bar-wrap { flex: 1; height: 6px; background: #F0EBE3; border-radius: 3px; overflow: hidden; }
.stat-bar-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 1s ease; width: 0%; }
.stat-bar-val { font-size: 12px; font-weight: 500; color: var(--navy); width: 28px; text-align: right; }

/* ── Product cards ── */
.product-card { background: white; border-radius: 16px; border: 1.5px solid var(--border); overflow: hidden; margin-bottom: 14px; }
.product-card-img { width: 100%; height: 130px; background: #F5F2EE; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--border); }
.product-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 12px; }
.img-placeholder { text-align: center; color: var(--muted); font-size: 13px; }
.product-card-body { padding: 14px 16px 16px; }
.product-label { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; padding: 3px 10px; border-radius: 20px; display: inline-block; margin-bottom: 8px; }
.product-label.primary { background: var(--pink); color: white; }
.product-label.secondary { background: var(--navy); color: white; }
.product-label.tertiary { background: #F0EBE3; color: var(--navy); }
.product-name { font-size: 17px; font-weight: 500; color: var(--navy); margin-bottom: 6px; }
.product-why { font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.product-stat { font-size: 11px; color: var(--pink); margin-bottom: 12px; }

/* ── Education strip ── */
.edu-strip { background: #F0FFF4; border-left: 3px solid var(--green); padding: 12px 16px; border-radius: 0 10px 10px 0; margin-bottom: 14px; }
.edu-strip-title { font-size: 13px; font-weight: 500; color: var(--navy); margin-bottom: 4px; }
.edu-strip-body { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ── Particles ── */
.particle-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.particle { position: absolute; border-radius: 50%; opacity: 0.1; animation: floatP linear infinite; }
@keyframes floatP { 0%{transform:translateY(20px) rotate(0deg);} 50%{transform:translateY(-40px) rotate(180deg);} 100%{transform:translateY(20px) rotate(360deg);} }

/* ── Landing icons ── */
.landing-icons { display: flex; gap: 0; background: white; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 32px; }
.landing-icon-item { flex: 1; padding: 14px 8px; text-align: center; border-right: 1px solid var(--border); }
.landing-icon-item:last-child { border-right: none; }
.landing-icon-emoji { font-size: 22px; display: block; margin-bottom: 5px; }
.landing-icon-label { font-size: 10px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; line-height: 1.4; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--navy); color: white; padding: 12px 20px; border-radius: 50px; font-size: 13px; font-weight: 500; transition: transform 0.35s ease; z-index: 100; white-space: nowrap; max-width: 320px; text-align: center; }
.toast.visible { transform: translateX(-50%) translateY(0); }

/* ── Share loading ── */
.share-loading { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Runner canvas ── */
#l4-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

/* ── Runner screens need full height ── */
#screen-runner1, #screen-runner2, #screen-runner3, #screen-level4 {
  min-height: 100vh;
}

/* ── Narrow screen adjustments ── */
@media (max-width: 360px) {
  .header { padding: 8px 10px; }
  .header-mid img { height: 20px; }
  .back-btn { font-size: 11px; }
  .pill { max-width: 80px; font-size: 9px; padding: 3px 6px; }
  .option-card { padding: 11px 12px; }
  .option-title { font-size: 13px; }
  .btn-primary { padding: 14px 20px; font-size: 14px; }
}
