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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    min-height: 100vh;
    padding: 10px;
    margin: 0;
    overflow-x: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
}

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

.title-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.header h1 {
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin: 0;
}

.subtitle {
    font-size: 14px;
    color: #B0C4DE;
    margin-top: 4px;
    font-weight: normal;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
}

button {
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    background: #4CAF50;
    color: white;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #45a049;
}

button:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.6;
}

button:disabled:hover {
    background: #666;
}

.auto-move-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.auto-move-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.score {
    font-size: 18px;
    font-weight: bold;
}

.game-board {
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 20px;
    min-height: 600px;
}

.top-cells {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 50px;
}

.foundations, .freecells {
    display: flex;
    gap: 10px;
}

.foundation, .freecell {
    width: 98px;
    height: 130px;
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s;
}

.foundation.highlight, .freecell.highlight {
    border-color: #FFD700;
    background: rgba(255,215,0,0.2);
    box-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.tableau {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    padding: 0 10px;
}

.column {
    min-height: 400px;
    padding: 10px 5px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    position: relative;
}

.column.highlight {
    background: rgba(255,215,0,0.1);
    box-shadow: inset 0 0 10px rgba(255,215,0,0.3);
}

.card {
    width: 93px;
    height: 126px;
    border-radius: 8px;
    background: white;
    border: 1px solid #ccc;
    position: absolute;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
    user-select: none;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

.card.dragging {
    transform: rotate(5deg);
    z-index: 1000;
    opacity: 0.8;
}

.card.selected {
    border: 2px solid #FFD700;
    box-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.card.red {
    color: #d63031;
}

.card.black {
    color: #2d3436;
}

.card-rank {
    font-size: 18.5px;
    font-weight: bold;
    line-height: 1;
}

.card-suit {
    font-size: 18.5px;
    text-align: center;
}

.card-center {
    font-size: 32px;
    text-align: center;
    align-self: center;
}

.status {
    text-align: center;
    margin-top: 20px;
    font-size: 18px;
    font-weight: bold;
}

.win-message {
    color: #FFD700;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.debug-panel {
    margin-top: 20px;
    background: rgba(0,0,0,0.8);
    border-radius: 8px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

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

.debug-buttons {
    display: flex;
    gap: 5px;
}

.debug-buttons button {
    padding: 4px 8px;
    font-size: 10px;
    min-width: 40px;
}

.debug-header h3 {
    margin: 0;
    color: #FFD700;
}

.debug-log {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: #00FF00;
    background: #000;
    padding: 10px;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.debug-log div {
    margin-bottom: 2px;
}

/* About Dialog */
.about-dialog {
    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: 1000;
}

.about-content {
    background: #2a5298;
    border: 2px solid #4CAF50;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.about-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #4CAF50;
    background: #1e3c72;
}

.about-header h3 {
    margin: 0;
    color: #FFD700;
    font-size: 1.2em;
}

.about-header button {
    background: #f44336;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.about-header button:hover {
    background: #d32f2f;
}

.about-body {
    padding: 20px;
    line-height: 1.6;
}

.about-body ul {
    padding-left: 20px;
}

.about-body a {
    color: #4CAF50;
    text-decoration: none;
}

.about-body a:hover {
    text-decoration: underline;
}

/* Responsive Design - Prevent Text Wrapping */
@media screen and (max-width: 1100px) {
    .header h1 {
        font-size: 2.2em;
    }
    
    button {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .controls {
        gap: 8px;
    }
}

@media screen and (max-width: 950px) {
    .header h1 {
        font-size: 2em;
    }
    
    button {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .subtitle {
        font-size: 12px;
    }
    
    .controls {
        gap: 6px;
    }
    
    .auto-move-toggle {
        font-size: 12px;
    }
}

@media screen and (max-width: 820px) {
    .header h1 {
        font-size: 1.8em;
    }
    
    button {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .subtitle {
        font-size: 11px;
    }
    
    .controls {
        gap: 5px;
    }
    
    .auto-move-toggle {
        font-size: 11px;
    }
    
    .score {
        font-size: 12px;
    }
}

@media screen and (max-width: 720px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .title-section {
        align-items: center;
    }
    
    .controls {
        justify-content: center;
        flex-wrap: wrap;
    }
}

