  @import url('https://fonts.googleapis.com/css2?family=Creepster&family=Nosifer&display=swap');

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

  body {
      font-family: 'Creepster', cursive;
      background: linear-gradient(135deg, #1a0033, #330066, #4d0080);
      min-height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      overflow: hidden;
  }

  #outerWrapper {
      width: 100vw;
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      overflow: hidden;
      background: linear-gradient(135deg, #1a0033, #330066, #4d0080);
  }

  .game-container {
      width: 780px;
      /* original fixed size */
      height: 750px;
      transform-origin: top left;
      /* needed for scaling math */
      position: relative;
  }


  .game-container {
      width: 780px;
      height: 750px;
      background: radial-gradient(circle at center, #2d1b69, #1a0033);
      border: 4px solid #6a0dad;
      border-radius: 15px;
      position: relative;
      box-shadow: 0 0 30px rgba(106, 13, 173, 0.5), inset 0 0 50px rgba(0, 0, 0, 0.3);
      overflow: hidden;

  }

  .stars {
      position: absolute;
      width: 100%;
      height: 100%;
      background-image:
          radial-gradient(2px 2px at 20px 30px, white, transparent),
          radial-gradient(2px 2px at 40px 70px, white, transparent),
          radial-gradient(1px 1px at 90px 40px, white, transparent),
          radial-gradient(1px 1px at 130px 80px, white, transparent),
          radial-gradient(2px 2px at 160px 30px, white, transparent);
      background-repeat: repeat;
      background-size: 200px 100px;
      animation: twinkle 3s infinite;
      opacity: 0.6;
  }

  @keyframes twinkle {

      0%,
      100% {
          opacity: 0.6;
      }

      50% {
          opacity: 0.9;
      }
  }

  .screen {
      position: absolute;
      width: 100%;
      height: 100%;
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      z-index: 10;
  }

  .screen.active {
      display: flex;
  }

  .start-screen h1 {
      font-family: 'Nosifer', cursive;
      font-size: 3rem;
      color: #ff6b35;
      text-shadow: 3px 3px 0px #000, 0 0 20px #ff6b35;
      margin-bottom: 30px;
      animation: glow 2s ease-in-out infinite alternate;
  }

  @keyframes glow {
      from {
          text-shadow: 3px 3px 0px #000, 0 0 20px #ff6b35;
      }

      to {
          text-shadow: 3px 3px 0px #000, 0 0 30px #ff6b35, 0 0 40px #ff6b35;
      }
  }

  .witch-icon {
      font-size: 4rem;
      margin-bottom: 20px;
      animation: float 3s ease-in-out infinite;
  }

  @keyframes float {

      0%,
      100% {
          transform: translateY(0px);
      }

      50% {
          transform: translateY(-10px);
      }
  }

  .start-btn,
  .home-btn {
      background: linear-gradient(45deg, #ff6b35, #f7931e);
      border: none;
      padding: 15px 30px;
      font-family: 'Creepster', cursive;
      font-size: 1.2rem;
      color: white;
      border-radius: 10px;
      cursor: pointer;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
      transition: transform 0.2s, box-shadow 0.2s;
  }

  .start-btn:hover,
  .home-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4);
  }

  .home-btn {
      position: absolute;
      top: 20px;
      right: 20px;
      padding: 10px 20px;
      font-size: 1rem;
      z-index: 100;
  }

  .game-screen {
      padding: 20px;
  }

  .game-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      margin-top: 50px;
  }

  .lives {
      display: flex;
      gap: 5px;
  }

  .heart {
      color: #ff1744;
      font-size: 1.5rem;
      text-shadow: 0 0 10px #ff1744;
      animation: heartbeat 1.5s infinite;
  }

  @keyframes heartbeat {

      0%,
      100% {
          transform: scale(1);
      }

      50% {
          transform: scale(1.1);
      }
  }

  .heart.lost {
      color: #666;
      text-shadow: none;
      animation: none;
  }

  .witch-character {
      text-align: center;
      margin-bottom: 20px;
  }

  .witch-face {
      font-size: 3rem;
      margin-bottom: 10px;
  }

  .witch-text {
      color: #9c27b0;
      font-size: 1.1rem;
      background: rgba(0, 0, 0, 0.5);
      padding: 10px;
      border-radius: 10px;
      margin: 0 auto;
      max-width: 400px;
  }

  .recipe {
      background: rgba(0, 0, 0, 0.7);
      border: 2px solid #6a0dad;
      border-radius: 10px;
      padding: 15px;
      margin-bottom: 20px;
      text-align: center;
  }

  .recipe h3 {
      color: #ff6b35;
      margin-bottom: 10px;
      font-size: 1.2rem;
  }

  .target-ingredients {
      display: flex;
      justify-content: center;
      gap: 10px;
      flex-wrap: wrap;
  }

  .target-ingredient {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: 2px solid white;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.2rem;
      background: var(--color);
  }

  .ingredients-panel {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 15px;
      margin-bottom: 20px;
  }

  .ingredient {
      width: 60px;
      height: 60px;
      border-radius: 50%;
      border: 3px solid #333;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.5rem;
      transition: transform 0.2s, box-shadow 0.2s;
      background: var(--color);
      margin: 0 auto;
  }

  .ingredient:hover {
      transform: scale(1.1);
      box-shadow: 0 0 20px var(--color);
  }

  .ingredient.selected {
      border-color: #ffff00;
      box-shadow: 0 0 15px #ffff00;
  }

  .cauldron {
      text-align: center;
      margin-bottom: 20px;
      position: relative;
  }

  .cauldron-icon {
      font-size: 4rem;
      margin-bottom: 10px;
  }

  .current-potion {
      display: flex;
      justify-content: center;
      gap: 10px;
      flex-wrap: wrap;
      min-height: 60px;
      background: rgba(0, 0, 0, 0.5);
      border-radius: 10px;
      padding: 10px;
      align-items: center;
  }

  .potion-ingredient {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: 2px solid white;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1rem;
      background: var(--color);
  }

  .action-buttons {
      display: flex;
      gap: 10px;
      justify-content: center;
  }

  .action-btn {
      background: linear-gradient(45deg, #6a0dad, #9c27b0);
      border: none;
      padding: 10px 20px;
      font-family: 'Creepster', cursive;
      color: white;
      border-radius: 8px;
      cursor: pointer;
      transition: transform 0.2s;
  }

  .action-btn:hover {
      transform: translateY(-2px);
  }

  .action-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
  }

  .end-screen {
      background: rgba(0, 0, 0, 0.9);
      backdrop-filter: blur(10px);
  }

  .end-screen h2 {
      font-family: 'Nosifer', cursive;
      font-size: 2.5rem;
      margin-bottom: 20px;
      text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  }

  .game-over h2 {
      color: #ff1744;
  }

  .congratulations h2 {
      color: #4caf50;
  }

  .final-message {
      font-size: 1.2rem;
      margin-bottom: 30px;
      color: #fff;
  }

  .score {
      font-size: 1.5rem;
      color: #ffeb3b;
      margin-bottom: 20px;
  }

  @keyframes fadeIn {
      from {
          opacity: 0;
          transform: translateY(20px);
      }

      to {
          opacity: 1;
          transform: translateY(0);
      }
  }

  .fade-in {
      animation: fadeIn 0.5s ease-out;
  }

  .level-indicator {
      color: #9c27b0;
      font-size: 1.2rem;
      font-weight: bold;
  }

  /* 3D Animation Container */
  .three-container {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 50;
  }

  .brewing-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.8);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 40;
  }

  .brewing-overlay.active {
      display: flex;
  }

  .brewing-text {
      color: #9c27b0;
      font-size: 1.5rem;
      text-align: center;
      animation: pulse 1s infinite;
  }

  @keyframes pulse {

      0%,
      100% {
          opacity: 0.7;
      }

      50% {
          opacity: 1;
      }
  }

  .failure-shake {
      animation: shake 0.6s ease-in-out;
  }

  @keyframes shake {

      0%,
      100% {
          transform: translateX(0);
      }

      10%,
      30%,
      50%,
      70%,
      90% {
          transform: translateX(-5px);
      }

      20%,
      40%,
      60%,
      80% {
          transform: translateX(5px);
      }
  }

  .success-burst {
      position: absolute;
      font-size: 2rem;
      animation: burst 1s ease-out forwards;
  }

  @keyframes burst {
      0% {
          transform: translate(-50%, -50%) scale(0.5);
          opacity: 1;
      }

      50% {
          transform: translate(-50%, -50%) scale(1.2);
          opacity: 0.8;
      }

      100% {
          transform: translate(-50%, -50%) scale(2);
          opacity: 0;
      }
  }