    /* Базові налаштування та змінні */
    :root {
        --bg-main: #0f172a;
        --bg-sidebar: #1e293b;
        --text-main: #f1f5f9;
        --text-muted: #94a3b8;
        --accent-sky: #38bdf8;
        --accent-indigo: #4f46e5;
        --border-color: #334155;
        --game-blue: #1e3a8a;
        --danger: #ef4444;
    }

    @import url('https://fonts.googleapis.com/css2?family=Segoe+UI:wght@400;700&display=swap');

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

    body {
        background-color: var(--bg-main);
        color: var(--text-main);
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        height: 100vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* Header */
    header {
        padding: 1rem;
        background: var(--bg-sidebar);
        border-bottom: 1px solid var(--border-color);
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
        z-index: 50;
    }

    .header-logo {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }

    .header-title {
        font-size: 1.125rem;
        font-weight: bold;
        line-height: 1;
    }

    .header-subtitle {
        font-size: 10px;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.1em;
    }

    .btn-group {
        display: flex;
        gap: 0.75rem;
    }

    /* Layout */
    main {
        display: flex;
        flex: 1;
        overflow: hidden;
    }

    .sidebar {
        width: 20rem;
        background: var(--bg-sidebar);
        border-right: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
    }

    .search-container {
        padding: 0.75rem;
        background: rgba(15, 23, 42, 0.5);
        border-bottom: 1px solid var(--border-color);
    }

    .search-input {
        width: 100%;
        background: #1e293b;
        border: 1px solid var(--border-color);
        border-radius: 0.25rem;
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        color: white;
        outline: none;
    }

    .search-input:focus {
        border-color: var(--accent-sky);
    }

    #dialogList {
        flex: 1;
        overflow-y: auto;
        padding: 0.5rem;
    }

    .editor-view {
        flex: 1;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        background: rgba(15, 23, 42, 0.2);
        overflow-y: auto;
    }

    .content-max-width {
        width: 100%;
        max-width: 56rem;
        margin: 0 auto;
        padding-bottom: 2.5rem;
    }

    /* RPG Maker Windows */
    .game-window {
        background: linear-gradient(180deg, rgba(30, 58, 138, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
        border: 2px solid #64748b;
        border-radius: 8px;
        padding: 1.5rem;
        position: relative;
        min-height: 120px;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
        margin-top: 2rem;
    }

    .name-box-editor {
        position: absolute;
        top: -14px;
        left: 20px;
        z-index: 50;
        background: #1e3a8a;
        border: 1px solid #94a3b8;
        border-radius: 4px;
        padding: 2px 8px;
        color: white;
        font-weight: bold;
        font-size: 14px;
        outline: none;
        min-width: 100px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    }

    .name-box-editor:focus {
        border-color: var(--accent-sky);
        background: #2563eb;
    }

    .rpg-input {
        background: transparent;
        border: none;
        color: white; 
        width: 100%;
        height: 140px;
        resize: none;
        outline: none;
        font-size: 1.125rem;
        line-height: 1.6;
        padding: 0;
        font-family: inherit;
    }

    /* Choice Window */
    .choice-window {
        background: linear-gradient(180deg, rgba(30, 58, 138, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
        border: 2px solid #64748b;
        border-radius: 4px;
        padding: 0.5rem;
        min-width: 240px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    }

    .choice-item-input {
        width: 100%;
        background: rgba(255,255,255,0.05);
        border: 1px solid transparent;
        color: white;
        padding: 6px 10px;
        margin-bottom: 3px;
        border-radius: 3px;
        outline: none;
        transition: all 0.2s;
        text-align: center;
    }

    .choice-item-input:focus {
        background: rgba(255,255,255,0.1);
        border-color: var(--accent-sky);
    }

    /* Buttons */
    button {
        cursor: pointer;
        border: none;
        border-radius: 0.25rem;
        font-weight: 500;
        font-size: 0.875rem;
        transition: background 0.2s;
    }

    .btn-secondary {
        background: #334155;
        color: white;
        padding: 0.5rem 1rem;
    }

    .btn-secondary:hover {
        background: #475569;
    }

    .btn-primary {
        background: #0284c7;
        color: white;
        padding: 0.5rem 1rem;
    }

    .btn-primary:hover {
        background: #0ea5e9;
    }

    .btn-danger {
        background: #334155;
        border: 1px solid #64748b;
        color: white;
        font-size: 11px;
        padding: 0.5rem 1rem;
    }

    .btn-danger:hover {
        background: var(--danger);
        border-color: var(--danger);
    }

    .btn-action {
        background: #4f46e5;
        color: white;
        font-size: 11px;
        padding: 0.5rem 1rem;
    }

    .btn-action:hover {
        background: #4338ca;
    }

    /* Utility Classes */
    .active-row {
        background: #334155 !important;
        border-left: 4px solid var(--accent-sky) !important;
    }

    .media-tag {
        font-size: 9px;
        padding: 1px 4px;
        background: rgba(0,0,0,0.3);
        border-radius: 3px;
        color: var(--text-muted);
        border: 1px solid rgba(255,255,255,0.1);
    }

    .hidden { display: none !important; }

    /* Lists and Items */
    .list-item {
        padding: 0.75rem;
        border-radius: 0.25rem;
        border: 1px solid transparent;
        cursor: pointer;
        transition: background 0.2s;
        margin-bottom: 0.25rem;
    }

    .list-item:hover {
        background: #1e293b;
    }

    .list-item-meta {
        display: flex;
        justify-content: space-between;
        font-size: 9px;
        color: #64748b;
        margin-bottom: 0.25rem;
    }

    .list-item-title {
        font-size: 0.75rem;
        font-weight: 500;
        color: #e2e8f0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 4px;
    }

    .media-tags-container {
        display: flex;
        gap: 4px;
        flex-wrap: wrap;
    }

    .badge {
        font-size: 10px;
        font-weight: bold;
        color: var(--accent-sky);
        text-transform: uppercase;
        background: #0c4a6e;
        padding: 0.125rem 0.5rem;
        border-radius: 0.25rem;
        margin-bottom: 0.5rem;
        display: inline-block;
    }

    /* Form Elements */
    .wrap-toggle {
        display: flex;
        align-items: center;
        gap: 10px;
        background: rgba(30, 41, 59, 0.5);
        padding: 8px 12px;
        border-radius: 6px;
        border: 1px solid var(--border-color);
    }

    .db-input {
        width: 100%;
        background: #1e293b;
        border: 1px solid var(--border-color);
        border-radius: 0.25rem;
        padding: 0.75rem;
        color: white;
        outline: none;
    }

    .db-input:focus {
        border-color: var(--accent-sky);
    }

    .label-small {
        font-size: 10px;
        font-weight: bold;
        color: var(--text-muted);
        text-transform: uppercase;
        margin-bottom: 0.25rem;
        display: block;
    }

    /* Scrollbar */
    ::-webkit-scrollbar { width: 8px; }
    ::-webkit-scrollbar-track { background: var(--bg-main); }
    ::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

    /* Grid for DB */
    .db-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .navigation-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: rgba(30, 41, 59, 0.4);
        padding: 1rem;
        border-radius: 0.5rem;
        border: 1px solid var(--border-color);
        margin-top: 2rem;
    }
