/* === Clean Design System === */
:root {
    --primary-color: #FFD700;
    --secondary-color: #FF6B6B;
    --accent-color: #4ECDC4;
    --blue-color: #4A90E2;
    --green-color: #7ED321;
    --red-color: #D0021B;
    --bg-primary: transparent;
    --text-primary: #ffffff;
    --text-secondary: #b8bcc8;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: transparent;
    color: var(--text-primary);
    overflow: hidden;
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* === Canvas Styling === */
#defaultCanvas0 {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
}

/* === Mode Toggle === */
.mode-toggle {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideInFromTop 0.5s ease-out;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    color: #666;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 80px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary-color), #E6C200);
    color: #000;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.mode-btn i {
    font-size: 16px;
    transition: all 0.3s ease;
}

.mode-btn span {
    font-size: 9px;
    white-space: nowrap;
}

/* === Tool Panel - 重新設計的隱藏機制 === */
.tool-panel {
    position: absolute;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 200;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    padding: 20px 30px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow);
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 隱藏狀態 - 變成圓形圖標 */
.tool-panel.collapsed {
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 50%;
    gap: 0;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-panel.collapsed .tool-btn {
    display: none;
}

/* 圓形狀態下的圖標 */
.tool-panel.collapsed::after {
    content: "";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 24px;
    color: #666;
    opacity: 1;
}

.tool-panel.collapsed::after {
    content: "\f0c9"; /* fas fa-bars (hamburger menu) */
}

/* hover 展開效果 - 完全無動畫 */
.tool-panel.collapsed:hover {
    width: auto;
    height: auto;
    padding: 20px 30px;
    border-radius: 25px;
    gap: 20px;
    background: rgba(255, 255, 255, 0.1);
}

.tool-panel.collapsed:hover .tool-btn {
    display: flex;
}

.tool-panel.collapsed:hover::after {
    display: none;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    min-width: 80px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.tool-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 1);
}

.tool-btn.active {
    background: var(--primary-color);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.tool-icon i {
    font-size: 24px;
    color: #333;
    transition: all 0.3s ease;
}

.tool-btn.active .tool-icon i {
    color: #000;
}

.tool-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.tool-btn.active .tool-label {
    color: #000;
}

/* === Action Buttons === */
.action-buttons {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 200;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    padding: 15px 25px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-width: 130px;
    justify-content: center;
}

.action-btn i {
    font-size: 16px;
}

.action-btn span {
    white-space: nowrap;
    font-size: 13px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.action-btn:active {
    transform: translateY(0);
}

.upload-btn {
    background: linear-gradient(135deg, var(--accent-color), #42B8A8);
    color: white;
}

.upload-btn:hover {
    background: linear-gradient(135deg, #42B8A8, #3AA394);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

.randomize-btn {
    background: linear-gradient(135deg, var(--blue-color), #357ABD);
    color: white;
}

.randomize-btn:hover {
    background: linear-gradient(135deg, #357ABD, #2A6AA0);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.save-btn {
    background: linear-gradient(135deg, var(--green-color), #6BC217);
    color: white;
}

.save-btn:hover {
    background: linear-gradient(135deg, #6BC217, #5AA013);
    box-shadow: 0 6px 20px rgba(126, 211, 33, 0.4);
}

.clear-btn {
    background: linear-gradient(135deg, var(--red-color), #B0001A);
    color: white;
}

.clear-btn:hover {
    background: linear-gradient(135deg, #B0001A, #950015);
    box-shadow: 0 6px 20px rgba(208, 2, 27, 0.4);
}

/* === 響應式設計 === */
@media (max-width: 768px) {
    .mode-toggle {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        gap: 6px;
        padding: 6px;
        border-radius: 10px;
    }
    
    .mode-btn {
        padding: 10px 12px;
        min-width: 70px;
        font-size: 10px;
    }
    
    .mode-btn i {
        font-size: 14px;
    }
    
    .mode-btn span {
        font-size: 8px;
    }
    
    .tool-panel.collapsed {
        width: 50px;
        height: 50px;
    }
    
    .tool-panel.collapsed::after {
        font-size: 24px;
    }
    
    .tool-panel {
        bottom: 180px;
        gap: 15px;
        padding: 15px 20px;
        flex-wrap: wrap;
        max-width: 90vw;
    }
    
    .tool-btn {
        min-width: 70px;
        padding: 12px 15px;
    }
    
    .tool-icon {
        width: 35px;
        height: 35px;
    }
    
    .tool-icon i {
        font-size: 20px;
    }
    
    .tool-label {
        font-size: 10px;
    }
    
    .action-buttons {
        bottom: 20px;
        flex-direction: column;
        gap: 8px;
        width: 90vw;
        max-width: 280px;
    }
    
    .action-btn {
        padding: 10px 15px;
        font-size: 12px;
        width: 100%;
        justify-content: center;
        min-width: auto;
    }
    
    .action-btn span {
        font-size: 12px;
    }
}

/* === API Info Panel === */
.api-info {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 20px;
    max-width: 350px;
    animation: slideIn 0.5s ease-out;
}

.api-content h3 {
    color: #FFD700;
    margin-bottom: 12px;
    font-size: 16px;
}

.api-content p {
    color: #ffffff;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 10px;
}

.api-content ul {
    color: #ffffff;
    font-size: 11px;
    line-height: 1.4;
    margin-bottom: 15px;
    padding-left: 0;
    list-style: none;
}

.api-content li {
    margin-bottom: 4px;
}

.api-close {
    background: #4A90E2;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.api-close:hover {
    background: #357ABD;
}

/* === 動畫效果 === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}