/* ============================================================
   Lumio Dream — modernized, magical variant
   Layers on top of ../../colors_and_type.css + ../lumio/styles.css
   ============================================================ */

:root {
  --dream-indigo:    #1B1B3A;
  --dream-violet:    #2A1F4A;
  --dream-mauve:     #3D2755;
  --dream-aurora-1:  rgba(155, 89, 182, 0.40);   /* purple wisp */
  --dream-aurora-2:  rgba(52, 152, 219, 0.30);   /* blue wisp */
  --dream-aurora-3:  rgba(233, 30, 140, 0.18);   /* pink wisp */
  --dream-moonlight: #FCE9A6;                    /* warm pale gold */
  --dream-star:      #F5F0FF;
  --dream-glow:      0 0 24px rgba(249, 202, 36, 0.45);
  --dream-soft-shadow: 0 8px 24px rgba(13, 5, 30, 0.35);
  --dream-pillow:    0 12px 28px -8px rgba(13, 5, 30, 0.45), 0 2px 4px rgba(13, 5, 30, 0.25);
}

* { box-sizing: border-box; }
html, body, #root {
  margin: 0; padding: 0; height: 100%;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
body { background: #06091A; color: white; overflow: hidden; }

/* ============================================================
   Aurora sky background
   ============================================================ */
.dream-app {
  width: 100%; flex: 1; min-height: 0;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 18% 110%, var(--dream-aurora-1) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 82% -10%, var(--dream-aurora-2) 0%, transparent 55%),
    radial-gradient(ellipse 40% 30% at 50% 50%, var(--dream-aurora-3) 0%, transparent 70%),
    linear-gradient(180deg, #0A1024 0%, var(--dream-indigo) 50%, var(--dream-violet) 100%);
}
.dream-app--chat {
  background:
    radial-gradient(ellipse 70% 60% at 18% 110%, rgba(155, 89, 182, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 82% -10%, rgba(52, 152, 219, 0.15) 0%, transparent 55%),
    linear-gradient(180deg, #FAF7FF 0%, #F4F0FE 100%);
}

/* ============================================================
   Twinkling stars
   ============================================================ */
.dream-starfield {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.dream-star {
  position: absolute;
  width: 3px; height: 3px;
  background: var(--dream-star);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(245, 240, 255, 0.7);
  animation: dream-twinkle 3s ease-in-out infinite;
  opacity: 0.5;
}
.dream-star--big { width: 5px; height: 5px; box-shadow: 0 0 12px rgba(252, 233, 166, 0.9); background: var(--dream-moonlight); }
.dream-star--tiny { width: 2px; height: 2px; box-shadow: 0 0 4px rgba(245, 240, 255, 0.5); }

@keyframes dream-twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.2); }
}

/* sparkle 4-point cross shape */
.dream-sparkle {
  position: absolute;
  width: 14px; height: 14px;
  opacity: 0.85;
  animation: dream-sparkle-spin 6s linear infinite, dream-twinkle 2.4s ease-in-out infinite;
}
@keyframes dream-sparkle-spin { to { transform: rotate(360deg); } }

/* ============================================================
   Floating clouds (chat surface)
   ============================================================ */
.dream-cloud {
  position: absolute;
  background: white;
  border-radius: 50%;
  opacity: 0.6;
  filter: blur(1px);
  animation: dream-float 14s ease-in-out infinite;
}
@keyframes dream-float {
  0%, 100% { transform: translateY(0) translateX(0); }
  50%      { transform: translateY(-14px) translateX(8px); }
}

/* ============================================================
   Wordmark + tagline (dream style)
   ============================================================ */
.dream-wordmark {
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--lumio-gold);
  letter-spacing: 0.04em;
  line-height: 1;
  text-shadow: 0 0 32px rgba(249, 202, 36, 0.55), 0 0 80px rgba(249, 202, 36, 0.25);
}
.dream-tagline {
  font-family: var(--font-body);
  font-weight: 700;
  color: #C8BDF0;
  font-size: 15px;
  margin-top: 6px;
  letter-spacing: 0.02em;
  white-space: nowrap; /* overridden on mobile below */
}

/* ============================================================
   Buttons — bigger, glowing, with soft elevation
   ============================================================ */
.dream-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  white-space: nowrap;
  height: 72px; padding: 0 40px;
  border: 0; border-radius: 999px;
  background: linear-gradient(180deg, #FFD960 0%, #F9CA24 60%, #E8B112 100%);
  color: var(--lumio-navy);
  font-family: var(--font-display); font-weight: 800; font-size: 18px;
  cursor: pointer;
  box-shadow:
    var(--dream-glow),
    0 10px 24px -6px rgba(232, 177, 18, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 180ms cubic-bezier(.34,1.56,.64,1),
              box-shadow 180ms var(--ease-out);
}
.dream-cta:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 0 36px rgba(249, 202, 36, 0.7),
    0 14px 32px -6px rgba(232, 177, 18, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.dream-cta:active { transform: translateY(0) scale(0.98); }

.dream-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap;
  height: 52px; padding: 0 28px;
  border: 1.5px solid rgba(200, 189, 240, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: #C8BDF0;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  border-radius: 999px; cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 180ms var(--ease-out);
}
.dream-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(200, 189, 240, 0.6);
  color: white;
}

/* ============================================================
   Tiles — modernized subject + level cards
   ============================================================ */
.dream-tile {
  border: 0; cursor: pointer; color: white;
  font-family: var(--font-display); font-weight: 800;
  position: relative; overflow: hidden;
  transition: transform 220ms cubic-bezier(.34,1.56,.64,1),
              box-shadow 220ms var(--ease-out);
}
.dream-tile:hover { transform: translateY(-4px) scale(1.03); }
.dream-tile:active { transform: scale(0.97); }

.dream-tile--subject {
  width: 240px; height: 132px;
  border-radius: 28px;
  font-size: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: var(--dream-pillow);
}
.dream-tile--subject .subj-icon {
  font-size: 38px; margin-bottom: 4px; line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}
.dream-tile--subject .subj-sparkles {
  position: absolute; inset: 0; pointer-events: none;
}

.dream-tile--level {
  width: 180px; height: 96px;
  border-radius: 24px;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--dream-pillow);
}
.dream-tile--level .lvl-emoji { font-size: 26px; margin-right: 8px; }

/* glossy highlight on tiles */
.dream-tile::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 50%);
  pointer-events: none;
}

/* ============================================================
   Stack + headlines
   ============================================================ */
.dream-stack {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: 18px;
  width: min(880px, 90%);
  text-align: center;
  padding: 32px;
}
.dream-h1 { font-family: var(--font-display); font-weight: 800; font-size: 28px; color: white; }
.dream-h2 { font-family: var(--font-display); font-weight: 800; font-size: 24px; color: white; }
.dream-h3 { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--lumio-gold); }
.dream-body { font-family: var(--font-body); font-weight: 600; font-size: 15px; line-height: 1.6; color: #DDD3FB; width: 100%; }
.dream-body--muted { color: #9489B8; font-size: 13px; }
.dream-italic { font-size: 12px; font-style: italic; color: #9489B8; }
.dream-greet { font-family: var(--font-display); font-weight: 800; font-size: 26px; color: #FFD960; text-shadow: 0 0 20px rgba(255, 217, 96, 0.5); }

/* gold divider with sparkles */
.dream-divider {
  display: flex; align-items: center; gap: 12px;
  width: min(380px, 90vw);
  color: var(--lumio-gold);
}
.dream-divider hr {
  flex: 1; border: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--lumio-gold), transparent);
  border-radius: 2px;
}
.dream-divider span { font-size: 14px; }

/* ============================================================
   Name input — softer, with moon glow
   ============================================================ */
.dream-input {
  width: min(360px, 90vw); height: 72px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 2px solid rgba(200, 189, 240, 0.25);
  border-radius: 20px;
  text-align: center;
  font-family: var(--font-display); font-weight: 800; font-size: 30px;
  outline: none; padding: 0 16px;
  caret-color: var(--lumio-gold);
  backdrop-filter: blur(8px);
  transition: border-color 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}
.dream-input:focus {
  border-color: var(--lumio-gold);
  box-shadow: 0 0 0 4px rgba(249, 202, 36, 0.15), 0 0 32px rgba(249, 202, 36, 0.3);
}
.dream-input::placeholder { color: rgba(200, 189, 240, 0.5); }

/* ============================================================
   Conversation chrome (dream)
   ============================================================ */
.dream-chat-header {
  height: 84px;
  display: flex; align-items: center; padding: 0 24px; gap: 12px;
  color: white;
  position: relative; z-index: 2;
}
.dream-chat-header::after {
  content: ""; position: absolute; left: 24px; right: 24px; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
}
.dream-chat-back {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 0; cursor: pointer;
  color: white; font-size: 18px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 180ms var(--ease-out);
}
.dream-chat-back:hover { background: rgba(255, 255, 255, 0.28); }
.dream-chat-title { font-family: var(--font-display); font-weight: 800; font-size: 17px; flex: 1; display: flex; align-items: center; gap: 10px; }
.dream-chat-title .crest { font-size: 22px; }
.dream-chat-score {
  font-family: var(--font-display); font-weight: 800; font-size: 14px;
  background: rgba(255, 255, 255, 0.22);
  padding: 8px 16px; border-radius: 999px;
  backdrop-filter: blur(8px);
}

.dream-chat-body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 26px 32px 24px;
  display: flex; flex-direction: column; gap: 18px;
  position: relative; z-index: 1;
}
.dream-chat-body::-webkit-scrollbar { width: 8px; }
.dream-chat-body::-webkit-scrollbar-thumb { background: #D5C9F2; border-radius: 4px; }

/* avatar bubbles */
.dream-msg { display: flex; gap: 12px; align-items: flex-end; max-width: 76%; animation: dream-msg-in 280ms cubic-bezier(.34,1.56,.64,1) both; }
.dream-msg--lumio { align-self: flex-start; }
.dream-msg--child { align-self: flex-end; flex-direction: row-reverse; }
@keyframes dream-msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.dream-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(13, 5, 30, 0.15);
}
.dream-avatar--luna { background: radial-gradient(circle at 35% 35%, #FFE89A 0%, #F9CA24 70%, #D89F00 100%); }
.dream-avatar--child { font-size: 22px; }

.dream-bubble {
  padding: 14px 18px;
  border-radius: 22px;
  font-family: var(--font-body); font-size: 15px; font-weight: 500; line-height: 1.5;
  color: var(--fg-on-chat);
  box-shadow: 0 4px 14px rgba(13, 5, 30, 0.06);
  position: relative;
}
.dream-bubble--lumio { background: white; border-bottom-left-radius: 6px; }
.dream-bubble--child { background: linear-gradient(135deg, #FFD960 0%, #F9CA24 100%); color: var(--lumio-navy); border-bottom-right-radius: 6px; font-weight: 700; }
.dream-bubble--perm  { background: #F4ECFF; color: #5E3B8C; font-style: italic; font-weight: 600; border-bottom-left-radius: 6px; }

/* typing dots, dream style */
.dream-typing {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 14px 18px;
  background: white;
  border-radius: 22px; border-bottom-left-radius: 6px;
  box-shadow: 0 4px 14px rgba(13, 5, 30, 0.06);
}
.dream-typing .d {
  width: 8px; height: 8px; border-radius: 50%; background: #9489B8;
  animation: dream-bounce 1.2s ease-in-out infinite;
}
.dream-typing .d:nth-child(2) { animation-delay: 0.15s; }
.dream-typing .d:nth-child(3) { animation-delay: 0.30s; }
@keyframes dream-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* ============================================================
   Bottom panel
   ============================================================ */
.dream-panel {
  background: white;
  border-top-left-radius: 32px;
  border-top-right-radius: 32px;
  padding: 18px 28px 20px;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px 22px;
  align-items: center;
  box-shadow: 0 -8px 24px rgba(13, 5, 30, 0.10);
  position: relative; z-index: 3;
}
.dream-panel__mic-col {
  grid-row: 1 / span 2;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.dream-panel__top {
  display: flex; align-items: center; gap: 12px;
}
.dream-panel__bottom {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.dream-panel-status {
  font-family: var(--font-display); font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.dream-panel-controls { display: contents; }
.dream-panel-label {
  font-family: var(--font-display); font-size: 10px; font-weight: 800;
  color: #888; text-transform: uppercase; letter-spacing: 0.06em;
  margin-right: 2px;
}

.dream-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 26px;
  border: 0; border-radius: 999px;
  font-family: var(--font-display); font-weight: 800; font-size: 14px;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.dream-pill:hover { transform: translateY(-1px); }
.dream-pill--selected { box-shadow: 0 6px 16px -4px rgba(0,0,0,0.25); }

.dream-action-bar {
  display: flex; gap: 10px; margin-left: auto;
}
.dream-action {
  display: inline-flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 28px;
  border: 0; border-radius: 999px;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  color: white; cursor: pointer;
  box-shadow: 0 6px 16px -4px rgba(0,0,0,0.25);
  transition: transform 160ms var(--ease-out);
}
.dream-action:hover { transform: translateY(-2px); }
.dream-action--skip { background: linear-gradient(180deg, #6FC4F4, #3498DB); }
.dream-action--stop { background: linear-gradient(180deg, #FF7A6B, #E74C3C); }
.dream-action--resume { background: linear-gradient(180deg, #4CD683, #27AE60); }

/* ============================================================
   Moon mic — the showpiece
   ============================================================ */
.dream-mic-wrap {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 4px 0;
}
.dream-mic-hint {
  font-size: 12px; font-weight: 800; color: #8E44AD;
  font-family: var(--font-display);
  display: inline-flex; align-items: center; gap: 6px;
}

.dream-moon-mic {
  width: 108px; height: 108px;
  position: relative;
  cursor: pointer;
}
.dream-moon-mic svg { display: block; width: 100%; height: 100%; }
.dream-moon-mic--listening .moon-fill {
  animation: dream-moon-glow 1.6s ease-in-out infinite;
}
@keyframes dream-moon-glow {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(46, 204, 113, 0.5)); }
  50%      { filter: drop-shadow(0 0 28px rgba(46, 204, 113, 0.95)); }
}
.dream-moon-mic--thinking .moon-fill {
  animation: dream-moon-glow-amber 1.4s ease-in-out infinite;
}
@keyframes dream-moon-glow-amber {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(243, 156, 18, 0.4)); }
  50%      { filter: drop-shadow(0 0 26px rgba(243, 156, 18, 0.9)); }
}
.dream-moon-mic--speaking .moon-fill {
  animation: dream-moon-glow-red 1.2s ease-in-out infinite;
}
@keyframes dream-moon-glow-red {
  0%, 100% { filter: drop-shadow(0 0 12px rgba(231, 76, 60, 0.4)); }
  50%      { filter: drop-shadow(0 0 26px rgba(231, 76, 60, 0.9)); }
}
.dream-moon-orbits {
  position: absolute; inset: 0;
  pointer-events: none;
  border-radius: 50%;
  animation: dream-orbit-rotate 20s linear infinite;
}
@keyframes dream-orbit-rotate { to { transform: rotate(360deg); } }

/* ============================================================
   Sparkle decorations on subject tiles
   ============================================================ */
.subj-spark {
  position: absolute; color: white; opacity: 0.5;
  animation: dream-twinkle 2.6s ease-in-out infinite;
}

/* ============================================================
   RESPONSIVE — Mobile (≤ 520px)
   ============================================================ */
@media (max-width: 520px) {

  /* Stack — reduce padding so content fits */
  .dream-stack {
    padding: 18px;
    width: min(100%, 97%);
    gap: 12px;
  }

  /* Age picker — 3 tiles must fit in one row */
  .dream-tile--level {
    width: calc(30vw);
    min-width: 88px;
    max-width: 145px;
    height: 76px;
    font-size: 13px;
    border-radius: 18px;
  }
  .dream-tile--level .lvl-emoji {
    font-size: 20px;
    margin-right: 5px;
  }
  /* Override the inline gap on the age-tiles flex container */
  .dream-levels {
    gap: 10px !important;
    justify-content: center;
  }

  /* Subject tiles — width: 100% so the grid column controls them */
  .dream-tile--subject {
    width: 100%;
    min-width: 0;
    height: 92px;
    font-size: 17px;
    border-radius: 20px;
  }
  .dream-tile--subject .subj-icon {
    font-size: 28px;
    margin-bottom: 2px;
  }
  /* Tighter gap on the subjects grid */
  .dream-subjects-grid {
    gap: 12px !important;
  }

  /* Headings */
  .dream-h1    { font-size: 22px; }
  .dream-h2    { font-size: 20px; }
  .dream-greet { font-size: 20px; }
  .dream-tagline { white-space: normal; text-align: center; }

  /* Name input */
  .dream-input {
    width: min(320px, 84vw);
    font-size: 26px;
    height: 64px;
  }

  /* Hide decorative mascots on small screens to save space */
  .dream-mascot-deco { display: none; }

  /* Chat body — tighter padding */
  .dream-chat-body {
    padding: 14px 14px 10px;
    gap: 12px;
  }
  /* Messages can use more of the width */
  .dream-msg { max-width: 90%; }

  /* Bottom panel — smaller mic column, tighter padding */
  .dream-panel {
    padding: 12px 14px 14px;
    grid-template-columns: 96px 1fr;
    gap: 8px 10px;
  }

  /* Action buttons — slightly smaller on mobile */
  .dream-action {
    height: 44px;
    padding: 0 16px;
    font-size: 13px;
  }
  .dream-pill {
    height: 42px;
    padding: 0 16px;
    font-size: 13px;
  }

  /* Panel top row — allow wrapping if needed */
  .dream-panel__top {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* "Arrêter / Reprendre" caché sur mobile — le bouton ← du header fait la même chose */
  .dream-btn-stop {
    display: none;
  }
}

/* ============================================================
   RESPONSIVE — Très petits écrans (≤ 380px)
   iPhone SE 1ère gen (320px), Galaxy A-series (360px)
   ============================================================ */
@media (max-width: 380px) {
  .dream-stack {
    padding: 14px;
    gap: 10px;
  }
  .dream-h1     { font-size: 20px; }
  .dream-h2     { font-size: 18px; }
  .dream-greet  { font-size: 18px; }
  .dream-body   { font-size: 14px; }

  /* Wordmark */
  .dream-wordmark { font-size: clamp(48px, 18vw, 80px); }

  /* Input prénom */
  .dream-input {
    width: min(290px, 88vw);
    font-size: clamp(20px, 7vw, 28px);
    height: 58px;
  }

  /* Divider */
  .dream-divider { width: 88vw; }

  /* CTA principal */
  .dream-cta {
    height: 60px;
    padding: 0 24px;
    font-size: 16px;
  }

  /* Ghost button */
  .dream-ghost {
    height: 44px;
    padding: 0 20px;
    font-size: 12px;
  }

  /* Age tiles — encore plus compactes */
  .dream-tile--level {
    width: calc(29vw);
    min-width: 82px;
    height: 68px;
    font-size: 12px;
  }
  .dream-tile--level .lvl-emoji { font-size: 17px; margin-right: 4px; }

  /* Subject tiles */
  .dream-tile--subject {
    height: 80px;
    font-size: 15px;
  }
  .dream-tile--subject .subj-icon { font-size: 24px; }

  /* Chat panel encore plus compact */
  .dream-panel {
    padding: 10px 12px 12px;
    grid-template-columns: 88px 1fr;
    gap: 6px 8px;
  }
}
