/* Loading Screen */
.loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(7,9,18,.96), rgba(10,15,33,.96));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity .25s ease;
}
.loading-logo { width: 120px; height: auto; animation: pulse 1.6s ease-in-out infinite; filter: drop-shadow(0 0 18px rgba(0,229,255,.35)); }
.loading-text { margin-top: 1rem; color: var(--text-secondary); letter-spacing: .5px; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Tema escuro (neon) */
    --bg-primary: #080a12;
    --bg-secondary: #0e1220;
    --bg-tertiary: #131833;
    --text-primary: #e6f1ff;
    --text-secondary: #99a3b0;
    --text-accent: #00f0ff;
    --neon-pink: #ff3b9d;
    --neon-orange: #ff7b00;
    --neon-yellow: #ffd166;
    --neon-purple: #8a5cff;
    --neon-blue: #3aa0ff;
    --neon-cyan: #00e5ff;
    --neon-green: #06ffa5;
    --border-color: #27304d;
    --shadow-neon: 0 0 20px rgba(0, 229, 255, 0.45), 0 0 40px rgba(0, 229, 255, 0.15);
    --shadow-glow: 0 0 12px rgba(58, 160, 255, 0.18);
}

[data-theme="light"] {
    --bg-primary: #f5f8ff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #edf2ff;
    --text-primary: #1c2333;
    --text-secondary: #657196;
    --text-accent: #1463ff;
    --border-color: #d6defa;
    --shadow-neon: 0 0 18px rgba(20, 99, 255, 0.25), 0 0 36px rgba(20, 99, 255, 0.12);
    --shadow-glow: 0 0 10px rgba(20, 99, 255, 0.12);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(1200px 800px at 15% 10%, rgba(58, 160, 255, 0.08), transparent 60%),
                radial-gradient(1000px 700px at 85% 30%, rgba(255, 59, 157, 0.06), transparent 55%),
                linear-gradient(180deg, #070912 0%, #0a0f21 60%, #070912 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Scanlines sutis para vibe arcade */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.015) 0px,
        rgba(255, 255, 255, 0.015) 1px,
        transparent 2px,
        transparent 4px
    );
    mix-blend-mode: overlay;
    z-index: 0;
}

/* Ajustes de fundo para tema claro */
[data-theme="light"] body {
    background: radial-gradient(1200px 800px at 15% 10%, rgba(20, 99, 255, 0.06), transparent 60%),
                radial-gradient(1000px 700px at 85% 30%, rgba(255, 59, 157, 0.05), transparent 55%),
                linear-gradient(180deg, #f8fbff 0%, #eef3ff 60%, #f8fbff 100%);
}

[data-theme="light"] body::before {
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.02) 0px,
        rgba(0, 0, 0, 0.02) 1px,
        transparent 2px,
        transparent 4px
    );
}

/* Header */
.app-header {
    padding: 1rem;
    background: linear-gradient(180deg, rgba(14, 18, 32, 0.95), rgba(14, 18, 32, 0.8));
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-glow);
}

/* Header claro */
[data-theme="light"] .app-header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    border-bottom-color: var(--border-color);
}

.neon-title {
    font-size: 1.5rem;
    color: var(--text-accent);
    text-shadow: var(--shadow-neon);
    font-weight: bold;
}

/* Logo no header */
.header-logo { display: flex; align-items: center; gap: 0.5rem; }
.header-logo img { height: 28px; width: auto; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-cyan));
    color: var(--bg-primary);
    box-shadow: var(--shadow-neon);
    transform: translateY(-1px) scale(1.05);
}

.lang-text {
    font-weight: bold;
    font-size: 0.8rem;
}

/* Main content */
.app-main {
    flex: 1;
    position: relative;
    padding-bottom: 80px;
}

.screen {
    display: none;
    min-height: calc(100vh - 160px);
    padding: 1rem;
}

.screen.active {
    display: block;
}

.screen-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Home screen */
.home-content {
    text-align: center;
    padding: 2rem 0;
}

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

.game-logo { margin-bottom: 1rem; display: flex; align-items: center; justify-content: center; }
.game-logo img { max-width: 240px; width: 60%; height: auto; filter: drop-shadow(0 0 12px rgba(0,229,255,.35)); }

@keyframes neonGlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.game-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 300px;
    margin: 0 auto;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 50px;
}

.menu-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--neon-cyan);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.menu-btn.primary {
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-cyan));
    border-color: var(--neon-blue);
    color: white;
}

/* Botão primário no tema claro com contraste melhor */
[data-theme="light"] .menu-btn.primary {
    background: linear-gradient(135deg, #2b74ff, #00cfff);
    border-color: #2b74ff;
}
[data-theme="light"] .menu-btn.primary:hover {
    background: linear-gradient(135deg, #00cfff, #2b74ff);
    border-color: #00cfff;
}

.menu-btn.primary:hover {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    border-color: var(--neon-cyan);
    box-shadow: var(--shadow-neon);
}

.menu-btn.danger {
    background: var(--neon-pink);
    border-color: var(--neon-pink);
    color: white;
}

.menu-btn.danger:hover {
    background: #ff3399;
    border-color: #ff3399;
    box-shadow: 0 0 20px rgba(255, 0, 110, 0.5);
}

/* Game screen */
.game-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 2rem;
}

/* Modo jogo em andamento: HUD compacto e mais espaço útil */
.is-playing .app-header,
.is-playing .bottom-nav {
    display: none !important;
}

.is-playing .game-container {
    position: relative;
    gap: 1rem;
}

.is-playing .game-info {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: row;
    gap: 6px;
    width: auto;
    background: none;
    padding: 0;
}

.is-playing .info-panel {
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.25);
    box-shadow: none;
    min-width: auto;
}

.is-playing .info-panel h3 {
    display: none;
}

.is-playing .score-value,
.is-playing .level-value,
.is-playing .lines-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: none;
}

/* Em telas pequenas, HUD ainda menor */
@media (max-width: 480px) {
    .is-playing .game-info { top: 6px; right: 6px; gap: 4px; }
    .is-playing .info-panel { padding: 3px 5px; border-radius: 5px; }
    .is-playing .score-value,
    .is-playing .level-value,
    .is-playing .lines-value { font-size: 0.85rem; }
}

/* Em telas grandes durante o jogo, mostrar game-info ao lado do tabuleiro */
@media (min-width: 992px) {
    .is-playing .game-container {
        flex-direction: row;
        align-items: flex-start;
        gap: 1.5rem;
    }
    .is-playing .game-area { order: 0; }
    .is-playing .game-info {
        position: static;
        order: 1;
        display: flex;
        flex-direction: column;
        width: 240px;
        gap: 0.75rem;
        background: transparent;
        padding: 0;
    }
    .is-playing .info-panel {
        background: var(--bg-secondary);
        border: 2px solid var(--border-color);
        border-radius: 12px;
        padding: 0.75rem;
        box-shadow: var(--shadow-glow);
    }
    .is-playing .info-panel h3 { display: block; font-size: 0.8rem; margin-bottom: 0.4rem; }
    .is-playing .score-value,
    .is-playing .level-value,
    .is-playing .lines-value { font-size: 1.3rem; text-shadow: none; }
    /* Card Próxima volta a ser estático ao lado */
    .is-playing .game-info .info-panel.next-piece { position: static; backdrop-filter: none; border-color: var(--border-color); }
    .is-playing .info-panel.next-piece canvas { width: 80px; height: 80px; }
}

.game-area {
    position: relative;
    background: linear-gradient(180deg, rgba(14, 18, 32, 0.9), rgba(14, 18, 32, 0.75));
    border: 3px solid var(--neon-cyan);
    border-radius: 12px;
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.1), var(--shadow-neon);
    padding: 1rem;
}

/* Game area clara */
[data-theme="light"] .game-area {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 255, 0.9));
    border-color: #a8c4ff;
    box-shadow: 0 0 0 2px rgba(20, 99, 255, 0.08), var(--shadow-neon);
}

#game-canvas {
    display: block;
    background: radial-gradient(600px 300px at 50% -20%, rgba(0, 229, 255, 0.06), transparent 60%), var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

/* Botão de pausa flutuante */
.pause-btn {
    position: absolute;
    top: 639px;
    right: -3px;
    z-index: 6;
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-primary);
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 10px;
    width: 50px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(3px);
}
.pause-btn:hover { box-shadow: var(--shadow-neon); transform: translateY(-1px); }

/* Overlay de pausa aproveita estilos do game-overlay */
.pause-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), rgba(0,0,0,0.6));
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 7;
}

/* Canvas claro */
[data-theme="light"] #game-canvas {
    background: radial-gradient(700px 350px at 50% -20%, rgba(43, 116, 255, 0.08), transparent 65%), #ffffff;
    border-color: var(--border-color);
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.75));
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(6px);
}

.overlay-content {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(180deg, var(--bg-secondary), rgba(14, 18, 32, 0.8));
    border: 2px solid var(--neon-cyan);
    border-radius: 16px;
    box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.15), var(--shadow-neon);
    max-width: 520px;
    width: 92%;
    animation: modalIn 0.3s ease;
}

/* Ajustes específicos para o modal de compartilhamento */
#share-modal .overlay-content {
    max-width: 640px;
}

#share-modal .overlay-buttons {
    justify-content: center;
}

#share-modal .menu-btn {
    min-width: 140px;
}

.overlay-content h3 {
    font-size: 2.2rem;
    color: var(--neon-cyan);
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.overlay-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.overlay-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Botões do modal ocupam largura inteira em telas pequenas */
@media (max-width: 480px) {
    .overlay-buttons .menu-btn {
        width: 100%;
    }
}

/* Animação de entrada do modal */
@keyframes modalIn {
    0% { opacity: 0; transform: translateY(10px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 150px;
}

.info-panel {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow-glow);
}

.info-panel h3 {
    font-size: 0.9rem;
    color: var(--neon-blue);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

[data-theme="light"] .info-panel h3 {
    color: #2b74ff;
}

.score-value, .level-value, .lines-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--neon-cyan);
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.6), 0 0 18px rgba(0, 229, 255, 0.3);
}
[data-theme="light"] .score-value, 
[data-theme="light"] .level-value, 
[data-theme="light"] .lines-value {
    color: #2b74ff;
    text-shadow: 0 0 6px rgba(43, 116, 255, 0.35), 0 0 14px rgba(43, 116, 255, 0.2);
}

.next-piece canvas {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 0.5rem;
}

/* Mobile controls */
.mobile-controls {
    display: none;
    padding: 1rem;
    background: linear-gradient(180deg, rgba(14, 18, 32, 0.95), rgba(14, 18, 32, 0.85));
    border-top: 2px solid var(--border-color);
    position: fixed;
    bottom: 130px;
    left: 0;
    right: 0;
    z-index: 50;
}

[data-theme="light"] .mobile-controls {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-btn {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    min-width: 60px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.control-btn:hover,
.control-btn:active {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    color: var(--bg-primary);
    box-shadow: var(--shadow-neon);
    transform: scale(0.95);
}
[data-theme="light"] .control-btn:hover,
[data-theme="light"] .control-btn:active {
    background: linear-gradient(135deg, #2b74ff, #00cfff);
}

.control-btn.drop {
    background: var(--neon-orange);
    border-color: var(--neon-orange);
    color: white;
}

.control-btn.drop:hover,
.control-btn.drop:active {
    background: var(--neon-yellow);
    border-color: var(--neon-yellow);
}

/* Instructions */
.instructions-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.instruction-section h3 {
    color: var(--neon-cyan);
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.controls-list, .scoring-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-item, .score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.key {
    background: var(--bg-tertiary);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    color: var(--neon-cyan);
    border: 1px solid var(--border-color);
}

.lines {
    font-weight: bold;
}

.points {
    color: var(--neon-yellow);
    font-weight: bold;
}

/* Scores */
.scores-content {
    margin-bottom: 2rem;
}

.scores-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-title { font-size: 0.8rem; color: var(--text-secondary); }
.summary-value { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }

.scores-list {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
    min-height: 200px;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

.score-entry:last-child {
    border-bottom: none;
}

.score-entry:hover {
    background: var(--bg-tertiary);
}

.score-rank {
    font-weight: bold;
    color: var(--neon-yellow);
    font-size: 1.2rem;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255, 209, 102, 0.15), rgba(255, 183, 3, 0.1));
    border: 1px solid rgba(255, 209, 102, 0.35);
    border-radius: 8px;
    padding: 4px 8px;
}

.score-details {
    flex: 1;
    margin-left: 1rem;
}

.score-points {
    font-weight: bold;
    color: var(--neon-cyan);
    font-size: 1.1rem;
}

.score-level {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.no-scores {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
}

@media (max-width: 600px) {
    .scores-summary { grid-template-columns: 1fr; }
}

/* Settings */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
}

.setting-item label {
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
    margin: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 30px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .toggle-slider {
    background: var(--neon-cyan);
    border-color: var(--neon-cyan);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
    background: white;
}

.setting-select {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    min-width: 150px;
}

.setting-select:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: var(--shadow-neon);
}

/* FAQ */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.faq-item {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: var(--neon-cyan);
    box-shadow: var(--shadow-glow);
}

.faq-question {
    width: 100%;
    padding: 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.faq-question:hover {
    background: var(--bg-tertiary);
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--neon-cyan);
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1rem 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    animation: fadeIn 0.3s ease;
}

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

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(14, 18, 32, 0.98), rgba(14, 18, 32, 0.9));
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .bottom-nav {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.9));
    border-top-color: var(--border-color);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    border-radius: 8px;
    min-width: 60px;
}

.nav-item:hover,
.nav-item.active {
    color: var(--neon-cyan);
    background: linear-gradient(135deg, rgba(19, 24, 51, 0.9), rgba(39, 48, 77, 0.6));
    transform: translateY(-2px);
    box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.15), 0 0 12px rgba(0, 229, 255, 0.25);
}
[data-theme="light"] .nav-item:hover,
[data-theme="light"] .nav-item.active {
    color: #2b74ff;
    background: linear-gradient(135deg, rgba(226, 235, 255, 0.95), rgba(210, 226, 255, 0.65));
    box-shadow: 0 0 0 1px rgba(43, 116, 255, 0.18), 0 0 12px rgba(43, 116, 255, 0.25);
}

.nav-item i {
    font-size: 1.2rem;
}

/* Footer */
footer {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    /* Sempre visível */
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 110;
    backdrop-filter: blur(6px);
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-left .brand { color: var(--text-primary); font-weight: 600; }
.footer-left .separator { opacity: 0.5; }
.footer-left .by { color: var(--text-secondary); }

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--neon-cyan);
    text-decoration: underline;
}

.footer-links { display: flex; gap: 0.75rem; }
.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: 1px solid transparent;
}
.footer-links a:hover {
    color: var(--neon-cyan);
    border-color: var(--border-color);
    background: rgba(0,0,0,0.08);
}

@media (max-width: 600px) {
    .footer-inner { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .footer-left { justify-content: center; }
    .footer-links { justify-content: center; flex-wrap: wrap; }
}

/* Footer sempre acima da bottom-nav */
footer { 
    bottom: 70px; 
}

/* Durante o jogo (bottom-nav oculta), footer gruda no fundo */
.is-playing footer { 
    bottom: 0; 
}

/* Responsive design */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        align-items: center;
    }
    
    .game-info {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        order: 0; /* Mostrar acima do tabuleiro */
        margin-bottom: 0.75rem;
    }
    
    .info-panel {
        min-width: 120px;
        flex-shrink: 0;
    }
    
    .game-area {
        order: 1; /* Tabuleiro abaixo dos cards */
    }
    
    .mobile-controls {
        display: block;
    }
    
    #game-canvas {
        max-width: 100%;
        height: auto;
    }
    
    .game-logo {
        font-size: 2rem;
    }
    
    .overlay-buttons {
        flex-direction: column;
    }
    
    .controls-list,
    .scoring-list {
        gap: 0.3rem;
    }
    
    .control-item,
    .score-item {
        font-size: 0.9rem;
        padding: 0.4rem;
    }
    
    .setting-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .setting-select {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 0.5rem;
    }
    
    .neon-title {
        font-size: 1.2rem;
    }
    
    .header-controls {
        gap: 0.3rem;
    }
    
    .icon-btn {
        padding: 0.4rem;
        min-width: 35px;
        min-height: 35px;
    }
    
    .screen {
        padding: 0.5rem;
    }
    
    .screen-content {
        padding: 0.5rem;
    }
    
    .game-logo {
        font-size: 1.8rem;
    }
    
    .menu-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    /* Controles em linha, compactos */
    .mobile-controls {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0.5rem;
        padding: 0.5rem;
        bottom: 130px; /* um pouco acima da bottom-nav */
        backdrop-filter: blur(6px);
    }

    .control-row {
        display: contents; /* usa o grid do contêiner */
        gap: 0;
        margin: 0;
    }

    .control-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.6rem;
        border-radius: 10px;
    }

    /* Ordem em linha: esquerda, baixo, direita, girar, drop */
    #left-btn { order: 1; }
    #down-btn { order: 2; }
    #right-btn { order: 3; }
    #rotate-btn { order: 4; }
    #drop-btn { order: 5; }

    /* Garante que o jogo não fique coberto pelos controles */
    .app-main { padding-bottom: 160px; }

    /* Cards de estatísticas compactos */
    .game-info {
        gap: 0.5rem;
    }
    .info-panel {
        padding: 0.5rem;
        border-radius: 8px;
        min-width: 84px;
    }
    .info-panel h3 {
        font-size: 0.7rem;
        margin-bottom: 0.25rem;
        letter-spacing: 0.5px;
    }
    .score-value, .level-value, .lines-value {
        font-size: 1.1rem;
        text-shadow: none;
    }

    /* Em telas pequenas, game-info logo abaixo do tabuleiro */
    .game-container { flex-direction: column; align-items: center; gap: 0.75rem; position: relative; }
    .game-area { order: 0; }
    /* Cards organizados em 3 colunas; Próxima como overlay dentro da área do jogo */
    .game-info { order: 1; width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .game-info .info-panel:not(.next-piece) { grid-column: auto; }
    .game-info .info-panel.next-piece {
        position: absolute;
        top: 1px;
        left: 26px;
        z-index: 5;
        background: rgba(0, 0, 0, 0.28);
        border: 1px solid rgba(0, 229, 255, 0.35);
        backdrop-filter: blur(3px);
        border-radius: 10px;
        padding: 6px;
    }
    .game-info .info-panel { display: flex; flex-direction: column; align-items: center; text-align: center; }
    .info-panel { min-width: 0; }
    .info-panel.next-piece canvas { width: 56px; height: 56px; }

    /* Sobrescreve HUD compacto do modo is-playing para ficar estático abaixo do canvas */
    .is-playing .game-info { position: static; top: auto; right: auto; gap: 0.5rem; padding: 0; background: none; }
    .is-playing .info-panel { background: rgba(0,0,0,0.18); }
    .is-playing .game-info .info-panel.next-piece { background: rgba(0, 0, 0, 0.32); border-color: rgba(0, 229, 255, 0.45); }
    /* Reexibir títulos no modo jogando em telas pequenas e diminuir tamanho */
    .is-playing .info-panel h3 { display: block; font-size: 0.65rem; margin-bottom: 2px; letter-spacing: 0.4px; }
}

/* Animações de linha completa */
@keyframes lineComplete {
    0% { background: var(--neon-yellow); }
    50% { background: var(--neon-pink); }
    100% { background: transparent; }
}

.line-complete {
    animation: lineComplete 0.5s ease-in-out;
}

/* Animações de level up */
@keyframes levelUp {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: var(--neon-yellow); }
    100% { transform: scale(1); }
}

.level-up {
    animation: levelUp 0.8s ease-in-out;
}

/* Estados de loading */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Tema claro específico */
[data-theme="light"] .game-logo {
    background: linear-gradient(45deg, #e91e63, #2196f3, #ff9800);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="light"] .neon-title {
    color: var(--text-accent);
    text-shadow: none;
}

[data-theme="light"] .score-value,
[data-theme="light"] .level-value,
[data-theme="light"] .lines-value {
    color: var(--text-accent);
    text-shadow: none;
}
