/* =================== */
/* FONTS */
/* =================== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600&family=Cinzel:wght@400;600&family=Cormorant+Garamond:wght@400;600&family=Lavishly+Yours&family=Love+Light&display=swap');

/* =================== */
/* RESET & ROOT */
/* =================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #16161f;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;
    --border: rgba(255,255,255,0.08);
    --danger: #ef4444;
    --success: #22c55e;
    
    /* Theme Variables */
    --msg-opacity: 0.7;
    --name-font: 'Playfair Display';
    --name-font-size: 20px;
    --text-size: 15px;
    --avatar-size: 40px;
    --color-dialog: #e0e0e0;
    --color-italic: #a0a0b0;
    --color-bold: #ffffff;
    --color-custom: #7c3aed;
    --name-weight: 600;
    --name-color: #ffffff;
    --line-height: 1.7;
    --user-msg-color: #7c3aed;
    --char-msg-color: #1e1e23;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* =================== */
/* SCROLLBAR */
/* =================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* =================== */
/* TOP BAR */
/* =================== */
#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

#top-left, #top-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

#page-title {
    font-weight: 600;
    font-size: 16px;
    margin-left: 5px;
}

/* =================== */
/* BUTTONS */
/* =================== */
.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
    backdrop-filter: blur(10px);
}

.icon-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.icon-btn svg { width: 20px; height: 20px; }

.btn-primary, .btn-secondary, .btn-danger {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border) !important;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--accent) !important;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.btn-danger:hover { transform: translateY(-1px); }

.btn-sm { padding: 6px 10px !important; font-size: 11px !important; }

/* =================== */
/* MAIN CONTENT */
/* =================== */
#content {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    background: transparent;
}

/* =================== */
/* SIDE PANELS */
/* =================== */
.side-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-secondary);
    overflow: hidden;
    z-index: 80;
    display: none;
}

.side-panel.open { display: flex; }

#left-panel { left: 0; border-right: 1px solid var(--border); }
#right-panel { right: 0; border-left: 1px solid var(--border); }

.panel-content {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

.panel-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 10;
    transition: background 0.15s;
}

.panel-resize-handle:hover,
.side-panel.resizing .panel-resize-handle { background: var(--accent); }

.panel-resize-right { right: 0; }
.panel-resize-left { left: 0; }

/* Panel Form Styles */
.panel-content label {
    display: block;
    margin: 15px 0 5px;
    font-size: 13px;
    color: var(--text-secondary);
}

.panel-content label:first-of-type { margin-top: 0; }

.panel-content input,
.panel-content textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.panel-content input:focus,
.panel-content textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Panel Headers */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h3 svg { width: 18px; height: 18px; }

.panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    border-radius: 6px;
    transition: 0.15s;
}

.panel-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.panel-close svg { width: 18px; height: 18px; }

/* Panel Tabs */
.panel-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.panel-tab {
    flex: 1;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.panel-tab:hover { color: var(--text-primary); }

.panel-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.panel-tab svg { width: 14px; height: 14px; }

.panel-section { display: none; }
.panel-section.active { display: block; }

/* Right Panel Items */
.right-panel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: 0.15s;
}

.right-panel-item:hover { border-color: var(--accent); }

.right-panel-item.active {
    border-color: var(--accent);
    background: rgba(124, 58, 237, 0.1);
}

.right-panel-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.right-panel-avatar img { width: 100%; height: 100%; object-fit: cover; }
.right-panel-avatar svg { width: 20px; height: 20px; color: var(--text-muted); }

.right-panel-info { flex: 1; min-width: 0; }

.right-panel-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.right-panel-meta { font-size: 12px; color: var(--text-muted); }

.right-panel-actions { display: flex; gap: 5px; }

.right-panel-actions button {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
}

.right-panel-actions button:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.right-panel-actions button svg { width: 14px; height: 14px; }

/* =================== */
/* CHAT AREA */
/* =================== */
#chat-area {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow: hidden;
    background: transparent;
    min-width: 0;
}

#chat-page {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
    position: relative;
}

/* Chat Header - Hover Trigger */
.chat-header-trigger {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 25px;
    z-index: 9;
}

#chat-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}

.chat-header-trigger:hover ~ #chat-header,
#chat-header:hover {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#chat-char-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#chat-char-avatar {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: 0.15s;
}

#chat-char-avatar:hover {
    transform: scale(1.05);
    border: 2px solid var(--accent);
}

#chat-char-avatar img { width: 100%; height: 100%; object-fit: cover; }

#chat-char-name { font-weight: 600; font-size: 16px; }

#chat-actions { display: flex; gap: 8px; }

#chat-new-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: white;
}

#chat-new-btn:hover {
    transform: scale(1.05);
}

/* Chat Container */
#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Gallery in Chat Header */
.chat-gallery {
    display: flex;
    gap: 8px;
    margin-left: 10px;
}

.chat-gallery-item {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: 0.15s;
}

.chat-gallery-item:hover {
    border-color: var(--accent);
    transform: scale(1.1);
}

.chat-gallery-item img { width: 100%; height: 100%; object-fit: cover; }

/* =================== */
/* MESSAGES */
/* =================== */
.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin-bottom: 25px;
}

/* Message Header */
.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px 12px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: none;
}

.message-avatar {
    width: var(--avatar-size, 40px);
    height: var(--avatar-size, 40px);
    border-radius: 10px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: 0.15s;
}

.message-avatar:hover { transform: scale(1.1); }

.message-avatar.user-avatar {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
}

.message-avatar img { width: 100%; height: 100%; object-fit: cover; }
.message-avatar svg { width: 20px; height: 20px; color: var(--text-muted); }
.message-avatar.user-avatar svg { color: white; }

.message-meta-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.message-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.message-name.char-name {
    font-family: var(--name-font, 'Playfair Display'), serif;
    font-size: var(--name-font-size, 20px);
    font-weight: var(--name-weight, 600);
    color: var(--name-color, #ffffff);
    -webkit-text-fill-color: var(--name-color, #ffffff);
    background: none;
}

.message-name.user-name {
    font-family: var(--name-font, 'Playfair Display'), serif;
    font-size: var(--name-font-size, 20px);
    font-weight: var(--name-weight, 600);
    color: var(--name-color, #ffffff);
}

.message {
    line-height: var(--line-height, 1.7);
}

.message-details {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--text-secondary); /* war --text-muted */
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    width: fit-content;
}

.message-id, .message-time { opacity: 1; } /* war 0.8 */

.message-tokens { color: var(--accent); font-weight: 600; }

/* Gallery in Message Header */
.message-header-gallery {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.message-header-gallery-item {
    width: var(--avatar-size, 40px);
    height: var(--avatar-size, 40px);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: 0.15s;
    flex-shrink: 0;
}

.message-header-gallery-item:hover {
    border-color: var(--accent);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.message-header-gallery-item img { width: 100%; height: 100%; object-fit: cover; }

/* Message Bubble */
.message {
    padding: 15px 18px;
    border-radius: 0;
    line-height: 1.7;
    font-size: var(--text-size, 15px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.message.assistant {
    background: var(--char-msg-bg, rgba(30, 30, 35, 0.7));
}

.message.user {
    background: var(--user-msg-bg, rgba(124, 58, 237, 0.21));
    border-color: rgba(124, 58, 237, 0.2);
}

/* Banner Support */
//.message-wrapper.has-banner .message.assistant { padding-top: 180px; }

.message-wrapper.has-banner .message.assistant .message-thinking,
.message-wrapper.has-banner .message.assistant .message-text {
    position: relative;
    z-index: 1;
}

/* Message Actions - Always Visible */
.message-actions {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0 0 12px 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: none;
    backdrop-filter: blur(10px);
}

.msg-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.msg-action-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.msg-action-btn svg { width: 15px; height: 15px; }

/* Message Text Content */
.message-text {
    color: var(--text-primary);
    line-height: var(--line-height, 1.7);
}

.message-text p { margin: 0 0 10px 0; }
.message-text p:last-child { margin-bottom: 0; }

/* Text Formatting */
.text-dialog { color: var(--color-dialog, #e0e0e0); }
.text-italic { color: var(--color-italic, #a0a0b0); font-style: italic; }
.text-bold { color: var(--color-bold, #ffffff); font-weight: 600; }
.text-custom { color: var(--color-custom, #7c3aed); font-style: italic; }

/* Code in Messages */
.message-text pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-text code { font-family: 'Consolas', 'Monaco', monospace; font-size: 13px; }
.message-text pre code { background: none; padding: 0; }

.message-text :not(pre) > code {
    background: rgba(124, 58, 237, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Thinking Block */
.message-thinking {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.message-thinking summary {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    user-select: none;
}

.message-thinking summary:hover { color: var(--text-primary); }
.message-thinking summary svg { width: 16px; height: 16px; }

.message-thinking .thinking-content {
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Swipe Controls */
.swipe-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.swipe-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
}

.swipe-btn:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.swipe-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.swipe-btn svg { width: 16px; height: 16px; }
.swipe-counter { font-size: 13px; color: var(--text-muted); min-width: 50px; text-align: center; }
.generating-text { color: var(--text-muted); font-style: italic; }

/* Edit Mode */
.message-edit-area {
    width: 100%;
    min-height: 120px;
    max-height: 400px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    line-height: 1.6;
}

.message-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.message-edit-actions button {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.15s;
}

.edit-save-btn { background: var(--accent); border: none; color: white; }
.edit-save-btn:hover { background: var(--accent-hover); }

.edit-cancel-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.edit-cancel-btn:hover { background: var(--bg-secondary); }

/* =================== */
/* INPUT AREA */
/* =================== */
#input-area {
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    max-height: 150px;
    font-family: inherit;
}

#user-input:focus { outline: none; border-color: var(--accent); }

#send-btn, #stop-btn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

#send-btn { background: var(--accent); }
#send-btn:hover { background: var(--accent-hover); }
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

#stop-btn { background: var(--danger); }
#stop-btn:hover { background: #dc2626; }

#send-btn svg, #stop-btn svg { width: 20px; height: 20px; }

/* =================== */
/* LANDING PAGE */
/* =================== */
#landing-page {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 50;
    padding: 80px 20px 20px;
    overflow-y: auto;
    display: none;
    justify-content: center;
    align-items: flex-start;
}

#landing-page.active { display: flex; }

/* =================== */
/* CHARACTER GRID */
/* =================== */
#character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.character-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: 0.2s;
}

.character-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.character-avatar {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.character-avatar img { width: 100%; height: 100%; object-fit: cover; }
.character-avatar svg { width: 64px; height: 64px; color: var(--text-muted); }

.character-info { padding: 15px; }
.character-info h3 { font-weight: 600; font-size: 16px; margin-bottom: 5px; }

.character-actions { padding: 0 15px 15px; }

.character-actions button,
.char-edit-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: 0.15s;
}

.character-actions button:hover,
.char-edit-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* FAB */
.fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
    transition: 0.2s;
    z-index: 60;
}

.fab:hover { background: var(--accent-hover); transform: scale(1.05); }
.fab svg { width: 28px; height: 28px; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg { width: 64px; height: 64px; margin-bottom: 20px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; margin-bottom: 10px; color: var(--text-secondary); }

/* =================== */
/* MODALS */
/* =================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.open { display: flex; }

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large { max-width: 650px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    transition: 0.15s;
}

.close-modal:hover { color: var(--text-primary); }
.close-modal svg { width: 24px; height: 24px; }

.modal-body { padding: 20px; }

.modal-body label {
    display: block;
    margin: 15px 0 5px;
    font-size: 13px;
    color: var(--text-secondary);
}

.modal-body label:first-child { margin-top: 0; }

.modal-body input,
.modal-body textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}

.modal-body textarea { resize: vertical; }

.modal-body input:focus,
.modal-body textarea:focus { outline: none; border-color: var(--accent); }

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-buttons button svg { width: 16px; height: 16px; }

/* Status Messages */
.status-msg {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    display: none;
}

.status-msg.success { display: block; background: rgba(34, 197, 94, 0.2); color: var(--success); }
.status-msg.error { display: block; background: rgba(239, 68, 68, 0.2); color: var(--danger); }

/* Character Form */
.char-form-grid {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.char-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#char-avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 16px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    overflow: hidden;
    color: var(--text-muted);
}

#char-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

.char-main-fields { flex: 1; }

/* =================== */
/* CHARACTER BANNER/GALLERY */
/* =================== */
.char-banner-section {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.banner-preview-row {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.banner-preview {
    width: 200px;
    height: 80px;
    border-radius: 8px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.banner-preview span { color: var(--text-muted); font-size: 12px; }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; }

.banner-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.banner-settings { display: flex; gap: 20px; }

.banner-setting {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.banner-setting input[type="number"] {
    width: 60px;
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
}

.banner-setting input[type="range"] { width: 100px; }

.char-gallery-section {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.gallery-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.gallery-empty { color: var(--text-muted); font-size: 13px; padding: 10px; }

.gallery-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.gallery-item img:hover { opacity: 0.8; }

.gallery-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.gallery-item:hover .gallery-remove { opacity: 1; }
.gallery-remove svg { width: 12px; height: 12px; }

.gallery-add-row { margin-top: 10px; }

/* =================== */
/* FLOATING PANELS */
/* =================== */
.floating-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.floating-panel.open { display: flex; }

.floating-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    cursor: move;
    user-select: none;
}

.floating-panel-header span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.floating-panel-header svg { width: 16px; height: 16px; }

.panel-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-close-btn:hover { color: var(--text-primary); }

/* Notepad */
#notepad-panel {
    height: 300px;
    resize: both;
    min-width: 250px;
    min-height: 200px;
}

#notepad-content {
    flex: 1;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
}

#notepad-content:focus { outline: none; }

/* =================== */
/* THEME PANEL */
/* =================== */
.theme-panel {
    width: 380px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.theme-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.theme-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.theme-tab {
    flex: 1;
    padding: 12px 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: 0.15s;
    border-bottom: 2px solid transparent;
}

.theme-tab:hover { color: var(--text-primary); }

.theme-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.theme-tab-content {
    display: none;
    padding: 15px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px; /* Platz für Footer */
}

.theme-tab-content.active { display: block; }

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.theme-color-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.theme-color-item label { font-size: 11px; color: var(--text-muted); }

.theme-color-item input[type="color"] {
    width: 100%;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    background: var(--bg-tertiary);
}

.theme-section { margin-bottom: 15px; }

.theme-section label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.theme-value { color: var(--accent); font-weight: 500; }

.theme-section input[type="text"],
.theme-section select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

.theme-section input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.theme-section input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.theme-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.preset-btn {
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.15s;
}

.preset-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.theme-user-avatar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-avatar-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.theme-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.theme-avatar-preview svg { width: 24px; height: 24px; color: var(--text-muted); }

.theme-avatar-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.theme-footer {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.theme-footer button { flex: 1; }

#theme-save.saved { background: var(--success) !important; }

/* =================== */
/* IMAGE PREVIEW */
/* =================== */
#image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

#image-preview-overlay.open { display: flex; }

#image-preview-img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}

#image-preview-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#image-preview-close:hover { background: rgba(255, 255, 255, 0.2); }

/* =================== */
/* DEBUG PANEL */
/* =================== */
.debug-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.debug-section h4 {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.debug-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
}

.debug-row span:first-child { color: var(--text-muted); }
.debug-row span:last-child { color: var(--text-primary); }

.debug-details {
    margin-top: 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.debug-details summary {
    padding: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.debug-details summary:hover { color: var(--text-primary); }
.debug-details[open] summary { color: var(--accent); }

.debug-payload-content {
    padding: 15px;
    max-height: 60vh;
    overflow-y: auto;
}

.payload-model,
.payload-thinking {
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.payload-thinking {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent);
}

.payload-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payload-message {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.payload-role {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payload-message.system .payload-role { background: rgba(124, 58, 237, 0.2); color: var(--accent); }
.payload-message.user .payload-role { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.payload-message.assistant .payload-role { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }

.payload-content {
    padding: 12px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    background: var(--bg-primary);
}

.payload-content p { margin-bottom: 10px; }
.payload-content p:last-child { margin-bottom: 0; }

/* =================== */
/* STORY DIRECTOR */
/* =================== */
.director-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.director-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.director-section-header h4 {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.director-section-header h4 svg { width: 16px; height: 16px; }

.director-add-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--accent);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
}

.director-add-btn:hover { background: var(--accent-hover); }
.director-add-btn svg { width: 14px; height: 14px; }

.director-empty {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 10px;
}

.director-warning {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 15px;
}

.director-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.director-card.active {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.05);
}

.director-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.director-card-header input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

.director-card-header input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--success);
}

.director-card-header select {
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

.director-card textarea {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

.director-delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s;
    flex-shrink: 0;
}

.director-delete-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.director-delete-btn svg { width: 14px; height: 14px; }

.arc-active-badge {
    font-size: 10px;
    background: var(--success);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.director-pacing {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.pacing-icon { font-size: 18px; }

.director-pacing input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: var(--bg-secondary);
    border-radius: 3px;
    outline: none;
}

.director-pacing input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.pacing-label {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 80px;
    text-align: right;
}

.director-focus {
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.focus-label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.focus-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: baseline;
}

.focus-option {
    display: inline-flex;
    align-items: center;
    gap: 4px;
	white-space: nowrap;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 0;
    transition: 0.15s;
}

.focus-option:hover { color: var(--text-primary); }

.focus-option input {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
}

.focus-option input:checked + span { color: var(--accent); }

.director-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.director-textarea:focus { outline: none; border-color: var(--accent); }

.director-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.director-tokens { font-size: 12px; color: var(--text-muted); }

.director-save-indicator {
    position: fixed;
    top: 70px;
    right: 340px;
    background: var(--success);
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transform: translateY(-10px);
    transition: 0.2s;
    z-index: 100;
}

.director-save-indicator.show { opacity: 1; transform: translateY(0); }
.director-save-indicator svg { width: 14px; height: 14px; }

.director-preview-content {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    max-height: 50vh;
    overflow-y: auto;
}

.director-preview-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.director-preview-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

/* =================== */
/* MODEL PICKER */
/* =================== */
.model-input-row {
    display: flex;
    gap: 8px;
}

.model-input-row input { flex: 1; }

.model-fetch-btn {
    width: 42px !important;
    flex-shrink: 0;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.model-fetch-btn svg { width: 18px; height: 18px; }

.model-search-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.model-search-input:focus { outline: none; border-color: var(--accent); }

.model-list { max-height: 400px; overflow-y: auto; }

.model-item {
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: 0.15s;
}

.model-item:hover {
    border-color: var(--accent);
    background: rgba(124, 58, 237, 0.1);
}

.model-item-id {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-all;
}

.model-item-context {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.model-loading,
.model-error,
.model-empty {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}

.model-error { color: var(--danger); }

/* Thinking Toggle */
.thinking-toggle {
    margin-top: 15px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.thinking-hint {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Message Headings */
.message-heading {
    margin: 15px 0 10px 0;
    color: var(--text-primary);
    font-weight: 600;
}

.message-text h1.message-heading {
    font-size: 1.6em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.message-text h2.message-heading {
    font-size: 1.4em;
}

.message-text h3.message-heading {
    font-size: 1.2em;
}

/* Load More Button */
#load-more-container {
    text-align: center;
    padding: 15px;
    margin-bottom: 10px;
}

#load-more-btn {
    padding: 10px 20px;
    gap: 8px;
}

/* API Profiles */
.api-profiles-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.profile-row {
    display: flex;
    gap: 8px;
}

.profile-row select {
    flex: 1;
}

.btn-sm {
    padding: 8px 10px;
}

.message-quote {
    border-left: 3px solid var(--accent-color);
    padding: 8px 12px;
    margin: 4px 0;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.95em;
}

.message-quote + .message-quote {
    margin-top: -4px;
}

/* =================== */
/* MOBILE */
/* =================== */
@media (max-width: 768px) {
    .side-panel {
        position: fixed;
        top: 57px;
        bottom: 0;
        width: 85% !important;
        max-width: 320px;
        z-index: 90;
    }
    
    #left-panel { left: 0; transform: translateX(-100%); }
    #left-panel.open { transform: translateX(0); }
    
    #right-panel { right: 0; transform: translateX(100%); }
    #right-panel.open { transform: translateX(0); }
    
    .panel-resize-handle { display: none; }
    
    #landing-page { padding: 20px; padding-top: 80px; }
    
    #character-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .character-avatar {
        max-height: 150px;
    }
    
    .char-form-grid {
        flex-direction: column;
        align-items: center;
    }
    
    .fab { bottom: 20px; right: 20px; width: 56px; height: 56px; }
    .director-save-indicator { right: 20px; }
}

/* Force theme panel hidden by default */
#theme-panel {
    display: none !important;
}

#theme-panel.open {
    display: flex !important;
}
