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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

body::-webkit-scrollbar,
.game-board::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

body::-webkit-scrollbar-track,
.game-board::-webkit-scrollbar-track,
.sidebar-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

body::-webkit-scrollbar-thumb,
.game-board::-webkit-scrollbar-thumb,
.sidebar-content::-webkit-scrollbar-thumb {
    background: #00d4ff;
    border-radius: 3px;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    gap: 16px;
    height: 100vh;
    width: 100vw;
    box-sizing: border-box;
    max-height: 100vh;
    overflow: hidden;
}

.game-header h1 {
    font-size: 2rem;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.5);
    color: #00d4ff;
    letter-spacing: 4px;
    line-height: 1;
    flex: 0 0 auto;
}

.game-main {
    flex: 0 1 auto;
    display: flex;
    gap: 30px;
    align-items: stretch;
    max-height: calc(100vh - 180px);
    min-height: 0;
}

.game-board,
.game-sidebar {
    background: rgba(0, 0, 0, 0.4);
    border: 3px solid #00d4ff;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.3),
                inset 0 0 20px rgba(0, 200, 255, 0.1);
    box-sizing: border-box;
}

.game-board {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    flex: 0 0 auto;
}

#gameCanvas {
    display: block;
    border-radius: 5px;
}

.game-sidebar {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #00d4ff;
    border-radius: 3px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.5);
}

.next-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.next-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#nextCanvas {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.controls-section h3 {
    color: #00d4ff;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.controls-section p {
    color: #aaa;
    line-height: 1.8;
}

.controls-section span {
    color: #fff;
    font-weight: bold;
}

.game-footer {
    display: flex;
    gap: 15px;
    flex: 0 0 auto;
}

.btn {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 200, 255, 0.3);
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn:disabled,
#startBtn:disabled,
#pauseBtn:disabled {
    background: #555;
    color: #fff;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#startBtn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

#startBtn:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.5);
}

#startBtn.restarting {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

#startBtn.restarting:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.5);
}

#pauseBtn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

#pauseBtn:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.5);
}

#pauseBtn.paused {
    background: linear-gradient(135deg, #ffa502 0%, #e67e22 100%);
    box-shadow: 0 4px 15px rgba(255, 165, 2, 0.3);
}

#pauseBtn.paused:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(255, 165, 2, 0.5);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #00d4ff;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 200, 255, 0.5);
    max-width: 90vw;
    box-sizing: border-box;
}

.modal-content h2 {
    color: #ff4757;
    font-size: 1.5rem;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(255, 71, 87, 0.5);
}

.modal-content p {
    font-size: 1rem;
    margin-bottom: 20px;
    color: #aaa;
}

.modal-content span {
    color: #00d4ff;
    font-weight: bold;
}

#pauseModal h2 {
    color: #ffa502;
    text-shadow: 0 0 20px rgba(255, 165, 2, 0.5);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease;
}
