
    body {
      font-family: 'Poppins', 'Arial', sans-serif;
      display: flex;
      justify-content: center;
      align-items: flex-start;
      min-height: 100vh;
      margin: 0;
      background-image: url('in.png');
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      touch-action: manipulation;
      overscroll-behavior: none;
      padding-top: clamp(8px, 2vw, 16px);
      overflow: hidden;
    }
    #intro-page {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100vh;
      background-image: url('bg.jpg');
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      box-sizing: border-box;
      padding: clamp(10px, 2.5vw, 16px);
      position: fixed;
      top: 0;
      left: 0;
      z-index: 1000;
    }
    #game-container {
      text-align: center;
      width: min(90vw, 400px);
      max-width: 100%;
      padding: clamp(6px, 4vw, 10px);
      box-sizing: border-box;
      display: none;
      margin: clamp(50px, 9vh, 70px);
      border-radius: clamp(6px, 1vw, 10px);
      box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
      touch-action: none;
      background-image: url('board.png');
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
    }
    #header {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: clamp(6px, 1.5vw, 10px) clamp(8px, 2vw, 12px);
      background: linear-gradient(90deg, #8e2de2, #4a00e0, #00ccff);
      box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
      z-index: 10;
      max-width: min(100vw, 960px);
      margin: 0 auto;
      border-bottom-left-radius: clamp(8px, 1.5vw, 12px);
      border-bottom-right-radius: clamp(8px, 1.5vw, 12px);
      flex-wrap: wrap;
      gap: clamp(6px, 1.5vw, 10px);
      animation: headerGlow 3s ease-in-out infinite;
    }
    @keyframes headerGlow {
      0%, 100% { box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
      50% { box-shadow: 0 3px 12px rgba(251, 255, 0, 0.6); }
    }
    #score-container {
      display: flex;
      align-items: center;
      gap: clamp(6px, 1.5vw, 10px);
      flex-wrap: wrap;
      justify-content: center;
      margin-left: 12px;
    }
    #score, #best-score {
      font-family: 'Montserrat', 'Poppins', 'Arial', sans-serif;
      font-size: clamp(14px, 4vw, 18px);
      font-weight: 900;
      color: #ffffff;
      background: linear-gradient(135deg, rgba(61, 59, 59, 0.95), rgba(30, 30, 30, 0.95));
      padding: clamp(6px, 1.2vw, 10px) clamp(10px, 2vw, 14px);
      border-radius: 4px;
      display: flex;
      align-items: center;
      gap: 4px;
      text-transform: uppercase;
      letter-spacing: 1.2px;
      text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
      transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    #score:hover, #best-score:hover {
      transform: scale(1.05);
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.7);
    }
    #score::before, #best-score::before {
      font-family: "Font Awesome 6 Free";
      font-weight: 900;
      font-size: clamp(12px, 3.5vw, 16px);
      color: #fbff00;
    }
    #score::before {
      content: "\f091";
    }
    #best-score::before {
      content: "\f005";
    }
    #target {
      display: flex;
      align-items: center;
      gap: clamp(4px, 1vw, 6px);
      flex-wrap: nowrap;
    }
    .star {
      font-size: clamp(12px, 3.5vw, 14px);
      color: #fbff00;
      transition: color 0.3s ease, transform 0.3s ease;
      margin-left: 6px;
    }
    .star.filled {
      color: #ffee00;
      transform: scale(1.1);
    }
    #ai-button, #board-toggle-button {
      padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 16px);
      font-size: clamp(14px, 4vw, 16px);
      font-weight: 600;
      cursor: pointer;
      border: none;
      border-radius: 6px;
      background: linear-gradient(135deg, #003172, #99018c);
      color: #fff;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
      transition: transform 0.2s ease, box-shadow 0.2s ease;
      margin-left: clamp(6px, 1.5vw, 8px);
      margin-top: 3px;
      min-width: 100px;
      touch-action: manipulation;
    }
    #ai-button:hover, #board-toggle-button:hover {
      transform: scale(1.08);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
    }
    #ai-button:active, #board-toggle-button:active {
      transform: scale(0.95);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }
    #ai-button.active {
      background: linear-gradient(135deg, #e40053, #45019e);
    }
    #board-toggle-button.active {
      background: linear-gradient(135deg, #e52e71, #ff8a00);
    }
    #menu {
      cursor: pointer;
      display: flex;
      flex-direction: column;
      gap: 2px;
      padding: 8px;
      border-radius: 6px;
      transition: background 0.3s ease, transform 0.3s ease;
      touch-action: manipulation;
    }
    #menu:hover, #menu:active {
      background: rgba(255, 255, 255, 0.25);
      transform: scale(1.08);
    }
    .menu-line {
      width: 24px;
      height: 3px;
      background: #fff;
      border-radius: 2px;
      transition: all 0.3s ease;
    }
    #menu:hover .menu-line:nth-child(2), #menu:active .menu-line:nth-child(2) {
      width: 16px;
    }
    #intro-image {
      width: 100%;
      max-width: 320px;
      height: auto;
      border-radius: clamp(5px, 1.2vw, 8px);
      margin-bottom: clamp(10px, 2.5vw, 16px);
    }
    h1 {
      font-size: clamp(20px, 7vw, 32px);
      color: #33ff81;
      margin: clamp(6px, 1.5vw, 10px) 0;
      text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
      letter-spacing: 1px;
    }
    #grid {
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      grid-gap: clamp(8px, 2.5vw, 16px);
      background-color: #b96301;
      padding: clamp(16px, 3vw, 24px);
      border-radius: clamp(8px, 2vw, 14px);
      width: 100%;
      max-width: 100%;
      min-height: clamp(280px, 50vh, 480px);
      box-sizing: border-box;
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
      position: relative;
      justify-content: center;
      align-content: center;
      margin: clamp(30px, 6vh, 60px) auto;
      border: 3px solid #014907;
    }
    .tile {
      width: 100%;
      aspect-ratio: 1 / 1;
      font-family: 'Fredoka One', 'Montserrat', 'Poppins', 'Arial', sans-serif;
      font-size: clamp(20px, 6.5vw, 26px);
      font-weight: 700;
      color: #000000;
      display: flex;
      justify-content: center;
      align-items: center;
      background-color: #545455;
      transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
      text-shadow: 0 0 10px rgba(255, 255, 255, 0.9), 0 0 15px rgba(255, 255, 255, 0.7);
      -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.8);
      letter-spacing: 1px;
      box-shadow: 0 0 12px rgba(255, 255, 255, 0.3), inset 0 0 8px rgba(0, 0, 0, 0.4);
    }
    .tile.hexagonal {
      clip-path: polygon(50% 0%, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%);
    }
    .tile.square {
      border-radius: clamp(8px, 2vw, 10px);
    }
    .tile[data-value="2"]    { background: #48ff00; }
    .tile[data-value="4"]    { background: #ff0281; }
    .tile[data-value="8"]    { background: #f6fa0f; color: #000000; }
    .tile[data-value="16"]   { background: #026d1d; color: #000000; }
    .tile[data-value="32"]   { background: #0026fd; color: #000000; }
    .tile[data-value="64"]   { background: #ff00dd; color: #000000; }
    .tile[data-value="128"]  { background: #ff4800; color: #000000; }
    .tile[data-value="256"]  { background: #00fff2; color: #000000; }
    .tile[data-value="512"]  { background: #8a0000; }
    .tile[data-value="1024"] { background: #aaa9a5; color: #000000; }
    .tile[data-value="2048"] { background: #ff0000; color: #000000; }
    .tile.merge {
      transform: scale(1.1);
      box-shadow: 0 5px 14px rgba(0, 0, 0, 0.6);
      animation: neonPulse 0.3s ease;
    }
    @keyframes neonPulse {
      0% { transform: scale(1); filter: brightness(1); }
      50% { transform: scale(1.1); filter: brightness(1.3); }
      100% { transform: scale(1.1); filter: brightness(1.2); }
    }
    #message {
      font-size: clamp(14px, 5vw, 20px);
      color: #fff;
      margin-top: clamp(6px, 1.5vw, 10px);
      text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    }
    button {
      padding: clamp(14px, 3.5vw, 22px) clamp(28px, 6vw, 40px);
      margin-top: clamp(12px, 3vw, 20px);
      font-size: clamp(18px, 5.5vw, 24px);
      font-weight: bold;
      cursor: pointer;
      border: none;
      border-radius: clamp(8px, 2vw, 12px);
      background: linear-gradient(135deg, #4e002b, #fc1a92);
      color: #fff;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
      transition: all 0.2s ease;
      touch-action: manipulation;
      min-width: 120px;
    }
    button:hover {
      background: linear-gradient(135deg, #ff6600, #ffe600);
      transform: translateY(-2px) scale(1.05);
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
    }
    button:active {
      transform: scale(0.95);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    }
    #menu-overlay, #settings-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(5px);
      z-index: 20;
      justify-content: center;
      align-items: center;
    }
    #menu-popup, #settings-popup {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%) scale(1);
      background: linear-gradient(135deg, #4b0082, #ff1493);
      padding: clamp(1.2rem, 3.5vw, 1.8rem);
      border-radius: 14px;
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
      display: flex;
      flex-direction: column;
      gap: 0.6rem;
      width: min(85%, 300px);
      text-align: center;
      z-index: 100;
      animation: popupFade 0.4s ease;
    }
    #settings-popup {
      display: none;
    }
    @keyframes popupFade {
      from {
        opacity: 0;
        transform: translate(-50%, -55%) scale(0.95);
      }
      to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
      }
    }
    #menu-popup .close-btn, #settings-popup .close-btn {
      position: absolute;
      top: 10px;
      right: 12px;
      background: rgba(255, 255, 255, 0.2);
      color: #fff;
      border: none;
      font-size: 1.1rem;
      padding: 6px 10px;
      border-radius: 50%;
      cursor: pointer;
      transition: background 0.3s ease;
    }
    #menu-popup .close-btn:hover, #settings-popup .close-btn:hover {
      background: rgba(255, 255, 255, 0.35);
    }
    #menu-popup button:not(.close-btn), #settings-popup button:not(.close-btn) {
      padding: 0.6rem 1.2rem;
      font-size: clamp(15px, 4vw, 17px);
      font-weight: 600;
      border: none;
      border-radius: 999px;
      cursor: pointer;
      background: linear-gradient(90deg, #ff8a00, #e52e71);
      color: white;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
      transition: transform 0.2s ease, box-shadow 0.2s ease;
      touch-action: manipulation;
    }
    #menu-popup button:not(.close-btn):hover, #settings-popup button:not(.close-btn):hover {
      transform: scale(1.06);
      box-shadow: 0 5px 12px rgba(0, 0, 0, 0.45);
    }
    #menu-popup button:active, #settings-popup button:active {
      transform: scale(0.94);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    }
    #settings-popup input {
      padding: 0.6rem;
      font-size: clamp(14px, 4vw, 16px);
      border: none;
      border-radius: 6px;
      width: 100%;
      box-sizing: border-box;
      margin: 0.5rem 0;
      background: rgba(255, 255, 255, 0.95);
      color: #333;
    }
    #settings-popup label, #settings-popup .high-score {
      font-size: clamp(14px, 4vw, 16px);
      color: #fff;
      font-weight: bold;
      text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    }
    @media (max-width: 480px) {
      #header {
        padding: clamp(5px, 1.2vw, 9px) clamp(7px, 1.8vw, 11px);
        gap: clamp(5px, 1.2vw, 9px);
      }
      #score-container {
        gap: clamp(5px, 1.2vw, 9px);
        margin-left: 10px;
      }
      #score, #best-score {
        font-size: clamp(12px, 3.8vw, 15px);
        padding: clamp(5px, 1vw, 7px) clamp(8px, 1.8vw, 12px);
      }
      #score::before, #best-score::before {
        font-size: clamp(10px, 3.2vw, 13px);
      }
      #ai-button, #board-toggle-button {
        padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 16px);
        font-size: clamp(13px, 3.8vw, 15px);
        margin-left: clamp(4px, 1vw, 6px);
        min-width: 90px;
      }
      .star {
        font-size: clamp(10px, 3.2vw, 13px);
        margin-left: 5px;
      }
      #menu {
        padding: 6px;
      }
      .menu-line {
        width: 20px;
        height: 2.5px;
      }
      #menu:hover .menu-line:nth-child(2), #menu:active .menu-line:nth-child(2) {
        width: 14px;
      }
      #game-container {
        width: min(95vw, 360px);
        margin: clamp(120px, 20vh, 150px) auto 0;
      }
      .tile {
        font-size: clamp(14px, 6vw, 20px);
      }
      #message {
        font-size: clamp(12px, 4.5vw, 16px);
      }
      button {
        padding: clamp(12px, 3vw, 18px) clamp(24px, 5vw, 36px);
        font-size: clamp(16px, 5vw, 22px);
        min-width: 110px;
      }
      #intro-image {
        max-width: 240px;
      }
      #menu-popup button, #settings-popup button {
        font-size: clamp(14px, 3.8vw, 16px);
        padding: 0.6rem 1.2rem;
      }
    }
    @media (max-width: 400px) {
      .tile {
        font-size: clamp(14px, 6vw, 20px);
      }
    }
