:root {
      --bg-color: #faf8ef;
      --grid-bg: #bbada0;
      --cell-bg: rgba(238, 228, 218, 0.35);
      --text-dark: #776e65;
      --text-light: #f9f6f2;
      --header-bg: #ffffff;
      --header-shadow: rgba(0,0,0,0.05);
      --score-bg: #bbada0;
      --home-btn-bg: #8f7a66;
      --home-btn-hover: #7f6a56;
    }

    [data-theme="dark"] {
      --bg-color: #1a1a2e;
      --grid-bg: #2a2a4a;
      --cell-bg: rgba(60, 60, 90, 0.5);
      --text-dark: #eaeaea;
      --text-light: #f9f6f2;
      --header-bg: #16213e;
      --header-shadow: rgba(0,0,0,0.3);
      --score-bg: #3a3a5a;
      --home-btn-bg: #4a4a6a;
      --home-btn-hover: #5a5a7a;
    }

    body {
      background-color: var(--bg-color);
      font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100vh;
      margin: 0;
      overflow: hidden;
      transition: background 0.3s;
    }

    .header {
      width: 400px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 14px;
      gap: 10px;
      flex-wrap: wrap;
    }

    .home-btn {
      text-decoration: none;
      background: var(--home-btn-bg);
      color: white;
      padding: 10px 14px;
      border-radius: 10px;
      font-weight: bold;
      transition: 0.2s;
    }
    .home-btn:hover { background: var(--home-btn-hover); }

    .badge {
      background: var(--header-bg);
      color: var(--text-dark);
      border-radius: 10px;
      padding: 10px 12px;
      font-weight: 800;
      box-shadow: 0 4px 12px var(--header-shadow);
    }

    .score-container {
      background: var(--score-bg);
      padding: 10px 18px;
      border-radius: 10px;
      color: white;
      text-align: center;
    }

    .score-label { font-size: 13px; display: block; }
    #score { font-size: 25px; font-weight: bold; }

    .grid-container {
      width: 400px;
      height: 400px;
      background: var(--grid-bg);
      border-radius: 6px;
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      grid-template-rows: repeat(4, 1fr);
      gap: 15px;
      padding: 15px;
      box-sizing: border-box;
      position: relative;
    }

    .cell {
      width: 100%;
      height: 100%;
      background: var(--cell-bg);
      border-radius: 3px;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 35px;
      font-weight: bold;
      color: var(--text-dark);
      transition: 0.1s;
    }

    /* 타일 색상 - 다크모드에서도 동일하게 유지 */
    .tile-2 { background: #eee4da; color: #776e65; }
    .tile-4 { background: #ede0c8; color: #776e65; }
    .tile-8 { background: #f2b179; color: var(--text-light); }
    .tile-16 { background: #f59563; color: var(--text-light); }
    .tile-32 { background: #f67c5f; color: var(--text-light); }
    .tile-64 { background: #f65e3b; color: var(--text-light); }
    .tile-128 { background: #edcf72; color: var(--text-light); font-size: 30px; }
    .tile-256 { background: #edcc61; color: var(--text-light); font-size: 30px; }
    .tile-512 { background: #edc850; color: var(--text-light); font-size: 30px; }
    .tile-1024 { background: #edc53f; color: var(--text-light); font-size: 25px; }
    .tile-2048 { background: #edc22e; color: var(--text-light); font-size: 25px; }

    .instructions { margin-top: 16px; color: var(--text-dark); font-weight: bold; }
