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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 50%, #0f1419 100%);
    color: #f7931a;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Game Container */
.game-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 8px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Desktop Header */
.desktop-header {
    text-align: center;
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(15, 20, 25, 0.8);
    border-radius: 8px;
    border: 2px solid #f7931a;
    box-shadow: 0 8px 32px rgba(247, 147, 26, 0.2);
}

.desktop-header h1 {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #f7931a;
    text-shadow: 0 0 20px rgba(247, 147, 26, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px rgba(247, 147, 26, 0.5); }
    to { text-shadow: 0 0 30px rgba(247, 147, 26, 0.8), 0 0 40px rgba(247, 147, 26, 0.3); }
}

.desktop-header p {
    font-size: 0.9rem;
    color: #8b9dc3;
}

/* Mobile Stats Header */
.mobile-stats-header {
    background: rgba(15, 20, 25, 0.8);
    border-radius: 10px;
    border: 2px solid #f7931a;
    padding: 8px;
    margin-bottom: 8px;
    box-shadow: 0 8px 32px rgba(247, 147, 26, 0.2);
}

.mobile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.stat-item {
    text-align: center;
    padding: 6px;
    background: rgba(26, 35, 50, 0.8);
    border-radius: 6px;
    border: 1px solid #f7931a;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: #8b9dc3;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    color: #f7931a;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 180px 1fr 180px;
    gap: 10px;
    flex: 1;
    margin-bottom: 20px;
}

/* Left Panel - Desktop Only */
.left-panel {
    background: rgba(15, 20, 25, 0.8);
    border-radius: 8px;
    border: 2px solid #f7931a;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(247, 147, 26, 0.2);
    height: fit-content;
}

/* Control Sections */
.control-section {
    margin-bottom: 8px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(26, 35, 50, 0.8);
    border: 1px solid #f7931a;
    box-shadow: 0 4px 16px rgba(247, 147, 26, 0.1);
}

.section-toggle {
    width: 100%;
    padding: 8px 10px;
    background: rgba(26, 35, 50, 0.9);
    border: none;
    color: #f7931a;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.section-toggle:hover {
    background: rgba(247, 147, 26, 0.1);
}

.section-toggle.active {
    background: rgba(247, 147, 26, 0.2);
    border-bottom: 1px solid #f7931a;
}

.section-toggle .toggle-icon {
    margin-right: 6px;
    font-size: 0.9rem;
}

.section-toggle .toggle-arrow {
    transition: transform 0.3s ease;
}

.control-section.active .toggle-arrow {
    transform: rotate(180deg);
}

.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(15, 20, 25, 0.9);
}

.control-section.active .section-content {
    max-height: 350px;
    padding: 8px;
}

/* Game Buttons */
.game-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.game-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.game-btn.primary {
    background: linear-gradient(45deg, #f7931a, #ff9500);
    color: #0f1419;
}

.game-btn.primary:hover:not(:disabled) {
    background: linear-gradient(45deg, #ff9500, #f7931a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(247, 147, 26, 0.4);
}

.game-btn.secondary {
    background: rgba(26, 35, 50, 0.9);
    color: #f7931a;
    border: 1px solid #f7931a;
}

.game-btn.secondary:hover:not(:disabled) {
    background: rgba(247, 147, 26, 0.1);
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.game-rules p {
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: #8b9dc3;
    line-height: 1.4;
}

.control-info p {
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: #8b9dc3;
    line-height: 1.4;
}

.difficulty-panel h4 {
    margin-bottom: 8px;
    color: #f7931a;
    font-size: 0.9rem;
}

.difficulty-options {
    display: flex;
    gap: 6px;
}

.difficulty-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #f7931a;
    background: rgba(26, 35, 50, 0.8);
    color: #f7931a;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.difficulty-btn:hover {
    background: rgba(247, 147, 26, 0.1);
}

.difficulty-btn.active {
    background: linear-gradient(45deg, #f7931a, #ff9500);
    color: #0f1419;
    box-shadow: 0 2px 8px rgba(247, 147, 26, 0.3);
}

.sound-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sound-btn {
    padding: 6px 10px;
    border: 1px solid #f7931a;
    background: rgba(26, 35, 50, 0.8);
    color: #f7931a;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sound-btn:hover {
    background: rgba(247, 147, 26, 0.1);
}

.sound-btn.active {
    background: linear-gradient(45deg, #f7931a, #ff9500);
    color: #0f1419;
    box-shadow: 0 2px 8px rgba(247, 147, 26, 0.3);
}

.element-legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.element-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.element-symbol {
    font-size: 1.2rem;
    min-width: 24px;
}

.element-text {
    font-size: 0.8rem;
    color: #8b9dc3;
}

.center-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.game-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(15, 20, 25, 0.8);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(247, 147, 26, 0.2);
}

#gameCanvas {
    border: 2px solid #f7931a;
    border-radius: 4px;
    background: #0f1419;
    box-shadow: inset 0 0 20px rgba(247, 147, 26, 0.1);
    min-width: 200px;
    min-height: 200px;
    /* Improved responsive scaling */
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
}

.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 20, 25, 0.95);
    color: #f7931a;
    padding: 15px 20px;
    border-radius: 8px;
    border: 2px solid #f7931a;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 8px 32px rgba(247, 147, 26, 0.3);
    z-index: 10;
    max-width: 80%;
    line-height: 1.4;
}

/* Mobile Game Controls */
.mobile-game-controls {
    width: 100%;
    max-width: 400px;
    background: rgba(15, 20, 25, 0.8);
    border-radius: 8px;
    border: 2px solid #f7931a;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(247, 147, 26, 0.2);
}

.mobile-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.mobile-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 44px;
    flex: 1;
    max-width: 120px;
}

.mobile-btn.primary {
    background: linear-gradient(45deg, #f7931a, #ff9500);
    color: #0f1419;
}

.mobile-btn.primary:hover:not(:disabled) {
    background: linear-gradient(45deg, #ff9500, #f7931a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(247, 147, 26, 0.4);
}

.mobile-btn.secondary {
    background: rgba(26, 35, 50, 0.9);
    color: #f7931a;
    border: 1px solid #f7931a;
}

.mobile-btn.secondary:hover:not(:disabled) {
    background: rgba(247, 147, 26, 0.1);
}

.mobile-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Mobile Bitcoin Tips */
.mobile-bitcoin-tips {
    width: 100%;
    max-width: 400px;
    background: rgba(15, 20, 25, 0.8);
    border-radius: 8px;
    border: 2px solid #f7931a;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(247, 147, 26, 0.2);
}

.mobile-bitcoin-tips h3 {
    color: #f7931a;
    font-size: 1rem;
    margin-bottom: 8px;
    text-align: center;
}

.mobile-bitcoin-tips .tip-content {
    color: #8b9dc3;
    font-size: 0.85rem;
    line-height: 1.4;
    text-align: center;
    transition: opacity 0.5s ease;
}

/* Mobile Info Section */
.mobile-info-section {
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: center;
}

.mobile-info-btn {
    padding: 12px 24px;
    border: 2px solid #f7931a;
    background: rgba(26, 35, 50, 0.8);
    color: #f7931a;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.mobile-info-btn:hover {
    background: rgba(247, 147, 26, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(247, 147, 26, 0.3);
}

.info-icon {
    font-size: 1.1rem;
}

.right-panel {
    background: rgba(15, 20, 25, 0.8);
    border-radius: 8px;
    border: 2px solid #f7931a;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(247, 147, 26, 0.2);
    height: fit-content;
}

.info-panel {
    margin-bottom: 15px;
}

.info-panel h3 {
    color: #f7931a;
    font-size: 1.1rem;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid #f7931a;
    padding-bottom: 5px;
}

.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(247, 147, 26, 0.2);
}

.stat-label {
    font-size: 0.8rem;
    color: #8b9dc3;
}

.stat-value {
    font-size: 0.8rem;
    font-weight: bold;
    color: #f7931a;
}

#speedCountdownRow {
    background: rgba(247, 147, 26, 0.1);
    border-radius: 4px;
    padding: 4px 8px;
    margin-top: 4px;
}

#speedCountdown {
    animation: pulse 1s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 1; }
    to { opacity: 0.7; }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.tips-panel h3 {
    color: #f7931a;
    font-size: 1.1rem;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid #f7931a;
    padding-bottom: 5px;
}

.tip-content {
    color: #8b9dc3;
    font-size: 0.85rem;
    line-height: 1.4;
    text-align: center;
    transition: opacity 0.5s ease;
}

/* Mobile Drawer */
.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: rgba(15, 20, 25, 0.95);
    border-left: 2px solid #f7931a;
    box-shadow: -8px 0 32px rgba(247, 147, 26, 0.3);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.mobile-drawer.active {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f7931a;
    background: rgba(26, 35, 50, 0.8);
}

.drawer-header h3 {
    color: #f7931a;
    font-size: 1.2rem;
    margin: 0;
}

.drawer-close {
    background: none;
    border: none;
    color: #f7931a;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-close:hover {
    background: rgba(247, 147, 26, 0.1);
    transform: scale(1.1);
}

.drawer-content {
    padding: 20px;
}

.mobile-section {
    margin-bottom: 25px;
}

.mobile-section h4 {
    color: #f7931a;
    font-size: 1rem;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(247, 147, 26, 0.3);
    padding-bottom: 5px;
}

.mobile-difficulty-options {
    display: flex;
    gap: 8px;
}

.mobile-difficulty-btn {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #f7931a;
    background: rgba(26, 35, 50, 0.8);
    color: #f7931a;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-difficulty-btn:hover {
    background: rgba(247, 147, 26, 0.1);
}

.mobile-difficulty-btn.active {
    background: linear-gradient(45deg, #f7931a, #ff9500);
    color: #0f1419;
    box-shadow: 0 2px 8px rgba(247, 147, 26, 0.3);
}

.mobile-sound-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-sound-btn {
    padding: 12px 16px;
    border: 1px solid #f7931a;
    background: rgba(26, 35, 50, 0.8);
    color: #f7931a;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-sound-btn:hover {
    background: rgba(247, 147, 26, 0.1);
}

.mobile-sound-btn.active {
    background: linear-gradient(45deg, #f7931a, #ff9500);
    color: #0f1419;
    box-shadow: 0 2px 8px rgba(247, 147, 26, 0.3);
}

.mobile-game-rules p,
.mobile-control-info p {
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #8b9dc3;
    line-height: 1.4;
}

.mobile-element-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-element-legend .element-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.mobile-element-legend .element-symbol {
    font-size: 1.3rem;
    min-width: 28px;
}

.mobile-element-legend .element-text {
    font-size: 0.9rem;
    color: #8b9dc3;
}

.game-footer {
    text-align: center;
    padding: 15px;
    background: rgba(15, 20, 25, 0.8);
    border-radius: 8px;
    border: 2px solid #f7931a;
    margin-top: 20px;
    box-shadow: 0 8px 32px rgba(247, 147, 26, 0.2);
}

.game-footer p {
    color: #8b9dc3;
    font-size: 0.9rem;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 160px 1fr 160px;
        gap: 8px;
    }
    
    .left-panel,
    .right-panel {
        padding: 8px;
    }
    
    #gameCanvas {
        width: 500px;
        height: 500px;
    }
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 140px 1fr 140px;
        gap: 6px;
    }
    
    .left-panel,
    .right-panel {
        padding: 6px;
    }
    
    #gameCanvas {
        width: 450px;
        height: 450px;
    }
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 120px 1fr 120px;
        gap: 5px;
    }
    
    .left-panel,
    .right-panel {
        padding: 5px;
    }
    
    #gameCanvas {
        width: 400px;
        height: 400px;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 5px;
    }
    
    .desktop-header {
        display: none;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .left-panel,
    .right-panel {
        display: none;
    }
    
    .center-panel {
        order: 1;
        gap: 12px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 500px;
        height: auto;
        min-width: auto;
        min-height: auto;
    }
    
    .game-footer {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .mobile-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    
    .stat-item {
        padding: 4px;
    }
    
    .stat-label {
        font-size: 0.6rem;
    }
    
    .stat-value {
        font-size: 0.8rem;
    }
    
    .mobile-controls {
        flex-direction: row;
        gap: 6px;
    }
    
    .mobile-btn {
        min-height: 32px;
        font-size: 0.7rem;
        padding: 6px 12px;
        min-width: 50px;
    }
    
    .mobile-info-btn {
        padding: 10px 20px;
        font-size: 0.8rem;
    }
    
    .drawer-header {
        padding: 15px;
    }
    
    .drawer-content {
        padding: 15px;
    }
    
    .mobile-section {
        margin-bottom: 20px;
    }
    
    .mobile-difficulty-btn,
    .mobile-sound-btn {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
}

/* Desktop Only Class */
.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}

/* Mobile Only Class */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .game-btn,
    .mobile-btn,
    .difficulty-btn,
    .sound-btn,
    .mobile-difficulty-btn,
    .mobile-sound-btn {
        min-height: 44px;
    }
    
    .section-toggle {
        min-height: 48px;
    }
    
    .element-item {
        min-height: 44px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #gameCanvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #0a0a0a 0%, #1a2332 50%, #0f1419 100%);
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-stats-header {
        margin-bottom: 5px;
    }
    
    .center-panel {
        gap: 8px;
    }
    
    .mobile-game-controls {
        padding: 8px;
    }
    
    .mobile-controls {
        flex-direction: row;
        gap: 6px;
    }
    
    .mobile-btn {
        min-height: 32px;
        padding: 6px 12px;
    }
    
    .mobile-info-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
} 