.vtt-shell {
    padding: 8px 10px 12px;
    max-width: 100%;
    position: relative;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vtt-async-hud {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 120;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid rgba(154, 127, 87, 0.8);
    border-radius: 999px;
    background: rgba(22, 16, 11, 0.92);
    color: #f3dfb5;
    font-size: 0.78rem;
}

.vtt-async-hud.is-active {
    display: inline-flex;
}

.vtt-async-spinner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(243, 223, 181, 0.3);
    border-top-color: #f3dfb5;
    animation: vttSpin .8s linear infinite;
}

@keyframes vttSpin {
    from { transform: rotate(0); }
    to { transform: rotate(360deg); }
}

body.no-sidebar .content-flex,
body.no-sidebar .footer-container {
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.journal-vtt-page .music-player {
    display: none !important;
}

.main-layout {
    margin-left: 0 !important;
}

.vtt-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
}

.vtt-board {
    border: 1px solid rgba(146, 122, 83, 0.7);
    border-radius: 12px;
    background: radial-gradient(circle at 35% 0%, rgba(205, 152, 76, 0.1), transparent 42%), #16110b;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
}

.vtt-board-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(146, 122, 83, 0.5);
    background: rgba(34, 25, 15, 0.9);
}

.vtt-board-title {
    color: #f0d7a3;
    font-weight: 700;
    margin: 0;
    font-size: 0.95rem;
}

.vtt-board-note {
    color: #cfb78a;
    font-size: 0.8rem;
}

.vtt-board-stage {
    height: calc(100% - 46px);
    min-height: 0;
    position: relative;
    overflow: auto;
}

.vtt-board-stage.can-pan {
    cursor: grab;
}

.vtt-board-stage.is-panning {
    cursor: grabbing !important;
}

.vtt-board-stage.can-pan .vtt-board-canvas {
    cursor: grab !important;
}

.vtt-board-stage.is-panning .vtt-board-canvas {
    cursor: grabbing !important;
}

.vtt-board-world {
    position: relative;
    width: max-content;
    height: max-content;
    min-width: 0;
    min-height: 0;
}

.vtt-tools {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    z-index: 20;
    background: rgba(25, 18, 12, 0.93);
    border: 1px solid rgba(146, 122, 83, 0.7);
    border-radius: 10px;
    padding: 6px;
}

.vtt-zoom-control {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    background: rgba(25, 18, 12, 0.93);
    border: 1px solid rgba(146, 122, 83, 0.7);
    border-radius: 10px;
    padding: 6px 10px;
    color: #f3dfb5;
    font-size: 0.78rem;
}

.vtt-zoom-control input[type="range"] {
    width: 150px;
}

.vtt-zoom-btn {
    border: 1px solid rgba(154, 127, 87, 0.8);
    background: #2b1f14;
    color: #f3dfb5;
    border-radius: 6px;
    width: 24px;
    height: 24px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.vtt-tool-btn,
.vtt-tools select {
    border: 1px solid rgba(154, 127, 87, 0.8);
    background: #2b1f14;
    color: #f3dfb5;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.78rem;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, background-color 0.12s ease;
    cursor: pointer;
}

.vtt-color-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(154, 127, 87, 0.8);
    background: #2b1f14;
    color: #f3dfb5;
    border-radius: 8px;
    padding: 2px 6px;
    font-size: 0.72rem;
}

.vtt-color-wrap input[type="color"] {
    width: 24px;
    height: 20px;
    border: 0;
    padding: 0;
    background: transparent;
}

.vtt-tool-btn:hover {
    filter: brightness(1.08);
}

.vtt-tool-btn:active,
.vtt-tool-btn.is-pressed {
    transform: translateY(1px) scale(0.95);
    box-shadow: inset 0 0 0 1px rgba(255, 234, 190, 0.3), 0 0 10px rgba(255, 189, 96, 0.18);
    filter: brightness(1.12);
}

.vtt-tool-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    filter: grayscale(0.2);
}

.vtt-tool-btn.active {
    background: linear-gradient(180deg, #7a5125, #5f3f1d);
    border-color: #ffd68e;
    color: #fff6e2;
    box-shadow: 0 0 0 1px rgba(255, 214, 142, 0.35), 0 0 12px rgba(255, 196, 97, 0.2);
}

.vtt-board-canvas {
    position: relative;
    width: 3000px;
    height: 1800px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    cursor: crosshair;
    background-size: cover;
    background-position: top left;
    background-repeat: no-repeat;
    --grid-px: 40px;
    --grid-major: calc(var(--grid-px) * 5);
    isolation: isolate;
    transform-origin: top left;
}

.vtt-fog-canvas {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 4;
    pointer-events: none;
}

.vtt-board-canvas::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 236, 193, 0.24) 1px, transparent 1px) 0 0/var(--grid-px) var(--grid-px),
        linear-gradient(90deg, rgba(255, 236, 193, 0.24) 1px, transparent 1px) 0 0/var(--grid-px) var(--grid-px),
        linear-gradient(rgba(255, 204, 112, 0.38) 2px, transparent 2px) 0 0/var(--grid-major) var(--grid-major),
        linear-gradient(90deg, rgba(255, 204, 112, 0.38) 2px, transparent 2px) 0 0/var(--grid-major) var(--grid-major);
    z-index: 1;
    mix-blend-mode: screen;
}

.vtt-board-canvas::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: rgba(0, 0, 0, 0.16);
}

.vtt-board-canvas.no-grid::before {
    display: none;
}

.vtt-token {
    position: absolute;
    width: var(--token-size, 48px);
    height: var(--token-size, 48px);
    border-radius: 50%;
    border: 2px solid rgba(255, 230, 180, 0.92);
    background: radial-gradient(circle at 30% 30%, #f7cf7d 0, #9b6320 75%);
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
    transform: translate(-50%, -50%) rotate(var(--token-rotation, 0deg));
    cursor: grab;
    user-select: none;
    z-index: 8;
}
.vtt-token.vtt-token-remote-moving {
    transition: left 120ms linear, top 120ms linear;
}

.vtt-token.selected {
    outline: 2px solid #5eb3ff;
}

.vtt-token.layer-map {
    z-index: 2;
    opacity: 0.92;
}

.vtt-token.layer-objects {
    z-index: 8;
}

.vtt-token.layer-gm {
    z-index: 15;
    border-style: dashed;
}

.vtt-token-label {
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.66rem;
    color: #fef5e6;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.vtt-token-hp {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.62rem;
    padding: 1px 5px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.72);
    color: #f7e7c5;
    border: 1px solid rgba(216, 182, 114, 0.8);
    white-space: nowrap;
}

.vtt-token-meta {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.58rem;
    color: #ddc79d;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0,0,0,.85);
}
.vtt-token.vtt-token-private .vtt-token-label {
    opacity: 0.92;
}
.vtt-measure-line {
    position: absolute;
    height: 0;
    border-top: 2px dashed rgba(255, 208, 120, 0.95);
    transform-origin: left center;
    z-index: 14;
    pointer-events: none;
}
.vtt-measure-label {
    position: absolute;
    transform: translate(-50%, -140%);
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(255, 208, 120, 0.85);
    background: rgba(28, 18, 10, 0.9);
    color: #ffe2ad;
    font-size: 11px;
    font-weight: 700;
    z-index: 15;
    pointer-events: none;
}
.vtt-online {
    border: 1px solid rgba(146, 122, 83, 0.55);
    border-radius: 10px;
    padding: 8px;
    background: rgba(18, 13, 8, 0.35);
}
.vtt-online-row {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}

.vtt-user-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.vtt-help {
    position: absolute;
    left: 12px;
    top: 66px;
    z-index: 19;
    background: rgba(19, 14, 10, 0.95);
    border: 1px solid rgba(146, 122, 83, 0.8);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.74rem;
    color: #edd9b4;
    max-width: 340px;
    line-height: 1.35;
}

.vtt-help strong {
    color: #f6e5c3;
}

.vtt-help.is-hidden {
    display: none;
}

.vtt-dice-tool {
    position: absolute;
    left: 12px;
    top: 66px;
    z-index: 19;
    background: rgba(19, 14, 10, 0.95);
    border: 1px solid rgba(146, 122, 83, 0.8);
    border-radius: 8px;
    padding: 8px 10px;
    color: #edd9b4;
    min-width: 280px;
}

.vtt-dice-tool.is-hidden {
    display: none;
}

.vtt-shape-tool {
    position: absolute;
    left: 12px;
    top: 66px;
    z-index: 19;
    background: rgba(19, 14, 10, 0.95);
    border: 1px solid rgba(146, 122, 83, 0.8);
    border-radius: 8px;
    padding: 8px 10px;
    color: #edd9b4;
    min-width: 220px;
}

.vtt-shape-tool.is-hidden {
    display: none;
}

.vtt-init {
    position: absolute;
    right: 10px;
    top: 66px;
    z-index: 19;
    background: rgba(22, 16, 11, 0.95);
    border: 1px solid rgba(146, 122, 83, 0.8);
    border-radius: 8px;
    padding: 8px 10px;
    min-width: 180px;
    max-width: 230px;
    color: #efdcb8;
}

.vtt-init-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid rgba(146, 122, 83, 0.3);
    padding: 2px 0;
}

.vtt-init-row:last-child {
    border-bottom: 0;
}

.vtt-marker {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #ffe393;
    background: #ba5c15;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(221, 133, 52, 0.8);
    z-index: 12;
    cursor: pointer;
}

.vtt-marker.is-hidden-marker {
    opacity: 0.22;
    filter: grayscale(0.7);
}

.vtt-draw {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 10;
    user-select: none;
    cursor: move;
}

.vtt-draw.selected {
    outline: 1px dashed rgba(183, 230, 255, 0.8);
    outline-offset: 2px;
}

.vtt-draw svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.vtt-draw-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(229, 246, 255, 0.96);
    background: #76d0ff;
    right: -7px;
    bottom: -7px;
    cursor: nwse-resize;
    display: none;
}

.vtt-draw-delete {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 196, 196, 0.92);
    background: rgba(80, 24, 24, 0.9);
    color: #ffe3e3;
    font-size: 0.68rem;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
}

.vtt-draw.selected .vtt-draw-handle,
.vtt-draw.selected .vtt-draw-delete {
    display: inline-flex;
}

.vtt-light-source {
    position: absolute;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    margin-top: -8px;
    border-radius: 50%;
    border: 2px solid rgba(255, 210, 120, 0.9);
    background: radial-gradient(circle, rgba(255, 235, 172, 0.95) 0%, rgba(255, 181, 66, 0.82) 70%, rgba(255, 181, 66, 0.2) 100%);
    box-shadow: 0 0 12px rgba(255, 189, 96, 0.55);
    z-index: 14;
    cursor: pointer;
}

.vtt-light-source.is-disabled {
    opacity: 0.45;
    filter: grayscale(0.55);
    box-shadow: 0 0 4px rgba(180, 180, 180, 0.35);
}

.vtt-ping {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ecd39a;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: vttPing 1s ease-out forwards;
    z-index: 30;
}

@keyframes vttPing {
    0% { width: 10px; height: 10px; opacity: 1; }
    100% { width: 120px; height: 120px; opacity: 0; }
}

.vtt-side {
    border: 1px solid rgba(146, 122, 83, 0.7);
    border-radius: 12px;
    background: #1b140f;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.vtt-side-top {
    padding: 10px;
    border-bottom: 1px solid rgba(146, 122, 83, 0.5);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.vtt-side-top::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.vtt-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    min-width: max-content;
}

.vtt-tab-btn {
    border: 1px solid rgba(154, 127, 87, 0.8);
    background: #2b1f14;
    color: #f3dfb5;
    border-radius: 8px;
    width: 36px;
    height: 32px;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vtt-tab-btn i {
    pointer-events: none;
}

.vtt-tab-btn.active {
    background: #62411f;
    border-color: #f2d39d;
    color: #fff4de;
}

.vtt-side-body {
    padding: 10px;
    overflow: auto;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#settingsPanel .form-select,
#settingsPanel .form-control {
    background: #21170f;
    border-color: rgba(154, 127, 87, 0.8);
    color: #f3dfb5;
}

#settingsPanel .form-select:focus,
#settingsPanel .form-control:focus {
    border-color: #d9b06a;
    box-shadow: 0 0 0 0.2rem rgba(217, 176, 106, 0.2);
}

.vtt-panel {
    display: none;
}

.vtt-panel.active {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.vtt-settings-block {
    border: 1px solid rgba(146, 122, 83, 0.5);
    border-radius: 10px;
    padding: 10px;
    background: rgba(21, 14, 9, 0.35);
}

.vtt-char-drag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.vtt-char-drag-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(154, 127, 87, 0.8);
    background: #22170f;
    color: #f3dfb5;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.76rem;
    cursor: grab;
    user-select: none;
}

.vtt-char-drag-item:active {
    cursor: grabbing;
}

.vtt-char-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #e6b96e;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}

.vtt-token-menu {
    position: absolute;
    z-index: 60;
    display: flex;
    flex-direction: column;
    min-width: 140px;
    background: rgba(21, 15, 10, 0.96);
    border: 1px solid rgba(146, 122, 83, 0.9);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.vtt-token-menu.is-hidden {
    display: none;
}

.vtt-token-menu button {
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(146, 122, 83, 0.35);
    color: #f3dfb5;
    text-align: left;
    padding: 6px 9px;
    font-size: 0.76rem;
}

.vtt-token-menu button:last-child {
    border-bottom: 0;
}

.vtt-token-menu button:hover {
    background: rgba(117, 78, 31, 0.45);
}

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

.vtt-folder-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vtt-library-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vtt-library-browser {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
    align-items: stretch;
}

.vtt-library-tree-wrap,
.vtt-library-content-wrap {
    border: 1px solid rgba(146, 122, 83, 0.6);
    border-radius: 10px;
    background: rgba(21, 14, 9, 0.35);
    padding: 8px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 68vh;
}

.vtt-library-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vtt-folder-node-btn {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(154, 127, 87, 0.65);
    background: #22170f;
    color: #f3dfb5;
    border-radius: 8px;
    padding: 4px 8px;
    line-height: 1.2;
    font-size: 0.74rem;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vtt-folder-node-btn.active {
    background: #62411f;
    border-color: #f2d39d;
}

.vtt-library-mixed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.vtt-library-entry {
    border: 1px solid rgba(146, 122, 83, 0.6);
    border-radius: 10px;
    background: #21170f;
    color: #f3dfb5;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    min-height: 120px;
    cursor: pointer;
    position: relative;
}

.vtt-library-entry img {
    width: 100%;
    height: 96px;
    object-fit: cover;
    border-radius: 8px;
}

.vtt-library-entry-folder {
    justify-content: center;
    min-height: 96px;
}

.vtt-library-entry-note {
    min-height: 96px;
}

.vtt-library-entry-delete {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid rgba(255, 196, 196, 0.92);
    background: rgba(72, 22, 22, 0.84);
    color: #ffe9e9;
    font-size: 0.8rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    user-select: none;
}

.vtt-library-entry-delete:hover {
    filter: brightness(1.1);
}

.vtt-shape {
    position: absolute;
    --shape-border: rgba(106, 194, 255, 0.95);
    --shape-bg: rgba(68, 154, 206, 0.22);
    transform: translate(-50%, -50%);
    transform-origin: center center;
    z-index: 9;
    user-select: none;
    cursor: move;
    overflow: visible;
}

.vtt-shape::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid var(--shape-border);
    background: var(--shape-bg);
    pointer-events: none;
}

.vtt-shape[data-shape-kind="circle"]::before {
    border-radius: 50%;
}

.vtt-shape[data-shape-kind="cone"]::before {
    clip-path: polygon(0% 50%, 100% 0%, 100% 100%);
}

.vtt-shape[data-shape-kind="line"] {
    height: 6px !important;
}

.vtt-shape[data-shape-kind="line"]::before {
    border-width: 1px;
    border-color: var(--shape-border);
    background: var(--shape-border);
}

.vtt-shape[data-barrier-kind="wall"] {
    --shape-border: rgba(236, 223, 196, 0.98);
    --shape-bg: rgba(12, 10, 8, 0.38);
}

.vtt-shape[data-barrier-kind="door"] {
    --shape-border: rgba(20, 20, 20, 0.98);
    --shape-bg: rgba(10, 10, 10, 0.55);
}

.vtt-shape[data-barrier-kind="window"] {
    --shape-border: rgba(20, 20, 20, 0.98);
    --shape-bg: rgba(10, 10, 10, 0.55);
}

.vtt-shape[data-barrier-kind="door"]::after,
.vtt-shape[data-barrier-kind="window"]::after {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    line-height: 1;
    z-index: 2;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

.vtt-shape[data-barrier-kind="door"]::after {
    content: "🚪";
}

.vtt-shape[data-barrier-kind="window"]::after {
    content: "🪟";
}

.vtt-shape[data-barrier-kind="door"][data-open="1"],
.vtt-shape[data-barrier-kind="window"][data-open="1"] {
    opacity: 0.68;
}

.vtt-shape[data-barrier-kind="door"][data-open="1"],
.vtt-shape[data-barrier-kind="window"][data-open="1"] {
    --shape-border: rgba(122, 235, 126, 0.98);
    --shape-bg: rgba(26, 108, 32, 0.22);
}

.vtt-shape[data-barrier-kind="door"][data-open="1"]::before,
.vtt-shape[data-barrier-kind="window"][data-open="1"]::before {
    border-style: dashed;
}

.vtt-shape[data-barrier-kind="wall"][data-shape-kind="square"]::before {
    border-width: 3px;
}

.vtt-board-canvas.vtt-role-player .vtt-shape[data-barrier-kind="wall"][data-shape-kind="square"]::before,
.vtt-board-canvas.vtt-role-viewer .vtt-shape[data-barrier-kind="wall"][data-shape-kind="square"]::before {
    border-color: rgba(0, 0, 0, 0.98);
    background: transparent;
}

.vtt-board-canvas.vtt-role-player .vtt-shape[data-barrier-kind="wall"][data-shape-kind="square"],
.vtt-board-canvas.vtt-role-viewer .vtt-shape[data-barrier-kind="wall"][data-shape-kind="square"] {
    pointer-events: none;
}

.vtt-board-canvas.vtt-role-admin .vtt-shape[data-barrier-kind="wall"][data-shape-kind="square"]::before,
.vtt-board-canvas.vtt-role-gm .vtt-shape[data-barrier-kind="wall"][data-shape-kind="square"]::before {
    border-color: rgba(240, 224, 195, 0.92);
    background: rgba(18, 15, 12, 0.34);
}

.vtt-shape.selected {
    box-shadow: 0 0 0 2px rgba(183, 230, 255, 0.52), 0 0 14px rgba(115, 208, 255, 0.5);
}

.vtt-shape-label {
    position: absolute;
    left: 50%;
    top: -10px;
    transform: translate(-50%, -100%);
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(168, 226, 255, 0.86);
    background: rgba(19, 14, 10, 0.93);
    color: #d8f1ff;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
}

.vtt-board-canvas.vtt-role-player .vtt-shape.is-barrier .vtt-shape-label,
.vtt-board-canvas.vtt-role-viewer .vtt-shape.is-barrier .vtt-shape-label {
    display: none;
}

.vtt-shape-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(229, 246, 255, 0.96);
    background: #76d0ff;
    right: -8px;
    bottom: -8px;
    cursor: nwse-resize;
    display: none;
    z-index: 3;
}

.vtt-shape.selected .vtt-shape-handle {
    display: block;
}

.vtt-shape-delete {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 196, 196, 0.92);
    background: rgba(80, 24, 24, 0.9);
    color: #ffe3e3;
    font-size: 0.68rem;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 3;
}

#archivePanel .form-control,
#archivePanel .form-select {
    background: #21170f;
    border-color: rgba(154, 127, 87, 0.8);
    color: #f3dfb5;
}

#archivePanel .form-control::placeholder {
    color: rgba(243, 223, 181, 0.72);
    opacity: 1;
}

#archivePanel .form-control:focus,
#archivePanel .form-select:focus {
    border-color: #d9b06a;
    box-shadow: 0 0 0 0.2rem rgba(217, 176, 106, 0.2);
}

.vtt-archive-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.vtt-archive-frame-wrap {
    min-height: 420px;
}

.vtt-shape.selected .vtt-shape-delete {
    display: inline-flex;
}

.vtt-modal {
    position: fixed;
    inset: 0;
    z-index: 160;
}

.vtt-modal.is-hidden {
    display: none;
}

.vtt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 4, 2, 0.72);
}

.vtt-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(720px, calc(100vw - 24px));
    margin: 5vh auto;
    background: #17100b;
    border: 1px solid rgba(182, 147, 94, 0.85);
    border-radius: 16px;
    padding: 14px;
    max-height: 88vh;
    overflow: auto;
}

.vtt-lib-item {
    border: 1px solid rgba(154, 127, 87, 0.8);
    background: #21170f;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.vtt-lib-card {
    position: relative;
}

.vtt-lib-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vtt-lib-del {
    position: absolute;
    top: 4px;
    right: 4px;
    border-radius: 6px;
    border: 1px solid rgba(255, 176, 176, 0.9);
    background: rgba(60, 18, 18, 0.82);
    color: #ffd8d8;
    font-size: 0.68rem;
    padding: 2px 6px;
    line-height: 1;
    z-index: 2;
}

.vtt-notes-pane {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
}

.vtt-notes-list {
    display: grid;
    gap: 8px;
    max-height: 34vh;
    overflow-y: auto;
}

.vtt-note-card {
    border: 1px solid rgba(146, 122, 83, 0.6);
    border-radius: 10px;
    background: #21170f;
    padding: 8px;
    cursor: pointer;
}

.vtt-note-card.active {
    border-color: #f2d39d;
    box-shadow: 0 0 0 1px rgba(242, 211, 157, 0.45);
}

.vtt-note-card-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: start;
}

.vtt-note-scope-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 0.68rem;
    border: 1px solid rgba(206, 175, 118, 0.7);
    color: #f3dfb5;
    background: rgba(78, 54, 28, 0.8);
}

.vtt-note-card-preview {
    margin-top: 6px;
    font-size: 0.74rem;
    color: #d9c39c;
    white-space: pre-wrap;
    max-height: 4.8em;
    overflow: hidden;
}

.vtt-note-editor {
    border: 1px solid rgba(146, 122, 83, 0.6);
    border-radius: 10px;
    background: #18110c;
    padding: 10px;
}

.vtt-note-image-preview {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(146, 122, 83, 0.6);
}

.vtt-note-stage {
    position: absolute;
    inset: 0;
    z-index: 55;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.vtt-note-stage.is-hidden {
    display: none;
}

.vtt-note-stage-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 4, 2, 0.68);
}

.vtt-note-stage-card {
    position: relative;
    z-index: 1;
    width: min(680px, 92vw);
    max-height: min(82vh, 760px);
    overflow: auto;
    border: 1px solid rgba(182, 147, 94, 0.85);
    border-radius: 16px;
    background: linear-gradient(180deg, #f2e3b7 0%, #e3cf9b 100%);
    color: #3b2a16;
    padding: 20px 20px 18px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
}

.vtt-note-stage-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: 1px solid rgba(90, 64, 29, 0.4);
    background: rgba(255, 248, 233, 0.88);
    border-radius: 999px;
    width: 32px;
    height: 32px;
}

.vtt-note-stage-scope {
    font-size: 0.8rem;
    font-weight: 700;
    color: #7c5622;
    margin-bottom: 6px;
}

.vtt-note-stage-title {
    margin: 0 34px 12px 0;
    font-size: 1.3rem;
    color: #3b2a16;
}

.vtt-note-stage-image {
    width: 100%;
    max-height: 340px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 12px;
}

.vtt-note-stage-content {
    white-space: pre-wrap;
    line-height: 1.45;
}

.journal-chat-list {
    flex: 1 1 auto;
    min-height: 160px;
    overflow-y: auto;
    border: 1px solid rgba(146, 122, 83, 0.6);
    border-radius: 10px;
    padding: 8px;
    background: #140f0b;
}

.chat-line {
    border-bottom: 1px solid rgba(150, 128, 92, 0.35);
    padding: 7px 0;
}

.chat-line:last-child {
    border-bottom: 0;
}

.music-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: min(38vh, 420px);
    overflow-y: auto;
}

.music-item {
    border: 1px solid rgba(146, 122, 83, 0.6);
    border-radius: 8px;
    padding: 6px 8px;
    background: #251a12;
}

.char-select {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.character-embed-wrap {
    flex: 1 1 auto;
    min-height: 0;
    border: 1px solid rgba(146, 122, 83, 0.6);
    border-radius: 10px;
    overflow: hidden;
    background: #090704;
    height: 100%;
}

.character-embed-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #090704;
}

@media (max-width: 1200px) {
    .vtt-shell {
        height: calc(100dvh - 60px);
    }
    .vtt-layout {
        grid-template-columns: 1fr;
    }
    .vtt-side {
        min-height: 320px;
    }
    .vtt-library-browser {
        grid-template-columns: 1fr;
    }
    .vtt-library-tree-wrap,
    .vtt-library-content-wrap {
        max-height: 36vh;
    }
}
