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

body {
    font-family: 'Bricolage Grotesque', sans-serif;
    background: linear-gradient(135deg, #1a0f0a 0%, #2d1f15 50%, #1a0f0a 100%);
    min-height: 100vh;
    color: #fef3c7;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
    border-radius: 12px;
    border: 3px solid #92400e;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.title-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fbbf24;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.subtitle {
    font-family: 'Crimson Pro', serif;
    font-style: italic;
    color: #fcd34d;
    opacity: 0.9;
}

.stats {
    display: flex;
    gap: 20px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    border: 2px solid #92400e;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #d97706;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fbbf24;
}

#new-game-btn {
    padding: 12px 24px;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #1a0f0a;
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#new-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

main {
    display: flex;
    gap: 30px;
    flex: 1;
}

.board-section {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#canvas {
    background: linear-gradient(135deg, #3d2817 0%, #2a1a0a 100%);
    border-radius: 16px;
    border: 4px solid #5c3d2e;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5), inset 0 2px 4px rgba(255,255,255,0.1);
}

#game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 16px;
    animation: fadeIn 0.5s ease;
}

#game-over-overlay.hidden {
    display: none;
}

.game-over-content {
    text-align: center;
    padding: 30px;
}

.game-over-content h2 {
    font-size: 2rem;
    color: #fbbf24;
    margin-bottom: 10px;
}

.game-over-content p {
    font-family: 'Crimson Pro', serif;
    font-size: 1.25rem;
    color: #fef3c7;
    margin-bottom: 20px;
}

#play-again-btn {
    padding: 12px 30px;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #1a0f0a;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#play-again-btn:hover {
    transform: translateY(-2px);
}

.coach-section {
    flex: 1;
    max-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.coach-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
    border-radius: 12px;
    border: 2px solid #92400e;
}

#coach-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid #fbbf24;
    object-fit: cover;
}

.coach-info h3 {
    color: #fbbf24;
    font-weight: 700;
}

.coach-title {
    font-family: 'Crimson Pro', serif;
    font-size: 0.875rem;
    color: #d97706;
}

.speech-bubble {
    position: relative;
    padding: 20px;
    background: #fef3c7;
    border-radius: 12px;
    color: #1a0f0a;
    font-family: 'Crimson Pro', serif;
    font-size: 1.1rem;
    line-height: 1.6;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.speech-bubble::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 30px;
    border-width: 0 10px 10px 10px;
    border-style: solid;
    border-color: transparent transparent #fef3c7 transparent;
}

.move-history-section {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    border: 2px solid #5c3d2e;
    overflow: hidden;
}

.history-toggle {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: none;
    color: #d97706;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.history-toggle:hover {
    background: rgba(255,255,255,0.05);
}

.move-history {
    max-height: 150px;
    overflow-y: auto;
    padding: 0 12px 12px;
}

.move-history.hidden {
    display: none;
}

#history-list {
    list-style: none;
}

#history-list li {
    padding: 6px 0;
    font-size: 0.875rem;
    color: #fcd34d;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.undo-btn {
    padding: 12px;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 600;
    color: #fef3c7;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.undo-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    color: #92400e;
    font-family: 'Crimson Pro', serif;
    font-style: italic;
}

footer a {
    color: #fbbf24;
    text-decoration: none;
    display: block;
    margin-top: 10px;
    font-style: normal;
    font-family: 'Bricolage Grotesque', sans-serif;
}

footer a:hover {
    text-decoration: underline;
}

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fadeIn 0.5s ease;
}

.tutorial-overlay.hidden {
    display: none;
}

.tutorial-content {
    background: linear-gradient(135deg, #78350f 0%, #451a03 100%);
    padding: 40px;
    border-radius: 16px;
    border: 3px solid #fbbf24;
    max-width: 500px;
    text-align: center;
}

.tutorial-content h2 {
    color: #fbbf24;
    font-size: 2rem;
    margin-bottom: 30px;
}

.tutorial-steps {
    text-align: left;
    margin-bottom: 30px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.step-number {
    width: 30px;
    height: 30px;
    background: #fbbf24;
    color: #1a0f0a;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step p {
    color: #fef3c7;
    line-height: 1.5;
}

.tutorial-note {
    font-family: 'Crimson Pro', serif;
    font-style: italic;
    color: #d97706;
    margin-bottom: 20px;
}

#start-game-btn {
    padding: 15px 40px;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a0f0a;
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#start-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    main {
        flex-direction: column;
        align-items: center;
    }
    
    .coach-section {
        max-width: 100%;
        width: 100%;
    }
    
    header {
        flex-direction: column;
        text-align: center;
    }
    
    .title-section h1 {
        font-size: 1.75rem;
    }
    
    .stats {
        justify-content: center;
    }
    
    .tutorial-content {
        margin: 20px;
        padding: 25px;
    }
    
    .board-section {
        width: 100%;
    }
}