:root {
    --primary: #5b8e7d;       /* 吉卜力绿 */
    --primary-dark: #4a7566;
    --secondary: #e3c88e;     /* 金色 */
    --bg-main: #f6f3ea;       /* 米色背景 */
    --bg-dark: #1a1a1a;       /* 深色背景 */
    --bg-card: #FFFFFF;
    --text-main: #333333;
    --text-sub: #999999;
    --border: #E5E7EB;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar - Resembling User Header */
.sidebar {
    width: 280px;
    background: var(--bg-dark);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.logo-area {
    padding: 30px 20px;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    color: rgba(255,255,255,0.8);
    margin-bottom: 8px;
}

.history-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.history-thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}

.history-info {
    flex: 1;
    overflow: hidden;
}

.history-prompt {
    font-size: 13px;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-time {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-top: 4px;
}

.user-panel {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: #fff;
}

.logout-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
}

.logout-btn:hover {
    color: #ff6b6b;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    padding: 30px;
    gap: 30px;
    overflow: hidden;
    position: relative;
    justify-content: center; /* Center for single column view */
}

/* New Ghibli Layout Styles */
.ghibli-main-card {
    width: 100%;
    max-width: 600px; /* Mobile width */
    background: var(--bg-card);
    border-radius: 24px;
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.ghibli-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-main);
}

.header-right {
    font-size: 12px;
    color: var(--text-sub);
}

.text-green { color: var(--primary); }

.input-area-ghibli {
    background: #F9FAFB;
    border-radius: 16px;
    padding: 15px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.input-area-ghibli:focus-within {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 142, 125, 0.1);
}

.prompt-textarea-short {
    width: 100%;
    height: 100px;
    border: none;
    background: transparent;
    resize: none;
    font-size: 15px;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
}

.input-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.action-btn-lite {
    font-size: 13px;
    color: var(--text-sub);
    cursor: pointer;
    padding: 4px 8px;
}
.action-btn-lite:hover { color: var(--text-main); }

.action-btn-pill {
    font-size: 13px;
    background: #fff;
    border: 1px solid #eee;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}
.action-btn-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Sections */
.ghibli-sub-section {
    margin-top: 25px;
}

.section-label {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 12px;
}

/* Ratio Grid */
.ratio-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.ratio-item {
    background: #f9fafb;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px 0;
    text-align: center;
    font-size: 12px;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
}

.ratio-item:hover { background: #f0f0f0; }

.ratio-item.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Size Row */
.size-row {
    display: flex;
    gap: 10px;
}

.size-item {
    flex: 1;
    background: #f9fafb;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 12px 0;
    text-align: center;
    font-size: 12px;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
}

.size-item:hover { background: #f0f0f0; }

.size-item.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Action Card / Footer */
.ghibli-action-card {
    margin-top: 25px;
    background: #fff; /* or inside main card? WXML puts it separate but for web fits in card or sticky footer */
    /* For web, let's keep it inside the main container flow or stick at bottom of card */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.cost-value {
    color: var(--secondary); /* Gold */
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ghibli-generate-btn {
    width: 100%;
    height: 50px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    box-shadow: 0 5px 15px rgba(91, 142, 125, 0.3);
}

.ghibli-generate-btn:hover { background: var(--primary-dark); }
.ghibli-generate-btn:disabled {
    background: #ccc;
    box-shadow: none;
    cursor: not-allowed;
}

/* Loading Screen - Soot Sprites */
.ghibli-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f6f3ea;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-paper {
    text-align: center;
}

.loading-title {
    font-size: 24px;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.loading-sub {
    font-size: 14px;
    color: #999;
    display: block;
    margin-bottom: 40px;
}

/* Soot Sprite Animation */
.soot-sprite {
    width: 50px;
    height: 50px;
    background: #000;
    border-radius: 50%;
    margin: 0 auto 20px;
    position: relative;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    animation: bounce 1s infinite alternate;
}

.soot-sprite::before, .soot-sprite::after {
    content: '';
    position: absolute;
    top: 15px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
}

.soot-sprite::before { left: 10px; }
.soot-sprite::after { right: 10px; }

@keyframes bounce {
    from { transform: translateY(0) scale(1.1, 0.9); }
    to { transform: translateY(-20px) scale(0.95, 1.05); }
}

.spark-row {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.spark {
    width: 8px;
    height: 8px;
    background: var(--secondary);
    border-radius: 50%;
    animation: fade 1.5s infinite;
}

.spark:nth-child(2) { animation-delay: 0.5s; }
.spark:nth-child(3) { animation-delay: 1s; }

@keyframes fade {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

/* Result Styles */
.image-result-box {
    margin: 20px 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.response-image {
    width: 100%;
    display: block;
}

.result-actions-ghibli {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.ghibli-btn-sm {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #eee;
    color: var(--text-main);
}
.ghibli-btn-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Helper */
.hidden { display: none !important; }

/* Responsive Adjustments */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        overflow-y: auto;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        box-shadow: none;
    }
    .logo-area {
        padding: 15px 20px;
    }
    .user-panel {
        display: none; /* Simplify for mobile if needed, or keep at bottom */
    }
    .history-list {
        display: none; /* Mobile hide history initially */
    }
    .main-content {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }
}