/* ==================== FONTS ==================== */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');

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

/* ==================== CSS VARIABLES ==================== */
:root {
    /* Retrofuture terminal palette */
    --void: #050510;
    --deep-space: #0d0d1f;
    --dark-grid: #141428;
    --panel-bg: #1a1a35;

    --electric-cyan: #00ffff;
    --hot-pink: #ff1493;
    --acid-green: #39ff14;
    --warning-orange: #ff6b00;

    --grid-cyan: rgba(0, 255, 255, 0.15);
    --grid-pink: rgba(255, 20, 147, 0.1);

    --text-bright: #e0f9ff;
    --text-mid: #7dd3fc;
    --text-dim: #3b82f6;

    --font-display: 'Orbitron', monospace;
    --font-mono: 'Share Tech Mono', monospace;
}

/* ==================== ANIMATIONS ==================== */
@keyframes neon-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
    75% { opacity: 0.95; }
}

@keyframes subtle-pulse {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.4;
    }
    33% {
        transform: translate(8%, 5%) scale(1.05);
        opacity: 0.6;
    }
    66% {
        transform: translate(-5%, 8%) scale(0.98);
        opacity: 0.5;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes fadeIn {
    from { opacity: 0.9; }
    to { opacity: 1; }
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ==================== VISIBILITY UTILITIES ==================== */
/* Hide mobile-only elements by default (desktop) */
.mobile-only,
.mobile-tabs,
.mobile-turn-navigation {
    display: none !important;
}

/* Desktop-only elements visible by default */
.desktop-only {
    display: block;
}

/* ==================== BODY & BASE LAYOUT ==================== */
body {
    font-family: var(--font-mono);
    background: radial-gradient(ellipse at top, var(--dark-grid) 0%, var(--void) 100%);
    color: var(--text-bright);
    overflow: hidden;
    position: relative;
}

/* Cyberpunk grid background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 49px,
            var(--grid-cyan) 49px,
            var(--grid-cyan) 50px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 49px,
            var(--grid-cyan) 49px,
            var(--grid-cyan) 50px
        );
    pointer-events: none;
    z-index: 1;
}

.app-container {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

/* ==================== COMMON COMPONENTS ==================== */

/* Dropdown Styles */
.conversation-dropdown {
    background: linear-gradient(to bottom,
        rgba(13, 13, 31, 0.95),
        rgba(20, 20, 40, 0.98)
    );
    border: 1px solid var(--electric-cyan);
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    max-width: 300px;
}

.conversation-dropdown:hover {
    border-color: var(--hot-pink);
    box-shadow: 0 0 15px rgba(255, 20, 147, 0.4);
}

.conversation-dropdown:focus {
    outline: none;
    border-color: var(--acid-green);
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.5);
}

.conversation-dropdown option {
    background: var(--deep-space);
    color: var(--text-bright);
    padding: 8px;
}

/* Narrative Style Dropdown in Header */
.header-bar .narrative-style-dropdown {
    background: linear-gradient(to bottom,
        rgba(13, 13, 31, 0.95),
        rgba(20, 20, 40, 0.98)
    );
    border: 1px solid rgba(138, 43, 226, 0.6);
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 8px rgba(138, 43, 226, 0.2);
    max-width: 120px;
}

.header-bar .narrative-style-dropdown:hover {
    border-color: rgba(138, 43, 226, 0.8);
    box-shadow: 0 0 12px rgba(138, 43, 226, 0.4);
}

.header-bar .narrative-style-dropdown:focus {
    outline: none;
    border-color: rgba(138, 43, 226, 1);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.5);
}

.header-bar .narrative-style-dropdown option {
    background: var(--deep-space);
    color: var(--text-bright);
    padding: 6px;
}

/* Model Settings Button */
.model-settings-btn {
    background: rgba(57, 255, 20, 0.1);
    border: 1px solid var(--acid-green);
    color: var(--acid-green);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.2);
}

.model-settings-btn:hover {
    background: rgba(57, 255, 20, 0.2);
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
}

/* ==================== PANELS ==================== */
.panel {
    display: flex;
    flex-direction: column;
    position: relative;
    background: linear-gradient(to bottom,
        var(--deep-space),
        var(--panel-bg)
    );
    overflow: hidden;
}

.panel-header {
    padding: 18px 24px;
    background: linear-gradient(to bottom,
        var(--panel-bg),
        var(--deep-space)
    );
    border-bottom: 2px solid var(--electric-cyan);
    box-shadow:
        inset 0 1px 0 rgba(0, 255, 255, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.5);
    position: relative;
}

.panel-title {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-mid);
    position: relative;
    z-index: 2;
}

.panel-subtitle {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 2px;
    position: relative;
    z-index: 2;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 24px;
    position: relative;
    z-index: 1;
}

/* Animated background glow (behind content) */
.panel-body::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -30%;
    width: 160%;
    height: 160%;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 255, 255, 0.08) 0%,
        rgba(0, 200, 255, 0.04) 30%,
        rgba(0, 150, 255, 0.02) 50%,
        transparent 70%
    );
    animation: subtle-pulse 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* ==================== MESSAGES ==================== */
.message {
    margin-bottom: 20px;
    padding: 20px 24px;
    border-radius: 8px;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
}

.message.user {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.95),
        rgba(240, 245, 255, 0.98)
    );
    border-left-color: var(--hot-pink);
    border: 1px solid rgba(255, 20, 147, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.message.user:hover {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 1),
        rgba(255, 240, 250, 0.98)
    );
    border-left-color: var(--warning-orange);
    border-color: rgba(255, 20, 147, 0.5);
    box-shadow: 0 4px 8px rgba(255, 20, 147, 0.15),
                0 0 20px rgba(255, 20, 147, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.message.assistant {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.95),
        rgba(240, 250, 255, 0.98)
    );
    border-left-color: var(--electric-cyan);
    border: 1px solid rgba(0, 255, 255, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.message.assistant:hover {
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 1),
        rgba(240, 255, 255, 0.98)
    );
    border-left-color: var(--acid-green);
    border-color: rgba(0, 255, 255, 0.5);
    box-shadow: 0 4px 8px rgba(0, 255, 255, 0.15),
                0 0 20px rgba(0, 255, 255, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.message.error {
    background: linear-gradient(135deg,
        rgba(168, 58, 42, 0.2),
        rgba(107, 35, 35, 0.3)
    );
    border-left-color: #a83a2a;
    border: 1px solid rgba(168, 58, 42, 0.4);
}

.message + .message {
    margin-top: 12px;
}

.message-content {
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.8;
    color: #1a1a4d;
    letter-spacing: 0.02em;
    white-space: pre-wrap; /* Preserve line breaks from model responses */
    word-wrap: break-word; /* Prevent long words from overflowing */
}

/* Quoted text styling */
.message-content .quoted-text {
    color: var(--hot-pink);
    font-style: italic;
    font-weight: 700;
}

/* Streaming text cursor animation */
.message-content.streaming::after {
    content: '▋';
    animation: blink 1s infinite;
    margin-left: 2px;
    color: var(--electric-cyan);
    font-weight: normal;
}

/* Smooth fade-in for streaming text */
.message-content.streaming {
    animation: fadeIn 0.15s ease-in;
}

/* Virtual scrolling spacers */
.message-spacer {
    width: 100%;
    flex-shrink: 0;
    background: transparent;
    pointer-events: none;
}

/* Message action buttons */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    justify-content: flex-start;
}

.action-btn {
    background: transparent;
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.action-btn:hover {
    opacity: 1;
    background: rgba(0, 255, 255, 0.1);
    transform: scale(1.1);
}

.action-btn.active {
    background: rgba(0, 255, 255, 0.2);
    border-color: var(--electric-cyan);
    opacity: 1;
}

/* ==================== INPUT & BUTTONS ==================== */

/* Input Form */
.input-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.input-field {
    flex: 1;
    padding: 14px 16px;
    background: rgba(13, 13, 31, 0.8);
    border: 2px solid var(--electric-cyan);
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    min-height: 70px;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.6),
                0 0 10px rgba(0, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--hot-pink);
    box-shadow:
        inset 2px 2px 4px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(255, 20, 147, 0.5),
        0 0 10px rgba(0, 255, 255, 0.3);
}

.input-field::placeholder {
    color: var(--text-dim);
}

/* iOS fix: Make readonly state look identical to normal state */
.input-field:read-only {
    opacity: 1;
    background: rgba(13, 13, 31, 0.8);
    color: var(--text-bright);
    -webkit-text-fill-color: var(--text-bright);
}

/* Footer Buttons Container */
.footer-buttons {
    display: flex;
    gap: 0;
    width: 100%;
}

/* Submit Button */
.submit-btn {
    flex: 1;
    background: linear-gradient(to bottom,
        var(--electric-cyan),
        var(--hot-pink)
    );
    color: var(--text-bright);
    border: 2px solid var(--electric-cyan);
    border-right: 1px solid var(--electric-cyan);
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 7px 26px;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.6),
        0 0 15px rgba(0, 255, 255, 0.4),
        inset 0 1px 0 rgba(0, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.submit-btn:hover:not(:disabled) {
    background: linear-gradient(to bottom,
        var(--hot-pink),
        var(--electric-cyan)
    );
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.7);
    transform: translateY(-2px);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Font Size Accessibility Button */
.font-size-btn {
    background: linear-gradient(to bottom,
        rgba(255, 140, 0, 0.9),
        rgba(255, 100, 0, 0.9)
    );
    color: var(--text-bright);
    border: 2px solid rgba(255, 140, 0, 0.8);
    border-left: 1px solid rgba(255, 140, 0, 0.8);
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    padding: 7px 14px;
    min-width: 52px;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.6),
        0 0 15px rgba(255, 140, 0, 0.3),
        inset 0 1px 0 rgba(255, 180, 0, 0.2);
    transition: all 0.3s ease;
}

.font-size-btn:hover {
    background: linear-gradient(to bottom,
        rgba(255, 160, 0, 1),
        rgba(255, 120, 0, 1)
    );
    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(255, 140, 0, 0.5);
    transform: translateY(-2px);
}

.font-size-btn:active {
    transform: translateY(0);
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Parse Button */
.parse-btn {
    flex: 1;
    background: linear-gradient(135deg,
        rgba(57, 255, 20, 0.2),
        rgba(57, 255, 20, 0.1)
    );
    color: var(--acid-green);
    border: 2px solid var(--acid-green);
    border-left: 1px solid var(--acid-green);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 7px 26px;
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.6),
        0 0 15px rgba(57, 255, 20, 0.3),
        inset 0 1px 0 rgba(57, 255, 20, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.parse-btn:hover:not(:disabled) {
    background: linear-gradient(135deg,
        rgba(57, 255, 20, 0.3),
        rgba(57, 255, 20, 0.15)
    );
    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(57, 255, 20, 0.4);
    transform: translateY(-2px);
}

.parse-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.parse-btn .parse-count {
    background: var(--acid-green);
    color: var(--void);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 900;
    min-width: 20px;
    text-align: center;
}

/* ==================== CONTEXT NOTES ==================== */
.context-footer {
    padding: 18px 24px;
    background: linear-gradient(to top,
        rgba(20, 20, 40, 0.95),
        rgba(26, 26, 53, 0.9)
    );
    border-top: 2px solid var(--electric-cyan);
    box-shadow: inset 0 1px 0 rgba(0, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.narrative-settings-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.narrative-style-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--electric-cyan);
    font-family: var(--font-display);
}

.narrative-style-dropdown {
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 10px 12px;
    background: rgba(13, 13, 31, 0.8);
    border: 2px solid var(--electric-cyan);
    color: var(--text-bright);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.narrative-style-dropdown:hover {
    border-color: var(--hot-pink);
    box-shadow: 0 0 10px var(--hot-pink);
}

.narrative-style-dropdown:focus {
    outline: none;
    border-color: var(--hot-pink);
    box-shadow: 0 0 15px var(--hot-pink);
}

/* ==================== INSTRUCTION BADGES ==================== */
/* Applied to Next Turn Badge (Cyan theme) */
.pending-instruction-section {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid var(--electric-cyan);
    border-radius: 4px;
}

.pending-instruction-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pending-instruction-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--electric-cyan);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.pending-instruction-text {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-bright);
    line-height: 1.4;
    min-width: 150px;
    word-break: break-word;
}

.pending-instruction-edit-btn,
.pending-instruction-remove-btn {
    padding: 4px 8px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid var(--electric-cyan);
    border-radius: 3px;
    color: var(--electric-cyan);
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pending-instruction-edit-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
}

.pending-instruction-remove-btn {
    background: rgba(255, 0, 0, 0.1);
    border-color: rgba(255, 0, 0, 0.5);
    color: rgba(255, 0, 0, 0.8);
}

.pending-instruction-remove-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.8);
    color: rgba(255, 0, 0, 1);
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

/* Pre-Instruction Badge (Hot Pink theme) */
.pre-instruction-section {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255, 20, 147, 0.05);
    border: 1px solid var(--hot-pink);
    border-radius: 4px;
}

.pre-instruction-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pre-instruction-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--hot-pink);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.pre-instruction-text {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-bright);
    line-height: 1.4;
    min-width: 150px;
    word-break: break-word;
}

.pre-instruction-edit-btn,
.pre-instruction-remove-btn {
    padding: 4px 8px;
    background: rgba(255, 20, 147, 0.1);
    border: 1px solid var(--hot-pink);
    border-radius: 3px;
    color: var(--hot-pink);
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pre-instruction-edit-btn:hover {
    background: rgba(255, 20, 147, 0.2);
    box-shadow: 0 0 8px rgba(255, 20, 147, 0.4);
}

.pre-instruction-remove-btn {
    background: rgba(255, 0, 0, 0.1);
    border-color: rgba(255, 0, 0, 0.5);
    color: rgba(255, 0, 0, 0.8);
}

.pre-instruction-remove-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.8);
    color: rgba(255, 0, 0, 1);
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

/* Active Instructions Section (Hot Pink theme - active context) */
.active-instructions-section {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255, 20, 147, 0.05);
    border: 1px solid var(--hot-pink);
    border-radius: 4px;
}

.active-instructions-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--hot-pink);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.active-instructions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.active-instruction-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 20, 147, 0.1);
    border: 1px solid rgba(255, 20, 147, 0.4);
    border-radius: 3px;
    font-size: 11px;
    color: rgba(255, 182, 223, 0.95);
    transition: all 0.2s ease;
}

.active-instruction-badge:hover {
    background: rgba(255, 20, 147, 0.15);
    border-color: rgba(255, 20, 147, 0.6);
    box-shadow: 0 0 6px rgba(255, 20, 147, 0.3);
}

.active-instruction-index {
    font-weight: 700;
    color: var(--hot-pink);
    min-width: 16px;
}

.active-instruction-text {
    flex: 1;
    word-break: break-word;
}

.active-instruction-remove-btn {
    padding: 2px 6px;
    background: transparent;
    border: 1px solid rgba(255, 20, 147, 0.4);
    border-radius: 2px;
    color: rgba(255, 20, 147, 0.8);
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.active-instruction-remove-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.8);
    color: rgba(255, 0, 0, 1);
    box-shadow: 0 0 6px rgba(255, 0, 0, 0.3);
}

.notes-section {
    margin-bottom: 0;
}

.notes-status {
    font-size: 10px;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
}

.notes-status.saved {
    color: var(--acid-green);
    background: rgba(0, 255, 0, 0.1);
}

.notes-status.unsaved {
    color: var(--warning-orange);
    background: rgba(255, 165, 0, 0.1);
}

.notes-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--electric-cyan);
    margin-bottom: 8px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.notes-input {
    width: 100%;
    padding: 12px;
    background: rgba(10, 10, 25, 0.8);
    border: 1px solid var(--electric-cyan);
    border-radius: 4px;
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 60px;
    transition: all 0.3s ease;
}

.notes-input:focus {
    outline: none;
    border-color: var(--hot-pink);
    box-shadow: 0 0 12px rgba(255, 0, 128, 0.3);
    background: rgba(15, 10, 25, 0.9);
}

.notes-input::placeholder {
    color: var(--text-dim);
    font-style: italic;
}

.save-notes-btn {
    padding: 10px 20px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid var(--electric-cyan);
    border-radius: 4px;
    color: var(--electric-cyan);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
    width: 100%;
}

.save-notes-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
}

.save-notes-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==================== INSTRUCTION NOTES ==================== */
.instruction-notes-section {
    margin-bottom: 16px;
    padding: 16px;
    background: rgba(0, 100, 255, 0.05);
    border: 1px solid rgba(0, 150, 255, 0.3);
    border-radius: 6px;
}

.instruction-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--electric-cyan);
}

.info-tooltip {
    cursor: help;
    font-size: 14px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.info-tooltip:hover {
    opacity: 1;
}

.pending-instruction-indicator {
    margin-left: auto;
    padding: 3px 8px;
    background: rgba(0, 150, 255, 0.2);
    border-radius: 3px;
    font-size: 10px;
    color: var(--electric-cyan);
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}

.instruction-input {
    width: 100%;
    padding: 12px;
    background: rgba(10, 10, 25, 0.8);
    border: 1px solid var(--electric-cyan);
    border-radius: 4px;
    color: var(--text-bright);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 70px;
    margin-bottom: 12px;
}

.instruction-input:focus {
    outline: none;
    border-color: var(--hot-pink);
    box-shadow: 0 0 12px rgba(255, 0, 128, 0.3);
    background: rgba(15, 10, 25, 0.9);
}

.instruction-input::placeholder {
    color: var(--text-dim);
    font-style: italic;
}

/* Scrollbar styling for instruction input */
.instruction-input::-webkit-scrollbar {
    width: 8px;
}

.instruction-input::-webkit-scrollbar-track {
    background: rgba(10, 10, 20, 0.5);
    border-radius: 4px;
}

.instruction-input::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.3);
    border-radius: 4px;
}

.instruction-input::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.5);
}

.instruction-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* End Scene Toggle Button */
.end-scene-toggle {
    margin-left: auto;
    padding: 4px 12px;
    background: rgba(138, 43, 226, 0.1);
    border: 1px solid rgba(138, 43, 226, 0.5);
    border-radius: 4px;
    color: rgba(138, 43, 226, 0.8);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.end-scene-toggle:hover {
    background: rgba(138, 43, 226, 0.2);
    border-color: rgba(138, 43, 226, 0.8);
    color: rgba(138, 43, 226, 1);
    box-shadow: 0 0 8px rgba(138, 43, 226, 0.3);
}

.end-scene-toggle.active {
    background: rgba(138, 43, 226, 0.3);
    border-color: rgba(138, 43, 226, 1);
    color: rgba(255, 255, 255, 1);
    box-shadow: 0 0 12px rgba(138, 43, 226, 0.5);
}

.apply-next-btn,
.regenerate-instruction-btn {
    padding: 7px 16px;  /* Reduced from 10px to 7px (33% reduction) */
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid var(--electric-cyan);
    border-radius: 4px;
    color: var(--electric-cyan);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.apply-next-btn:hover:not(:disabled),
.regenerate-instruction-btn:hover:not(:disabled),
.end-scene-btn:hover:not(:disabled) {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
}

.apply-next-btn:disabled,
.regenerate-instruction-btn:disabled,
.end-scene-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==================== CONVERSATIONS ==================== */
.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(135deg,
        rgba(20, 20, 40, 0.9),
        rgba(26, 26, 53, 0.85)
    );
    border: 1px solid var(--electric-cyan);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
    font-family: var(--font-mono);
}

.conversation-item:hover {
    background: linear-gradient(135deg,
        rgba(30, 30, 60, 0.95),
        rgba(36, 36, 73, 0.9)
    );
    border-color: var(--hot-pink);
    box-shadow: 0 0 12px rgba(255, 0, 128, 0.3);
    transform: translateX(4px);
}

.conversation-item.active {
    border-color: var(--hot-pink);
    background: linear-gradient(135deg,
        rgba(40, 20, 40, 0.95),
        rgba(46, 26, 53, 0.9)
    );
    box-shadow: 0 0 16px rgba(255, 0, 128, 0.4);
}

.conversation-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid var(--electric-cyan);
    border-radius: 50%;
    font-size: 20px;
    color: var(--electric-cyan);
    flex-shrink: 0;
}

.new-conversation-btn .conversation-icon {
    background: rgba(255, 0, 128, 0.1);
    border-color: var(--hot-pink);
    color: var(--hot-pink);
    font-size: 24px;
    font-weight: bold;
}

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

.conversation-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

/* ==================== UTILITY STATES ==================== */

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
}

.empty-icon {
    font-size: 36px;
    margin-bottom: 14px;
    opacity: 0.3;
}

.empty-title {
    font-family: var(--font-serif);
    font-size: 13px;
    font-weight: 400;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.empty-subtitle {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    opacity: 0.6;
}

/* Error Display */
.error-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.error-icon {
    font-size: 48px;
}

.error-title {
    color: #ff6b6b;
    font-size: 18px;
    font-weight: 600;
}

.error-message {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-align: center;
    max-width: 400px;
    line-height: 1.5;
}

.error-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-style: italic;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 255, 255, 0.1);
    border-top: 3px solid var(--electric-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: var(--electric-cyan);
    font-size: 14px;
    font-weight: 500;
    animation: pulse 2s ease-in-out infinite;
}

/* ==================== SECTIONS & INFO BOXES ==================== */
.section {
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.section-title {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--electric-cyan);
    background: linear-gradient(to right,
        rgba(0, 255, 255, 0.05),
        transparent
    );
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.section-title:hover {
    background: linear-gradient(to right,
        rgba(0, 255, 255, 0.1),
        transparent
    );
    border-bottom-color: var(--hot-pink);
}

.section-title::after {
    content: '▼';
    font-size: 10px;
    color: var(--electric-cyan);
    transition: transform 0.3s ease;
}

.section-title.collapsed::after {
    transform: rotate(-90deg);
}

.section-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
    font-size: 11px;
    line-height: 1.5;
}

.section-content.collapsed {
    max-height: 0;
    opacity: 0;
    font-size: 11px;
}

.info-box {
    padding: 12px 16px;
    background: linear-gradient(135deg,
        rgba(13, 13, 31, 0.7),
        rgba(20, 20, 40, 0.5)
    );
    border-left: 2px solid var(--electric-cyan);
    margin-bottom: 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-mid);
    box-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(0, 255, 255, 0.1),
        inset 1px 1px 0 rgba(0, 255, 255, 0.1);
}

.info-box-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.info-box-value {
    color: var(--text-bright);
}

/* ==================== NARRATIVE STYLE SELECTOR ==================== */
.narrative-style-selector {
    padding: 16px;
    background: linear-gradient(135deg,
        rgba(13, 13, 31, 0.6),
        rgba(26, 26, 53, 0.4)
    );
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 4px;
    margin-bottom: 16px;
}

.narrative-style-hint {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 8px;
    margin-bottom: 0;
    opacity: 0.7;
    font-style: italic;
}

.narrative-prompt-display {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(0, 255, 255, 0.2);
}

.narrative-prompt-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--hot-pink);
    margin-bottom: 10px;
}

.narrative-prompt-preview {
    background: rgba(5, 5, 16, 0.8);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-bright);
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

.narrative-prompt-preview::-webkit-scrollbar {
    width: 8px;
}

.narrative-prompt-preview::-webkit-scrollbar-track {
    background: rgba(5, 5, 16, 0.5);
}

.narrative-prompt-preview::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--electric-cyan), var(--hot-pink));
    border-radius: 4px;
}

/* ==================== CONTEXT DISPLAY ==================== */
.context-section {
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(0, 255, 255, 0.03);
    border-left: 2px solid var(--electric-cyan);
    border-radius: 4px;
}

.context-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--electric-cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Character cards */
.character-card {
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.character-name {
    font-weight: 700;
    color: var(--hot-pink);
    margin-bottom: 6px;
}

.character-description,
.character-mood,
.character-intention {
    font-size: 13px;
    color: var(--text-mid);
    margin-bottom: 4px;
}

.character-meta {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 6px;
    font-style: italic;
}

/* Setting cards */
.setting-card {
    padding: 8px 0;
}

.setting-location,
.setting-time,
.setting-atmosphere {
    font-size: 13px;
    color: var(--text-mid);
    margin-bottom: 6px;
}

.setting-meta {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 6px;
    font-style: italic;
}

/* Plot cards */
.plot-card {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.plot-thread {
    font-size: 13px;
    color: var(--text-bright);
    margin-bottom: 4px;
}

.plot-status {
    font-size: 12px;
    color: var(--acid-green);
}

/* Character knowledge and interactions */
.character-knowledge {
    font-size: 12px;
    color: var(--acid-green);
    margin-top: 6px;
}

.character-knowledge ul {
    margin: 4px 0 0 16px;
    padding: 0;
}

.character-knowledge li {
    margin-bottom: 2px;
}

.character-interactions {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
    font-style: italic;
}

/* Relationships subsection */
.relationships-subsection {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 255, 255, 0.2);
}

.subsection-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--electric-cyan);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.relationship-card {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 20, 147, 0.1);
    border-left: 2px solid var(--hot-pink);
    border-radius: 4px;
}

.relationship-characters {
    font-size: 13px;
    font-weight: 600;
    color: var(--hot-pink);
    margin-bottom: 4px;
}

.relationship-behavior {
    font-size: 12px;
    color: var(--text-mid);
    margin-bottom: 2px;
}

.relationship-tone {
    font-size: 11px;
    color: var(--text-dim);
    font-style: italic;
}

/* Continuity flags */
.continuity-flag {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 20, 147, 0.15);
    border-left: 3px solid var(--hot-pink);
    border-radius: 4px;
}

.flag-type {
    font-size: 12px;
    font-weight: 700;
    color: var(--hot-pink);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.flag-character,
.flag-characters {
    font-size: 12px;
    color: var(--acid-green);
    margin-bottom: 3px;
}

.flag-issue {
    font-size: 13px;
    color: var(--text-bright);
    margin-top: 4px;
}

/* Model Instruction Badge */
.instruction-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(0, 150, 255, 0.15);
    border: 1px solid rgba(0, 150, 255, 0.4);
    border-radius: 12px;
    font-size: 11px;
    color: rgba(100, 180, 255, 0.9);
    font-family: var(--font-mono);
    margin-bottom: 12px;
    cursor: help;
    transition: all 0.2s ease;
}

.instruction-badge:hover {
    background: rgba(0, 150, 255, 0.25);
    border-color: rgba(0, 180, 255, 0.6);
}

.instruction-badge-icon {
    font-size: 14px;
}

.instruction-badge-text {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Issue cards (new format) */
.issue-card {
    margin-bottom: 10px;
    padding: 8px;
    background: rgba(255, 107, 0, 0.1);
    border-left: 2px solid var(--warning-orange);
    border-radius: 4px;
}

.issue-type {
    font-size: 12px;
    font-weight: 600;
    color: var(--warning-orange);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.issue-description {
    font-size: 13px;
    color: var(--text-mid);
}

/* ==================== MODE CONTROLS & INDICATORS ==================== */
.mode-controls {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.mode-controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 255, 255, 0.15);
}

.mode-detected-label {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mode-detected-value {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.mode-detected-value.conversation {
    color: var(--electric-cyan);
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid var(--electric-cyan);
}

.mode-detected-value.story {
    color: var(--hot-pink);
    background: rgba(255, 20, 147, 0.1);
    border: 1px solid var(--hot-pink);
}

.mode-override-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-mid);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 255, 0.2);
}

.mode-btn.active {
    border-width: 2px;
}

.mode-btn[data-mode="conversation"].active {
    background: rgba(0, 255, 255, 0.15);
    border-color: var(--electric-cyan);
    color: var(--electric-cyan);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.mode-btn[data-mode="story"].active {
    background: rgba(255, 20, 147, 0.15);
    border-color: var(--hot-pink);
    color: var(--hot-pink);
    box-shadow: 0 0 20px rgba(255, 20, 147, 0.3);
}

.mode-btn-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.mode-btn-label {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mode-override-hint {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    opacity: 0.7;
}

.mode-indicator {
    margin-bottom: 1.5rem;
}

.mode-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.conversation-mode {
    border-color: var(--electric-cyan);
    background: rgba(0, 255, 255, 0.05);
}

.story-mode {
    border-color: var(--hot-pink);
    background: rgba(255, 20, 147, 0.05);
}

.mode-icon {
    font-size: 2rem;
    line-height: 1;
}

.mode-content {
    flex: 1;
}

.mode-label {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.conversation-mode .mode-label {
    color: var(--electric-cyan);
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.story-mode .mode-label {
    color: var(--hot-pink);
    text-shadow: 0 0 10px rgba(255, 20, 147, 0.5);
}

.mode-description {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-mid);
    opacity: 0.9;
}

/* ==================== LOGOUT BUTTON ==================== */
.logout-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font-mono);
    transition: background 0.2s, border-color 0.2s;
    margin-left: 12px;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ==================== TURN FEEDBACK UI ==================== */
.turn-feedback-btn {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 16px;
    background: rgba(255, 20, 147, 0.15);
    border: 1px solid rgba(255, 20, 147, 0.4);
    border-radius: 4px;
    color: var(--hot-pink);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font-mono);
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-block;
    line-height: 1.4;
}

.turn-feedback-btn:hover {
    background: rgba(255, 20, 147, 0.25);
    border-color: var(--hot-pink);
    box-shadow: 0 0 16px rgba(255, 20, 147, 0.5);
}

.turn-feedback-btn.has-feedback {
    background: rgba(255, 20, 147, 0.25);
    border-color: var(--hot-pink);
    box-shadow: 0 0 12px rgba(255, 20, 147, 0.4);
}

.turn-feedback-section {
    padding: 16px 24px;
    background: rgba(26, 22, 18, 0.8);
    border-bottom: 1px solid rgba(255, 20, 147, 0.3);
    animation: slideDown 0.2s ease-out;
}

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

.turn-feedback-container {
    max-width: 100%;
}

.turn-feedback-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--hot-pink);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.turn-feedback-input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 20, 147, 0.3);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.turn-feedback-input:focus {
    outline: none;
    border-color: var(--hot-pink);
    box-shadow: 0 0 12px rgba(255, 20, 147, 0.3);
}

.turn-feedback-input::placeholder {
    color: var(--text-dim);
    opacity: 0.6;
}

.turn-feedback-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.turn-feedback-save-btn,
.turn-feedback-cancel-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.turn-feedback-save-btn {
    background: rgba(255, 20, 147, 0.15);
    border: 1px solid var(--hot-pink);
    color: var(--hot-pink);
}

.turn-feedback-save-btn:hover {
    background: rgba(255, 20, 147, 0.25);
    box-shadow: 0 0 16px rgba(255, 20, 147, 0.5);
}

.turn-feedback-cancel-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-mid);
}

.turn-feedback-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.turn-feedback-status {
    margin-top: 8px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    min-height: 20px;
}

/* Mobile floating button */
.turn-feedback-floating-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 20, 147, 0.2);
    border: 2px solid var(--hot-pink);
    color: var(--hot-pink);
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 20, 147, 0.4);
    transition: all 0.3s;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.turn-feedback-floating-btn:hover,
.turn-feedback-floating-btn:active {
    background: rgba(255, 20, 147, 0.3);
    box-shadow: 0 6px 24px rgba(255, 20, 147, 0.6);
    transform: scale(1.05);
}

.turn-feedback-floating-btn.has-feedback {
    background: rgba(255, 20, 147, 0.3);
    box-shadow: 0 4px 20px rgba(255, 20, 147, 0.5);
    animation: pulseShadow 2s infinite;
}

@keyframes pulseShadow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(255, 20, 147, 0.5);
    }
    50% {
        box-shadow: 0 6px 28px rgba(255, 20, 147, 0.7);
    }
}

/* Mobile modal */
.turn-feedback-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

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

.turn-feedback-modal-content {
    background: var(--panel-bg);
    border: 2px solid var(--hot-pink);
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(255, 20, 147, 0.4);
    animation: slideUp 0.3s ease-out;
}

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

.turn-feedback-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.turn-feedback-modal-header h3 {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--hot-pink);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.turn-feedback-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-mid);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.turn-feedback-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
}

/* ==================== REVIEW TABS ==================== */

.review-tabs {
    display: flex;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
}

.review-tab {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s;
}

.review-tab:hover {
    background: rgba(0, 255, 255, 0.05);
    color: var(--accent-cyan);
}

.review-tab.active {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    background: rgba(0, 255, 255, 0.1);
}

.review-tab-content {
    display: block;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
}

.review-tab-content.hidden {
    display: none;
}

/* Remove nested scrolling from characterPanel - parent handles it */
#characterPanel {
    overflow: visible;
    max-height: none;
}

/* Custom scrollbar for review tab content */
.review-tab-content::-webkit-scrollbar {
    width: 8px;
}

.review-tab-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-left: 1px solid rgba(0, 243, 255, 0.2);
}

.review-tab-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(0, 243, 255, 0.6), rgba(255, 0, 255, 0.4));
    border-radius: 4px;
}

.review-tab-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(0, 243, 255, 0.8), rgba(255, 0, 255, 0.6));
}

/* ==================== WORLD STATE VIEWER ==================== */

.world-state-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.world-state-title {
    font-weight: 600;
    color: var(--text-primary);
}

.world-state-controls {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 4px 8px;
    font-size: 11px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}

.btn-small.btn-primary {
    background: var(--accent-cyan);
    color: var(--bg-deep);
    border-color: var(--accent-cyan);
}

.btn-small.btn-primary:hover {
    background: rgba(0, 255, 255, 0.8);
}

.btn-small.btn-success {
    background: var(--accent-green);
    color: var(--bg-deep);
}

.btn-tiny {
    padding: 2px 6px;
    font-size: 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-tiny:hover {
    background: var(--accent-magenta);
    color: var(--bg-deep);
    border-color: var(--accent-magenta);
}

/* ==================== COLLAPSIBLE SECTIONS ==================== */

.collapsible-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.collapsible-header {
    padding: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-panel);
    transition: background 0.2s;
}

.collapsible-header:hover {
    background: rgba(0, 255, 255, 0.05);
}

.collapse-icon {
    color: var(--accent-cyan);
    font-size: 12px;
    transition: transform 0.2s;
}

.collapsible-content {
    padding: 0 12px 12px 28px;
    background: var(--bg-elevated);
}

.collapsible-content.collapsed {
    display: none;
}

/* ==================== SCENE FIELDS ==================== */

.scene-field {
    margin-bottom: 12px;
}

.scene-field label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.world-input {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 13px;
    font-family: var(--font-base);
}

.world-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    background: var(--bg-deep);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid var(--accent-cyan);
    border-radius: 12px;
    font-size: 11px;
    color: var(--accent-cyan);
}

.tag-remove {
    background: none;
    border: none;
    color: var(--accent-cyan);
    cursor: pointer;
    padding: 0 2px;
    font-size: 14px;
}

.tag-remove:hover {
    color: var(--accent-magenta);
}

.tag-add {
    padding: 4px 8px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag-add:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* ==================== FACT/THREAD/EVENT ITEMS ==================== */

.fact-item,
.thread-item,
.event-item {
    padding: 8px;
    background: var(--bg-panel);
    border-radius: 4px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fact-text,
.thread-text,
.event-text {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary);
}

.fact-turn,
.thread-turn,
.event-turn {
    font-size: 10px;
    color: var(--text-muted);
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.thread-item.resolved {
    opacity: 0.5;
}

.thread-item.resolved .thread-text {
    text-decoration: line-through;
}

.empty-state {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

/* ==================== DEPOSIT BUTTONS ==================== */

.deposit-btn {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid var(--accent-cyan);
    border-radius: 4px;
    color: var(--accent-cyan);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.deposit-btn:hover {
    background: var(--accent-cyan);
    color: var(--bg-deep);
}

/* ==================== DEPOSIT AREA ==================== */

.deposit-area {
    background: rgba(0, 255, 255, 0.03);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
}

.deposit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.deposit-label {
    font-weight: 500;
    color: var(--text-primary);
}

.deposit-count {
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

.deposit-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 24px;
}

.deposit-empty {
    color: var(--text-muted);
    font-size: 11px;
    font-style: italic;
}

.deposit-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-panel);
    border: 1px solid var(--accent-cyan);
    border-radius: 4px;
    font-size: 11px;
}

.deposit-item-type {
    color: var(--accent-cyan);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 9px;
}

.deposit-item-label {
    color: var(--text-primary);
}

.deposit-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 2px;
    font-size: 14px;
    transition: color 0.2s;
}

.deposit-item-remove:hover {
    color: var(--accent-magenta);
}

/* ==================== JSON EDITOR ==================== */

.json-editor {
    width: 100%;
    min-height: 400px;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 12px;
    resize: vertical;
    border-radius: 4px;
}

.json-editor:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

/* ==================== CHARACTER CARDS ==================== */

.character-card {
    background: rgba(0, 255, 255, 0.03);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.character-card:hover {
    background: rgba(0, 255, 255, 0.05);
    border-color: var(--accent-cyan);
}

.character-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.character-name {
    font-weight: 600;
    flex: 1;
    color: var(--text-primary);
}

.character-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.status-active {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.status-inactive {
    background: rgba(136, 136, 160, 0.2);
    color: var(--text-muted);
}

.status-mentioned {
    background: rgba(255, 136, 0, 0.2);
    color: #ff8800;
}

.character-details {
    margin-bottom: 8px;
}

.char-field {
    font-size: 12px;
    margin-bottom: 4px;
}

.char-field label {
    color: var(--text-muted);
    font-weight: 500;
}

.char-field span {
    color: var(--text-primary);
}

.char-monologue {
    margin-top: 8px;
    padding: 8px;
    background: rgba(255, 136, 255, 0.05);
    border-left: 2px solid var(--accent-magenta);
    border-radius: 4px;
}

.char-monologue label {
    display: block;
    font-size: 10px;
    color: var(--accent-magenta);
    font-weight: 500;
    margin-bottom: 4px;
}

.monologue-text {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 12px;
    margin: 0;
}

.expand-char-btn {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.expand-char-btn:hover {
    background: var(--accent-cyan);
    color: var(--bg-deep);
    border-color: var(--accent-cyan);
}

.error-state {
    padding: 20px;
    text-align: center;
    color: var(--accent-magenta);
    font-size: 12px;
}
