:root {
    --bg: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(255, 255, 255, 0.05);
    --text: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --primary: #00d2ff;
    --accent: #7b2ff7;
    --gradient: linear-gradient(135deg, #00d2ff, #7b2ff7);
    --border: rgba(255, 255, 255, 0.12);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius: 16px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-display: 'Georgia', 'Noto Serif SC', serif;
    --dialog-bg: rgba(10, 10, 30, 0.85);
    --dialog-border: rgba(255, 255, 255, 0.15);
    --nameplate-bg: var(--gradient);
}

[data-theme="sakura"] {
    --bg: #1a0a14;
    --bg-secondary: #2a1225;
    --bg-card: rgba(255, 150, 180, 0.08);
    --primary: #ff69b4;
    --accent: #ff1493;
    --gradient: linear-gradient(135deg, #ff69b4, #ff1493);
    --border: rgba(255, 105, 180, 0.2);
    --dialog-bg: rgba(26, 10, 20, 0.88);
    --dialog-border: rgba(255, 105, 180, 0.25);
    --nameplate-bg: linear-gradient(135deg, #ff69b4, #ff1493);
}

[data-theme="cyberpunk"] {
    --bg: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-card: rgba(0, 255, 65, 0.05);
    --primary: #00ff41;
    --accent: #ff0090;
    --gradient: linear-gradient(135deg, #00ff41, #ff0090);
    --border: rgba(0, 255, 65, 0.2);
    --dialog-bg: rgba(13, 13, 13, 0.9);
    --dialog-border: rgba(0, 255, 65, 0.25);
    --nameplate-bg: linear-gradient(135deg, #00ff41, #ff0090);
}

[data-theme="ink-wash"] {
    --bg: #f5f0e8;
    --bg-secondary: #e8e0d0;
    --bg-card: rgba(0, 0, 0, 0.04);
    --text: #2c2c2c;
    --text-secondary: rgba(44, 44, 44, 0.7);
    --text-muted: rgba(44, 44, 44, 0.4);
    --primary: #8b4513;
    --accent: #2c2c2c;
    --gradient: linear-gradient(135deg, #8b4513, #2c2c2c);
    --border: rgba(139, 69, 19, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --dialog-bg: rgba(245, 240, 232, 0.92);
    --dialog-border: rgba(139, 69, 19, 0.25);
    --nameplate-bg: linear-gradient(135deg, #8b4513, #2c2c2c);
}

[data-theme="vaporwave"] {
    --bg: #1a0030;
    --bg-secondary: #2a0050;
    --bg-card: rgba(255, 0, 200, 0.06);
    --primary: #ff6ec7;
    --accent: #7b68ee;
    --gradient: linear-gradient(135deg, #ff6ec7, #7b68ee, #00ffff);
    --border: rgba(255, 110, 199, 0.2);
    --dialog-bg: rgba(26, 0, 48, 0.88);
    --dialog-border: rgba(255, 110, 199, 0.25);
    --nameplate-bg: linear-gradient(135deg, #ff6ec7, #7b68ee);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

.screen {
    position: absolute;
    inset: 0;
    display: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

.hidden {
    display: none !important;
}

/* ==================== 标题画面 ==================== */
#title-screen {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

#title-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.title-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
}

.title-logo {
    text-align: center;
    animation: titleFloat 4s ease-in-out infinite;
}

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

.title-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 20px var(--primary));
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { filter: drop-shadow(0 0 20px var(--primary)); }
    50% { filter: drop-shadow(0 0 40px var(--accent)); }
}

.title-logo h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.15em;
    line-height: 1.2;
}

.title-sub {
    font-size: 0.9rem;
    letter-spacing: 0.5em;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.title-tag {
    font-size: 0.75rem;
    color: var(--primary);
    opacity: 0.6;
    margin-top: 0.2rem;
    letter-spacing: 0.2em;
}

.title-menu {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
}

.menu-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-main);
    text-align: left;
}

.menu-btn .btn-icon {
    font-size: 1.3rem;
    width: 2rem;
    text-align: center;
}

.menu-btn small {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.menu-btn.primary {
    background: var(--gradient);
    border-color: transparent;
    color: white;
}

.menu-btn.primary:hover {
    box-shadow: 0 12px 32px rgba(123, 47, 247, 0.4);
    transform: translateY(-3px);
}

.title-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

/* ==================== 游戏画面 ==================== */
#game-screen {
    flex-direction: column;
    background: #000;
}

#scene-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
}

#scene-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 1s ease, opacity 1s ease;
}

#scene-bg.fade-out {
    opacity: 0;
}

#scene-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 40%, transparent 70%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
}

#character-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 220px;
    pointer-events: none;
}

#character-container {
    max-height: 65vh;
    transition: all 0.5s ease;
    filter: drop-shadow(0 0 30px rgba(0, 0, 0, 0.5));
}

#character-container.entering {
    animation: charEnter 0.6s ease-out;
}

#character-container.leaving {
    animation: charLeave 0.4s ease-in forwards;
}

@keyframes charEnter {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes charLeave {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-20px) scale(0.95); }
}

#character-img {
    max-height: 60vh;
    max-width: 50vw;
    object-fit: contain;
    display: block;
}

#game-toolbar {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem;
    opacity: 0.4;
    transition: opacity var(--transition);
}

#game-toolbar:hover {
    opacity: 1;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    backdrop-filter: blur(8px);
}

.toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

#api-indicator {
    width: auto;
    padding: 0 0.5rem;
    gap: 0.3rem;
    font-size: 0.7rem;
}

.api-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #555;
    transition: background var(--transition);
}

.api-dot.connected { background: #00ff41; }
.api-dot.error { background: #ff0040; }
.api-dot.loading { background: #ffaa00; animation: dotPulse 1s infinite; }

@keyframes dotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==================== 对话框 ==================== */
#dialog-box {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    padding: 0 2rem 1.5rem;
}

#dialog-box.clickable {
    cursor: pointer;
}

#dialog-box::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 240px;
    background: var(--dialog-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--dialog-border);
    z-index: -1;
}

#dialog-nameplate {
    display: inline-block;
    padding: 0.35rem 1.2rem;
    background: var(--nameplate-bg);
    border-radius: 20px 20px 0 0;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}

#dialog-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    letter-spacing: 0.1em;
}

#dialog-content {
    padding: 0.8rem 0;
    min-height: 80px;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text);
    letter-spacing: 0.03em;
}

.cursor-blink {
    animation: cursorBlink 1s step-end infinite;
    color: var(--primary);
    font-weight: 300;
}

@keyframes cursorBlink {
    50% { opacity: 0; }
}

#dialog-click-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    animation: hintBounce 2s ease-in-out infinite;
    letter-spacing: 0.2em;
}

@keyframes hintBounce {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(3px); opacity: 1; }
}

/* ==================== 选项 ==================== */
#choices-box {
    position: absolute;
    bottom: 260px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 90%;
    max-width: 600px;
    pointer-events: auto;
}

.choice-btn {
    padding: 0.9rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--dialog-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-main);
    text-align: left;
    animation: choiceAppear 0.4s ease-out backwards;
}

.choice-btn:nth-child(1) { animation-delay: 0.1s; }
.choice-btn:nth-child(2) { animation-delay: 0.2s; }
.choice-btn:nth-child(3) { animation-delay: 0.3s; }
.choice-btn:nth-child(4) { animation-delay: 0.4s; }

@keyframes choiceAppear {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.choice-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    transform: translateX(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.choice-btn::before {
    content: '▸ ';
    color: var(--primary);
}

/* ==================== AI生成中 ==================== */
#ai-generating {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 2rem;
    background: var(--dialog-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    border: 1px solid var(--dialog-border);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.ai-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 模态框 ==================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* ==================== 设置面板 ==================== */
.settings-tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-main);
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: tabFade 0.3s ease;
}

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

.api-provider {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    background: var(--bg-card);
}

.api-provider h3 {
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font-main);
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.form-group input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
    accent-color: var(--primary);
}

.form-group input[type="color"] {
    width: 48px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
}

.api-quota {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.quota-label {
    color: var(--text-muted);
}

.quota-value {
    color: var(--primary);
    font-weight: 600;
}

/* ==================== 主题选择 ==================== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
}

.theme-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.theme-card:hover {
    border-color: var(--primary);
}

.theme-card.active {
    border-color: var(--primary);
    background: rgba(0, 210, 255, 0.08);
}

.theme-preview {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 4px;
    overflow: hidden;
}

.dark-star-preview {
    background: linear-gradient(135deg, #0a0a1a, #1a1a3a);
    box-shadow: inset 0 0 20px rgba(0, 210, 255, 0.3);
}

.sakura-preview {
    background: linear-gradient(135deg, #1a0a14, #2a1225);
    box-shadow: inset 0 0 20px rgba(255, 105, 180, 0.3);
}

.cyberpunk-preview {
    background: linear-gradient(135deg, #0d0d0d, #1a1a1a);
    box-shadow: inset 0 0 20px rgba(0, 255, 65, 0.3);
}

.ink-wash-preview {
    background: linear-gradient(135deg, #f5f0e8, #e8e0d0);
    box-shadow: inset 0 0 20px rgba(139, 69, 19, 0.2);
}

.vaporwave-preview {
    background: linear-gradient(135deg, #1a0030, #2a0050);
    box-shadow: inset 0 0 20px rgba(255, 110, 199, 0.3);
}

.custom-preview {
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* ==================== 存档面板 ==================== */
#save-slots {
    display: grid;
    gap: 0.6rem;
}

.save-slot {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
}

.save-slot:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.06);
}

.save-slot .slot-number {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gradient);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.save-slot .slot-info {
    flex: 1;
}

.save-slot .slot-info .slot-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.save-slot .slot-info .slot-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.save-slot .slot-actions {
    display: flex;
    gap: 0.3rem;
}

.save-slot .slot-actions button {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.save-slot .slot-actions button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ==================== 对话历史 ==================== */
#history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.history-item {
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.5;
}

.history-item .history-name {
    font-weight: 700;
    color: var(--primary);
    margin-right: 0.5rem;
}

.history-item.player {
    background: rgba(0, 210, 255, 0.08);
    border-left: 3px solid var(--primary);
}

.history-item.ai {
    background: var(--bg-card);
    border-left: 3px solid var(--accent);
}

/* ==================== API状态 ==================== */
#api-status-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.api-status-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}

.api-status-card h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.api-status-card .status-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 0.3rem 0;
}

.api-status-card .status-label {
    color: var(--text-muted);
}

.api-status-card .status-value {
    font-weight: 600;
}

.status-ok { color: #00ff41; }
.status-warn { color: #ffaa00; }
.status-err { color: #ff0040; }

/* ==================== Toast ==================== */
#toast-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 2.7s forwards;
    pointer-events: auto;
}

.toast.success { border-left: 3px solid #00ff41; }
.toast.error { border-left: 3px solid #ff0040; }
.toast.info { border-left: 3px solid var(--primary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* ==================== 通用按钮 ==================== */
.action-btn {
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-main);
}

.action-btn:hover {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.action-btn.danger {
    border-color: #ff0040;
    color: #ff0040;
}

.action-btn.danger:hover {
    background: rgba(255, 0, 64, 0.1);
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .title-content { gap: 1.5rem; }
    .title-logo h1 { font-size: 2.2rem; }
    .title-sub { font-size: 0.75rem; letter-spacing: 0.3em; }
    #dialog-box { padding: 0 1rem 1rem; }
    #dialog-box::before { height: 200px; }
    #dialog-content { font-size: 0.95rem; }
    #choices-box { bottom: 220px; }
    .modal-content { width: 95%; max-height: 90vh; }
    .theme-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-tabs { flex-wrap: wrap; }
    #character-layer { padding-bottom: 180px; }
    #character-img { max-height: 50vh; max-width: 70vw; }
}

@media (max-width: 480px) {
    .menu-btn { padding: 0.8rem 1rem; font-size: 0.95rem; }
    .menu-btn small { display: none; }
    .toolbar-btn { width: 30px; height: 30px; font-size: 0.85rem; }
    #game-toolbar { gap: 0.15rem; padding: 0.3rem; }
}

/* ==================== 滚动条 ==================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==================== 场景过渡 ==================== */
.scene-transition {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: #000;
    animation: sceneFade 1.2s ease-in-out;
    pointer-events: none;
}

@keyframes sceneFade {
    0% { opacity: 0; }
    40% { opacity: 1; }
    60% { opacity: 1; }
    100% { opacity: 0; }
}

/* ==================== 赛博朋克特效 ==================== */
[data-theme="cyberpunk"] #dialog-box::before {
    border-top: 1px solid rgba(0, 255, 65, 0.4);
    box-shadow: 0 -2px 20px rgba(0, 255, 65, 0.1);
}

[data-theme="cyberpunk"] .choice-btn:hover {
    text-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

[data-theme="cyberpunk"] #dialog-nameplate {
    clip-path: polygon(0 0, 100% 0, 95% 100%, 5% 100%);
}

/* ==================== 古风特效 ==================== */
[data-theme="ink-wash"] #dialog-box::before {
    background: rgba(245, 240, 232, 0.92);
    border-top: 1px solid rgba(139, 69, 19, 0.3);
}

[data-theme="ink-wash"] .choice-btn {
    border-style: dashed;
}

[data-theme="ink-wash"] .choice-btn::before {
    content: '◆ ';
    color: var(--primary);
}

/* ==================== 蒸汽波特效 ==================== */
[data-theme="vaporwave"] #scene-overlay {
    background: linear-gradient(to top, rgba(26,0,48,0.7) 0%, transparent 40%, rgba(255,110,199,0.05) 70%, rgba(123,104,238,0.1) 100%);
}

[data-theme="vaporwave"] .choice-btn:hover {
    text-shadow: 0 0 10px rgba(255, 110, 199, 0.6);
    box-shadow: 0 0 20px rgba(255, 110, 199, 0.2);
}

/* ==================== 模型标签 ==================== */
.model-tags {
    display: inline-flex;
    gap: 0.3rem;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.tag {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1.4;
}

.tag-free { background: rgba(0, 255, 65, 0.15); color: #00ff41; border: 1px solid rgba(0, 255, 65, 0.3); }
.tag-thinking { background: rgba(123, 47, 247, 0.15); color: #b388ff; border: 1px solid rgba(123, 47, 247, 0.3); }
.tag-vision { background: rgba(0, 210, 255, 0.15); color: #00d2ff; border: 1px solid rgba(0, 210, 255, 0.3); }
.tag-image { background: rgba(255, 170, 0, 0.15); color: #ffaa00; border: 1px solid rgba(255, 170, 0, 0.3); }

.model-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    margin-top: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==================== 图片画廊 ==================== */
#gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.8rem;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    aspect-ratio: 1;
    cursor: pointer;
    transition: all var(--transition);
}

.gallery-item:hover {
    border-color: var(--primary);
    transform: scale(1.03);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item .gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity var(--transition);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay button {
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.gallery-overlay button:hover {
    background: rgba(255, 255, 255, 0.2);
}

#gallery-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.9rem;
}

/* ==================== 场景图下载按钮 ==================== */
#scene-download-btn {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 11;
    padding: 0.3rem 0.6rem;
    border: none;
    border-radius: 0 0 var(--radius-sm) 0;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition);
    backdrop-filter: blur(8px);
}

#scene-layer:hover #scene-download-btn {
    opacity: 0.7;
}

#scene-download-btn:hover {
    opacity: 1 !important;
    background: rgba(0, 0, 0, 0.7);
}

/* ==================== 面板差异化 ==================== */
.settings-panel { max-width: 640px; }
.save-panel { max-width: 560px; }
.history-panel { max-width: 600px; }
.gallery-panel { max-width: 800px; }
.api-status-panel { max-width: 500px; }

.api-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}
