/* ===========================
   倍倍FIGHT! - Responsive Design
   =========================== */

/* Tablet Landscape (1024px) */
@media screen and (max-width: 1024px) {
    .game-header {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .multiplier-chart {
        position: static;
        transform: none;
        margin: 2rem auto;
        max-width: 500px;
    }

    .table-felt {
        padding: 3rem 1rem;
    }

    .card-container {
        gap: 1rem;
    }

    .game-card {
        width: 120px;
        height: 170px;
    }
}

/* Tablet Portrait (768px) */
@media screen and (max-width: 768px) {
    #gameScreen {
        padding: 1rem;
    }

    .logo-text {
        font-size: 4rem;
    }

    .logo-subtitle {
        font-size: 2rem;
    }

    .start-form {
        padding: 2rem;
        margin: 0 1rem;
    }

    .game-header {
        margin-bottom: 2rem;
    }

    .score-display,
    .round-display,
    .next-multiplier {
        padding: 1rem;
    }

    .amount-number {
        font-size: 2rem;
    }

    .round-number {
        font-size: 2rem;
    }

    .table-felt {
        padding: 2rem 1rem;
        border-radius: 20px;
    }

    .game-card {
        width: 100px;
        height: 140px;
    }

    .card-back::after {
        font-size: 1.5rem;
    }

    .card-symbol {
        font-size: 3rem;
    }

    .floating-chips {
        display: none;
    }

    .decoration-corner {
        width: 40px;
        height: 40px;
    }
}

/* Mobile Landscape (640px) */
@media screen and (max-width: 640px) and (orientation: landscape) {
    .screen {
        min-height: auto;
        padding: 1rem;
    }

    .logo-container {
        margin-bottom: 2rem;
    }

    .logo-text {
        font-size: 3rem;
    }

    .logo-subtitle {
        font-size: 1.5rem;
    }

    .game-header {
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .score-display,
    .round-display,
    .next-multiplier {
        flex: 1;
        min-width: 150px;
    }

    .table-felt {
        padding: 1.5rem 0.5rem;
    }

    .game-card {
        width: 80px;
        height: 110px;
    }
}

/* Mobile Portrait (480px) */
@media screen and (max-width: 480px) {
    body {
        font-size: 14px;
    }

    #startScreen {
        padding: 1rem;
    }

    .logo-text {
        font-size: 3rem;
        letter-spacing: 0.05em;
    }

    .logo-subtitle {
        font-size: 1.8rem;
        letter-spacing: 0.2em;
        margin-top: -0.3rem;
    }

    .start-form {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }

    .input-label {
        font-size: 0.9rem;
    }

    .amount-input {
        font-size: 1.2rem;
        padding: 1rem 0.5rem;
    }

    .currency-symbol {
        padding: 0 1rem;
        font-size: 1.2rem;
    }

    .premium-button {
        padding: 1.2rem 2rem;
        font-size: 1.1rem;
    }

    /* Game Screen Mobile */
    #gameScreen {
        padding: 0.5rem;
    }

    .game-header {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .score-display,
    .round-display,
    .next-multiplier {
        padding: 0.8rem;
        border-radius: 15px;
    }

    .score-label,
    .round-label,
    .next-label {
        font-size: 0.7rem;
    }

    .amount-number {
        font-size: 1.5rem;
    }

    .currency {
        font-size: 1rem;
    }

    .round-number {
        font-size: 1.5rem;
    }

    .next-value {
        font-size: 1.3rem;
    }

    .progress-bar {
        width: 120px;
        height: 6px;
    }

    .game-table {
        margin: 1.5rem auto;
    }

    .table-felt {
        padding: 1.5rem 0.5rem;
        border-radius: 15px;
        border-width: 2px;
    }

    .card-container {
        gap: 0.5rem;
        min-height: 180px;
    }

    .game-card {
        width: 70px;
        height: 100px;
    }

    .card-back::after {
        font-size: 1rem;
    }

    .card-symbol {
        font-size: 2rem;
    }

    .card-label {
        font-size: 0.8rem;
    }

    .game-controls {
        margin-top: 1.5rem;
    }

    .cash-out-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
    }

    .hint-text {
        font-size: 0.85rem;
    }

    .multiplier-chart {
        padding: 1rem;
        border-radius: 15px;
    }

    .chart-title {
        font-size: 0.9rem;
    }

    .multiplier-item {
        padding: 0.3rem;
        font-size: 0.85rem;
    }

    /* Result Screen Mobile */
    .result-container {
        padding: 1rem;
    }

    .result-title {
        font-size: 2rem;
    }

    .result-amount {
        margin: 1rem 0;
    }

    .currency-large {
        font-size: 1.5rem;
    }

    .amount-large {
        font-size: 2.5rem;
    }

    .result-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .stat-item {
        padding: 0.5rem;
    }

    .decoration-corner {
        display: none;
    }

    /* Sound Controls Mobile */
    .sound-controls {
        top: 1rem;
        right: 1rem;
    }

    .sound-toggle {
        width: 40px;
        height: 40px;
    }

    .sound-icon {
        width: 20px;
        height: 20px;
    }
}

/* Very Small Mobile (360px) */
@media screen and (max-width: 360px) {
    .logo-text {
        font-size: 2.5rem;
    }

    .logo-subtitle {
        font-size: 1.5rem;
    }

    .game-card {
        width: 60px;
        height: 85px;
    }

    .card-back::after {
        font-size: 0.8rem;
    }

    .card-symbol {
        font-size: 1.5rem;
    }

    .amount-number {
        font-size: 1.2rem;
    }

    .round-number {
        font-size: 1.2rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .game-card:hover:not(.flipped):not(.disabled) {
        transform: none;
    }

    .game-card:active:not(.flipped):not(.disabled) {
        transform: scale(0.95);
    }

    .premium-button:hover {
        transform: none;
    }

    .premium-button:active {
        transform: scale(0.95);
    }

    /* Larger touch targets */
    .game-card {
        min-width: 70px;
        min-height: 100px;
    }

    .premium-button {
        min-height: 48px;
    }

    .sound-toggle {
        min-width: 44px;
        min-height: 44px;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card-back::before {
        background: 
            repeating-linear-gradient(
                45deg,
                transparent,
                transparent 5px,
                rgba(255, 215, 0, 0.1) 5px,
                rgba(255, 215, 0, 0.1) 10px
            ),
            repeating-linear-gradient(
                -45deg,
                transparent,
                transparent 5px,
                rgba(255, 215, 0, 0.1) 5px,
                rgba(255, 215, 0, 0.1) 10px
            );
    }
}

/* Landscape Orientation Lock Message */
@media screen and (max-width: 768px) and (orientation: portrait) {
    .orientation-message {
        display: none;
    }
}

@media screen and (max-width: 768px) and (orientation: landscape) and (max-height: 480px) {
    .orientation-message {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--primary-dark);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        padding: 2rem;
        text-align: center;
    }

    .orientation-message p {
        font-size: 1.2rem;
        color: white;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animated-background {
        display: none;
    }

    .floating-chips {
        display: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-dark: #000000;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .animated-background,
    .floating-chips,
    .sound-controls,
    #particleCanvas {
        display: none;
    }
}