@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Manrope:wght@400;600;700&family=Roboto+Condensed:wght@400;700&display=swap');

:root {
    --bg-0: #0f0f10;
    --bg-1: #18181b;
    --bg-2: #202124;
    --text-0: #f5f5f5;
    --text-1: #b9bcc4;
    --accent: #ff1f1f;
    --accent-2: #d41717;
    --line: #2d2f35;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    color: var(--text-0);
    background:
        radial-gradient(circle at 10% 10%, rgba(255, 31, 31, 0.15), transparent 40%),
        radial-gradient(circle at 90% 20%, rgba(255, 31, 31, 0.08), transparent 45%),
        linear-gradient(180deg, var(--bg-0) 0%, #121215 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

body.embed-mode .bg-shape,
body.embed-mode .topbar,
body.embed-mode .sidebar {
    display: none;
}

body.embed-mode .layout {
    grid-template-columns: 1fr;
    min-height: 100vh;
}

body.embed-mode .content {
    padding: 0;
}

.bg-shape {
    position: fixed;
    pointer-events: none;
    z-index: -1;
    filter: blur(50px);
}

.bg-shape-1 {
    width: 240px;
    height: 240px;
    background: rgba(255, 31, 31, 0.2);
    top: 8%;
    left: -80px;
}

.bg-shape-2 {
    width: 320px;
    height: 320px;
    background: rgba(255, 31, 31, 0.14);
    bottom: -120px;
    right: -90px;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(18, 18, 21, 0.85);
    backdrop-filter: blur(7px);
    position: sticky;
    top: 0;
    z-index: 20;
}

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

.brand-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 0 10px rgba(255, 31, 31, 0.22));
}

.brand-text {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1;
}

.brand-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 38px;
    letter-spacing: 0.8px;
}

.brand-subtitle {
    font-family: 'Roboto Condensed', 'Manrope', sans-serif;
    font-size: 40px;
    font-weight: 400;
    letter-spacing: 0;
}

@media (max-width: 920px) {
    .brand-logo {
        width: 44px;
        height: 44px;
    }

    .brand-name {
        font-size: 32px;
    }

    .brand-subtitle {
        font-size: 32px;
    }
}

.menu-btn,
.ghost-btn,
.accent-btn {
    border: 0;
    cursor: pointer;
    border-radius: 10px;
    font-family: inherit;
}

.menu-btn {
    background: transparent;
    color: var(--text-0);
    font-size: 20px;
    width: 40px;
    height: 40px;
}

.topbar-actions {
    display: flex;
    gap: 8px;
}

.ghost-btn {
    color: var(--text-0);
    background: #2a2d33;
    padding: 10px 14px;
}

.accent-btn {
    color: #fff;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
    padding: 10px 14px;
}

.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 64px);
}

.sidebar {
    border-right: 1px solid var(--line);
    padding: 14px;
    background: rgba(24, 24, 27, 0.9);
}

.nav-link {
    display: block;
    color: var(--text-1);
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: #2a2d33;
    color: var(--text-0);
}

.content {
    padding: 5px;
}

.hero {
    animation: fadeUp 0.55s ease-out;
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    margin: 0;
}

h1 {
    margin: 8px 0 12px;
    font-size: clamp(28px, 5vw, 42px);
}

.subtitle {
    margin: 0;
    color: var(--text-1);
    max-width: 760px;
}

.cards-grid {
    margin-top: 24px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.card,
.editor-preview {
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
}

.card h3,
.editor-preview h2 {
    margin: 0 0 8px;
}

.card p {
    margin: 0;
    color: var(--text-1);
}

.editor-preview {
    margin-top: 18px;
}

.editor-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.code-block {
    margin: 12px 0 0;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid #343842;
    background: #121317;
    color: #e4e8f1;
    overflow-x: auto;
}

.reveal {
    opacity: 0;
    transform: translateY(12px);
    animation: reveal 0.55s ease forwards;
}

.cards-grid .reveal:nth-child(2) {
    animation-delay: 0.08s;
}

.cards-grid .reveal:nth-child(3) {
    animation-delay: 0.16s;
}

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

@keyframes reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 880px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar.open {
        display: block;
    }

    .content {
        padding: 5px;
    }

    .topbar-actions {
        display: none;
    }
}

.user-pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid #3b3f47;
    border-radius: 20px;
    padding: 7px 12px;
    color: var(--text-1);
    font-size: 13px;
}

.permissions-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.permission-chip {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #3b3f47;
    color: #f2f6ff;
    background: #1a1d24;
    font-size: 12px;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(520px, 100%);
    background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 24px;
}

.form-grid {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.form-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-items: center;
}

.password-tools {
    display: grid;
    gap: 6px;
}

.password-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tool-btn {
    padding: 6px 9px;
    border-radius: 8px;
    font-size: 12px;
}

.role-picks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid #3a3f48;
    border-radius: 10px;
    background: #111317;
}

.role-picks label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #3a3f48;
    font-size: 12px;
    color: #e7ebf5;
}

.field {
    display: grid;
    gap: 5px;
}

.field span {
    font-size: 12px;
    color: var(--text-1);
}

input,
select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #3a3f48;
    background: #111317;
    color: #f1f4fb;
}

input:focus,
select:focus {
    outline: 2px solid rgba(255, 31, 31, 0.35);
    border-color: #5a2323;
}

.error-text {
    color: #ff6b6b;
    min-height: 18px;
    margin: 6px 0 0;
}

.flash-msg {
    position: sticky;
    top: 74px;
    z-index: 25;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    display: none;
    border: 1px solid transparent;
    font-size: 13px;
}

.flash-msg.show {
    display: block;
}

.flash-msg.error {
    color: #ffc8c8;
    background: #3a1a1a;
    border-color: #6b2a2a;
}

.flash-msg.success {
    color: #c8ffd8;
    background: #183525;
    border-color: #2a6643;
}

.admin-grid {
    margin-top: 18px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 540px;
}

.data-table th,
.data-table td {
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #333844;
    padding: 10px 8px;
    font-size: 13px;
}

.data-table th {
    color: var(--text-1);
    font-weight: 600;
}

.table-btn {
    border: 1px solid #3a3f48;
    background: #1a1d24;
    color: #f5f6fa;
    padding: 6px 8px;
    border-radius: 8px;
    margin-right: 4px;
    cursor: pointer;
}

.danger-btn {
    border-color: #6a2c2c;
    background: #2a1616;
    color: #ffc9c9;
}

.status-pill {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-ok {
    color: #8cffc4;
    background: rgba(26, 109, 66, 0.35);
}

.status-bad {
    color: #ffc0c0;
    background: rgba(121, 31, 31, 0.35);
}

.filter-grid {
    margin-top: 12px;
}

.locations-shell {
    margin-top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 0;
    height: calc(100vh - 74px);
    min-height: calc(100vh - 74px);
    align-items: stretch;
    overflow: hidden;
}

.locations-stage {
    height: calc(100vh - 74px);
    min-height: calc(100vh - 74px);
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 6px;
}

.map-viewport {
    position: relative;
    flex: 1;
    height: calc(100vh - 86px);
    min-height: calc(100vh - 86px);
    border-radius: 12px;
    border: 1px solid #343844;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 31, 31, 0.06), transparent 45%),
        linear-gradient(180deg, #101217, #161922);
    overflow: hidden;
    cursor: grab;
}

.map-viewport.dragging {
    cursor: grabbing;
}

.map-viewport.block-mode {
    cursor: crosshair;
}

.map-viewport.block-mode.dragging {
    cursor: grabbing;
}

.block-edge-indicator {
    position: absolute;
    z-index: 30;
    min-width: 60px;
    height: 26px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid #6a2121;
    background: rgba(20, 18, 18, 0.9);
    color: #ffd6d6;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    pointer-events: none;
    user-select: none;
}

.map-canvas {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: top left;
    user-select: none;
    display: none;
}

.map-canvas img {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
}

.grid-layer {
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
}

.cell-overlay {
    position: relative;
    width: 59px;
    height: 59px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    margin: 0;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.cell-overlay:hover {
    border-color: rgba(255, 99, 99, 0.85);
    background: rgba(255, 31, 31, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255, 122, 122, 0.8);
}

.cell-overlay.selected {
    border-color: #ffd166;
    background: rgba(255, 209, 102, 0.25);
    box-shadow: inset 0 0 0 2px rgba(255, 209, 102, 0.9), 0 0 10px rgba(255, 209, 102, 0.35);
}

.map-viewport.block-mode .cell-overlay:hover {
    border-color: rgba(255, 99, 99, 0.7);
    background: rgba(255, 31, 31, 0.09);
    box-shadow: none;
}

.map-viewport.block-mode .cell-overlay.edge-hover-top {
    box-shadow: inset 0 4px 0 rgba(255, 31, 31, 0.95);
}

.map-viewport.block-mode .cell-overlay.edge-hover-bottom {
    box-shadow: inset 0 -4px 0 rgba(255, 31, 31, 0.95);
}

.map-viewport.block-mode .cell-overlay.edge-hover-left {
    box-shadow: inset 4px 0 0 rgba(255, 31, 31, 0.95);
}

.map-viewport.block-mode .cell-overlay.edge-hover-right {
    box-shadow: inset -4px 0 0 rgba(255, 31, 31, 0.95);
}

.map-viewport.npc-interaction-mode .cell-overlay {
    cursor: default;
}

.map-viewport.npc-interaction-mode .cell-overlay:hover {
    border-color: rgba(255, 255, 255, 0.08);
    background: transparent;
    box-shadow: none;
}

.cell-block-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 80;
}

.cell-block-edge {
    position: absolute;
    background: rgba(255, 31, 31, 1);
}

.cell-block-edge.top {
    left: 0;
    right: 0;
    top: 0;
    height: var(--block-line-size, 1px);
}

.cell-block-edge.bottom {
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--block-line-size, 1px);
}

.cell-block-edge.left {
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--block-line-size, 1px);
}

.cell-block-edge.right {
    top: 0;
    bottom: 0;
    right: 0;
    width: var(--block-line-size, 1px);
}

.cell-trait-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.cell-trait-image {
    position: absolute;
    left: 0;
    top: 0;
    image-rendering: auto;
    z-index: 10;
}

.cell-teleport-image {
    position: absolute;
    left: 0;
    top: 0;
    image-rendering: auto;
    z-index: 50;
}

.cell-transition-image {
    position: absolute;
    left: 42px;
    top: 1px;
    image-rendering: auto;
    z-index: 55;
}

.cell-npc-image {
    position: absolute;
    width: 27px;
    height: 28px;
    object-fit: contain;
    image-rendering: auto;
    z-index: 70;
    pointer-events: none;
    transition: transform 0.16s ease;
}

.cell-npc-button {
    position: absolute;
    width: 27px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    z-index: 70;
    pointer-events: none;
    cursor: default;
}

.map-viewport.npc-interaction-mode .cell-npc-button {
    pointer-events: auto;
    cursor: pointer;
}

.map-viewport.npc-interaction-mode .cell-npc-button:hover .cell-npc-image {
    transform: scale(1.32);
}

.map-viewport.npc-interaction-mode .cell-npc-button:focus-visible {
    outline: 1px solid rgba(255, 122, 122, 0.8);
    outline-offset: 2px;
    border-radius: 6px;
}

.npc-hover-tooltip {
    position: fixed;
    z-index: 140;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 190px;
    max-width: 300px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #465067;
    background: rgba(9, 12, 19, 0.95);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.npc-hover-tooltip[hidden] {
    display: none !important;
}

.npc-hover-tooltip-media {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    border-radius: 8px;
    border: 1px solid #2f3a52;
    background: rgba(3, 6, 12, 0.9);
    overflow: hidden;
    display: grid;
    place-items: center;
}

.npc-hover-tooltip-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.npc-hover-tooltip-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.npc-hover-tooltip-content strong {
    font-size: 14px;
    line-height: 1.2;
    color: #f2f4fb;
    max-width: 210px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.npc-hover-tooltip-content span {
    font-size: 12px;
    line-height: 1.2;
    color: #b7c2dd;
    max-width: 210px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #e5e8ef;
    text-align: center;
    font-size: 15px;
    background: linear-gradient(180deg, rgba(16, 18, 23, 0.4), rgba(16, 18, 23, 0.7));
}

.workspace-modal-backdrop {
    position: absolute;
    inset: 0;
    z-index: 35;
    display: grid;
    place-items: center;
    background: rgba(6, 8, 14, 0.72);
    backdrop-filter: blur(1px);
    padding: 12px;
}

.workspace-modal-backdrop[hidden] {
    display: none !important;
}

.workspace-modal {
    width: min(680px, 100%);
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #3b3f49;
    border-radius: 12px;
    background: linear-gradient(180deg, #151922, #0f131b);
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.4);
    padding: 12px;
    overflow: auto;
}

.workspace-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.workspace-modal-head h3 {
    margin: 0;
    font-size: 18px;
}

.workspace-modal-close {
    min-width: 96px;
}

.workspace-modal-value {
    margin: 10px 0 0;
    padding: 10px;
    border-radius: 9px;
    border: 1px solid #343844;
    background: #101217;
    color: #dfe6f4;
    font-size: 12px;
    line-height: 1.35;
    max-height: min(260px, 45vh);
    overflow: auto;
    white-space: pre-wrap;
}

.workspace-modal-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.property-modal-editor {
    margin-top: 10px;
    display: grid;
    gap: 10px;
    min-width: 0;
}

.property-field {
    border: 1px solid #343844;
    border-radius: 10px;
    background: #101217;
    padding: 9px;
    min-width: 0;
}

.property-field h4 {
    margin: 0 0 7px;
    font-size: 13px;
    color: #f3f5fb;
}

.property-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.property-chip {
    border: 1px solid #3a3f48;
    background: #161a24;
    color: #e5e8f2;
    border-radius: 8px;
    font-size: 12px;
    padding: 6px 9px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.property-chip:hover {
    border-color: #5f3340;
    background: #1a1f2b;
}

.property-chip.is-selected {
    border-color: #2f9a5c;
    background: rgba(47, 154, 92, 0.24);
    box-shadow: inset 0 0 0 1px rgba(120, 255, 173, 0.24);
}

.transition-location-select {
    width: 100%;
    border: 1px solid #363b47;
    border-radius: 10px;
    background: #101217;
    color: #f0f4ff;
    font-size: 13px;
    padding: 8px 10px;
}

.transition-picker-wrap {
    margin-top: 8px;
    width: 100%;
    max-width: 100%;
    border: 1px solid #343844;
    border-radius: 10px;
    background: #0f1218;
    overflow: hidden;
}

.transition-picker-viewport {
    position: relative;
    width: 100%;
    height: 260px;
    overflow: hidden;
    cursor: grab;
    user-select: none;
}

.transition-picker-viewport.dragging {
    cursor: grabbing;
}

.transition-picker-viewport.dragging .transition-picker-cell {
    cursor: grabbing;
}

.transition-picker-canvas {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: top left;
    will-change: transform;
}

.transition-picker-image {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.transition-picker-grid {
    position: relative;
    display: grid;
}

.transition-picker-cell {
    cursor: pointer;
}

.transition-picker-cell:disabled {
    cursor: not-allowed;
    opacity: 0.78;
}

.transition-picker-cell:disabled:hover {
    border-color: rgba(255, 255, 255, 0.08);
    background: transparent;
    box-shadow: none;
}

.locations-tools {
    height: calc(100vh - 74px);
    min-height: calc(100vh - 74px);
    max-height: calc(100vh - 74px);
    overflow: auto;
    position: static;
}

@supports (height: 100dvh) {
    .locations-shell {
        height: calc(100dvh - 74px);
        min-height: calc(100dvh - 74px);
    }

    .locations-stage {
        height: calc(100dvh - 74px);
        min-height: calc(100dvh - 74px);
    }

    .map-viewport {
        height: calc(100dvh - 86px);
        min-height: calc(100dvh - 86px);
    }

    .locations-tools {
        height: calc(100dvh - 74px);
        min-height: calc(100dvh - 74px);
        max-height: calc(100dvh - 74px);
    }
}

.locations-tools h2 {
    margin: 0 0 12px;
}

.tools-current-location {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #3a3f48;
    border-radius: 10px;
    background: #101217;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--text-1);
}

.tools-current-location strong {
    color: #f5f7fd;
    font-size: 14px;
}

.tools-block {
    margin-top: 10px;
    border: 1px solid #343844;
    border-radius: 12px;
    padding: 10px;
    background: #0f1116;
}

.tools-block h3 {
    margin: 0 0 8px;
    font-size: 14px;
}

.locations-tools .tools-block:first-of-type {
    margin-top: 0;
}

.tools-block[data-collapsible="1"] > h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.tools-block[data-collapsible="1"] > h3::after {
    content: "▾";
    font-size: 12px;
    color: #aeb4c3;
    transition: transform 0.16s ease;
}

.tools-block[data-collapsible="1"] > h3:focus-visible {
    outline: 2px solid rgba(255, 31, 31, 0.35);
    outline-offset: 2px;
    border-radius: 6px;
}

.tools-block.is-collapsed[data-collapsible="1"] > h3 {
    margin-bottom: 0;
}

.tools-block.is-collapsed[data-collapsible="1"] > h3::after {
    transform: rotate(-90deg);
}

.tools-block.is-collapsed > :not(h3) {
    display: none;
}

.block-mode-toggle {
    width: 100%;
}

.npc-mode-toggle {
    width: 100%;
    margin-top: 8px;
}

.block-mode-toggle.is-active {
    background: linear-gradient(180deg, rgba(96, 26, 26, 0.55), rgba(59, 20, 20, 0.44));
    border: 1px solid #8d2d2d;
    box-shadow: inset 0 0 0 1px rgba(225, 68, 68, 0.25);
}

.npc-mode-toggle.is-active {
    background: linear-gradient(180deg, rgba(96, 26, 26, 0.55), rgba(59, 20, 20, 0.44));
    border: 1px solid #8d2d2d;
    box-shadow: inset 0 0 0 1px rgba(225, 68, 68, 0.25);
}

.block-mode-status {
    margin-top: 6px;
    min-height: 18px;
}

.block-mode-status.success {
    color: #8dffbd;
}

.block-mode-status.error {
    color: #ffb3b3;
}

.filter-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filter-toggle-label {
    color: #f1f4fb;
    font-size: 13px;
    font-weight: 600;
}

.filter-toggle-switch {
    position: relative;
    display: inline-flex;
    width: 92px;
    height: 34px;
    flex: 0 0 auto;
}

.filter-toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.filter-toggle-track {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    border: 1px solid #3a3f48;
    background: #101217;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 11px;
    box-sizing: border-box;
    overflow: hidden;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-toggle-off,
.filter-toggle-on {
    position: relative;
    z-index: 2;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: color 0.2s ease;
}

.filter-toggle-off {
    color: #f2f5fc;
}

.filter-toggle-on {
    color: #8f96a8;
}

.filter-toggle-thumb {
    position: absolute;
    left: 3px;
    top: 3px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(180deg, #242a35, #151922);
    border: 1px solid #404654;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.filter-toggle-switch input:checked + .filter-toggle-track {
    border-color: #8d2d2d;
    background: rgba(96, 26, 26, 0.42);
    box-shadow: inset 0 0 0 1px rgba(225, 68, 68, 0.18);
}

.filter-toggle-switch input:checked + .filter-toggle-track .filter-toggle-thumb {
    transform: translateX(58px);
    background: linear-gradient(180deg, #d14b4b, #8d2d2d);
    border-color: #b94747;
}

.filter-toggle-switch input:checked + .filter-toggle-track .filter-toggle-off {
    color: #8f96a8;
}

.filter-toggle-switch input:checked + .filter-toggle-track .filter-toggle-on {
    color: #fff4f4;
}

.filter-toggle-switch input:focus-visible + .filter-toggle-track {
    outline: 2px solid rgba(255, 31, 31, 0.35);
    outline-offset: 2px;
}

.admin-sync-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.admin-sync-actions .ghost-btn,
.admin-sync-actions .accent-btn {
    width: 100%;
    padding: 9px 10px;
    font-size: 12px;
}

.sync-status {
    margin-top: 8px;
    min-height: 18px;
}

.sync-status.success {
    color: #8dffbd;
}

.sync-status.error {
    color: #ffb3b3;
}

.npc-editor-modal {
    width: min(1380px, 98vw);
    max-height: calc(100vh - 28px);
    padding: 10px;
}

.npc-editor-frame {
    width: 100%;
    height: min(86vh, 900px);
    border: 1px solid #343844;
    border-radius: 10px;
    background: #0f1116;
}

.property-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.property-action {
    width: 100%;
    min-height: 38px;
    border-radius: 9px;
    border: 1px solid #363b47;
    background: #101217;
    color: #e8ecf8;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 7px 9px;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.property-action img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex: 0 0 18px;
}

.property-action:hover:not(:disabled) {
    border-color: #5f3340;
    background: #151924;
}

.property-action.is-active {
    border-color: #a63434;
    background: linear-gradient(180deg, rgba(96, 26, 26, 0.45), rgba(59, 20, 20, 0.35));
    box-shadow: inset 0 0 0 1px rgba(225, 68, 68, 0.25);
}

.property-action.is-opened {
    border-color: #ffd166;
    box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.5);
}

.property-action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.tools-block p {
    margin: 6px 0;
    font-size: 13px;
}

.tools-muted {
    margin: 0;
    font-size: 12px;
    color: var(--text-1);
}

.cell-json {
    margin: 8px 0 0;
    padding: 10px;
    border-radius: 9px;
    border: 1px solid #343844;
    background: #101217;
    color: #dfe6f4;
    font-size: 12px;
    line-height: 1.35;
    max-height: 160px;
    overflow: auto;
    white-space: pre-wrap;
}

.cell-json.editable {
    min-height: 120px;
    cursor: text;
}

.cell-json.editable:focus {
    outline: 2px solid rgba(255, 31, 31, 0.35);
    border-color: #5a2323;
}

.cell-edit-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.cell-edit-status {
    margin-top: 7px;
    min-height: 18px;
}

.cell-edit-status.success {
    color: #8dffbd;
}

.cell-edit-status.error {
    color: #ffb3b3;
}

.preview-main-wrap {
    margin-top: 8px;
}

.cell-preview-main {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #343844;
    display: none;
    object-fit: cover;
    max-height: 180px;
}

.cell-preview-strip {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cell-preview-item {
    position: relative;
    width: 64px;
    height: 50px;
}

.cell-preview-thumb {
    width: 64px;
    height: 50px;
    border-radius: 8px;
    border: 1px solid #3a3f48;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.75;
}

.cell-preview-thumb.active,
.cell-preview-thumb:hover {
    opacity: 1;
    border-color: #ffd166;
}

.cell-preview-delete-btn {
    position: absolute;
    right: 2px;
    top: 2px;
    border: 0;
    width: 16px;
    height: 16px;
    padding: 0;
    border-radius: 4px;
    background: #b32525;
    color: #ffffff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cell-preview-delete-btn:hover:not(:disabled) {
    background: #d22f2f;
}

.cell-preview-delete-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bg-group-list {
    margin-top: 8px;
    display: grid;
    gap: 6px;
    max-height: 180px;
    overflow: auto;
    padding-right: 2px;
}

.bg-group-row {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 6px;
    align-items: center;
}

.bg-group-delete-btn {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 6px;
    background: #b32525;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bg-group-delete-btn:hover:not(:disabled) {
    background: #d22f2f;
}

.bg-group-delete-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bg-group-select-btn {
    border: 1px solid #3a3f48;
    border-radius: 8px;
    background: #111317;
    color: #eaf0ff;
    padding: 6px 8px;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
}

.bg-group-row.is-selected .bg-group-select-btn {
    border-color: #8f2e2e;
    box-shadow: inset 0 0 0 1px rgba(225, 68, 68, 0.28);
    background: linear-gradient(180deg, rgba(96, 26, 26, 0.45), rgba(59, 20, 20, 0.35));
}

.bg-group-select-btn:hover:not(:disabled) {
    border-color: #5f3340;
    background: #161a24;
}

.bg-group-select-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.album-actions-grid {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.album-actions-grid .ghost-btn,
.album-actions-grid .accent-btn {
    width: 100%;
    padding: 8px 9px;
    font-size: 12px;
}

.characters-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    height: calc(100vh - 74px);
    min-height: calc(100vh - 74px);
}

.characters-workplace {
    height: calc(100vh - 74px);
    min-height: calc(100vh - 74px);
    max-height: calc(100vh - 74px);
    overflow: auto;
    padding: 12px;
}

.characters-workplace-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.characters-shell.is-embed {
    grid-template-columns: 1fr;
}

.characters-shell.is-embed > .characters-workplace:first-child {
    display: none;
}

@supports (height: 100dvh) {
    .characters-shell {
        height: calc(100dvh - 74px);
        min-height: calc(100dvh - 74px);
    }

    .characters-workplace {
        height: calc(100dvh - 74px);
        min-height: calc(100dvh - 74px);
        max-height: calc(100dvh - 74px);
    }
}

.characters-head {
    margin-bottom: 12px;
}

.characters-head-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.characters-head h2 {
    margin: 0;
    font-size: 22px;
}

.character-create-btn {
    padding: 8px 12px;
    font-size: 12px;
}

.character-settings {
    display: grid;
    gap: 8px;
    margin-bottom: 2px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.character-settings .character-setting-row:nth-child(-n + 3) {
    grid-column: span 2;
}

.character-settings .character-setting-row:nth-child(4),
.character-settings .character-setting-row:nth-child(5) {
    grid-column: span 3;
}

.character-settings .character-setting-row:nth-child(6) {
    grid-column: span 6;
}

.character-setting-row {
    border: 1px solid #343844;
    border-radius: 10px;
    background: #101217;
    padding: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.character-setting-row select {
    width: 220px;
}

.character-setting-row input[type="text"] {
    width: 220px;
    border: 1px solid #343844;
    border-radius: 8px;
    background: #0f131b;
    color: #e8ecf8;
    padding: 8px 10px;
    font: inherit;
}

.character-setting-labels h3 {
    margin: 0 0 4px;
    font-size: 13px;
}

.character-setting-labels p {
    margin: 0;
}

.characters-locations {
    display: grid;
    gap: 10px;
}

.character-location-group {
    border: 1px solid #343844;
    border-radius: 12px;
    padding: 10px;
    background: #0f1116;
}

.character-location-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.character-location-header h3 {
    margin: 0;
    font-size: 14px;
}

.character-location-header span {
    min-width: 22px;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid #3a3f48;
    font-size: 11px;
    text-align: center;
    color: var(--text-1);
    background: #111317;
}

.character-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    gap: 8px;
}

.character-card {
    position: relative;
    width: 100%;
    border: 1px solid #363b47;
    border-radius: 10px;
    background: #101217;
    padding: 8px;
    color: #e8ecf8;
    cursor: pointer;
    text-align: left;
}

.character-card:hover {
    border-color: #5f3340;
    background: #151924;
}

.character-card.is-selected {
    border-color: #a63434;
    box-shadow: inset 0 0 0 1px rgba(225, 68, 68, 0.25);
    background: linear-gradient(180deg, rgba(96, 26, 26, 0.45), rgba(59, 20, 20, 0.35));
}

.character-delete-zone {
    position: absolute;
    left: 4px;
    top: 4px;
    width: 26px;
    height: 26px;
    z-index: 8;
}

.character-delete-btn {
    position: absolute;
    left: 6px;
    top: 6px;
    width: 14px;
    height: 14px;
    border: 0;
    border-radius: 3px;
    background: rgba(179, 37, 37, 0);
    color: rgba(255, 255, 255, 0);
    padding: 0;
    line-height: 1;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.character-delete-zone:hover .character-delete-btn,
.character-delete-zone:focus-within .character-delete-btn {
    background: rgba(179, 37, 37, 1);
    color: rgba(255, 255, 255, 1);
}

.character-delete-btn:hover,
.character-delete-btn:focus-visible {
    background: rgba(212, 47, 47, 1);
    color: rgba(255, 255, 255, 1);
    outline: none;
}

.character-visual {
    position: relative;
    height: 154px;
    border-radius: 8px;
    border: 1px solid #2f3440;
    background: #0c0e13;
    overflow: hidden;
}

.character-skin-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.character-skin-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #7f8696;
    font-size: 10px;
    letter-spacing: 0.8px;
}

.character-profession-icon {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid #2e3340;
    background: rgba(9, 10, 14, 0.85);
    object-fit: contain;
    padding: 2px;
}

.character-name {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.2;
    color: #f1f4fb;
    min-height: 30px;
}

.character-profession-panel {
    min-height: 220px;
    flex: 0 0 auto;
    border: 1px solid #343844;
    border-radius: 12px;
    background: #0f1116;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.character-profession-panel-head h3 {
    margin: 0;
    font-size: 14px;
}

.character-profession-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.character-panel-toggle {
    border: 1px solid #343844;
    background: #151922;
    color: #f2f6ff;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.character-panel-toggle:hover {
    background: #1a2130;
}

.character-profession-panel-body {
    display: flex;
    flex: 0 0 auto;
    min-height: 0;
    flex-direction: column;
    gap: 8px;
}

.character-profession-panel.is-collapsed .character-profession-panel-body {
    display: none;
}

.character-profession-panel-body[hidden] {
    display: none !important;
}

.character-profession-panel.is-collapsed {
    flex: 0 0 auto;
    min-height: 0;
    gap: 0;
}

.character-json {
    margin: 0;
    min-height: 180px;
    max-height: none;
    overflow: visible;
    border-radius: 10px;
    border: 1px solid #343844;
    background: #101217;
    padding: 12px;
    white-space: pre-wrap;
    font-size: 12px;
    line-height: 1.35;
    color: #dfe6f4;
}

.character-profession-content {
    flex: 0 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.character-json-section {
    margin-top: 0;
    border: 1px solid #343844;
    border-radius: 10px;
    background: #101217;
    overflow: hidden;
    flex: 0 0 auto;
}

.character-json-toggle {
    width: 100%;
    border: 0;
    border-bottom: 1px solid #343844;
    background: #0f131b;
    color: #f2f6ff;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.character-json-toggle:hover {
    background: #161b25;
}

.character-json-section.is-collapsed .character-json-toggle {
    border-bottom: 0;
}

.character-json-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
    align-items: start;
}

.character-json-body.single-column {
    grid-template-columns: 1fr;
}

.character-json-body[hidden] {
    display: none !important;
}

.character-json-column {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.character-json-column.is-hidden,
.character-json-column[hidden] {
    display: none !important;
}

.character-json-column h4 {
    margin: 0;
    font-size: 12px;
    color: #dfe6f4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.character-json-column .character-json {
    flex: 1 1 auto;
}

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

.trader-sells-open-btn {
    grid-column: 1 / -1;
    border: 1px solid #343844;
    border-radius: 10px;
    background: #151922;
    color: #e8ecf8;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
}

.trader-sells-open-btn:hover {
    border-color: #5f3340;
    background: #1b2333;
}

.trader-panel-card {
    border: 1px solid #343844;
    border-radius: 10px;
    background: #101318;
    color: #e8ecf8;
    text-align: left;
    padding: 8px;
    display: grid;
    gap: 6px;
    cursor: pointer;
}

.trader-panel-card:hover {
    border-color: #5f3340;
    background: #161b25;
}

.trader-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.trader-panel-head strong {
    font-size: 12px;
    line-height: 1.2;
}

.trader-panel-inline-controls {
    display: grid;
    gap: 6px;
}

.trader-panel-delete-btn {
    border: 1px solid #6e2b33;
    background: rgba(168, 48, 60, 0.18);
    color: #ffdce2;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    text-align: center;
    cursor: pointer;
}

.trader-panel-delete-btn:hover:not(:disabled) {
    background: rgba(168, 48, 60, 0.3);
}

.trader-panel-delete-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.trader-panel-charge-row {
    display: grid;
    grid-template-columns: 1fr 90px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-1);
}

.trader-panel-charge-input {
    width: 100%;
    border: 1px solid #343844;
    border-radius: 8px;
    background: #0f131b;
    color: #e8ecf8;
    padding: 6px 8px;
    font: inherit;
}

.trader-board {
    --trader-cell: 20px;
    position: relative;
    width: calc(var(--trader-cell) * 12);
    height: calc(var(--trader-cell) * 8);
    display: grid;
    grid-template-columns: repeat(12, var(--trader-cell));
    grid-template-rows: repeat(8, var(--trader-cell));
    border: 1px solid #343844;
    border-radius: 8px;
    background: #0b0e14;
    overflow: hidden;
}

.trader-board-cell {
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.trader-board-item {
    position: absolute;
    border: 1px solid rgba(111, 184, 129, 0.7);
    border-radius: 4px;
    background: rgba(111, 184, 129, 0.14);
    display: grid;
    place-items: center;
    padding: 1px;
    overflow: hidden;
    box-sizing: border-box;
}

.trader-board-item img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.trader-modal-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 10px;
}

.trader-modal-settings,
.trader-modal-list {
    border: 1px solid #343844;
    border-radius: 10px;
    background: #101217;
    padding: 10px;
    min-height: 420px;
}

.trader-modal-settings h4,
.trader-modal-list h4 {
    margin: 0 0 8px;
}

.trader-item-list {
    display: grid;
    gap: 6px;
    max-height: 70vh;
    overflow: auto;
}

.trader-item-row {
    border: 1px solid #343844;
    border-radius: 8px;
    background: #0f131b;
    color: #e8ecf8;
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 8px;
    align-items: center;
    padding: 6px;
    text-align: left;
    cursor: pointer;
}

.trader-item-row:hover {
    border-color: #5f3340;
    background: #161b25;
}

.trader-item-row.is-selected {
    border-color: #a63434;
}

.trader-item-row.is-added {
    border-color: #2f9a5c;
    background: rgba(47, 154, 92, 0.2);
}

.trader-item-row-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    border-radius: 6px;
    border: 1px solid #2f3440;
    display: grid;
    place-items: center;
    background: #0b0f15;
    padding: 2px;
    box-sizing: border-box;
    overflow: hidden;
    line-height: 0;
}

.trader-item-row-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.trader-item-row-text strong {
    font-size: 12px;
}

.trader-item-row-text small {
    font-size: 11px;
    color: var(--text-1);
}

.trader-item-preview {
    width: 180px;
    height: 180px;
    border: 1px solid #343844;
    border-radius: 10px;
    background: #0b0f15;
    display: grid;
    place-items: center;
    margin-bottom: 8px;
    padding: 6px;
    box-sizing: border-box;
    overflow: hidden;
    line-height: 0;
}

.trader-item-fit {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
    object-position: center;
}

.trader-item-form {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.trader-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.trader-sells-modal-grid {
    display: grid;
    gap: 8px;
    max-height: 60vh;
    overflow: auto;
}

.trader-sells-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    align-items: center;
    gap: 10px;
    border: 1px solid #343844;
    border-radius: 8px;
    background: #0f131b;
    padding: 8px;
}

.trader-sells-row span {
    color: #dfe6f4;
    font-size: 13px;
}

.trader-sells-input {
    width: 100%;
    border: 1px solid #343844;
    border-radius: 8px;
    background: #0b0f15;
    color: #e8ecf8;
    padding: 7px 8px;
    font: inherit;
}

.mechanic-sections-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: start;
}

.mechanic-section {
    border: 1px solid #343844;
    border-radius: 10px;
    background: #101217;
    padding: 10px;
    display: grid;
    gap: 8px;
    align-content: start;
    align-self: start;
}

.mechanic-section h4 {
    margin: 0;
    font-size: 13px;
    color: #f1f4fb;
}

.mechanic-rows {
    display: grid;
    gap: 6px;
    align-content: start;
    grid-auto-rows: min-content;
}

.mechanic-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    align-items: center;
    gap: 8px;
    border: 1px solid #2f3440;
    border-radius: 8px;
    padding: 6px 8px;
    background: #0d1118;
}

.mechanic-row-label {
    display: grid;
    min-width: 0;
}

.mechanic-row-label strong {
    font-size: 12px;
    color: #e8ecf8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mechanic-row-label small {
    color: #8e96aa;
    font-size: 11px;
}

.mechanic-coefficient-input {
    width: 100%;
    border: 1px solid #343844;
    border-radius: 8px;
    background: #0b0f15;
    color: #e8ecf8;
    padding: 6px 8px;
    font: inherit;
}

.mechanic-coefficient-input:focus {
    border-color: #a63434;
    outline: none;
}

.character-modal {
    width: min(1240px, 98vw);
    max-height: calc(100vh - 28px);
    overflow: auto;
}

.character-modal .transition-picker-viewport {
    height: min(68vh, 560px);
    min-height: 380px;
}

.character-picker-grid .character-picker-cell {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
}

.character-picker-grid .character-picker-cell:hover {
    background: rgba(255, 31, 31, 0.16);
    border-color: rgba(255, 102, 102, 0.72);
}

.character-picker-grid .character-picker-cell.is-selected {
    background: rgba(255, 31, 31, 0.26);
    border-color: rgba(255, 102, 102, 0.9);
    box-shadow: inset 0 0 0 1px rgba(255, 138, 138, 0.55);
}

.character-skin-gallery {
    display: grid;
    gap: 10px;
}

.character-skin-group {
    margin: 0;
}

.character-skin-variants {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
    gap: 8px;
}

.character-skin-variant {
    border: 1px solid #363b47;
    border-radius: 9px;
    background: #0f1219;
    color: #e8ecf8;
    padding: 6px;
    cursor: pointer;
    display: grid;
    gap: 6px;
    font-size: 11px;
    min-height: 192px;
    align-content: start;
    overflow: hidden;
}

.character-skin-variant:hover {
    border-color: #5f3340;
    background: #161b25;
}

.character-skin-variant.is-selected {
    border-color: #2f9a5c;
    box-shadow: inset 0 0 0 1px rgba(120, 255, 173, 0.24);
    background: rgba(47, 154, 92, 0.2);
}

.character-skin-variant-preview {
    border: 1px solid #2f3440;
    border-radius: 8px;
    height: 132px;
    display: grid;
    place-items: center;
    background: #0b0f15;
    color: #7f8696;
    font-size: 11px;
}

.character-skin-variant-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.character-skin-variant-title {
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 1180px) {
    .locations-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .locations-stage {
        min-height: auto;
    }

    .map-viewport {
        min-height: 62vh;
    }

    .locations-tools {
        position: static;
        height: auto;
        min-height: auto;
        max-height: none;
    }

    .characters-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
    }

    .characters-workplace {
        height: auto;
        min-height: 62vh;
        max-height: none;
    }

    .character-setting-row {
        grid-template-columns: 1fr;
    }

    .character-setting-row select {
        width: 100%;
    }

    .character-setting-row input[type="text"] {
        width: 100%;
    }

    .character-settings {
        grid-template-columns: 1fr;
    }

    .character-settings .character-setting-row:nth-child(-n + 3),
    .character-settings .character-setting-row:nth-child(n + 4) {
        grid-column: auto;
    }

    .character-modal .transition-picker-viewport {
        height: min(56vh, 460px);
        min-height: 300px;
    }

    .trader-panels-grid {
        grid-template-columns: 1fr;
    }

    .character-json-body {
        grid-template-columns: 1fr;
    }

    .trader-board {
        --trader-cell: 18px;
    }

    .trader-modal-layout {
        grid-template-columns: 1fr;
    }

    .trader-modal-settings,
    .trader-modal-list {
        min-height: 260px;
    }

    .trader-sells-row {
        grid-template-columns: 1fr;
    }

    .mechanic-sections-grid {
        grid-template-columns: 1fr;
    }

    .mechanic-row {
        grid-template-columns: 1fr;
    }
}
