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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #ff6b35, #f7931e, #ff4081);
    min-height: 100vh;
    color: #333;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    text-align: center;
    margin-bottom: 1rem;
    color: #d32f2f;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(45deg, #d32f2f, #ff6f00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.toolbar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.ai-toolbar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tool-btn {
    background: #fff;
    border: 2px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.tool-btn:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tool-btn.active {
    background: #d32f2f;
    color: white;
    border-color: #d32f2f;
}

.ai-btn {
    background: linear-gradient(45deg, #ff6f00, #ffb300) !important;
    color: white !important;
    border: none !important;
    font-weight: bold;
    font-size: 1rem !important;
    padding: 0.6rem 1.2rem !important;
    box-shadow: 0 4px 15px rgba(255, 111, 0, 0.3);
    animation: aiGlow 2s ease-in-out infinite alternate;
}

.ai-btn:hover {
    background: linear-gradient(45deg, #f57c00, #ffa000) !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 111, 0, 0.4);
}

.ai-btn:disabled {
    background: #ccc !important;
    animation: none;
    cursor: not-allowed;
}

@keyframes aiGlow {
    0% { box-shadow: 0 4px 15px rgba(255, 111, 0, 0.3); }
    100% { box-shadow: 0 4px 25px rgba(255, 111, 0, 0.6); }
}

.export-btn {
    background: #4caf50 !important;
    color: white !important;
    border-color: #4caf50 !important;
    font-weight: bold;
}

.export-btn:hover {
    background: #45a049 !important;
    transform: translateY(-2px) scale(1.05);
}

.main-container {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
}

.canvas-section {
    position: relative;
    flex-shrink: 0;
}

#basketball-court {
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    cursor: default;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    z-index: 10;
}

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

.loading-content {
    text-align: center;
    color: white;
}

.basketball-loader {
    font-size: 3rem;
    margin-bottom: 1rem;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.loading-bar {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin: 1rem auto 0;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #ff6f00, #ffb300);
    border-radius: 3px;
    width: 0%;
}

@keyframes loadingProgress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.visualization-section {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    height: fit-content;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.visualization-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.visualization-header h3 {
    color: #d32f2f;
    font-size: 1.2rem;
    background: linear-gradient(45deg, #d32f2f, #ff6f00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.visualization-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.visualization-controls select {
    padding: 0.5rem;
    border: 2px solid #ddd;
    border-radius: 20px;
    font-size: 0.8rem;
    background: white;
}

.visualization-display {
    flex: 1;
    border: 2px dashed #ddd;
    border-radius: 10px;
    overflow: auto;
}

.visualization-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    text-align: center;
    color: #666;
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.visualization-result {
    padding: 1rem;
}

.visualization-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.visualization-info {
    margin-top: 1rem;
}

.visualization-prompt {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.visualization-actions {
    display: flex;
    gap: 0.5rem;
}

.zoom-btn {
    padding: 0.3rem 0.8rem;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.zoom-btn:hover {
    background: #e0e0e0;
}

.visualization-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    text-align: center;
    color: #666;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.retry-btn {
    padding: 0.6rem 1.2rem;
    background: #ff6f00;
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

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

.side-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 1.5rem;
    min-width: 280px;
    max-width: 300px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.panel-section {
    margin-bottom: 1.5rem;
}

.panel-section h3 {
    color: #d32f2f;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    border-bottom: 2px solid #ff6f00;
    padding-bottom: 0.3rem;
}

.panel-section ul {
    list-style: none;
    padding: 0;
}

.panel-section li {
    padding: 0.3rem 0;
    font-size: 0.9rem;
    color: #555;
}

.panel-section li::before {
    content: "🏀 ";
    margin-right: 0.5rem;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem;
    background: rgba(211, 47, 47, 0.1);
    border-radius: 8px;
    border-left: 3px solid #d32f2f;
}

.player-circle {
    width: 30px;
    height: 30px;
    background: #d32f2f;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.player-item span {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

.panel-section label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
}

.panel-section input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #d32f2f;
}

.ai-settings {
    margin-top: 1rem;
}

.ai-settings label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
    font-weight: bold;
    color: #666;
}

.ai-settings select {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    background: white;
}

.play-library {
    max-height: 300px;
    overflow-y: auto;
}

.library-placeholder {
    text-align: center;
    color: #666;
    padding: 2rem;
    font-style: italic;
}

.library-item {
    display: flex;
    gap: 0.8rem;
    padding: 0.8rem;
    background: rgba(255, 111, 0, 0.1);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid #ff6f00;
}

.library-item:hover {
    background: rgba(255, 111, 0, 0.2);
    transform: translateX(2px);
}

.library-thumbnail {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.library-info h4 {
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
    color: #333;
}

.library-info p {
    font-size: 0.8rem;
    color: #666;
}

.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    text-align: center;
    padding: 1.5rem;
    margin-top: 1rem;
    color: #555;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.footer p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.footer a {
    color: #d32f2f;
    text-decoration: none;
    font-weight: 500;
}

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

/* Responsive Design */
@media (max-width: 1400px) {
    .main-container {
        flex-direction: column;
        align-items: center;
    }
    
    .visualization-section {
        max-width: none;
        width: 100%;
        order: 2;
    }
    
    .side-panel {
        max-width: none;
        width: 100%;
        order: 3;
    }
    
    .canvas-section {
        order: 1;
    }
}

@media (max-width: 900px) {
    #basketball-court {
        width: 100%;
        max-width: 600px;
        height: auto;
    }
    
    .toolbar, .ai-toolbar {
        justify-content: center;
    }
    
    .tool-btn, .ai-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .visualization-header {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 600px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .toolbar, .ai-toolbar {
        gap: 0.3rem;
    }
    
    .tool-btn, .ai-btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
    
    .main-container {
        padding: 0.5rem;
    }
    
    .side-panel, .visualization-section {
        padding: 1rem;
    }
    
    .visualization-placeholder {
        height: 200px;
    }
    
    .placeholder-icon {
        font-size: 2rem;
    }
}