/* Tetris Game Styles */

:root {
    --primary: #003366;
    --primary-light: #0077B6;
    --secondary: #28a745;
    --accent: #ffc107;
    --background: #ffffff;
    --muted: #f8f9fa;
    --text: #1a1a1a;
    --text-light: #6b7280;
    --border: #e9ecef;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tetris-card {
    background: #fff;
    padding: 0;
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 500px;
}

.tetris-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: relative;
    max-height: 500px;
    overflow: hidden;
}

.tetris-main {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.6rem;
    background: linear-gradient(135deg, #0a0e27 0%, #0d0d0d 100%);
    flex: 1;
    overflow: hidden;
}

.tetris-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    min-height: 0;
}

#tetrisCanvas {
    display: block;
    background: #000;
    border: 1px solid var(--primary);
    border-radius: 3px;
    box-shadow: 0 0 8px rgba(0, 51, 102, 0.3);
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    transition: filter 0.15s ease;
}

.tetris-sidebar {
    display: flex;
    gap: 0.2rem;
    width: 100%;
    height: auto;
}

.tetris-info-block {
    flex: 1;
    text-align: center;
    background: rgba(0, 51, 102, 0.3);
    padding: 0.2rem;
    border-radius: 3px;
    border: 1px solid rgba(0, 119, 182, 0.3);
}

.tetris-info-label {
    font-size: 0.52rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0rem;
    font-weight: 700;
    line-height: 1;
}

.tetris-info-value {
    font-size: 0.92rem;
    font-weight: bold;
    color: var(--accent);
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px rgba(255, 193, 7, 0.25);
    line-height: 1;
}

.tetris-level-block {
    flex: 1;
    text-align: center;
    background: rgba(0, 119, 182, 0.2);
    padding: 0.2rem;
    border-radius: 3px;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.tetris-level-value {
    font-size: 0.92rem;
    font-weight: bold;
    color: var(--secondary);
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px rgba(40, 167, 69, 0.25);
    line-height: 1;
}

.tetris-next-block {
    flex: 1;
    text-align: center;
    background: rgba(0, 51, 102, 0.3);
    padding: 0.2rem;
    border-radius: 3px;
    border: 1px solid rgba(0, 119, 182, 0.3);
    min-height: 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
}

.tetris-next-label {
    font-size: 0.42rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0;
    font-weight: 700;
    line-height: 1;
}

#tetrisNext {
    display: block;
    background: #000;
    border: 1px solid var(--primary-light);
    border-radius: 2px;
    width: 32px;
    height: 32px;
}

.tetris-buttons {
    display: flex;
    gap: 0.15rem;
    width: 100%;
    height: auto;
}

.tetris-btn {
    flex: 1;
    padding: 0.25rem 0.2rem;
    border: none;
    border-radius: 3px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    line-height: 1;
}

.tetris-btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
}

.tetris-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 119, 182, 0.4);
}

.tetris-btn-primary:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.tetris-btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #218838 100%);
    color: #fff;
}

.tetris-btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(40, 167, 69, 0.4);
}

.tetris-btn-secondary:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.tetris-stats {
    display: flex;
    gap: 0.15rem;
    width: 100%;
    height: auto;
}

.tetris-stat-item {
    flex: 1;
    text-align: center;
    background: rgba(0, 51, 102, 0.3);
    padding: 0.2rem;
    border-radius: 3px;
    border: 1px solid rgba(0, 119, 182, 0.3);
    font-size: 0.58rem;
    color: var(--text);
    font-weight: 600;
    line-height: 1;
}

.tetris-stat-item span {
    display: block;
    font-size: 0.87rem;
    color: var(--accent);
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px rgba(255, 193, 7, 0.25);
    margin-top: 0rem;
    line-height: 1;
}

.tetris-controls {
    text-align: center;
    padding: 0.6rem;
    background: #fff;
    width: 100%;
    font-size: 0.7rem;
    color: var(--text);
    line-height: 1.3;
    border-top: 1px solid var(--border);
}

.tetris-controls strong {
    color: var(--primary);
    font-weight: 700;
    display: block;
    margin-bottom: 0.2rem;
}

/* Main Menu */
.tetris-menu {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #0a0e27 0%, #0d0d0d 100%);
    gap: 0.8rem;
    width: 100%;
    height: 100%;
}

.tetris-menu.active {
    display: flex;
}

.tetris-game-screen {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.tetris-menu-subtitle {
    font-size: 0.8rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tetris-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.tetris-menu-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    box-shadow: 0 3px 10px rgba(0, 51, 102, 0.3);
}

.tetris-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 119, 182, 0.4);
}

.tetris-mode-name {
    font-size: 0.95rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    margin-bottom: 0.2rem;
}

.tetris-mode-desc {
    font-size: 0.75rem;
    opacity: 0.9;
}

.tetris-menu-stats {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.tetris-menu-stat {
    background: rgba(0, 51, 102, 0.3);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    color: #fff;
    font-size: 0.75rem;
    border: 1px solid rgba(0, 119, 182, 0.3);
}

.tetris-menu-stat span {
    display: block;
    font-size: 1rem;
    color: var(--accent);
    font-weight: bold;
    margin-top: 0.2rem;
    font-family: 'Courier New', monospace;
}

/* Pause Menu */
.tetris-pause-menu {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
}

.tetris-pause-menu.hidden {
    display: none;
}

.tetris-pause-content {
    background: linear-gradient(135deg, #0a0e27 0%, #0d0d0d 100%);
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 0.8rem;
    max-width: 240px;
    box-shadow: 0 0 20px rgba(0, 51, 102, 0.5);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.tetris-pause-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.3);
    letter-spacing: 1px;
    text-align: center;
}

.tetris-pause-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    width: 100%;
}

.tetris-pause-stat {
    background: rgba(0, 51, 102, 0.3);
    padding: 0.5rem;
    border-radius: 5px;
    color: #fff;
    text-align: center;
    font-size: 0.65rem;
    border: 1px solid rgba(0, 119, 182, 0.3);
}

.tetris-pause-stat span {
    display: block;
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: bold;
    margin-top: 0.15rem;
    font-family: 'Courier New', monospace;
}

.tetris-pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}

/* Dark theme */
[data-theme="dark"] .tetris-card {
    background: #0f172a;
}

[data-theme="dark"] .tetris-info-block {
    background: rgba(0, 119, 182, 0.15);
}

[data-theme="dark"] .tetris-level-block {
    background: rgba(40, 167, 69, 0.15);
}

[data-theme="dark"] .tetris-next-block {
    background: rgba(0, 119, 182, 0.15);
}

[data-theme="dark"] .tetris-stat-item {
    background: rgba(0, 119, 182, 0.15);
    color: #fff;
}

[data-theme="dark"] .tetris-controls {
    background: #0f172a;
    color: #fff;
    border-color: var(--border);
}

[data-theme="dark"] .tetris-menu-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

[data-theme="dark"] .tetris-menu-stat {
    background: rgba(0, 119, 182, 0.15);
    color: #fff;
}

[data-theme="dark"] .tetris-pause-stat {
    background: rgba(0, 119, 182, 0.15);
    color: #fff;
}

/* Settings Modal */
.tetris-settings-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    border-radius: 8px;
}

.tetris-settings-modal.hidden {
    display: none;
}

.tetris-settings-content {
    background: linear-gradient(135deg, #0a0e27 0%, #0d0d0d 100%);
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 1.2rem;
    max-width: 280px;
    box-shadow: 0 0 30px rgba(0, 51, 102, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: settingsSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
}

@keyframes settingsSlideIn {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tetris-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid rgba(0, 119, 182, 0.4);
    background: linear-gradient(90deg, rgba(0, 119, 182, 0.1), transparent);
    padding: 0 0.5rem 0.8rem 0.5rem;
    margin: -1.2rem -1.2rem 1rem -1.2rem;
    padding-left: 1.2rem;
    padding-right: 1.2rem;
}

.tetris-settings-header h3 {
    margin: 0;
    color: var(--accent);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.2);
}

.tetris-settings-header button:hover {
    transform: rotate(90deg) scale(1.2);
    transition: all 0.3s ease;
    color: #ff6b6b;
}

.tetris-settings-group {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 119, 182, 0.2);
    font-size: 0.7rem;
    color: #fff;
}

.tetris-settings-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.tetris-settings-group label {
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.tetris-settings-group label:hover {
    color: var(--accent);
    transform: translateX(4px);
}

.tetris-settings-group input[type="radio"],
.tetris-settings-group input[type="checkbox"] {
    margin-right: 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tetris-settings-group input[type="radio"]:checked,
.tetris-settings-group input[type="checkbox"]:checked {
    transform: scale(1.2);
}

[data-theme="light"] .tetris-settings-content {
    background: linear-gradient(135deg, #e8ecf1 0%, #f0f2f5 100%);
    border-color: #003366;
    box-shadow: 0 0 30px rgba(0, 51, 102, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    color: var(--text);
}

[data-theme="light"] .tetris-settings-header {
    border-color: rgba(0, 119, 182, 0.5);
    background: linear-gradient(90deg, rgba(0, 119, 182, 0.15), transparent);
}

[data-theme="light"] .tetris-settings-header h3 {
    color: #003366;
}

[data-theme="light"] .tetris-settings-group {
    border-color: rgba(0, 119, 182, 0.3);
    color: var(--text);
}

[data-theme="light"] .tetris-settings-group label:hover {
    color: #003366;
}

/* Mobile devices - hide tetris */
@media (max-width: 768px) {
    .tetris-card {
        display: none;
    }
}

/* Animations for game events */
@keyframes scorePopup {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.3);
    }
}

@keyframes lineFlash {
    0% {
        background: rgba(0, 255, 0, 0.3);
    }
    50% {
        background: rgba(0, 255, 0, 0.8);
    }
    100% {
        background: rgba(0, 0, 0, 0);
    }
}

@keyframes comboGlow {
    0% {
        box-shadow: 0 0 0 rgba(255, 193, 7, 0.5);
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 193, 7, 0.8);
    }
    100% {
        box-shadow: 0 0 0 rgba(255, 193, 7, 0.5);
    }
}

@keyframes levelUp {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.tetris-animate-score {
    animation: scorePopup 0.6s ease-out;
}

.tetris-animate-line {
    animation: lineFlash 0.4s ease-out;
}

.tetris-animate-combo {
    animation: comboGlow 0.5s ease-in-out;
}

.tetris-animate-level {
    animation: levelUp 0.5s ease-out;
}
