/* Puzzle Games Collection - Main Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    margin: 0;
}

/* Game selection menu */
.game-selection {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.main-title {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 10px;
    font-weight: bold;
}

.main-subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 30px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.game-card {
    background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
    border-radius: 15px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    border: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.game-card.huarong {
    background: linear-gradient(45deg, #FF6B6B, #FF8E8E);
}

.game-card.gomoku {
    background: linear-gradient(45deg, #4ECDC4, #44A08D);
}

.game-card.sudoku {
    background: linear-gradient(45deg, #45B7D1, #2E86AB);
}

.game-card.puzzle2048 {
    background: linear-gradient(45deg, #96CEB4, #FFEAA7);
}

.game-title {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
}

.game-desc {
    font-size: 0.9em;
    opacity: 0.9;
    line-height: 1.4;
}

.game-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 600px;
    width: 95vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: auto;
    max-height: 95vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.game-info {
    width: 100%;
    margin-bottom: 20px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 5px;
}

.game-title-section {
    text-align: center;
    flex: 1;
}

.game-title {
    font-size: 2.2em;
    color: #333;
    margin-bottom: 5px;
    font-weight: bold;
}

.game-subtitle {
    color: #666;
    font-size: 1em;
}

.back-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.back-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.control-section {
    display: flex;
    flex-direction: row; /* Changed to row */
    align-items: center;
    justify-content: space-between; /* Space out items */
    gap: 15px; /* Add some gap */
    width: 100%;
    padding: 10px; /* Add some padding */
    background-color: #f8f9fa; /* Add a light background */
    border-radius: 12px; /* Rounded corners */
    margin-top: 15px;
    margin-bottom: 15px;
}

.primary-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.status-info {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 90px;
    text-align: center;
}

.btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.moves-counter {
    background: #f7fafc;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    color: #333;
}

.victory-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 10px;
    box-sizing: border-box;
}

.victory-content {
    background: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    max-width: 350px;
    width: 100%;
    box-sizing: border-box;
}

.victory-title {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 15px;
}

.victory-stats {
    margin: 15px 0;
    font-size: 1.1em;
    color: #333;
}

/* Mobile drag instructions */
.drag-instructions {
    background: #e2e8f0;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    color: #4a5568;
    margin-bottom: 8px;
    text-align: center;
    display: none;
}

.backup-controls-btn {
    background: #718096;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    margin-top: 4px;
    cursor: pointer;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.audio-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    min-width: 45px;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.audio-btn.muted {
    background: linear-gradient(45deg, #ccc, #999);
    opacity: 0.6;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-label {
    color: white;
    font-size: 0.9em;
    font-weight: bold;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 6px;
    border-radius: 3px;
    background: rgba(0, 0, 255, 0.4);
    outline: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    border: none;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.3);
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.3);
}

.volume-slider::-moz-range-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    border: none;
}

.volume-slider::-ms-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: transparent;
    border-color: transparent;
    color: transparent;
}

.volume-slider::-ms-fill-lower {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.volume-slider::-ms-fill-upper {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.volume-slider::-ms-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.volume-value {
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    min-width: 35px;
    text-align: center;
}

/* Notification System */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
    pointer-events: none;
}

.notification {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #667eea;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.success {
    border-left-color: #4CAF50;
}

.notification.error {
    border-left-color: #f44336;
}

.notification.warning {
    border-left-color: #FF9800;
}

.notification.info {
    border-left-color: #2196F3;
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.notification-icon {
    font-size: 1.2em;
    margin-right: 8px;
}

.notification-title {
    font-weight: bold;
    color: #333;
    font-size: 1em;
    margin: 0;
    flex: 1;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: #f0f0f0;
    color: #666;
}

.notification-message {
    color: #666;
    font-size: 0.9em;
    line-height: 1.4;
    margin: 0;
}

.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(102, 126, 234, 0.3);
    border-radius: 0 0 12px 12px;
    transform-origin: left;
    animation: notificationProgress 4s linear;
}

.notification.success .notification-progress {
    background: rgba(76, 175, 80, 0.3);
}

.notification.error .notification-progress {
    background: rgba(244, 67, 54, 0.3);
}

.notification.warning .notification-progress {
    background: rgba(255, 152, 0, 0.3);
}

.notification.info .notification-progress {
    background: rgba(33, 150, 243, 0.3);
}

@keyframes notificationProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Confirmation Modal */
.confirmation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 15000;
    padding: 20px;
    box-sizing: border-box;
}

.confirmation-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: confirmationSlideIn 0.3s ease;
}

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

.confirmation-title {
    font-size: 1.4em;
    color: #333;
    margin-bottom: 15px;
    font-weight: bold;
}

.confirmation-message {
    color: #666;
    font-size: 1em;
    line-height: 1.5;
    margin-bottom: 25px;
}

.confirmation-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-cancel {
    background: #6c757d !important;
}

.btn-cancel:hover {
    background: #5a6268 !important;
}

.btn-confirm {
    background: #667eea !important;
}

.btn-confirm:hover {
    background: #5a67d8 !important;
}

.math-controls {
    flex-wrap: nowrap !important;
}