body {
    color: #776e65;
    font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.game-main-container {
    width: 485px;
    margin: 40px auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.title {
    font-size: 80px;
    font-weight: bold;
    margin: 0;
    line-height: 1;
}

.scores-container {
    display: flex;
    gap: 5px;
}

.score-container, .best-container {
    background: #bbada0;
    color: white;
    padding: 10px 20px;
    border-radius: 3px;
    text-align: center;
    font-weight: bold;
    font-size: 13px;
    min-width: 50px;
}

.score-container span, .best-container span {
    font-size: 20px;
    display: block;
    margin-top: 5px;
}

.above-game {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    margin-bottom: 30px;
}

.game-intro {
    font-size: 18px;
    color: #776e65;
    margin: 0;
}

.restart-button, .retry-button {
    background: #8f7a66;
    color: #f9f6f2;
    border: none;
    border-radius: 3px;
    padding: 10px 20px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease-in-out;
}

.restart-button:hover, .retry-button:hover {
    background: #9f8b77;
}

.game-container {
    position: relative;
    padding: 15px;
    cursor: default;
    background: #bbada0;
    border-radius: 6px;
    width: 475px;
    height: 475px;
    box-sizing: border-box;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 100px);
    grid-template-rows: repeat(4, 100px);
    gap: 15px;
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1;
}

.grid-cell {
    width: 100px;
    height: 100px;
    border-radius: 3px;
    background: rgba(238, 228, 218, 0.35);
}

.tile-container {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
}

.tile {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 3px;
    background: #eee4da;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 40px;
    transition: all 150ms ease-in-out;
}

/* Tile Colors */
.tile-2 { background: #eee4da; color: #776e65; }
.tile-4 { background: #ede0c8; color: #776e65; }
.tile-8 { background: #f2b179; color: #f9f6f2; }
.tile-16 { background: #f59563; color: #f9f6f2; }
.tile-32 { background: #f67c5f; color: #f9f6f2; }
.tile-64 { background: #f65e3b; color: #f9f6f2; }
.tile-128 { background: #edcf72; color: #f9f6f2; font-size: 36px; }
.tile-256 { background: #edcc61; color: #f9f6f2; font-size: 36px; }
.tile-512 { background: #edc850; color: #f9f6f2; font-size: 36px; }
.tile-1024 { background: #edc53f; color: #f9f6f2; font-size: 28px; }
.tile-2048 { background: #edc22e; color: #f9f6f2; font-size: 28px; }

/* Game Message Overlay */
.game-message {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(238, 228, 218, 0.73);
    z-index: 100;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 6px;
}

.game-message p {
    font-size: 50px;
    font-weight: bold;
    color: #776e65;
    margin: 0 0 10px;
}

.powerups-used-msg {
    font-size: 18px;
    font-weight: bold;
    color: #776e65;
    margin-bottom: 20px;
}

.game-message.game-over, .game-message.game-won {
    display: flex;
}

/* Powers */
.powers-container {
    display: flex;
    gap: 15px;
    background: #bbada0;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.power-button {
    background: #8f7a66;
    color: #f9f6f2;
    border: none;
    border-radius: 6px;
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.power-button:hover:not(:disabled) {
    background: #9f8b77;
}

.power-button:disabled {
    opacity: 0.5;
    cursor: default;
}

.power-button.active {
    background: #edc22e;
    transform: scale(1.05);
}

.power-button .material-symbols-outlined {
    font-size: 30px;
    margin-bottom: 5px;
}

/* Targeting */
.game-container.targeting-bomb .tile, .game-container.targeting-bomb .grid-cell { cursor: crosshair; }
.game-container.targeting-swap .tile { cursor: grab; }

.tile.selected-swap {
    outline: 5px solid #edc22e;
    outline-offset: -5px;
    z-index: 10 !important;
}

@keyframes bomb-shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.tile.bomb-shake {
    animation: bomb-shake 0.1s infinite;
    z-index: 20 !important;
}

.tile.bomb-exploded {
    transform: scale(0.1) !important;
    opacity: 0;
}

.bomb-emoji {
    position: absolute;
    font-size: 60px;
    z-index: 50;
    pointer-events: none;
    line-height: 100px;
    text-align: center;
    width: 100px;
    height: 100px;
}

.power-button {
    position: relative;
    overflow: hidden;
}

.power-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #f65e3b;
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.premium-toggle-container {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    color: #776e65;
}

.premium-toggle-container label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Locked state */
.lock-icon {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 22px !important;
    color: #ffd700; /* Gold lock icon */
    z-index: 20;
    text-shadow: 0 0 4px rgba(0,0,0,0.5);
    display: block;
}

.premium-only:not(.is-premium) .material-symbols-outlined:not(.lock-icon),
.premium-only:not(.is-premium) span:not(.lock-icon),
.premium-only:not(.is-premium) .power-badge {
    opacity: 0.2;
}

.premium-only.is-premium .lock-icon {
    display: none !important;
}

.buy-coffee-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background-color: #facc15;
    color: #713f12;
    font-weight: 800;
    text-transform: uppercase;
    padding: 15px 0;
    border-radius: 12px;
    font-size: 18px;
    box-shadow: 0 6px 0 0 #ca8a04;
    letter-spacing: 0.025em;
    text-decoration: none;
    margin-top: 20px;
    margin-bottom: 5px;
    transition: transform 0.1s, box-shadow 0.1s;
    box-sizing: border-box;
}

.buy-coffee-btn:hover {
    background-color: #fde047;
}

.buy-coffee-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0px 0 0 #ca8a04 !important;
}

.buy-coffee-icon {
    font-size: 24px;
    margin-right: 8px;
}
