/* Outskirts Tetris WordPress Plugin Styles */

.outskirts-tetris-container {
    font-family: 'Arial', sans-serif;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    width: 100%;
    max-width: 100%;
}

.tetris-game-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 1200px;
    min-width: 600px;
}

/* Main game area with horizontal layout */
.game-main-section {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
    max-width: 1000px;
}

.game-area {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-canvas {
    border: 3px solid #4a90e2;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(74, 144, 226, 0.3);
    background: #0a0a0a;
    display: block;
    max-width: 100%;
    height: auto;
}

.ui-panel {
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid #4a90e2;
    border-radius: 10px;
    padding: 20px;
    min-width: 200px;
    max-width: 250px;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.next-piece h3, .hold-piece h3 {
    margin: 0 0 10px 0;
    color: #4a90e2;
    font-size: 16px;
}

.next-canvas, .hold-canvas {
    border: 2px solid #4a90e2;
    border-radius: 5px;
    background: #0a0a0a;
    display: block;
    margin: 0 auto; /* center canvases horizontally */
}

.hold-piece {
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Center the next/hold tile sections within the UI panel */
.ui-panel .next-piece,
.ui-panel .hold-piece {
    display: flex;
    flex-direction: column;
    align-items: center; /* horizontally center children (canvas) */
}

.stats {
    margin-bottom: 20px;
}

.stat-item {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.stat-label {
    color: #888;
    font-size: 14px;
}

.stat-value {
    color: #4a90e2;
    font-weight: bold;
    font-size: 16px;
}

.performance {
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

.performance h3 {
    margin: 0 0 10px 0;
    color: #4a90e2;
    font-size: 14px;
}

.controls {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.controls h3 {
    margin: 0 0 10px 0;
    color: #4a90e2;
    font-size: 14px;
}

.control-item {
    font-size: 12px;
    margin-bottom: 5px;
    color: #ccc;
}

.game-over-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #e74c3c;
    z-index: 1000;
}

.game-over-overlay h2 {
    color: #e74c3c;
    margin: 0 0 20px 0;
}

.restart-btn, .save-score-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
    margin: 5px;
}

.restart-btn:hover, .save-score-btn:hover {
    background: #357abd;
}

.save-score-btn.saved {
    background: #4CAF50;
    cursor: default;
    opacity: 0.8;
}

.save-score-btn:disabled {
    background: #9e9e9e;
    cursor: not-allowed;
    opacity: 0.6;
}

.pause-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #4a90e2;
    z-index: 1000;
}

.pause-overlay h2 {
    color: #4a90e2;
    margin: 0 0 20px 0;
}

.game-logo {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(26, 26, 46, 0.6);
    border: 2px solid #4a90e2;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.logo-main {
    font-size: 32px;
    font-weight: bold;
    color: #4a90e2;
    text-shadow: 0 0 20px rgba(74, 144, 226, 0.8);
    margin: 0;
    letter-spacing: 3px;
    animation: logoGlow 3s ease-in-out infinite;
}

.logo-sub {
    font-size: 18px;
    color: #ffffff;
    margin: 5px 0 0 0;
    font-weight: 300;
    letter-spacing: 2px;
}

.logo-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: #4a90e2;
    margin-right: 10px;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.6);
}

@keyframes logoGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(74, 144, 226, 0.8); }
    50% { text-shadow: 0 0 30px rgba(74, 144, 226, 1), 0 0 40px rgba(74, 144, 226, 0.6); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(74, 144, 226, 0.5); }
    50% { box-shadow: 0 0 40px rgba(74, 144, 226, 0.8); }
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tetris-game-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        min-width: auto;
        width: 95%;
        padding: 15px;
    }
    
    .game-main-section {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .ui-panel {
        min-width: 300px;
        max-width: 100%;
        order: -1;
    }
    
    .game-canvas {
        width: 100%;
        max-width: 300px;
        height: auto;
    }
    
    .logo-main {
        font-size: 24px;
    }
    
    .logo-sub {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .tetris-game-wrapper {
        padding: 10px;
    }
    
    .ui-panel {
        min-width: 280px;
        padding: 15px;
    }
    
    .game-canvas {
        max-width: 280px;
    }
    
    .logo-main {
        font-size: 20px;
    }
}

/* Theme Variations */
.outskirts-tetris-container[data-theme="light"] .tetris-game-wrapper {
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0, #d0d0d0);
    color: #333;
}

.outskirts-tetris-container[data-theme="light"] .ui-panel {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.outskirts-tetris-container[data-theme="light"] .stat-label {
    color: #666;
}

.outskirts-tetris-container[data-theme="light"] .control-item {
    color: #555;
}

/* Elementor Compatibility */
.elementor-widget-container .outskirts-tetris-container {
    width: 100%;
}

.elementor-widget-container .tetris-game-wrapper {
    max-width: 100%;
}

/* Gutenberg Block Compatibility */
.wp-block .outskirts-tetris-container {
    width: 100%;
}

/* Focus styles for accessibility */
.restart-btn:focus, .save-score-btn:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Loading state */
.outskirts-tetris-container.loading {
    opacity: 0.7;
    pointer-events: none;
}

.outskirts-tetris-container.loading::after {
    content: "Loading...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #4a90e2;
    font-size: 18px;
    font-weight: bold;
}

/* Start Screen Overlay */
.start-screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(20, 20, 40, 0.95) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 1000;
}

.start-content {
    text-align: center;
    max-width: 400px;
    padding: 20px;
}

/* Language flags */
.language-selector {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px; /* spacing above Start Game button */
}
.language-selector .lang-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 4px;
    line-height: 1;
    font-size: 32px; /* approx 2x larger */
    cursor: pointer;
    border-radius: 8px;
}
.language-selector .lang-btn[aria-pressed="true"] {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    background: rgba(102, 126, 234, 0.15);
}

.start-title {
    font-size: 2.5em;
    margin-bottom: 30px;
    color: #667eea;
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    font-weight: bold;
}

.start-game-btn {
    padding: 15px 40px;
    font-size: 1.3em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
}

.start-game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Enhanced High Score Display */
.scores-list {
    max-height: 150px;
    overflow-y: auto;
    overflow-x: hidden; /* prevent horizontal scrolling in score lists */
}

/* Use more space for the preview list on the start screen */
.start-screen-overlay #scores-preview {
    max-height: 45vh; /* expand to use available vertical space on the start screen */
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    margin: 3px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    border-left: 3px solid #667eea;
    transition: all 0.2s ease;
    font-size: 0.85em;
}

.score-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(3px);
}

.score-rank {
    font-weight: bold;
    color: #FFD700;
    min-width: 40px;
    font-size: 0.9em;
}

.score-name {
    flex: 1;
    margin: 0 8px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9em;
}

.score-points {
    font-weight: bold;
    color: #4ECDC4;
    min-width: 60px;
    text-align: right;
    font-size: 0.9em;
}

.no-scores {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 15px;
    font-size: 0.9em;
}

/* Enhanced Game Over */
.game-over-overlay {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.game-over-content {
    text-align: center;
    animation: gameOverSlideIn 0.5s ease;
}

@keyframes gameOverSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.final-score {
    font-size: 3em;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    margin: 20px 0;
    animation: scoreGlow 2s ease-in-out infinite alternate;
}

@keyframes scoreGlow {
    from { text-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
    to { text-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.3); }
}

/* Notifications */
.tetris-notification {
    position: fixed;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 10000;
    transition: transform 0.3s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tetris-notification.show {
    transform: translateX(-50%) translateY(0);
}

.tetris-notification-success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-left: 4px solid #2E7D32;
}

.tetris-notification-error {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    border-left: 4px solid #c62828;
}

.tetris-notification-highscore {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    border-left: 4px solid #FF8C00;
    animation: pulse 1s infinite;
}

.tetris-notification-gameover {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
    border-left: 4px solid #6A1B9A;
}

.tetris-notification-info {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    border-left: 4px solid #1565C0;
}

@keyframes pulse {
    0% { transform: translateX(-50%) translateY(0) scale(1); }
    50% { transform: translateX(-50%) translateY(0) scale(1.05); }
    100% { transform: translateX(-50%) translateY(0) scale(1); }
}

/* Ticker */
.tetris-ticker {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #FF6B6B, #4ECDC4);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 14px;
    z-index: 1000;
    transition: transform 0.5s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.tetris-ticker.show {
    transform: translateX(-50%) translateY(0);
}

/* High Scores Overlay */
.high-scores-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    /* stronger blur and dim to diffuse main menu behind overlay */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 1000;
}

.high-scores-content {
    text-align: center;
    max-width: 500px;
    height: 90vh; /* nearly full viewport height inside overlay */
    max-height: 90vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* confine internal scrolling to lists */
}

.high-scores-overlay h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #667eea;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

/* In overlay, let the list area take all remaining space and scroll */
.high-scores-content .scores-list {
    max-height: none;
    flex: 1 1 auto;
    overflow-y: auto;
}
.high-scores-content #full-scores-list { /* override preview constraints for non-logged view */
    max-height: none;
}

/* Keep the back button anchored at the bottom of the overlay content */
.high-scores-content .back-to-menu-btn {
    margin-top: auto;
}

.back-to-menu-btn {
    padding: 12px 24px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.back-to-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* High Scores Overlay toggles */
.high-scores-content .toggle-registered,
.high-scores-content .toggle-community,
.high-scores-content .toggle-combined,
.high-scores-content .toggle-fullscreen {
  margin-right: 8px;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: #4a90e2;
  color: #fff;
  cursor: pointer;
}
.high-scores-content .toggle-registered:hover,
.high-scores-content .toggle-community:hover,
.high-scores-content .toggle-combined:hover,
.high-scores-content .toggle-fullscreen:hover {
  background: #357abd;
}

/* Fullscreen list tweaks are inline for simplicity */
/* Preview High Scores toggle */
.high-scores-toggle {
  margin: 8px 0 6px;
}
.high-scores-toggle .hs-btn {
  margin-right: 6px;
  padding: 5px 10px;
  background: #4a90e2;
  border: none;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.high-scores-toggle .hs-btn.active,
.high-scores-toggle .hs-btn[aria-pressed="true"] {
  background: #357abd;
}