/* =====================================================================
   TODDLER TYPE GAME — styles.css
   Author: Toddler Type Game
   ===================================================================== */

/* ── Custom Properties ── */
:root {
  --c-bg: #0d0120;
  --c-bg2: #1a0533;
  --c-purple: #8b2fc9;
  --c-violet: #6c17a4;
  --c-pink: #ff5ca8;
  --c-yellow: #ffe246;
  --c-cyan: #00e5ff;
  --c-green: #39ff14;
  --c-orange: #ff7b00;
  --c-red: #ff2d55;
  --c-white: #ffffff;
  --c-text-muted: rgba(255,255,255,0.65);

  --font-primary: 'Fredoka One', 'Nunito', 'Arial Rounded MT Bold', sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;

  --radius-lg: 24px;
  --radius-xl: 40px;
  --shadow-glow: 0 0 40px rgba(139, 47, 201, 0.7);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition-fast: 0.15s ease;
  --transition-med: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--c-bg);
  font-family: var(--font-body);
  color: var(--c-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* =====================================================================
   SPLASH SCREEN
   ===================================================================== */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.splash__bg {
  position: absolute;
  inset: 0;
  /* Static background — no color cycling to avoid photosensitivity triggers */
  background: radial-gradient(ellipse at 30% 35%, #3d0b6b 0%, #1a0533 45%, #0d0120 100%);
}

.splash__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  text-align: center;
  padding: 2rem;
}

/* Orbiting emoji ring */
.splash__emoji-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 320px;
  height: 320px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ring-emoji {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 2rem;
  transform-origin: 0 0;
  /* Slowed to 30s — well below photosensitivity threshold */
  animation: orbit 30s linear infinite;
  animation-delay: calc(var(--i) * -3.75s);
}

@keyframes orbit {
  0%   { transform: rotate(calc(var(--i) * 45deg)) translateX(145px) rotate(calc(var(--i) * -45deg)) scale(1); }
  100% { transform: rotate(calc(var(--i) * 45deg + 360deg)) translateX(145px) rotate(calc(var(--i) * -45deg - 360deg)) scale(1); }
}

.splash__title {
  font-family: var(--font-primary);
  font-size: clamp(3.5rem, 10vw, 7rem);
  line-height: 0.95;
  color: transparent;
  background: linear-gradient(135deg, #ff5ca8 0%, #ffe246 40%, #00e5ff 80%, #c47aff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(255, 92, 168, 0.6));
  /* Slower float — 6s instead of 3s */
  animation: titleFloat 6s ease-in-out infinite;
  position: relative;
  z-index: 3;
}

@keyframes titleFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%       { transform: translateY(-10px) rotate(1deg); }
}

.splash__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--c-text-muted);
  font-weight: 700;
  position: relative;
  z-index: 3;
  max-width: 360px;
}

.splash__btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.1rem 2.8rem;
  font-family: var(--font-primary);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  background: linear-gradient(135deg, var(--c-pink) 0%, var(--c-purple) 100%);
  color: var(--c-white);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(255, 92, 168, 0.35), var(--shadow-glow);
  position: relative;
  z-index: 3;
  transition: transform var(--transition-med), box-shadow var(--transition-med);
  animation: btnPulse 2s ease-in-out infinite;
}

.splash__btn:hover,
.splash__btn:focus-visible {
  transform: scale(1.08);
  box-shadow: 0 0 0 6px rgba(255, 92, 168, 0.5), 0 0 60px rgba(139, 47, 201, 0.9);
  outline: none;
}

.splash__btn:active {
  transform: scale(0.97);
}

@keyframes btnPulse {
  /* Slowed to 4s and reduced contrast between states */
  0%, 100% { box-shadow: 0 0 0 4px rgba(255, 92, 168, 0.3), 0 0 35px rgba(139, 47, 201, 0.6); }
  50%       { box-shadow: 0 0 0 6px rgba(255, 92, 168, 0.2), 0 0 50px rgba(139, 47, 201, 0.4); }
}

.btn-icon {
  font-size: 1.1em;
}

.splash__hint {
  font-size: 0.9rem;
  color: var(--c-text-muted);
  opacity: 0.75;
  position: relative;
  z-index: 3;
}

/* Info toggle in splash (For Parents) */
.info-toggle {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--c-text-muted);
  padding: 0.5rem 1.4rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}

.info-toggle:hover,
.info-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  color: var(--c-white);
  outline: none;
}

/* Splash exit animation */
.splash--exiting {
  animation: splashExit 0.5s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

@keyframes splashExit {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); pointer-events: none; }
}

/* =====================================================================
   GAME AREA
   ===================================================================== */
.game-area {
  position: fixed;
  inset: 0;
  overflow: hidden;
  /* Static background — no dynamic color changes */
  background: #0d0120;
  display: none;
}

.game-area.active {
  display: block;
}

/* ── HUD ── */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hud__counter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.hud__label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--c-text-muted);
  font-weight: 800;
}

.hud__value {
  font-family: var(--font-primary);
  font-size: 1.8rem;
  line-height: 1;
  color: var(--c-yellow);
  text-shadow: 0 0 20px rgba(255, 226, 70, 0.7);
  transition: transform 0.1s;
}

.hud__value.bump {
  animation: scoreBump 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scoreBump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.hud__combo {
  font-family: var(--font-primary);
  font-size: 1.1rem;
  color: var(--c-cyan);
  text-shadow: 0 0 15px rgba(0, 229, 255, 0.7);
  min-width: 80px;
  text-align: center;
  transition: opacity 0.3s;
}

.hud__exit {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: var(--c-text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud__exit:hover,
.hud__exit:focus-visible {
  background: rgba(255, 45, 85, 0.4);
  color: var(--c-white);
  outline: none;
}

/* ── Key Display (center floating label) ── */
.key-display {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key-display__char {
  position: absolute;
  font-family: var(--font-primary);
  font-size: clamp(4rem, 15vw, 10rem);
  font-weight: 900;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 0 40px currentColor;
  /* Slowed to 1.4s for gentle appearance */
  animation: keyCharAnim 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  will-change: transform, opacity;
  transform-origin: center;
  line-height: 1;
}

@keyframes keyCharAnim {
  0%   { transform: scale(0.4); opacity: 0.9; }
  35%  { transform: scale(1.05); opacity: 0.9; }
  100% { transform: scale(1.2); opacity: 0; }
}

/* =====================================================================
   VISUAL EFFECTS
   ===================================================================== */

/* ── Emoji burst ── */
.effect-emoji {
  position: absolute;
  pointer-events: none;
  font-size: var(--size, 3rem);
  line-height: 1;
  z-index: 20;
  will-change: transform, opacity;
  animation: emojiBurst var(--duration, 1.2s) ease-out forwards;
}

@keyframes emojiBurst {
  0%   { transform: translate(-50%, -50%) scale(0);    opacity: 0.9; }
  30%  { transform: translate(-50%, -50%) scale(1.1); opacity: 0.9; }
  70%  { transform: translate(-50%, calc(-50% - 50px)) scale(1); opacity: 0.7; }
  100% { transform: translate(-50%, calc(-50% - 110px)) scale(0.7); opacity: 0; }
}

/* ── Shape burst ── */
.effect-shape {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  will-change: transform, opacity;
  border-radius: var(--br, 50%);
  width: var(--size, 60px);
  height: var(--size, 60px);
  background: var(--color, hotpink);
  animation: shapeBurst var(--duration, 0.9s) ease-out forwards;
}

@keyframes shapeBurst {
  0%   { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 0.85; }
  40%  { transform: translate(-50%, -50%) scale(1.1) rotate(15deg); opacity: 0.85; }
  100% { transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, -80px))) scale(0.5) rotate(40deg); opacity: 0; }
}

/* ── Ripple ── */
.effect-ripple {
  position: absolute;
  pointer-events: none;
  z-index: 15;
  border-radius: 50%;
  border: 4px solid var(--color, var(--c-cyan));
  width: 10px;
  height: 10px;
  will-change: transform, opacity;
  animation: rippleAnim var(--duration, 1s) ease-out forwards;
}

@keyframes rippleAnim {
  0%   { transform: translate(-50%, -50%) scale(0);   opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(var(--scale, 20)); opacity: 0; }
}

/* ── Particle ── */
.effect-particle {
  position: absolute;
  pointer-events: none;
  z-index: 25;
  border-radius: 50%;
  width: var(--size, 10px);
  height: var(--size, 10px);
  background: var(--color, hotpink);
  will-change: transform, opacity;
  animation: particleAnim var(--duration, 0.8s) ease-out forwards;
}

@keyframes particleAnim {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 0.75; }
  100% {
    transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, -80px))) scale(0);
    opacity: 0;
  }
}

/* ── SVG Star ── */
.effect-star {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  will-change: transform, opacity;
  animation: starAnim var(--duration, 1.1s) ease-out forwards;
}

@keyframes starAnim {
  0%   { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 0.85; }
  40%  { transform: translate(-50%, -50%) scale(1.1) rotate(20deg); opacity: 0.85; }
  100% { transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, -90px))) scale(0.3) rotate(80deg); opacity: 0; }
}

/* bg-flash class removed — full-screen color flashing can trigger
   photosensitive epilepsy. Effect is simply omitted. */

/* ── Combo/Score popup ── */
.score-popup {
  position: absolute;
  pointer-events: none;
  z-index: 30;
  font-family: var(--font-primary);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 900;
  color: var(--c-yellow);
  text-shadow: 0 0 30px rgba(255, 226, 70, 0.9), 0 3px 0 rgba(0,0,0,0.4);
  will-change: transform, opacity;
  animation: scorePopup 1.1s ease-out forwards;
}

@keyframes scorePopup {
  0%   { transform: translate(-50%, -50%) scale(0.7); opacity: 0.9; }
  30%  { transform: translate(-50%, -50%) scale(1.05); opacity: 0.9; }
  100% { transform: translate(-50%, calc(-50% - 60px)) scale(0.9); opacity: 0; }
}

/* =====================================================================
   PARENT INFO SECTION
   ===================================================================== */
.parent-info {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow-y: auto;
  background: rgba(10, 2, 25, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 2rem 1rem 4rem;
  animation: infoSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.parent-info[hidden] {
  display: none;
}

@keyframes infoSlideIn {
  0%   { opacity: 0; transform: translateY(30px); }
  100% { opacity: 1; transform: translateY(0); }
}

.parent-info__inner {
  max-width: 900px;
  margin: 0 auto;
}

.parent-info__close {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.4rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: var(--c-text-muted);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 2rem;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.parent-info__close:hover,
.parent-info__close:focus-visible {
  background: rgba(255, 45, 85, 0.3);
  color: var(--c-white);
  outline: none;
}

.parent-info__header {
  margin-bottom: 2.5rem;
}

.parent-info__title {
  font-family: var(--font-primary);
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--c-white);
  margin-bottom: 0.75rem;
  background: linear-gradient(90deg, var(--c-pink), var(--c-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.parent-info__lead {
  font-size: 1.1rem;
  color: var(--c-text-muted);
  line-height: 1.65;
  max-width: 640px;
}

.parent-info__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

/* ── PI Card ── */
.pi-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: transform var(--transition-med), border-color var(--transition-fast);
}

.pi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 47, 201, 0.5);
}

.pi-card__icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
  line-height: 1;
}

.pi-card__title {
  font-family: var(--font-primary);
  font-size: 1.15rem;
  color: var(--c-white);
  margin-bottom: 0.6rem;
}

.pi-card__text {
  font-size: 0.9rem;
  color: var(--c-text-muted);
  line-height: 1.7;
}

.parent-info__footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.5rem;
  color: var(--c-text-muted);
  font-size: 0.88rem;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.parent-info__footer strong {
  color: var(--c-white);
}

/* =====================================================================
   SEO ARTICLE — Long-form content inside parent info panel
   ===================================================================== */
.seo-article {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.seo-article__heading {
  font-family: var(--font-primary);
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  color: var(--c-white);
  margin-bottom: 1.5rem;
  background: linear-gradient(90deg, var(--c-yellow), var(--c-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.seo-article__section {
  margin-bottom: 1.75rem;
}

.seo-article__section:last-child {
  margin-bottom: 0;
}

.seo-article__section h3 {
  font-family: var(--font-primary);
  font-size: 1.1rem;
  color: var(--c-pink);
  margin-bottom: 0.6rem;
}

.seo-article__section p {
  font-size: 0.9rem;
  color: var(--c-text-muted);
  line-height: 1.75;
  margin-bottom: 0.75rem;
}

.seo-article__section p:last-child {
  margin-bottom: 0;
}

.seo-article__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0;
  margin-top: 0.75rem;
}

.seo-article__list li {
  font-size: 0.9rem;
  color: var(--c-text-muted);
  line-height: 1.6;
  padding-left: 1.4rem;
  position: relative;
}

.seo-article__list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--c-green);
  font-size: 0.8rem;
  top: 0.1em;
}

/* =====================================================================
   FAQ SECTION — native <details>/<summary> accordion
   ===================================================================== */
.faq-section {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.faq-section__heading {
  font-family: var(--font-primary);
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  color: var(--c-white);
  margin-bottom: 1.25rem;
  background: linear-gradient(90deg, var(--c-pink), var(--c-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.faq-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color var(--transition-fast), background var(--transition-fast);
  overflow: hidden;
}

.faq-item[open] {
  border-color: rgba(139, 47, 201, 0.45);
  background: rgba(139, 47, 201, 0.07);
}

.faq-item__question {
  font-family: var(--font-primary);
  font-size: 1.05rem;
  color: var(--c-white);
  padding: 1.1rem 1.4rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  user-select: none;
  -webkit-user-select: none;
  transition: color var(--transition-fast);
}

.faq-item__question::-webkit-details-marker {
  display: none;
}

.faq-item__question::after {
  content: '+';
  font-size: 1.4rem;
  color: var(--c-purple);
  line-height: 1;
  flex-shrink: 0;
  transition: transform var(--transition-med), color var(--transition-fast);
}

.faq-item[open] .faq-item__question::after {
  transform: rotate(45deg);
  color: var(--c-pink);
}

.faq-item__question:hover {
  color: var(--c-pink);
}

.faq-item__answer {
  font-size: 0.9rem;
  color: var(--c-text-muted);
  line-height: 1.75;
  padding: 0 1.4rem 1.25rem;
}

/* =====================================================================
   SPLASH H1 SIZE — adjusted for longer keyword-rich H1
   ===================================================================== */
.splash__title {
  font-size: clamp(2.2rem, 7vw, 5rem);
}

/* =====================================================================
   ACCESSIBILITY & FOCUS
   ===================================================================== */
:focus-visible {
  outline: 3px solid var(--c-cyan);
  outline-offset: 3px;
}

/* =====================================================================
   RESPONSIVE ADJUSTMENTS
   ===================================================================== */
@media (max-width: 480px) {
  .splash__emoji-ring {
    width: 220px;
    height: 220px;
  }

  .ring-emoji {
    font-size: 1.5rem;
  }

  @keyframes orbit {
    0%   { transform: rotate(calc(var(--i) * 45deg)) translateX(100px) rotate(calc(var(--i) * -45deg)) scale(1); }
    100% { transform: rotate(calc(var(--i) * 45deg + 360deg)) translateX(100px) rotate(calc(var(--i) * -45deg - 360deg)) scale(1); }
  }

  .hud__value {
    font-size: 1.4rem;
  }

  .parent-info__grid {
    grid-template-columns: 1fr;
  }

  .seo-article,
  .faq-section {
    padding: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

