/* Fonts */
@font-face {
    font-family: "Shojumaru";
    src: url("fonts/Shojumaru.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "KungFuPanda";
    src: url("fonts/KungFuPanda.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

/* Page Load Animations */
@keyframes logoFadeInGlow {
    0% {
        opacity: 0;
        filter: drop-shadow(0 0 0 rgba(255, 220, 50, 0));
    }
    40% {
        opacity: 1;
        filter: drop-shadow(0 0 40px rgba(255, 220, 50, 1))
            drop-shadow(0 0 80px rgba(255, 200, 50, 0.9))
            drop-shadow(0 0 120px rgba(255, 180, 50, 0.7));
    }
    100% {
        opacity: 1;
        filter: drop-shadow(0 0 15px rgba(255, 220, 50, 0.8))
            drop-shadow(0 0 30px rgba(255, 200, 50, 0.6))
            drop-shadow(0 0 45px rgba(255, 180, 50, 0.4));
    }
}

@keyframes textFadeInGlow {
    0% {
        opacity: 0;
        text-shadow: none;
    }
    40% {
        opacity: 1;
        text-shadow:
            0 0 20px rgba(255, 220, 50, 1),
            0 0 40px rgba(255, 200, 50, 0.9),
            0 0 80px rgba(255, 180, 50, 0.7),
            0 0 120px rgba(255, 150, 50, 0.5),
            2px 2px 4px rgba(0, 0, 0, 0.8);
    }
    100% {
        opacity: 1;
        text-shadow:
            0 0 10px rgba(255, 220, 50, 0.9),
            0 0 20px rgba(255, 200, 50, 0.7),
            0 0 40px rgba(255, 180, 50, 0.5),
            0 0 60px rgba(255, 150, 50, 0.3),
            2px 2px 4px rgba(0, 0, 0, 0.8);
    }
}

@keyframes subtitleFadeInGlow {
    0% {
        opacity: 0;
        text-shadow: none;
    }
    40% {
        opacity: 1;
        text-shadow:
            0 0 20px rgba(255, 220, 50, 1),
            0 0 40px rgba(255, 200, 50, 0.9),
            0 0 80px rgba(255, 180, 50, 0.7),
            2px 2px 4px rgba(0, 0, 0, 0.8);
    }
    100% {
        opacity: 1;
        text-shadow:
            0 0 10px rgba(255, 220, 50, 0.9),
            0 0 20px rgba(255, 200, 50, 0.7),
            0 0 40px rgba(255, 180, 50, 0.5),
            2px 2px 4px rgba(0, 0, 0, 0.8);
    }
}

@keyframes contentFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: #fff;
}

/* Game Container */
.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Background */
.background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("img/backgrounds/background-ring.jpg");
    background-size: cover;
    background-position: center;
    filter: brightness(0.4);
    z-index: -1;
}

/* Header */
.game-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 20px;
    z-index: 10;
    gap: 5px;
}

.logo-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 120px;
    filter: drop-shadow(0 0 15px rgba(255, 220, 50, 0.8))
        drop-shadow(0 0 30px rgba(255, 200, 50, 0.6))
        drop-shadow(0 0 45px rgba(255, 180, 50, 0.4));
    animation: logoFadeInGlow 1.5s ease-out forwards;
}

.logo-text {
    font-family: "Shojumaru", cursive;
    font-size: 48px;
    color: #fff;
    text-shadow:
        0 0 10px rgba(255, 220, 50, 0.9),
        0 0 20px rgba(255, 200, 50, 0.7),
        0 0 40px rgba(255, 180, 50, 0.5),
        0 0 60px rgba(255, 150, 50, 0.3),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: textFadeInGlow 1.5s ease-out forwards;
}

.logo-kung {
    color: #fff;
}

.logo-pow {
    color: #fff;
}

.subtitle {
    font-family: "KungFuPanda", cursive;
    font-size: 24px;
    color: #fff;
    letter-spacing: 4px;
    text-shadow:
        0 0 10px rgba(255, 220, 50, 0.9),
        0 0 20px rgba(255, 200, 50, 0.7),
        0 0 40px rgba(255, 180, 50, 0.5),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: subtitleFadeInGlow 1.5s ease-out 0.3s forwards;
    opacity: 0;
}

/* Main Game Area */
.game-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 10px 20px 10px;
    animation: contentFadeIn 0.8s ease-out 1.2s forwards;
    opacity: 0;
}

/* Player Section */
.player-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Player Info */
.player-info {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.player-1 .player-info {
    border-color: rgba(100, 150, 255, 0.5);
    box-shadow: 0 0 20px rgba(100, 150, 255, 0.3);
}

.player-2 .player-info {
    border-color: rgba(255, 150, 100, 0.5);
    box-shadow: 0 0 20px rgba(255, 150, 100, 0.3);
}

.player-name {
    font-size: 14px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.score-bg {
    width: 120px;
    height: auto;
    object-fit: contain;
}

.score {
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* HP Bar */
.hp-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 200px;
    padding: 5px 0;
    margin-bottom: -15px;
    z-index: 10;
    position: relative;
}

.hp-bar-wrapper {
    flex: 1;
    height: 16px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hp-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    border-radius: 6px;
    transition:
        width 0.3s ease,
        background 0.3s ease;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

.hp-text {
    font-size: 14px;
    font-weight: bold;
    min-width: 30px;
    text-align: right;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Player-specific HP bar colors */
.player-1-character .hp-bar-wrapper {
    border-color: rgba(100, 150, 255, 0.5);
}

.player-1-character .hp-container {
    flex-direction: row-reverse;
    margin-right: 60px;
}

.player-2-character .hp-bar-wrapper {
    border-color: rgba(255, 150, 100, 0.5);
}

.player-2-character .hp-container {
    margin-left: 60px;
}

/* Game Board */
.game-board-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Board Top Bar - Player name and next piece */
.board-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(6, 40px);
    grid-template-rows: repeat(12, 40px);
    gap: 2px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 0 30px rgba(0, 0, 0, 0.5),
        inset 0 0 50px rgba(0, 0, 0, 0.3);
}

.player-1 .game-board {
    border-color: rgba(100, 150, 255, 0.6);
}

.player-2 .game-board {
    border-color: rgba(255, 150, 100, 0.6);
}

/* Character Face-off Area */
.character-faceoff {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    padding: 0;
    /* Align with game board: 12 rows × 40px + 2×10px padding + 2×3px border = 506px */
    height: 506px;
}

.character-wrapper {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    height: 100%;
    padding: 0;
    margin: 0;
}

.character-container {
    width: 360px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.character-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.8));
}

/* Player 1 character - no flip */
.player-1-character .character-container img {
    transform: scaleX(1);
}

/* Player 2 character - flipped horizontally */
.player-2-character .character-container img {
    transform: scaleX(-1);
}

.vs-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.vs-icon img {
    width: 60px;
    filter: drop-shadow(0 0 15px rgba(255, 200, 100, 0.7));
}

/* Candy Cells */
.cell {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cell.active {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.cell.locked {
    opacity: 1;
}

@keyframes pulse {
    from {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
    to {
        box-shadow: 0 0 30px rgba(255, 255, 255, 1);
    }
}

.cell.matched {
    animation: matched 0.3s ease-out forwards;
}

@keyframes matched {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.cell.falling {
    animation: fall 0.3s ease-in;
}

@keyframes fall {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cell.swapping {
    transition: transform 0.2s ease-in-out;
}

/* Candy Images */
.cell img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    pointer-events: none;
}

/* Empty cell */
.cell.empty {
    background: transparent;
    pointer-events: none;
}

/* Candy Colors (fallback when images not used) */
.cell.candy-circle {
    background: radial-gradient(circle, #ff6b6b, #c92a2a);
}
.cell.candy-diamond {
    background: radial-gradient(circle, #4ecdc4, #1a8f8a);
}
.cell.candy-hexagon {
    background: radial-gradient(circle, #a78bfa, #7c3aed);
}
.cell.candy-square {
    background: radial-gradient(circle, #feca57, #ff9f43);
}
.cell.candy-star {
    background: radial-gradient(circle, #54a0ff, #2e86de);
}
.cell.candy-triangle {
    background: radial-gradient(circle, #5cd85c, #27ae60);
}

/* Combo Display */
.combo-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: bold;
    color: #fff;
    text-shadow:
        0 0 20px rgba(255, 200, 0, 0.8),
        0 0 40px rgba(255, 100, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
}

.combo-display.show {
    animation: comboShow 1s ease-out forwards;
}

@keyframes comboShow {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.3);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Next Piece */
.next-piece-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 8px;
}

.next-label {
    height: 18px;
}

.next-piece {
    display: flex;
    gap: 5px;
}

.next-piece .preview-candy {
    width: 25px;
    height: 25px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.next-piece .preview-candy img {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

/* Bottom Control Bar */
.bottom-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.7);
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    animation: contentFadeIn 0.8s ease-out 1.4s forwards;
    opacity: 0;
}

/* Chain Mode Selector */
.chain-mode-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 15px;
    border-radius: 10px;
}

.chain-mode-selector label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.chain-mode-selector select {
    background: #2d2d4a;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    outline: none;
}

.chain-mode-selector select:hover {
    border-color: rgba(255, 200, 100, 0.6);
}

/* Game Controls */
.game-controls {
    display: flex;
    gap: 15px;
}

.control-btn {
    background: linear-gradient(135deg, #ff9f43, #ff6b6b);
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 10px;
    cursor: pointer;
    transition:
        transform 0.2s,
        box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(255, 100, 100, 0.4);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 100, 100, 0.6);
}

.control-btn:active {
    transform: translateY(0);
}

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

/* Timer */
.timer-display {
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 25px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#game-timer {
    font-size: 28px;
    font-weight: bold;
    font-family: "Courier New", monospace;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Game Over Overlay */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-overlay.show {
    display: flex;
}

.game-over-content {
    background: linear-gradient(135deg, #2d2d4a, #1a1a2e);
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid rgba(255, 200, 100, 0.5);
    box-shadow: 0 0 50px rgba(255, 200, 100, 0.3);
}

.game-over-content h2 {
    font-size: 36px;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(255, 200, 100, 0.7);
}

.final-scores {
    display: flex;
    gap: 40px;
    margin-bottom: 30px;
}

.final-score {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
}

.final-score span:first-child {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

.final-score span:last-child {
    font-size: 32px;
    font-weight: bold;
}

/* D-Pad Controls */
.dpad-container {
    display: none;
    position: relative;
    width: 120px;
    height: 120px;
    margin-top: 10px;
}

.dpad-btn {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition:
        background 0.1s,
        transform 0.1s;
}

.dpad-btn:active {
    background: rgba(255, 200, 100, 0.5);
    transform: scale(0.95);
}

.dpad-up {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-down {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-left {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-right {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    font-size: 12px;
}

/* Mobile D-Pad - Hidden by default on desktop */
.mobile-dpad {
    display: none;
}

/* Board and Controls wrapper for horizontal layout on mobile */
.board-and-controls {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* Player 2 next piece on left side (desktop) */
.player-2 .board-and-controls {
    flex-direction: row-reverse;
}

/* Responsive */
@media (max-width: 1200px) {
    .game-board {
        grid-template-columns: repeat(6, 35px);
        grid-template-rows: repeat(12, 35px);
    }

    .cell {
        width: 35px;
        height: 35px;
    }

    .character-container {
        width: 140px;
        height: 180px;
    }
}

@media (max-width: 900px) {
    .game-area {
        flex-direction: column;
        gap: 10px;
    }

    .character-faceoff {
        flex-direction: row;
        padding: 10px;
    }

    .character-container {
        width: 100px;
        height: 120px;
    }

    .bottom-bar {
        flex-wrap: wrap;
        gap: 15px;
        padding: 10px 15px;
    }

    /* Show D-Pad on mobile */
    .dpad-container {
        display: block;
    }
}

/* Mobile Portrait Optimization - All elements on one screen */
@media (max-width: 600px) and (orientation: portrait) {
    html,
    body {
        overflow: auto;
    }

    .game-container {
        min-height: 100vh;
        height: auto;
        padding-bottom: 10px;
    }

    /* Compact Header */
    .game-header {
        padding: 5px 10px;
        gap: 2px;
    }

    .logo-row {
        gap: 8px;
    }

    .logo {
        height: 50px;
    }

    .logo-text {
        font-size: 24px;
    }

    .subtitle {
        font-size: 12px;
        letter-spacing: 2px;
    }

    /* Game Area - Flex row for side-by-side boards */
    .game-area {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 5px 10px;
        align-items: flex-start;
        justify-content: center;
    }

    /* Player Sections - Side by Side */
    .player-section {
        gap: 5px;
        flex: 0 0 auto;
    }

    .player-info {
        padding: 4px 12px;
        border-radius: 6px;
    }

    .player-name {
        font-size: 10px;
    }

    /* Board and controls - vertical stack on mobile */
    .board-and-controls {
        flex-direction: column;
        align-items: center;
    }

    /* Player 2 board also stacks vertically on mobile */
    .player-2 .board-and-controls {
        flex-direction: column;
    }

    /* Both boards same size - side by side, maximized for screen width */
    /* Calculate: (screen width - outer padding - gap between boards) / 2 boards */
    /* Then divide by 6 columns for cell size */
    .player-1 .game-board,
    .player-2 .game-board {
        grid-template-columns: repeat(6, calc((100vw - 40px) / 12 - 2px));
        grid-template-rows: repeat(12, calc((100vw - 40px) / 12 - 2px));
        gap: 1px;
        padding: 3px;
        border-width: 2px;
    }

    .player-1 .cell,
    .player-2 .cell {
        width: calc((100vw - 40px) / 12 - 2px);
        height: calc((100vw - 40px) / 12 - 2px);
        border-radius: 4px;
    }

    /* Hide D-Pads inside player sections on mobile */
    .player-section .dpad-container {
        display: none;
    }

    /* Next Piece - Compact horizontal */
    .next-piece-container {
        flex-direction: row;
        padding: 4px 8px;
        gap: 6px;
        border-radius: 6px;
        margin-top: 5px;
    }

    .next-label {
        height: 14px;
    }

    .next-piece .preview-candy {
        width: 20px;
        height: 20px;
    }

    /* Character Face-off - Full width, below boards */
    .character-faceoff {
        width: 100%;
        gap: 15px;
        padding: 8px 10px;
        order: 1;
    }

    .character-wrapper {
        gap: 4px;
    }

    .character-container {
        width: 90px;
        height: 110px;
    }

    .vs-icon img {
        width: 40px;
    }

    .score-container {
        gap: 2px;
    }

    .score-bg {
        width: 65px;
    }

    .score {
        font-size: 14px;
    }

    /* Mobile D-Pad - Centered below character faceoff */
    .mobile-dpad {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        order: 2;
        padding: 10px 0;
    }

    .mobile-dpad .dpad-btn {
        position: static;
        width: 50px;
        height: 50px;
        transform: none;
        font-size: 20px;
        border-radius: 12px;
    }

    .mobile-dpad .dpad-center {
        border-radius: 50%;
    }

    /* Bottom Bar - Ultra Compact */
    .bottom-bar {
        padding: 8px 10px;
        gap: 10px;
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .timer-display {
        padding: 6px 12px;
        border-radius: 6px;
    }

    #game-timer {
        font-size: 18px;
    }

    .chain-mode-selector {
        padding: 4px 8px;
        border-radius: 6px;
    }

    .chain-mode-selector label {
        font-size: 9px;
        display: none; /* Hide label on very small screens */
    }

    .chain-mode-selector select {
        padding: 4px 8px;
        font-size: 11px;
        border-radius: 4px;
    }

    .game-controls {
        gap: 8px;
    }

    .control-btn {
        padding: 8px 14px;
        font-size: 11px;
        letter-spacing: 1px;
        border-radius: 6px;
    }

    /* Combo Display - Smaller */
    .combo-display {
        font-size: 24px;
    }

    /* Game Over Overlay - Mobile Friendly */
    .game-over-content {
        padding: 20px 30px;
        border-radius: 15px;
        margin: 10px;
    }

    .game-over-content h2 {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .final-scores {
        gap: 20px;
        margin-bottom: 20px;
    }

    .final-score {
        padding: 10px 15px;
    }

    .final-score span:first-child {
        font-size: 11px;
    }

    .final-score span:last-child {
        font-size: 22px;
    }
}

/* Extra small phones */
@media (max-width: 380px) and (orientation: portrait) {
    .player-1 .game-board {
        grid-template-columns: repeat(6, 24px);
        grid-template-rows: repeat(12, 24px);
    }

    .player-1 .cell {
        width: 24px;
        height: 24px;
    }

    .player-2 .game-board {
        grid-template-columns: repeat(6, 15px);
        grid-template-rows: repeat(12, 15px);
    }

    .player-2 .cell {
        width: 15px;
        height: 15px;
    }

    .dpad-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .character-container {
        width: 50px;
        height: 60px;
    }

    .vs-icon img {
        width: 28px;
    }

    .score-bg {
        width: 55px;
    }

    .score {
        font-size: 14px;
    }
}

/* Animations for scoring */
.score-pop {
    animation: scorePop 0.3s ease-out;
}

@keyframes scorePop {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Chain indicator */
.chain-indicator {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff6b6b, #feca57);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
}

.chain-indicator.show {
    opacity: 1;
    animation: chainBounce 0.5s ease-out;
}

@keyframes chainBounce {
    0% {
        transform: translateX(-50%) translateY(10px);
    }
    50% {
        transform: translateX(-50%) translateY(-5px);
    }
    100% {
        transform: translateX(-50%) translateY(0);
    }
}

/* Hint animation */
.cell.hint {
    animation: hint 1s ease-in-out infinite;
}

@keyframes hint {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    }
}
