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

  body {
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    font-family: 'Rubik', 'Nunito', 'Segoe UI Emoji', 'Apple Color Emoji', system-ui, sans-serif;
    cursor: none;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
  }

  #canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
  }

  /* Floating character that appears on keypress */
  .magic-char {
    position: fixed;
    z-index: 10;
    pointer-events: none;
    animation: magicPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
    filter: drop-shadow(0 0 15px currentColor);
    font-family: 'Rubik', 'Varela Round', 'Nunito', system-ui, sans-serif;
    font-weight: 700;
  }

  .magic-char.float-away {
    animation: floatAway 3s ease-out forwards;
  }

  /* Theme-specific float animations */
  .magic-char.float-swim { animation: floatSwim 3s ease-out forwards; }
  .magic-char.float-space { animation: floatSpace 3s ease-out forwards; }
  .magic-char.float-bounce { animation: floatBounce 2.5s ease-out forwards; }
  .magic-char.float-dance { animation: floatDance 2.5s ease-out forwards; }

  /* Wobble while visible */
  .magic-char.wobble { animation: magicPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, charWobble 0.6s ease-in-out 0.4s infinite; }

  /* Giant letter easter egg */
  .magic-char.giant {
    animation: giantPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    z-index: 25;
  }

  @keyframes magicPop {
    0% { transform: scale(0) rotate(-20deg); opacity: 0; }
    60% { transform: scale(1.3) rotate(10deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
  }

  @keyframes charWobble {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
  }

  @keyframes floatAway {
    0% { opacity: 1; }
    100% { transform: translateY(-200px) rotate(360deg) scale(0.3); opacity: 0; }
  }

  @keyframes floatSwim {
    0% { opacity: 1; transform: translate(0, 0); }
    100% { opacity: 0; transform: translate(300px, 50px) rotate(20deg) scale(0.3); }
  }

  @keyframes floatSpace {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translateY(-400px) scale(0.1); }
  }

  @keyframes floatBounce {
    0% { opacity: 1; transform: translateY(0); }
    20% { transform: translateY(-80px); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-120px); opacity: 0.7; }
    100% { transform: translateY(-250px); opacity: 0; }
  }

  @keyframes floatDance {
    0% { opacity: 1; transform: rotate(0deg) translateY(0); }
    25% { transform: rotate(15deg) translateY(-40px) translateX(30px); }
    50% { transform: rotate(-15deg) translateY(-80px) translateX(-30px); }
    75% { transform: rotate(10deg) translateY(-150px); opacity: 0.5; }
    100% { transform: rotate(-5deg) translateY(-250px); opacity: 0; }
  }

  @keyframes giantPop {
    0% { transform: translate(-50%,-50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%,-50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(1); opacity: 1; }
  }

  /* Portal transition */
  .theme-btn.portal-active {
    z-index: 200 !important;
    position: fixed !important;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  #portal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 150;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
  }

  #portal-overlay.active { opacity: 1; }

  /* Hearts easter egg */
  .heart-float {
    position: fixed;
    z-index: 30;
    pointer-events: none;
    font-size: 3rem;
    animation: heartRise 2s ease-out forwards;
  }

  @keyframes heartRise {
    0% { transform: scale(0) translateY(0); opacity: 1; }
    20% { transform: scale(1.3) translateY(-30px); opacity: 1; }
    100% { transform: scale(0.8) translateY(-300px); opacity: 0; }
  }

  /* Rainbow easter egg */
  .rainbow-bar {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 30;
    pointer-events: none;
    background: linear-gradient(180deg,
      rgba(255,0,0,0.3), rgba(255,165,0,0.3), rgba(255,255,0,0.3),
      rgba(0,128,0,0.3), rgba(0,0,255,0.3), rgba(75,0,130,0.3));
    animation: rainbowFlash 1.5s ease-out forwards;
  }

  @keyframes rainbowFlash {
    0% { opacity: 0; transform: scaleY(0); transform-origin: top; }
    20% { opacity: 1; transform: scaleY(1); }
    100% { opacity: 0; transform: scaleY(1); }
  }

  /* Achievement overlay */
  #achievement {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 80;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(10px);
    color: white;
    font-family: 'Rubik', sans-serif;
    text-align: center;
    animation: achieveFadeIn 0.5s ease;
    direction: rtl;
  }

  #achievement.show { display: flex; }

  @keyframes achieveFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
  }

  #achievement h2 {
    font-size: clamp(1.5rem, 5vw, 3rem);
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffd700, #ff6b9d, #48dbfb);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  #achievement .achieve-count {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 900;
    line-height: 1;
    margin: 0.5rem 0;
  }

  #achievement .achieve-mosaic {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
    max-width: 400px;
    margin: 1rem 0;
  }

  #achievement .achieve-mosaic span {
    font-size: 1.5rem;
    animation: mosaicPop 0.3s ease backwards;
  }

  @keyframes mosaicPop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
  }

  #achieve-continue {
    margin-top: 1.5rem;
    padding: 1rem 2.5rem;
    border-radius: 30px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    font-family: 'Rubik', sans-serif;
    transition: all 0.3s;
  }

  #achieve-continue:hover {
    background: rgba(255,255,255,0.25);
    border-color: white;
    transform: scale(1.05);
  }

  /* Guided mode */
  #mission-btn {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    border: 2px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.85);
    font-size: 1rem;
    font-family: 'Rubik', sans-serif;
    cursor: pointer;
    display: none;
    transition: all 0.3s;
  }

  #mission-btn:hover {
    background: rgba(0,0,0,0.5);
    border-color: rgba(255,255,255,0.5);
    transform: translateX(-50%) scale(1.05);
  }

  #mission-btn.active {
    background: rgba(168,130,255,0.3);
    border-color: rgba(168,130,255,0.6);
  }

  #mission-target {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
    font-size: clamp(4rem, 15vw, 10rem);
    font-family: 'Rubik', sans-serif;
    font-weight: 900;
    color: rgba(255,255,255,0.12);
    pointer-events: none;
    display: none;
    animation: targetPulse 2s ease-in-out infinite;
  }

  #mission-target.show { display: block; }

  @keyframes targetPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.12; }
    50% { transform: translate(-50%, -50%) scale(1.05); opacity: 0.18; }
  }

  #mission-prompt {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-family: 'Rubik', sans-serif;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 15px rgba(0,0,0,0.5);
    pointer-events: none;
    display: none;
    text-align: center;
    direction: rtl;
  }

  #mission-prompt.show { display: block; }

  #success-flash {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 30;
    pointer-events: none;
    opacity: 0;
  }

  #success-flash.flash {
    background: radial-gradient(circle, rgba(255,215,0,0.4) 0%, transparent 70%);
    animation: successPulse 0.8s ease-out forwards;
  }

  @keyframes successPulse {
    0% { opacity: 1; }
    100% { opacity: 0; }
  }

  /* Ripple effect on click/touch */
  .ripple {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
    animation: rippleExpand 1s ease-out forwards;
  }

  @keyframes rippleExpand {
    0% { transform: scale(0); opacity: 0.6; }
    100% { transform: scale(4); opacity: 0; }
  }

  /* Sparkle trail for cursor */
  .sparkle {
    position: fixed;
    pointer-events: none;
    z-index: 15;
    animation: sparkleFade 0.8s ease-out forwards;
  }

  @keyframes sparkleFade {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    100% { transform: scale(0) rotate(180deg); opacity: 0; }
  }

  /* Start screen */
  #start-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 40%, #24243e 100%);
    transition: opacity 0.8s, visibility 0.8s;
    visibility: visible;
    overflow: hidden;
    padding: 0 1rem;
    gap: 0.8vh;
  }

  #start-screen::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    pointer-events: none;
    background:
      radial-gradient(circle at 20% 30%, rgba(120, 80, 255, 0.3) 0%, transparent 40%),
      radial-gradient(circle at 80% 70%, rgba(255, 100, 200, 0.25) 0%, transparent 40%),
      radial-gradient(circle at 50% 50%, rgba(80, 200, 255, 0.2) 0%, transparent 50%);
    animation: bgOrbit 15s linear infinite;
    z-index: 0;
  }

  @keyframes bgOrbit {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  #start-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  #start-screen > *:not(.start-deco) { position: relative; z-index: 1; }

  /* Floating emoji decorations on start screen */
  .start-deco {
    position: absolute;
    z-index: 0;
    font-size: 2.5rem;
    opacity: 0.15;
    animation: decoFloat 8s ease-in-out infinite;
    pointer-events: none;
  }

  @keyframes decoFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(5deg); }
    75% { transform: translateY(15px) rotate(-5deg); }
  }

  /* Title */
  .title-container {
    text-align: center;
    margin-bottom: 0;
  }

  #start-screen h1 {
    font-size: clamp(2rem, 8vw, 5rem);
    font-weight: 900;
    color: transparent;
    background: linear-gradient(135deg, #fff 0%, #a78bfa 30%, #f472b6 60%, #38bdf8 100%);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    animation: titleShine 4s ease-in-out infinite, titleFloat 3s ease-in-out infinite;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  @keyframes titleShine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
  }

  @keyframes titleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
  }

  .title-sub {
    font-size: clamp(0.7rem, 2vw, 1rem);
    color: rgba(255,255,255,0.5);
    margin-top: 0.2rem;
    font-weight: 400;
    letter-spacing: 0.15em;
  }

  /* Subtitle */
  #start-screen .intro-text {
    font-size: clamp(0.95rem, 2.5vw, 1.3rem);
    color: rgba(255,255,255,0.85);
    margin-bottom: 0;
    text-align: center;
    max-width: 500px;
    line-height: 1.5;
  }

  .intro-text .highlight {
    color: #c084fc;
    font-weight: 700;
  }

  /* Section labels */
  .section-label {
    font-size: clamp(0.7rem, 1.8vw, 0.85rem);
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
    font-weight: 600;
  }

  /* Language picker */
  .lang-picker {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0;
    flex-wrap: wrap;
    justify-content: center;
  }

  .lang-btn {
    font-size: clamp(0.8rem, 2.2vw, 0.95rem);
    padding: 0.4rem 1rem;
    border: 1.5px solid rgba(255,255,255,0.15);
    border-radius: 30px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(4px);
  }

  .lang-btn.selected {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.5);
    color: white;
    box-shadow: 0 0 20px rgba(168, 130, 255, 0.3);
    transform: scale(1.05);
  }

  .lang-btn:hover:not(.selected) {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.3);
    color: white;
  }

  /* Theme picker */
  .theme-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    max-width: 480px;
    width: 90%;
  }

  .theme-btn {
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
    padding: 0.8rem 0.6rem;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    text-align: center;
  }

  .theme-btn .theme-emoji {
    font-size: 1.6rem;
    display: block;
    transition: transform 0.35s;
  }

  .theme-btn .theme-name {
    font-size: 0.85rem;
    opacity: 0.8;
  }

  .theme-btn:hover, .theme-btn:focus {
    transform: translateY(-4px) scale(1.03);
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.1);
    box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 0 20px rgba(168, 130, 255, 0.2);
  }

  .theme-btn:hover .theme-emoji {
    transform: scale(1.3) rotate(10deg);
  }

  .theme-btn:active {
    transform: translateY(0) scale(0.97);
  }

  /* Features row */
  .features {
    display: flex;
    gap: 1.5rem;
    margin-top: 0;
    opacity: 0.35;
    font-size: 0.75rem;
    color: white;
  }

  .features span { display: flex; align-items: center; gap: 0.3rem; }

  /* Combo counter */
  #combo {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
  }

  #combo.visible { opacity: 1; }

  /* Home button (back to theme selection) */
  #home-btn {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.25);
    backdrop-filter: blur(8px);
    color: white;
    cursor: pointer;
    font-size: 1.4rem;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    line-height: 1;
  }

  #home-btn:hover {
    background: rgba(0,0,0,0.5);
    border-color: rgba(255,255,255,0.5);
    transform: scale(1.1);
  }

  /* Start screen footer - pinned to bottom center */
  .start-footer {
    position: absolute;
    bottom: 2vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
  }

  .footer-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.08em;
  }

  .start-share {
    display: flex;
    gap: 0.8rem;
    align-items: center;
  }

  .share-ico {
    display: flex;
    align-items: center;
    transition: transform 0.25s, opacity 0.25s;
    opacity: 0.5;
  }

  .share-ico:hover {
    transform: scale(1.3);
    opacity: 1;
  }

  .start-footer .privacy-link {
    color: rgba(255,255,255,0.2);
    text-decoration: none;
    font-size: 0.55rem;
    transition: color 0.2s;
  }

  .start-footer .privacy-link:hover { color: rgba(255,255,255,0.6); }

  /* Parent button */
  #parent-btn {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 50;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.25);
    backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  #parent-btn:hover {
    background: rgba(0,0,0,0.5);
    border-color: rgba(255,255,255,0.5);
    color: white;
    transform: scale(1.1);
  }

  /* Parent panel */
  #parent-panel {
    position: fixed;
    top: 0; right: -320px;
    width: 300px;
    height: 100%;
    z-index: 60;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(20px);
    color: white;
    padding: 2rem 1.5rem;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    direction: ltr;
  }

  #parent-panel.open { right: 0; }

  #parent-panel h2 { margin-bottom: 1.5rem; font-size: 1.3rem; }

  .panel-section {
    margin-bottom: 1.5rem;
  }

  .panel-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
  }

  .panel-section select, .panel-section input[type="range"] {
    width: 100%;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1rem;
  }

  .panel-section select option { color: black; }

  .toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
  }

  .toggle {
    width: 50px;
    height: 26px;
    border-radius: 13px;
    background: rgba(255,255,255,0.2);
    border: none;
    cursor: pointer;
    position: relative;
    transition: background 0.3s;
  }

  .toggle.active { background: #4ade80; }

  .toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    transition: left 0.3s;
  }

  .toggle.active::after { left: 27px; }

  #close-panel {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
  }

  #fullscreen-btn, #back-to-themes-btn {
    width: 100%;
    padding: 0.8rem;
    border-radius: 12px;
    border: none;
    background: #667eea;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 0.5rem;
  }

  #fullscreen-btn:hover, #back-to-themes-btn:hover { background: #5a6fd6; }

  /* Custom cursor */
  #custom-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 100;
    font-size: 2rem;
    transform: translate(-50%, -50%);
    transition: font-size 0.1s;
  }