:root{
    --sky-top: #BFE8F5;
    --sky-bottom: #DFF3D6;
    --ink: #3A3358;
    --ink-soft: #6B6486;
    --card: #FFFDF8;
    --water-top: #7FD4E6;
    --water-bottom: #1C6E8C;
    --sun: #FFC93C;
    --coral: #FF8966;
    --line: rgba(58,51,88,0.12);
    --shadow: 0 10px 24px rgba(58,51,88,0.14);
    --acc-soft: #E7F6F2;
  }
  *{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html,body{ margin:0; padding:0; }
  body{
    min-height:100vh; font-family:'Quicksand', sans-serif; color: var(--ink);
    background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-top) 55%, var(--sky-bottom) 100%);
    overflow-x:hidden;
  }
  h1,h2,h3,.display{ font-family:'Baloo 2', sans-serif; margin:0; }
  html, body{ height:100%; }
  #app{ width:100%; min-height:100vh; margin:0; padding: 16px 22px; box-sizing:border-box; }
  #app.fill-screen{ height:100vh; display:flex; flex-direction:column; overflow:hidden; }
  button{ font-family:inherit; cursor:pointer; border:none; background:none; }
  button:active{ transform: scale(0.96); }

  /* ---------- Top bar (brand + all status pills in one row) ---------- */
  .topbar{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 12px; gap:10px; flex-wrap:wrap; flex-shrink:0; }
  .brand{ display:flex; align-items:center; gap:8px; }
  .brand .display{ font-size: 1.1rem; color: var(--ink); font-weight:700; }
  .back-btn.small{ width:32px; height:32px; font-size:0.95rem; }
  .badges{ display:flex; gap:8px; flex-wrap:wrap; }
  .badge{ display:flex; align-items:center; gap:5px; background: var(--card); border-radius: 999px; padding: 6px 12px; box-shadow: var(--shadow); font-weight:700; font-family:'Baloo 2'; font-size:0.86rem; cursor:pointer; }
  .badge.streak span.n{ color:#FF7A45; }
  .badge.food span.n{ color: var(--coral); }
  .badge.goal span.n{ color: #4E9F5A; }
  .badge.goal{ cursor:default; }

  /* ---------- Landscape two-column layout, fills remaining height ---------- */
  .main-layout{ display:flex; gap: 20px; align-items:stretch; flex:1; min-height:0; }
  .left-col{ flex: 1.15; min-width:0; display:flex; flex-direction:column; }
  .right-col{ flex: 0.85; min-width:0; overflow-y:auto; padding-right:4px; }

  /* ---------- Playful tap reactions ---------- */
  .tap-bounce{ animation: tap-bounce-kf 500ms ease; }
  @keyframes tap-bounce-kf{ 0%{ transform: scale(1) rotate(0);} 30%{ transform: scale(1.28) rotate(-9deg);} 60%{ transform: scale(0.9) rotate(7deg);} 100%{ transform: scale(1) rotate(0);} }
  .tap-spin{ animation: tap-spin-kf 550ms ease; }
  @keyframes tap-spin-kf{ 0%{ transform: rotate(0) scale(1);} 60%{ transform: rotate(320deg) scale(1.15);} 100%{ transform: rotate(360deg) scale(1);} }
  .tap-jump{ animation: tap-jump-kf 450ms ease; }
  @keyframes tap-jump-kf{ 0%,100%{ transform: translateY(0) scale(1);} 40%{ transform: translateY(-14px) scale(1.08);} 70%{ transform: translateY(2px) scale(0.95);} }
  .tap-soft{ animation: tap-soft-kf 320ms ease; }
  @keyframes tap-soft-kf{ 0%,100%{ transform: scale(1);} 50%{ transform: scale(1.06);} }
  .burst-piece{ position:fixed; font-size:1.25rem; z-index:80; pointer-events:none; animation: burst-out-kf 700ms ease-out forwards; }
  @keyframes burst-out-kf{ 0%{ transform: translate(0,0) scale(0.5); opacity:1;} 100%{ transform: translate(var(--dx), var(--dy)) scale(1.15); opacity:0;} }
  .confetti-piece{ position:fixed; top:-10px; font-size:1.4rem; z-index:80; animation: fall linear forwards; pointer-events:none; }
  @keyframes fall{ to{ transform: translateY(110vh) rotate(360deg); opacity:0.2; } }

  /* ---------- Onboarding ---------- */
  .onboard-card{ background: var(--card); border-radius:28px; padding:26px 20px; box-shadow: var(--shadow); text-align:center; }
  .onboard-emojis{ font-size:3rem; margin-bottom:6px; }
  .field{ margin: 16px 0; text-align:left; }
  .field label{ font-family:'Baloo 2'; font-weight:700; font-size:0.95rem; display:block; margin-bottom:6px; }
  .field input{ width:100%; padding: 12px 14px; border-radius:14px; border:2px solid var(--line); font-family:'Quicksand'; font-size:1rem; background:#fff; color:var(--ink); }
  .field input:focus{ outline:none; border-color: var(--coral); }
  .color-grid{ display:flex; gap:10px; justify-content:center; margin-top:6px; flex-wrap:wrap; }
  .color-opt{ width:46px; height:46px; border-radius:50%; border:3px solid transparent; }
  .color-opt.selected{ border-color: var(--ink); }
  .cta-btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; background: var(--coral); color:#fff; font-family:'Baloo 2'; font-weight:700; font-size:1.05rem; padding: 14px 26px; border-radius:999px; box-shadow: var(--shadow); width:100%; margin-top: 6px; }

  /* ---------- Scene: sky blends into meadow blends into pond ---------- */
  .scene{ position:relative; flex:1; min-height:0; width:100%; border-radius: 26px; overflow:hidden;
    background: linear-gradient(180deg, #BFE8F5 0%, #BFE8F5 26%, #DFF3D6 52%, #BFE3A8 100%); }
  .sun{ position:absolute; top:8px; width:44px; height:44px; border-radius:50%; background: radial-gradient(circle at 35% 30%, #FFF3C4, var(--sun)); box-shadow: 0 0 18px rgba(255,201,60,0.55); cursor:pointer; animation: sun-drift 26s linear infinite; z-index:2; }
  .sun.winking{ animation: sun-drift 26s linear infinite, sun-wink 350ms ease; }
  @keyframes sun-drift{ 0%{ left:-15%; } 100%{ left:115%; } }
  @keyframes sun-wink{ 0%,100%{ transform: scaleY(1);} 50%{ transform: scaleY(0.2);} }
  .sun-face{ position:absolute; inset:0; }
  .sun-eye{ position:absolute; width:4.5px; height:6px; background: var(--ink); border-radius:50%; top:16px; }
  .sun-eye.l{ left:12px; } .sun-eye.r{ left:25px; }
  .sun-mouth{ position:absolute; left:13px; top:23px; width:16px; height:8px; border-bottom: 3px solid var(--ink); border-radius: 0 0 16px 16px; }
  .cloud{ position:absolute; opacity:0.9; cursor:pointer; z-index:2; }
  .cloud.c1{ top:2px; animation: cloud-drift1 34s linear infinite; }
  .cloud.c2{ top:32px; animation: cloud-drift2 46s linear infinite; animation-delay:-18s; }
  @keyframes cloud-drift1{ 0%{ left:-20%; } 100%{ left:120%; } }
  @keyframes cloud-drift2{ 0%{ left:-20%; } 100%{ left:120%; } }

  .meadow-decor{ position:absolute; inset:0; z-index:1; pointer-events:none; }
  .flower{ position:absolute; font-size:1.15rem; }
  .tree{ position:absolute; }
  .reed{ position:absolute; font-size:1rem; opacity:0.9; }
  .blade{ position:absolute; bottom:0; width:3px; height:14px; background:#7BBF6E; border-radius:3px 3px 0 0; transform-origin:bottom center; animation: sway 3s ease-in-out infinite; opacity:0.85; }
  @keyframes sway{ 0%,100%{ transform: rotate(-6deg);} 50%{ transform: rotate(6deg);} }

  .pond-halo{ position:absolute; z-index:2; border-radius: 46% 54% 58% 42% / 50% 44% 56% 50%;
    background: radial-gradient(circle, rgba(46,95,88,0.4), rgba(46,95,88,0) 72%); filter: blur(14px); }

  .bird-fly{ z-index:90; pointer-events:none; animation: bird-fly-kf linear forwards; font-size:1.15rem; }
  @keyframes bird-fly-kf{ 0%{ transform: translate(0,0);} 50%{ transform: translate(calc(var(--fly-dist) * 0.5), var(--fly-drift));} 100%{ transform: translate(var(--fly-dist), 0);} }

  /* ---------- Pond (sits inside .scene, no card shadow, blends via soft mask fade) ---------- */
  .tank{ position:absolute; left:12%; right:12%; top:35%; bottom:10%; border-radius: 46% 54% 58% 42% / 50% 44% 56% 50%; overflow:hidden; z-index:3;
    background: linear-gradient(175deg, #86C6BE 0%, #3E7F78 55%, #2B5E58 100%);
    -webkit-mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, black 74%, transparent 100%);
    mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, black 74%, transparent 100%); }
  .tank-floor{ position:absolute; left:0; right:0; bottom:0; height: 18px; background: #6B5A3E; opacity:0.7; }
  .bubble{ position:absolute; bottom:16px; width:7px; height:7px; border-radius:50%; background: rgba(255,255,255,0.4); animation: rise linear infinite; }
  @keyframes rise{ 0%{ transform: translateY(0); opacity:0.7;} 100%{ transform: translateY(-190px); opacity:0; } }
  .fish-bubble{ position:fixed; border-radius:50%; background: rgba(255,255,255,0.65); border:1px solid rgba(255,255,255,0.85); z-index:80; pointer-events:none; animation: fish-bubble-rise 900ms ease-out forwards; }
  @keyframes fish-bubble-rise{ 0%{ transform: translateY(0) scale(0.7); opacity:0.9;} 100%{ transform: translateY(-70px) scale(1.1); opacity:0;} }
  .decor-fab{ position:absolute; top:36%; right:22%; width:38px; height:38px; border-radius:12px; background: var(--card); box-shadow: var(--shadow); display:flex; align-items:center; justify-content:center; font-size:1.15rem; z-index:5; }
  .decor-fab .count-badge{ position:absolute; top:-6px; right:-6px; background: var(--coral); color:#fff; font-size:0.65rem; font-weight:700; border-radius:999px; padding: 1px 5px; }
  .food-can{ position:absolute; top:36%; left:22%; width:38px; height:38px; border-radius:12px; background: var(--card); box-shadow: var(--shadow); display:flex; align-items:center; justify-content:center; font-size:1.15rem; z-index:5; }
  .food-can.disabled{ opacity:0.35; cursor:default; }
  .food-can .count-badge{ position:absolute; top:-6px; right:-6px; background: var(--coral); color:#fff; font-size:0.65rem; font-weight:700; border-radius:999px; padding: 1px 5px; }
  .food-flake{ position:absolute; font-size:0.9rem; z-index:6; animation: flake-fall 900ms ease-in forwards; pointer-events:none; }
  @keyframes flake-fall{ 0%{ transform: translateY(0); opacity:1;} 100%{ transform: translateY(60px); opacity:0; } }
  .decor-item{ position:absolute; font-size:1.7rem; transform: translate(-50%,-50%); cursor:grab; filter: drop-shadow(0 3px 3px rgba(0,0,0,0.2)); z-index:4; }
  .fish-wrap{ position:absolute; transition: left 4s ease-in-out, top 4s ease-in-out; cursor:pointer; }
  .fish-wrap.bob{ animation: fish-bob-kf 2.6s ease-in-out infinite; }
  @keyframes fish-bob-kf{ 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-5px);} }
  .fish-wrap.flip .fish-svg{ transform: scaleX(-1); }
  .fish-pupil{ transition: transform 400ms ease; }
  .fish-wrap.looking .fish-pupil{ transform: translate(-2px,0); }
  .mouth-closed{ display:block; } .mouth-open{ display:none; }
  .fish-wrap.eating .mouth-closed{ display:none; } .fish-wrap.eating .mouth-open{ display:block; }
  .decor-item{ position:absolute; font-size:1.9rem; transform: translate(-50%,-50%); cursor:grab; filter: drop-shadow(0 3px 3px rgba(0,0,0,0.2)); }
  .food-can{ position:absolute; top:10px; right:10px; width:44px; height:44px; border-radius:14px; background: var(--card); box-shadow: var(--shadow); display:flex; align-items:center; justify-content:center; font-size:1.4rem; z-index:3; }
  .food-can.disabled{ opacity:0.35; cursor:default; }
  .food-can .count-badge{ position:absolute; top:-6px; right:-6px; background: var(--coral); color:#fff; font-size:0.68rem; font-weight:700; border-radius:999px; padding: 1px 6px; }
  .food-flake{ position:absolute; font-size:1rem; z-index:4; animation: flake-fall 900ms ease-in forwards; pointer-events:none; }
  @keyframes flake-fall{ 0%{ transform: translateY(0); opacity:1;} 100%{ transform: translateY(70px); opacity:0; } }

  .heart-row{ display:flex; align-items:center; gap:8px; margin: 8px 4px 4px; }
  .heart-bar{ flex:1; height:12px; background: rgba(255,255,255,0.5); border-radius:999px; overflow:hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.08); }
  .heart-fill{ height:100%; background: linear-gradient(90deg, #FF8FA3, #FF5C7A); border-radius:999px; transition: width 500ms ease; }
  .heart-label{ font-family:'Baloo 2'; font-weight:700; font-size:0.85rem; color: var(--ink-soft); white-space:nowrap; }

  /* ---------- Decor tray ---------- */
  .tray-title{ font-family:'Baloo 2'; font-weight:700; font-size:0.95rem; margin: 6px 4px 8px; color: var(--ink-soft); }
  .tray{ display:flex; gap:10px; overflow-x:auto; padding: 4px 4px 10px; }
  .tray-item{ min-width:54px; height:54px; border-radius:16px; background: var(--card); box-shadow: var(--shadow); display:flex; align-items:center; justify-content:center; font-size:1.6rem; cursor:grab; }
  .tray-item.special{ background: linear-gradient(160deg,#FFEDE6,#FFF7DC); border:2px solid var(--coral); }
  .tray-empty{ color: var(--ink-soft); font-size:0.85rem; padding: 12px 4px; }

  /* ---------- Levels ---------- */
  .levels{ display:flex; flex-direction:column; gap:12px; margin-top: 8px; }
  .level-card{ display:flex; align-items:center; gap:14px; background: var(--card); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); text-align:left; width:100%; }
  .level-icon{ font-size: 1.8rem; width:52px; height:52px; min-width:52px; border-radius:16px; display:flex; align-items:center; justify-content:center; background: var(--acc-soft); }
  .level-info{ flex:1; }
  .level-name{ font-family:'Baloo 2'; font-weight:700; font-size:1.05rem; }
  .level-meta{ color: var(--ink-soft); font-size:0.85rem; margin-top:2px; }
  .level-check{ font-size:1.4rem; }

  /* ---------- Practice screen ---------- */
  .practice-top{ display:flex; align-items:center; gap:10px; margin-bottom: 14px; }
  .back-btn{ background: var(--card); border-radius:999px; width:40px; height:40px; box-shadow: var(--shadow); font-size:1.1rem; display:flex; align-items:center; justify-content:center;}
  .progress-track{ flex:1; height:10px; background: rgba(255,255,255,0.6); border-radius:999px; overflow:hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);}
  .progress-fill{ height:100%; background: linear-gradient(90deg, var(--sun), var(--coral)); border-radius:999px; transition: width 400ms ease; }

  .word-card{ position:relative; background: var(--card); border-radius: 28px; padding: 26px 20px 22px; box-shadow: var(--shadow); text-align:center; overflow:hidden; }
  .word-emoji{ font-size: 4.2rem; margin-bottom: 6px; cursor:pointer; display:inline-block; }
  .lang-row{ display:flex; gap:10px; margin-top: 14px; }
  .lang-btn{ flex:1; display:flex; flex-direction:column; align-items:center; gap:6px; border-radius:20px; padding: 14px 8px 12px; font-family:'Baloo 2'; font-weight:700; border: 2px solid var(--line); background:#fff; }
  .lang-btn.de{ background: #EAF3EA; }
  .lang-btn.en{ background: #EFEAF6; }
  .lang-btn .word-text{ font-size:1.15rem; color: var(--ink); margin-top:2px; }
  .lang-btn.speaking{ box-shadow: 0 0 0 4px rgba(255,137,102,0.35); }
  .flag-svg{ display:block; border-radius:3px; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

  .try-section{ margin-top: 22px; padding-top: 20px; border-top: 2px dashed var(--line); }
  .try-label{ font-family:'Baloo 2'; font-weight:700; font-size:1.05rem; margin-bottom:14px; }
  .mic-btn{ width: 96px; height: 96px; border-radius:50%; background: linear-gradient(160deg, var(--coral), #ff6f4d); color:#fff; font-size:2.2rem; margin: 4px auto 4px; display:flex; align-items:center; justify-content:center; box-shadow: 0 10px 20px rgba(255,137,102,0.4); }
  .mic-btn.listening{ animation: mic-pulse 1s ease-in-out infinite; }
  @keyframes mic-pulse{ 0%,100%{ box-shadow: 0 0 0 0 rgba(255,137,102,0.5);} 50%{ box-shadow: 0 0 0 18px rgba(255,137,102,0);} }
  .mic-hint{ color: var(--ink-soft); font-size:0.85rem; margin-top:8px; }

  .feedback{ margin-top: 18px; padding: 16px; border-radius:18px; text-align:center; min-height: 20px; }
  .feedback.success{ background: #E9F8E3; }
  .feedback.help{ background: #FFF3DC; }
  .feedback .fb-text{ font-weight:700; font-family:'Baloo 2'; font-size:1.05rem; }
  .feedback .fb-sub{ color: var(--ink-soft); font-size:0.9rem; margin-top:4px; }
  .feedback .fb-decor{ margin-top:8px; font-family:'Baloo 2'; font-weight:700; color: var(--coral); }
  .feedback-actions{ display:flex; gap:10px; justify-content:center; margin-top:12px; flex-wrap:wrap; }
  .small-btn{ padding: 10px 18px; border-radius:999px; font-family:'Baloo 2'; font-weight:700; font-size:0.9rem; background:#fff; border: 2px solid var(--line); color: var(--ink); }
  .small-btn.primary{ background: var(--ink); color:#fff; border-color: var(--ink); }
  .skip-row{ text-align:center; margin-top: 16px; }
  .skip-row button{ color: var(--ink-soft); font-size:0.85rem; text-decoration:underline; }

  .sentence-line{ font-family:'Baloo 2'; font-weight:700; font-size:1.2rem; margin: 6px 0; cursor:pointer; }

  .bonus-banner{ position:absolute; inset:0; z-index:5; display:flex; align-items:center; justify-content:center; background: linear-gradient(135deg, var(--sun), var(--coral)); border-radius:28px; animation: bonus-fade 1.5s ease forwards; }
  @keyframes bonus-fade{ 0%{opacity:1; transform:scale(1);} 65%{opacity:1; transform:scale(1.03);} 100%{opacity:0; transform:scale(1.12); visibility:hidden;} }
  .bonus-banner-text{ font-family:'Baloo 2'; font-weight:800; color:#fff; font-size:1.8rem; text-shadow:0 2px 6px rgba(0,0,0,0.15); text-align:center; }

  .game-options{ display:grid; grid-template-columns: repeat(3,1fr); gap:12px; margin-top:18px; }
  .game-opt{ background:#fff; border:2px solid var(--line); border-radius:18px; padding: 18px 6px; font-size:2.4rem; box-shadow: var(--shadow); }
  .game-opt.correct{ background: #E9F8E3; border-color: #4E9F5A; }
  .game-opt.wrong{ opacity:0.5; }

  /* ---------- Level complete / all done ---------- */
  .celebrate-wrap{ text-align:center; padding: 30px 10px; }
  .celebrate-title{ font-size: 1.5rem; margin: 10px 0 6px; }
  .celebrate-sub{ color: var(--ink-soft); margin-bottom: 18px; }
  .new-decor{ display:inline-flex; align-items:center; gap:10px; background: var(--card); border-radius:16px; padding: 12px 18px; box-shadow: var(--shadow); font-family:'Baloo 2'; font-weight:700; margin-bottom: 18px; }

  /* ---------- Baby celebration ---------- */
  .baby-emojis{ font-size: 3rem; }
  .baby-emojis span{ display:inline-block; animation: pop-in 500ms ease backwards; }
  .baby-emojis span:nth-child(2){ animation-delay: 120ms; }
  .baby-emojis span:nth-child(3){ animation-delay: 240ms; }
  @keyframes pop-in{ from{ transform: scale(0) rotate(-10deg); opacity:0;} to{ transform: scale(1) rotate(0); opacity:1;} }

  .footnote{ text-align:center; color: var(--ink-soft); font-size:0.78rem; margin-top: 28px; line-height:1.5; }
