/* ===== Brand Variables & Reset ===== */
:root {
  --offwhite: #f5f2ea;
  --beige: #d8d4ae;
  --green: #c5d07d;
  --pink: #ffacb8;
  --lavender: #d899d0;
  --darkgray: #393737;
  --brown: #583d32;

  --font-heading: 'Lora', 'Georgia Pro', Georgia, 'Times New Roman', serif;
  --font-accent: 'Alex Brush', 'Brush Script MT', 'Segoe Script', cursive;
  --font-body: 'TT Chocolates', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;

  --radius: 20px;
  --radius-sm: 12px;
  --shadow-bubble: 0 5px 20px rgba(88, 61, 50, 0.18);
  --transition: 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  color: var(--darkgray);
  background: var(--offwhite);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  color: var(--brown);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition);
}
a:hover { color: var(--lavender); }
img { max-width: 100%; height: auto; display: block; }

/* =============================================
   START OVERLAY
   ============================================= */
.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #e8d5b7 0%, #f5c6c6 40%, #d9c4e8 100%);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.8s ease;
}
.start-overlay.hidden { opacity: 0; pointer-events: none; }

.start-content {
  text-align: center;
  animation: startPulse 2s ease-in-out infinite;
}
.start-sparkle {
  font-size: 3.5rem;
  margin-bottom: 6px;
}
.start-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--brown);
  font-weight: 700;
}
.start-sub {
  font-family: var(--font-accent);
  font-size: 1.4rem;
  color: var(--brown);
  margin-top: 2px;
  opacity: 0.85;
}

@keyframes startPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes startFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.start-content { animation: startFloat 2.5s ease-in-out infinite; }

/* =============================================
   TOP BANNER — compact
   ============================================= */
.top-banner {
  background: linear-gradient(160deg, #e8d5b7 0%, #f5c6c6 40%, #d9c4e8 100%);
  padding: 18px 16px 16px;
  text-align: center;
  position: relative;
  z-index: 10;
  box-shadow: 0 3px 14px rgba(57, 55, 55, 0.06);
  overflow: hidden;
  width: 100%;
}

.top-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(255,172,184,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(216,153,208,0.12) 0%, transparent 60%);
  pointer-events: none;
}

.banner-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--brown);
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(88, 61, 50, 0.2);
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.header-title-group { text-align: center; }

.site-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--brown);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.site-subtitle {
  font-family: var(--font-accent);
  font-size: 1.5rem;
  color: var(--brown);
  font-weight: 400;
  margin-top: -6px;
  opacity: 0.85;
}

@media (min-width: 480px) {
  .top-banner { padding: 22px 20px 20px; }
  .logo-link { width: 80px; height: 80px; }
  .site-title { font-size: 2.4rem; }
  .site-subtitle { font-size: 1.7rem; }
}

@media (min-width: 768px) {
  .top-banner { padding: 26px 24px 22px; }
  .logo-link { width: 90px; height: 90px; }
  .site-title { font-size: 2.8rem; }
  .site-subtitle { font-size: 1.9rem; }
  .banner-inner { gap: 18px; }
}

/* =============================================
   PROGRESS SECTION — compact
   ============================================= */
.progress-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 16px 4px;
  text-align: center;
}

.progress-label {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--brown);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(216, 212, 174, 0.5);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(57,55,55,0.06);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--pink));
  border-radius: 10px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.celebration {
  margin-top: 6px;
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--brown);
  opacity: 0;
  transition: opacity var(--transition);
  min-height: 1.5rem;
  font-weight: 500;
  font-style: italic;
}
.celebration.show { opacity: 1; }

#resetProgress {
  margin-top: 6px;
  background: none;
  border: 1.5px solid var(--beige);
  border-radius: 20px;
  padding: 3px 14px 4px;
  font-size: 0.78rem;
  color: var(--brown);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s;
}
#resetProgress:hover { background: var(--beige); border-color: var(--beige); }
#resetProgress:focus-visible { outline: 3px solid var(--lavender); outline-offset: 2px; }

/* =============================================
   PLAYFIELD — wide, no clipping
   ============================================= */
.playfield {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 50px;
  box-sizing: border-box;
}

@media (min-height: 800px) {
  .playfield { padding-bottom: 60px; }
}

/* =============================================
   BUBBLE
   ============================================= */
.bubble {
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  font-family: inherit;
  padding: 0;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  will-change: transform;
}

.bubble-tool {
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.85) 0%, var(--beige) 50%, var(--pink) 100%);
  box-shadow:
    inset 0 -4px 10px rgba(88,61,50,0.08),
    inset 0 4px 10px rgba(255,255,255,0.55),
    var(--shadow-bubble);
}

.bubble-social {
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.85) 0%, var(--beige) 50%, var(--lavender) 100%);
  box-shadow:
    inset 0 -4px 10px rgba(88,61,50,0.08),
    inset 0 4px 10px rgba(255,255,255,0.55),
    var(--shadow-bubble);
}

.bubble-fact {
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.92) 0%, #fce8a0 35%, #f5d76e 100%);
  box-shadow:
    inset 0 -4px 10px rgba(88,61,50,0.08),
    inset 0 4px 10px rgba(255,255,255,0.55),
    0 0 20px rgba(245, 215, 110, 0.4),
    var(--shadow-bubble);
}
.bubble-fact:hover {
  box-shadow:
    inset 0 -4px 10px rgba(88,61,50,0.08),
    inset 0 4px 10px rgba(255,255,255,0.55),
    0 0 30px rgba(245, 215, 110, 0.7),
    var(--shadow-bubble) !important;
}

.bubble:focus-visible { outline: 3px solid var(--lavender); outline-offset: 5px; }

.bubble:hover { transform: scale(1.1) !important; z-index: 5; }

.bubble-tool:hover {
  box-shadow:
    inset 0 -4px 10px rgba(88,61,50,0.08),
    inset 0 4px 10px rgba(255,255,255,0.55),
    0 0 28px rgba(255, 172, 184, 0.45),
    var(--shadow-bubble);
}

.bubble-social:hover {
  box-shadow:
    inset 0 -4px 10px rgba(88,61,50,0.08),
    inset 0 4px 10px rgba(255,255,255,0.55),
    0 0 28px rgba(216, 153, 208, 0.45),
    var(--shadow-bubble);
}

.bubble:active { transform: scale(0.93) !important; }

.bubble-icon-wrap {
  width: 78px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.bubble-icon {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  display: block;
}

.bubble-emoji {
  font-size: 40px;
  line-height: 1;
  pointer-events: none;
}

.bubble-tooltip {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  font-size: 0.72rem;
  color: var(--darkgray);
  opacity: 0;
  transition: opacity 0.25s ease;
  white-space: nowrap;
  background: var(--offwhite);
  padding: 3px 12px;
  border-radius: 20px;
  border: 1px solid var(--beige);
  pointer-events: none;
  font-family: var(--font-body);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.bubble:hover .bubble-tooltip,
.bubble:focus-visible .bubble-tooltip { opacity: 1; }

.bubble.explored { cursor: default; pointer-events: none; }

@media (max-width: 560px) {
  .bubble { width: 100px; height: 100px; }
  .bubble-icon-wrap { width: 56px; height: 56px; }
  .bubble-emoji { font-size: 30px; }
  .playfield { padding-bottom: 40px; }
}

@media (min-width: 768px) {
  .bubble { width: 145px; height: 145px; }
  .bubble-icon-wrap { width: 82px; height: 82px; }
  .bubble-emoji { font-size: 42px; }
}

/* ===== Floating Animations ===== */
@keyframes floatA {
  0%, 100% { transform: translate(0px, 0px); }
  25% { transform: translate(18px, -20px); }
  50% { transform: translate(-16px, 14px); }
  75% { transform: translate(10px, -8px); }
}
@keyframes floatB {
  0%, 100% { transform: translate(0px, 0px); }
  25% { transform: translate(-20px, 14px); }
  50% { transform: translate(18px, -18px); }
  75% { transform: translate(-6px, 10px); }
}
@keyframes floatC {
  0%, 100% { transform: translate(0px, 0px); }
  25% { transform: translate(14px, 18px); }
  50% { transform: translate(-18px, -8px); }
  75% { transform: translate(8px, 16px); }
}
@keyframes floatD {
  0%, 100% { transform: translate(0px, 0px); }
  25% { transform: translate(-16px, -18px); }
  50% { transform: translate(20px, 10px); }
  75% { transform: translate(-10px, -4px); }
}

.float-a { animation: floatA 15s ease-in-out infinite; }
.float-b { animation: floatB 12s ease-in-out infinite; }
.float-c { animation: floatC 17s ease-in-out infinite; }
.float-d { animation: floatD 13s ease-in-out infinite; }

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  .float-a, .float-b, .float-c, .float-d { animation: none !important; }
  .bubble:hover { transform: scale(1.05) !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Confetti ===== */
.confetti-container {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 900;
}
.confetti-piece { position: absolute; pointer-events: none; }

/* =============================================
   RESOURCE CARD MODAL
   ============================================= */
.card-overlay {
  position: fixed;
  inset: 0;
  background: rgba(57, 55, 55, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.card-overlay.open { display: flex; opacity: 1; }
.card-overlay.closing { opacity: 0; }

.resource-card {
  background: var(--offwhite);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 82vh;
  overflow-y: auto;
  padding: 14px 22px 24px;
  position: relative;
  transform: translateY(100%);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -8px 48px rgba(57, 55, 55, 0.2);
}
.card-overlay.open .resource-card { transform: translateY(0); }
.card-overlay.closing .resource-card { transform: translateY(100%); }

.card-handle {
  width: 40px; height: 4px;
  border-radius: 4px; background: var(--beige);
  margin: 0 auto 10px;
}

.card-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--beige);
  color: var(--brown);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition), opacity 0.5s ease;
  font-family: var(--font-body);
  padding: 0;
  margin: 0;
  line-height: 1;
}

.card-close:focus-visible { outline: 3px solid var(--lavender); outline-offset: 2px; }

.card-overlay.card-locked .card-close { opacity: 0; pointer-events: none; }

.card-content { padding-top: 0; }

.card-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 8px;
  line-height: 1.3;
}

.card-action {
  font-size: 1rem;
  color: var(--darkgray);
  margin-bottom: 18px;
  line-height: 1.6;
  padding: 12px 16px;
  background: rgba(255, 172, 184, 0.1);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--pink);
  font-weight: 500;
}

.card-section-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--brown);
  margin: 16px 0 8px;
}

.card-links {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  background: rgba(216, 212, 174, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--brown);
  text-decoration: none;
  transition: background var(--transition);
  font-family: var(--font-body);
  font-weight: 600;
}
.card-link:hover { background: var(--beige); text-decoration: underline; }
.card-link:focus-visible { outline: 3px solid var(--lavender); outline-offset: 2px; }

.card-fact {
  background: rgba(216, 153, 208, 0.08);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 14px;
  border-left: 4px solid var(--lavender);
  font-size: 0.95rem;
  color: var(--darkgray);
  line-height: 1.6;
  font-style: italic;
}

.card-script {
  background: rgba(197, 208, 125, 0.1);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 12px;
  border-left: 4px solid var(--green);
  font-size: 0.95rem;
  color: var(--brown);
  line-height: 1.6;
  font-style: italic;
}

.card-script-label {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  font-style: normal;
  color: var(--darkgray);
}

.social-follow {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.social-follow .card-link {
  background: rgba(216, 153, 208, 0.1);
  text-align: center;
  justify-content: center;
  font-weight: 700;
  padding: 14px;
  font-size: 1.05rem;
}
.social-follow .card-link:hover { background: var(--lavender); color: white; text-decoration: none; }

/* ===== Fun Fact Card ===== */
.card-fact-special {
  background: linear-gradient(135deg, #fef9e7 0%, #fdf2d7 100%);
  border-radius: var(--radius-sm);
  padding: 20px 18px;
  border: 2px solid #f5d76e;
  font-size: 1.05rem;
  color: var(--darkgray);
  line-height: 1.7;
  margin-top: 4px;
  text-align: center;
  box-shadow: 0 2px 16px rgba(245, 215, 110, 0.2);
}
.card-fact-special::before {
  content: '\2728';
  display: block;
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.card-fact-source {
  font-size: 0.78rem;
  color: #999;
  margin-top: 12px;
  font-style: italic;
}

/* =============================================
   END OVERLAY
   ============================================= */
.end-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(57, 55, 55, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.end-overlay.open { display: flex; }

.end-content {
  background: var(--offwhite);
  border-radius: var(--radius);
  padding: 36px 32px 32px;
  max-width: 400px;
  width: 90vw;
  text-align: center;
  box-shadow: 0 12px 60px rgba(57,55,55,0.25);
  animation: endSlideUp 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes endSlideUp {
  0% { transform: translateY(40px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.end-emoji { font-size: 3.2rem; margin-bottom: 6px; }
.end-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--brown);
  margin-bottom: 4px;
}
.end-sub {
  font-size: 1rem;
  color: var(--darkgray);
  margin-bottom: 20px;
}
.end-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.end-btn {
  padding: 14px 20px;
  border-radius: 30px;
  border: none;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.end-btn:hover { transform: scale(1.03); }
.end-btn:active { transform: scale(0.96); }
.end-btn:focus-visible { outline: 3px solid var(--lavender); outline-offset: 3px; }
.end-btn-play {
  background: linear-gradient(135deg, var(--green), var(--pink));
  color: var(--darkgray);
  box-shadow: 0 4px 14px rgba(197, 208, 125, 0.3);
}
.end-btn-share {
  background: var(--brown);
  color: #fff;
  box-shadow: 0 4px 14px rgba(88, 61, 50, 0.2);
}

/* =============================================
   FOOTER — compact
   ============================================= */
.site-footer {
  background: linear-gradient(135deg, var(--brown) 0%, #7a5547 100%);
  text-align: center;
  padding: 18px 16px 20px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  box-shadow: 0 -3px 12px rgba(57, 55, 55, 0.06);
}

.footer-inner { max-width: 900px; margin: 0 auto; }

.footer-tagline {
  font-family: var(--font-accent);
  font-size: 1.3rem;
  color: var(--beige);
  margin-bottom: 4px;
  font-weight: 400;
}

.footer-crisis {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.9);
  line-height: 1.5;
}
.footer-crisis strong { color: #fff; font-weight: 700; }

.footer-copy {
  margin-top: 6px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
}

/* ===== Scrollbar ===== */
.resource-card::-webkit-scrollbar { width: 6px; }
.resource-card::-webkit-scrollbar-track { background: transparent; }
.resource-card::-webkit-scrollbar-thumb { background: var(--beige); border-radius: 6px; }
