:root {
    color-scheme: dark;
    --bg: #090b10;
    --panel: #11151d;
    --panel2: #171c26;
    --border: #2a3240;
    --text: #edf2f7;
    --muted: #929cab;
    --accent: #ff9d32;
    --green: #62d39a;
    --red: #ff6b6b
}

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 Inter, Segoe UI, Arial, sans-serif
}

.app {
    min-height: 100vh;
    background: linear-gradient(180deg, #0a0d12, #090b10)
}

header {
    height: 64px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    padding: 0 20px;
    background: #0d1016;
    position: sticky;
    top: 0;
    z-index: 5
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center
}

.logo {
    width: 34px;
    height: 34px;
    border: 1px solid #47515f;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: #171c24;
    color: var(--accent);
    font-weight: 800
}

.brand h1 {
    font-size: 16px;
    margin: 0
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 11px
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px
}

.workspace-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px
}

.workspace-actions #downloadBtn {
    flex: 0 0 auto;
    padding: 8px 12px
}

button,
.filebtn,
select,
input {
    font: inherit
}

button,
.filebtn {
    border: 1px solid var(--border);
    background: #171c24;
    color: var(--text);
    padding: 8px 11px;
    border-radius: 7px;
    cursor: pointer
}

.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #181008;
    font-weight: 700
}

.danger {
    color: #ff9999
}

.layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 150px;
    min-height: calc(100vh - 64px)
}

aside {
    border-right: 1px solid var(--border);
    padding: 16px;
    background: #0d1016
}

.right {
    border-left: 1px solid var(--border);
    border-right: 0
}

.section {
    margin-bottom: 18px
}

.section h2 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .11em;
    color: var(--muted);
    margin: 0 0 9px
}

.field {
    min-width: 0;
    margin: 8px 0
}

.field input[type=range] {
    width: 100%
}

.field label {
    display: flex;
    justify-content: space-between;
    color: #bbc3ce;
    font-size: 12px;
    margin-bottom: 5px
}

input[type=text],
input[type=number],
select {
    width: 100%;
    background: #0b0e13;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 8px
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

.checks label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    color: #cbd2dc
}

.checks input {
    accent-color: var(--accent)
}

main {
    padding: 18px;
    min-width: 0
}

.mode-control {
    display: flex;
    align-items: center;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #0b0e13;
    font-weight: 700
}

.mode-caption {
    padding: 5px 9px;
    border-right: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .11em;
    line-height: 1.4
}

.mode-switch {
    position: relative;
    display: flex;
    width: 184px;
    padding: 2px;
}

.mode-switch::before {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    width: calc((100% - 4px) / 2);
    border-radius: 2px;
    background: var(--accent);
    content: "";
    transition: transform .2s ease
}

.mode-switch[data-mode="canvas"]::before {
    transform: translateX(100%)
}

.mode-option {
    position: relative;
    z-index: 1;
    flex: 1;
    padding: 6.5px 9px;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700
}

.mode-option[aria-pressed="true"] {
    color: #181008
}

.mode-option:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px
}

.mode-option:hover {
    color: var(--text)
}

.mode-option[aria-pressed="true"]:hover {
    color: #181008
}

@media (prefers-reduced-motion: reduce) {
    .mode-switch::before {
        transition: none
    }
}

.drop {
    border: 1px dashed #3b4554;
    border-radius: 10px;
    background: #0d1118;
    padding: 12px
}

.drop textarea {
    width: 100%;
    height: 220px;
    resize: vertical;
    border: 0;
    outline: 0;
    background: transparent;
    color: #e9edf2;
    font: 13px/1.55 Consolas, Monaco, monospace
}

.toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 9px
}

.toolbar .spacer {
    flex: 1
}

.preview-shell {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #06080c;
    overflow: hidden
}

.preview-top {
    min-height: 55px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #06080c;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    color: var(--muted);
    font-size: 15px
}

.preview-tools {
    display: flex;
    align-items: center;
    flex: 0 0 auto
}

#count {
    margin-left: auto
}

.upload-image-btn {
    padding: 5px 9px;
    border-color: #3b4554;
    background: #11151d;
    color: #cbd2dc;
    font-size: 12px
}

.upload-image-btn span:first-child {
    color: var(--accent);
    font-size: 14px
}

.upload-image-note {
    color: var(--muted);
    font-size: 10px
}

.preview {
    padding: 22px;
    min-height: 440px;
    overflow: auto;
    background: #000;
    transition: .2s
}

.chat {
    max-width: 1100px;
    margin: auto;
    font-family: Arial, sans-serif;
    font-weight: 700
}

.line {
    white-space: pre-wrap;
    word-break: break-word;
    text-shadow: 0 1px 2px #000;
    margin: 0
}

.timestamp {
    color: #8b929d
}

.name {
    font-weight: 700
}

.line.me,
.line.do {
    color: #c2a3da
}

.line.low {
    color: #9d9d9d
}

.line.whisper {
    color: #eda841
}

.line.system {
    color: #aab4c2
}

.line.ooc {
    color: #b5b5b5
}

.line.radio {
    color: #84d7a4
}

.line.ad {
    color: #ffd27b
}

.line.money {
    color: #56d64b
}

.line.item {
    color: #56d64b
}

.line.phone {
    color: #fbf724
}

.line.hidden {
    display: none
}

.line em {
    font-style: normal
}

.legend {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px
}

.legend div {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px
}

.sample {
    height: 8px;
    width: 8px;
    display: inline-block;
    border-radius: 50%;
    margin-right: 6px
}

.canvas {
    display: none;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: #171717
}

.canvas img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover
}

.canvas .overlay {
    position: absolute;
    left: 30px;
    bottom: 30px;
    right: 30px;
    background: rgba(0, 0, 0, .42);
    padding: 12px;
    border-radius: 4px;
    resize: both;
    overflow: auto;
    cursor: grab
}

.canvas .overlay.dragging {
    cursor: grabbing;
    user-select: none
}

.canvas .overlay .line {
    margin: 1px 0
}

.hint {
    color: var(--muted);
    font-size: 11px
}

.line.inventory {
    color: #ffff00
}

.line.shout {
    color: #f1f1f1
}

.line.unknown {
    color: #e7e7e7
}

.line.ckblue {
    color: #3896f3
}

.line.ckred {
    color: #f00000
}

@media(max-width:1050px) {
    .layout {
        grid-template-columns: 250px minmax(0, 1fr)
    }

    .right {
        display: none
    }
}

@media(max-width:700px) {
    .layout {
        display: block
    }

    .layout>aside {
        display: none
    }

    header {
        padding: 0 10px
    }

    .brand small {
        display: none
    }

    main {
        padding: 10px
    }

    .preview {
        padding: 12px
    }

    .preview-top {
        flex-wrap: wrap;
        gap: 8px
    }

    .preview-tools {
        flex-wrap: wrap;
        gap: 6px
    }

    .upload-image-note {
        display: none
    }

    .drop textarea {
        height: 180px
    }
}
