/* Tetris Game Styles */
:root {
    --tetris-primary: #9c27b0;
    --tetris-secondary: #673ab7;
    --tetris-accent: #e91e63;
    --game-bg: #1a1a1a;
    --grid-color: #2a2a2a;
    --text-light: #ffffff;
    --text-dark: #333333;
    --overlay-bg: rgba(0, 0, 0, 0.8);
    --panel-bg: rgba(255, 255, 255, 0.1);
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --hover-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    --panel-border: rgba(255, 255, 255, 0.18);
    --panel-glow: 0 24px 55px rgba(26, 18, 88, 0.35);
    
    /* Tetrimino Colors */
    --i-piece: #00bcd4;
    --o-piece: #ffeb3b;
    --t-piece: #9c27b0;
    --s-piece: #4caf50;
    --z-piece: #f44336;
    --j-piece: #2196f3;
    --l-piece: #ff9800;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Background Particles Canvas */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Header Styles */
.game-header {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-home-btn, .help-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 13px;
}

.back-home-btn:hover, .help-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.game-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--tetris-primary);
    text-shadow: 0 0 10px rgba(156, 39, 176, 0.5);
}

/* Main Game Area */
.game-main {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: clamp(32px, 6vw, 56px) clamp(20px, 5vw, 48px) clamp(48px, 8vw, 72px);
    display: flex;
    flex-direction: column;
    gap: clamp(32px, 6vw, 52px);
    position: relative;
    z-index: 1;
}

.play-area {
    width: 100%;
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 32px;
    padding: clamp(28px, 4vw, 46px);
    backdrop-filter: blur(24px);
    box-shadow: 0 34px 90px rgba(18, 12, 64, 0.35);
}

.play-grid {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(400px, 500px) minmax(220px, 280px);
    grid-template-areas: "hero board support";
    gap: clamp(20px, 3.5vw, 32px);
    align-items: start;
}

.play-column {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 2.5vw, 26px);
}

.hero-column {
    grid-area: hero;
    gap: clamp(18px, 3vw, 30px);
}

.board-column {
    grid-area: board;
    align-items: center;
}

.support-column {
    grid-area: support;
    gap: clamp(20px, 3vw, 28px);
}

.hero-eyebrow {
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
}

.hero-heading {
    font-size: clamp(2.1rem, 3.4vw, 2.9rem);
    font-weight: 700;
    line-height: 1.15;
    color: #ffffff;
    text-shadow: 0 20px 55px rgba(12, 6, 44, 0.45);
}

.game-description {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.65;
    opacity: 0.88;
}

.hero-actions {
    justify-content: flex-start;
    background: none;
    border: none;
    padding: 0;
    box-shadow: none;
    margin: 0;
    gap: clamp(12px, 2vw, 18px);
}

.game-controls {
    display: flex;
    gap: clamp(12px, 2vw, 18px);
    flex-wrap: wrap;
    justify-content: flex-start;
}

.game-controls button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    min-width: 140px;
    background: linear-gradient(135deg, var(--tetris-primary), var(--tetris-accent));
    color: #fff;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    box-shadow: 0 16px 36px rgba(156, 39, 176, 0.35);
}

.game-controls button i,
.overlay-btn i {
    font-size: 1.1em;
}

.game-controls button:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 42px rgba(156, 39, 176, 0.5);
}

.game-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.22);
}

.game-controls button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 4px;
}

.hero-subtext {
    font-size: 0.92rem;
    opacity: 0.7;
    line-height: 1.5;
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 2vw, 20px);
    width: 100%;
}

.stat-box {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 20px;
    padding: clamp(16px, 2.3vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #ffffff;
    box-shadow: 0 18px 44px rgba(18, 12, 64, 0.38);
}

.stat-title {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.72;
}

.stat-value {
    font-size: clamp(1.8rem, 2.6vw, 2.2rem);
    font-weight: 700;
    text-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
}

.hero-highlight {
    background: rgba(6, 8, 28, 0.55);
    border-radius: 24px;
    padding: clamp(18px, 2.5vw, 24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: grid;
    gap: 12px;
}

.hero-highlight h4 {
    font-size: 1rem;
    color: #ffffff;
    letter-spacing: 0.04em;
}

.hero-highlight ul {
    list-style: none;
    display: grid;
    gap: 10px;
    padding: 0;
    margin: 0;
}

.hero-highlight li {
    position: relative;
    padding-left: 18px;
    font-size: 0.95rem;
    opacity: 0.82;
}

.hero-highlight li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--tetris-accent);
}

.stage-board {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, rgba(18, 16, 54, 0.88), rgba(18, 12, 44, 0.78));
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 28px;
    padding: clamp(16px, 2vw, 24px);
    box-shadow: 0 26px 65px rgba(10, 6, 34, 0.42);
}

.side-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 2.5vw, 22px);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 26px;
    padding: clamp(18px, 2.5vw, 26px);
    backdrop-filter: blur(18px);
    box-shadow: 0 22px 52px rgba(14, 10, 44, 0.38);
    overflow: hidden;
}

.side-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(120% 120% at 0% 0%, rgba(255, 255, 255, 0.32), transparent 60%);
    opacity: 0.5;
    pointer-events: none;
}

.side-panel > * {
    position: relative;
    z-index: 1;
}

.side-panel h3 {
    color: #ffffff;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.side-panel h4 {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

#nextCanvas,
#holdCanvas {
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 180px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 14px 32px rgba(0, 0, 0, 0.35);
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.control-info {
    display: grid;
    gap: 12px;
    background: rgba(6, 8, 28, 0.5);
    border-radius: 18px;
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.86);
}

.key {
    background: rgba(255, 255, 255, 0.18);
    padding: 6px 10px;
    border-radius: 8px;
    font-family: "Menlo", "Fira Code", monospace;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #fff;
}

.action {
    opacity: 0.78;
    font-weight: 500;
}

/* Level Progress */
.level-progress {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    background: rgba(6, 8, 28, 0.45);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    margin-top: auto;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    overflow: hidden;
    margin: 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--tetris-primary), var(--tetris-accent));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    text-align: left;
    opacity: 0.7;
}

.progress-text span {
    color: #ffffff;
    font-weight: 600;
}

.stage-metrics {
    display: grid;
    gap: 12px;
    background: rgba(6, 8, 28, 0.45);
    border-radius: 18px;
    padding: 18px 20px;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
}

.metric-label {
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.75rem;
    opacity: 0.7;
}

.metric-value {
    font-weight: 600;
    color: #ffffff;
}

.play-footer {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: clamp(20px, 3.5vw, 32px);
    align-items: stretch;
    width: 100%;
    margin-top: clamp(12px, 2.5vw, 24px);
}

/* Game Container */
.game-container {
    position: relative;
    /* Override global min-height:100vh to allow fitting within viewport */
    min-height: 0;
    width: clamp(360px, 46vw, 500px);
    /* Use dvh to avoid mobile address bar issues and keep canvas fully visible */
    height: clamp(320px, 70dvh, 560px);
    padding: clamp(12px, 1.8vw, 20px) clamp(14px, 2vw, 22px);
    border-radius: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(18, 20, 48, 0.95), rgba(10, 12, 32, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: var(--panel-glow);
    overflow: hidden;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    max-width: calc(100% - clamp(8px, 1vw, 16px));
    max-height: calc(100% - clamp(8px, 1vw, 16px));
    background: var(--game-bg);
    display: block;
    border-radius: 18px;
    box-shadow: inset 0 16px 32px rgba(0, 0, 0, 0.45);
}

/* Game Overlays */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(8, 10, 24, 0.9), rgba(8, 10, 24, 0.6));
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border-radius: inherit;
}

.game-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.overlay-content {
    text-align: center;
    padding: clamp(22px, 4vw, 32px);
    background: linear-gradient(160deg, rgba(16, 18, 48, 0.92), rgba(48, 24, 88, 0.65));
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: var(--panel-glow);
    backdrop-filter: blur(18px);
    max-width: 320px;
}

.overlay-title {
    font-size: 2.2rem;
    margin-bottom: 16px;
    font-weight: 700;
}

.start-screen .overlay-title {
    color: var(--tetris-primary);
    text-shadow: 0 0 10px rgba(156, 39, 176, 0.5);
}

.game-over-screen .overlay-title {
    color: #f44336;
    text-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
}

.pause-screen .overlay-title {
    color: #ff9800;
    text-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

.overlay-description {
    font-size: 1rem;
    margin: 0 auto 20px;
    opacity: 0.85;
    max-width: 260px;
}

.overlay-score,
.overlay-lines {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.85);
}

.overlay-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 22px;
}

.overlay-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 26px;
    background: linear-gradient(135deg, var(--tetris-primary), var(--tetris-secondary));
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 14px 32px rgba(156, 39, 176, 0.35);
}

.overlay-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 38px rgba(156, 39, 176, 0.45);
}

.share-btn {
    background: linear-gradient(135deg, #42a5f5, #1e88e5);
}

.share-btn:hover {
    box-shadow: 0 20px 38px rgba(33, 150, 243, 0.4);
}

/* Responsive Layout Adjustments */
@media (max-width: 1200px) {
    .play-grid {
        grid-template-columns: minmax(220px, 1fr) minmax(360px, 1.15fr) minmax(220px, 1fr);
    }
}

@media (max-width: 1024px) {
    .play-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas:
            "board board"
            "hero support";
    }

    .stage-board {
        padding: clamp(20px, 3vw, 32px);
    }

    .side-panel {
        justify-self: stretch;
    }

    .play-footer {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 820px) {
    .game-main {
        padding: clamp(28px, 6vw, 44px) clamp(16px, 4vw, 32px) clamp(40px, 7vw, 60px);
        gap: clamp(28px, 6vw, 44px);
    }

    .play-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "board"
            "hero"
            "support";
    }

    .stage-board {
        padding: clamp(18px, 5vw, 30px);
    }

    .game-controls {
        justify-content: center;
    }

    .game-container {
        width: clamp(240px, 70vw, 340px);
        height: clamp(300px, 70dvh, 520px);
    }

    .hero-highlight li {
        font-size: 0.92rem;
    }
}

@media (max-width: 640px) {
    .game-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .game-controls button {
        width: 100%;
        min-width: 0;
    }

    .mobile-row {
        gap: 8px;
    }
}



/* Mobile Controls */
.mobile-controls {
    display: grid;
    gap: 14px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 26px;
    padding: clamp(20px, 3vw, 28px);
    box-shadow: 0 26px 60px rgba(12, 6, 36, 0.4);
    backdrop-filter: blur(18px);
}

.mobile-controls h3 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ffffff;
}

.mobile-hint {
    margin: 0;
    font-size: 0.88rem;
    opacity: 0.75;
    line-height: 1.5;
}

.mobile-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.mobile-btn {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    color: var(--text-light);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mobile-btn:hover,
.mobile-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.mobile-btn.hard-drop {
    background: var(--tetris-accent);
    border-color: var(--tetris-accent);
}

.mobile-btn.hard-drop:hover {
    background: #c2185b;
}

/* Game Instructions */
.game-instructions {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 26px;
    padding: clamp(20px, 3vw, 28px);
    box-shadow: 0 26px 60px rgba(12, 6, 36, 0.4);
    backdrop-filter: blur(18px);
}

.game-instructions h3 {
    color: #ffffff;
    margin-bottom: 16px;
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.game-instructions ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.game-instructions li {
    padding-left: 20px;
    position: relative;
    font-size: 0.98rem;
    line-height: 1.5;
    opacity: 0.85;
}

.game-instructions li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tetris-primary), var(--tetris-accent));
    box-shadow: 0 0 12px rgba(233, 30, 99, 0.45);
}

/* Help Modal */
.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.help-modal.show {
    display: flex;
}

.help-content {
    background: var(--game-bg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.help-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.help-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.help-title {
    color: var(--tetris-primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.help-section {
    margin-bottom: 20px;
}

.help-section h4 {
    color: var(--tetris-primary);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.help-section p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.help-section ul {
    list-style: none;
    padding-left: 20px;
}

.help-section li {
    margin-bottom: 5px;
    position: relative;
}

.help-section li::before {
    content: "•";
    position: absolute;
    left: -15px;
    color: var(--tetris-primary);
}

/* Share Modal */
.share-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.share-modal.show {
    display: flex;
}

.share-content {
    background: var(--game-bg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    position: relative;
}

.share-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.share-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.share-title {
    color: var(--tetris-primary);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.share-score {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border: none;
    border-radius: var(--border-radius);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.share-btn.twitter {
    background: #1da1f2;
}

.share-btn.facebook {
    background: #4267b2;
}

.share-btn.whatsapp {
    background: #25d366;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

@media (max-width: 768px) {
    .game-title {
        font-size: 1.4rem;
    }

    .header-content {
        padding: 0 16px;
    }

    .back-home-btn span,
    .help-btn span {
        display: none;
    }

    .hero-heading {
        font-size: 2rem;
    }

    .game-stats {
        gap: 12px;
    }

    .stat-box {
        padding: 14px;
    }

    .game-controls {
        align-items: stretch;
        gap: 10px;
    }

    .game-controls button {
        padding: 10px 18px;
        font-size: 14px;
    }

    .side-panel {
        padding: clamp(18px, 6vw, 26px);
    }

    .stage-board {
        padding: clamp(16px, 6vw, 28px);
    }

    .play-footer {
        gap: clamp(16px, 5vw, 28px);
    }

    .mobile-controls,
    .game-instructions {
        padding: clamp(18px, 5vw, 26px);
    }

    .mobile-row {
        gap: 6px;
    }

    .mobile-btn {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.25rem;
    }

    .hero-heading {
        font-size: 1.75rem;
    }

    .stat-box {
        padding: 12px;
    }

    .game-controls button {
        padding: 10px 16px;
        font-size: 13px;
    }

    .mobile-controls {
        gap: 12px;
    }

    .mobile-controls h3 {
        font-size: 0.95rem;
    }

    .mobile-hint {
        font-size: 0.82rem;
    }

    .mobile-btn {
        padding: 10px;
        font-size: 12px;
    }

    .game-container {
        width: clamp(220px, 85vw, 300px);
        height: clamp(280px, 70dvh, 420px);
    }

    .overlay-title {
        font-size: 1.8rem;
    }
}

/* Animation Effects */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.stat-value.updated {
    animation: pulse 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-overlay.visible {
    animation: fadeIn 0.3s ease;
}

@keyframes lineCleared {
    0% { background-color: white; }
    50% { background-color: var(--tetris-accent); }
    100% { background-color: transparent; }
}

.line-clear-effect {
    animation: lineCleared 0.5s ease;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --tetris-primary: #ff00ff;
        --tetris-secondary: #00ffff;
        --text-light: #ffffff;
        --game-bg: #000000;
    }
}

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