/* ==========================================================
   WorldEvil Manager — оформление
   Основа: холодный бетон. Акцент: огонь. Кислотный —
   только для предупреждений, как на знаках радиации.
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Russo+One&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --void:      #0B0C0E;
    --concrete:  #15171B;
    --panel:     #1A1D22;
    --rebar:     #262A31;
    --ash:       #868C96;
    --bone:      #E6E4DF;
    --ember:     #FF6A16;
    --flare:     #FFB43C;
    --geiger:    #C9D92B;
    --rust:      #C4432B;

    --display: 'Russo One', 'Arial Narrow', sans-serif;
    --body:    'Inter', -apple-system, 'Segoe UI', sans-serif;
    --mono:    'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;

    --r: 4px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--void);
    color: var(--bone);
    font-family: var(--body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ember); text-decoration: none; }
a:hover { color: var(--flare); }

:focus-visible {
    outline: 2px solid var(--ember);
    outline-offset: 2px;
}

/* ---------- Общие элементы ---------- */

.eyebrow {
    font-family: var(--display);
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--ash);
}

.mono { font-family: var(--mono); font-size: 13px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 20px;
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    background: var(--panel);
    color: var(--bone);
    font-family: var(--body);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--ash); }

.btn-fire {
    border-color: transparent;
    background: linear-gradient(100deg, var(--ember), var(--flare));
    color: #1A0A00;
    font-weight: 600;
}
.btn-fire:hover { filter: brightness(1.08); }

.btn-quiet {
    background: transparent;
    color: var(--ash);
    padding: 7px 12px;
    font-size: 13px;
}
.btn-quiet:hover { color: var(--bone); }

/* ==========================================================
   Экран входа
   ========================================================== */

.gate {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.gate-card {
    width: 100%;
    max-width: 420px;
    background: var(--concrete);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    position: relative;
    overflow: hidden;
}

/* Диагональные пластины — мотив взят из логотипа. */
.gate-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--ember) 0%, var(--ember) 22%,
        transparent 22%, transparent 26%,
        var(--flare) 26%, var(--flare) 40%,
        transparent 40%, transparent 44%,
        var(--ember) 44%, var(--ember) 100%);
}

.gate-body { padding: 40px 36px 32px; }

.mark {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 34px;
}
.mark img {
    width: 46px;
    height: 46px;
    display: block;
}
.mark-text { line-height: 1.15; }
.mark-name {
    font-family: var(--display);
    font-size: 21px;
    letter-spacing: .04em;
}
.mark-sub {
    font-size: 12px;
    color: var(--ash);
    letter-spacing: .02em;
}

.gate h1 {
    font-family: var(--body);
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 6px;
}
.gate p.lede {
    margin: 0 0 26px;
    color: var(--ash);
    font-size: 14px;
}

.gate .btn { width: 100%; }

/* Служебная сводка внизу карточки. */
.readout {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--rebar);
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ash);
}
.readout div {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}
.readout b { color: var(--bone); font-weight: 400; }

.alarm {
    margin: 0 0 22px;
    padding: 11px 14px;
    border-left: 3px solid var(--rust);
    background: rgba(196, 67, 43, .1);
    font-size: 13.5px;
}

/* ==========================================================
   Рабочая область
   ========================================================== */

.shell {
    display: grid;
    grid-template-columns: 232px 1fr;
    min-height: 100vh;
}

.rail {
    background: var(--concrete);
    border-right: 1px solid var(--rebar);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.rail-head {
    padding: 20px 18px;
    border-bottom: 1px solid var(--rebar);
    display: flex;
    align-items: center;
    gap: 11px;
}
.rail-head img { width: 30px; height: 30px; }
.rail-head .mark-name { font-size: 15px; }

.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }

.nav-group {
    padding: 14px 10px 6px;
    font-family: var(--display);
    font-size: 10px;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: #5A606B;
}

.nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: var(--r);
    color: var(--ash);
    font-size: 14px;
    border-left: 2px solid transparent;
}
.nav a:hover { background: var(--panel); color: var(--bone); }
.nav a.on {
    background: var(--panel);
    color: var(--bone);
    border-left-color: var(--ember);
}
.nav a.locked { opacity: .38; pointer-events: none; }
.nav a .tag {
    font-family: var(--mono);
    font-size: 10px;
    color: #5A606B;
}

.rail-foot {
    padding: 14px;
    border-top: 1px solid var(--rebar);
    display: flex;
    align-items: center;
    gap: 10px;
}
.rail-foot img { width: 28px; height: 28px; border-radius: 50%; }
.who { flex: 1; min-width: 0; }
.who-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.who-role { font-size: 11px; color: var(--ash); }

main { padding: 28px 34px 60px; max-width: 1240px; }

.page-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--rebar);
}
.page-head h1 {
    font-family: var(--display);
    font-size: 24px;
    font-weight: 400;
    letter-spacing: .02em;
    margin: 0;
}

/* ---------- Карточки состояния ---------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 30px;
}

.card {
    background: var(--concrete);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    padding: 18px;
}
.card .eyebrow { display: block; margin-bottom: 10px; }
.card .value {
    font-family: var(--mono);
    font-size: 22px;
    color: var(--bone);
}
.card .note {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--ash);
    word-break: break-all;
}

.dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}
.dot-ok   { background: var(--geiger); }
.dot-bad  { background: var(--rust); }

/* ---------- Таблицы ---------- */

.section { margin-bottom: 36px; }
.section > h2 {
    font-family: var(--display);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ash);
    margin: 0 0 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--concrete);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    overflow: hidden;
}
th {
    text-align: left;
    padding: 11px 14px;
    font-family: var(--display);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #5A606B;
    border-bottom: 1px solid var(--rebar);
    font-weight: 400;
}
td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--rebar);
    font-size: 13.5px;
    vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel); }
td.mono, th.mono { font-family: var(--mono); font-size: 12.5px; }
td .muted { color: var(--ash); }

.empty {
    padding: 34px 18px;
    text-align: center;
    color: var(--ash);
    font-size: 14px;
    background: var(--concrete);
    border: 1px dashed var(--rebar);
    border-radius: var(--r);
}

.chip {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 4px 4px 0;
    border: 1px solid var(--rebar);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ash);
}
.chip-fire { border-color: var(--ember); color: var(--flare); }

@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .rail { position: static; height: auto; }
    main { padding: 20px 18px 50px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ==========================================================
   Модуль спавна
   ========================================================== */

/* Логотип нарисован белым по чёрному квадрату — режим screen
   убирает подложку и оставляет только пластины. */
.mark img, .rail-head img { mix-blend-mode: screen; }

.rail-foot img {
    mix-blend-mode: normal;
    background: var(--rebar);
    object-fit: cover;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 22px;
}
.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: var(--concrete);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    color: var(--ash);
    font-family: var(--body);
    font-size: 13.5px;
    cursor: pointer;
}
.tab:hover { color: var(--bone); border-color: var(--ash); }
.tab.on {
    color: var(--bone);
    border-color: var(--ember);
    background: var(--panel);
}
.tab-mark {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--flare);
}
.tab-add { border-style: dashed; }

.props {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 20px;
    padding: 18px;
    background: var(--concrete);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    margin-bottom: 10px;
}
.props-foot { margin-bottom: 26px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field-label {
    font-family: var(--display);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #5A606B;
}
.field-check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    align-self: flex-end;
    padding-bottom: 8px;
    font-size: 13.5px;
    color: var(--ash);
    cursor: pointer;
}

input[type="text"], input[type="number"], select {
    background: var(--void);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    color: var(--bone);
    padding: 7px 10px;
    font-family: var(--body);
    font-size: 13.5px;
    min-width: 150px;
}
input.mono, select.mono { font-family: var(--mono); font-size: 12.5px; }
input.narrow { min-width: 84px; width: 84px; }
input:focus, select:focus { border-color: var(--ember); outline: none; }
input::placeholder { color: #4E545E; }

.section-note {
    margin: -4px 0 14px;
    color: var(--ash);
    font-size: 13px;
    max-width: 70ch;
}



/* ---------- дерево экипировки ---------- */

.loadout {
    background: var(--concrete);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    padding: 8px;
}
.loadout-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: var(--r);
}
.loadout-row:hover { background: var(--panel); }
.depth-1 { padding-left: 30px; }
.depth-2 { padding-left: 58px; }
.depth-3 { padding-left: 86px; }
.branch {
    width: 12px;
    color: #4E545E;
    font-family: var(--mono);
}
.class-field { flex: 1; min-width: 180px; }
.class-field input { width: 100%; }
.row-actions { display: flex; gap: 2px; margin-left: auto; }
.btn.danger:hover { color: var(--rust); }

.tree-foot { margin-top: 12px; }

/* ---------- сообщения ---------- */

.notice {
    margin: 0 0 8px;
    padding: 10px 13px;
    border-left: 3px solid var(--geiger);
    background: rgba(201, 217, 43, .07);
    font-size: 13.5px;
}
.notice.ok {
    border-left-color: var(--ember);
    background: rgba(255, 106, 22, .07);
}

.grid-compact .value { font-size: 17px; }


/* ---------- карта ---------- */

.map-block { margin-bottom: 16px; }

.map-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--concrete);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
}
.map-spacer { flex: 1; }
.map-hint {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ash);
    margin-right: 10px;
}
.map-zoom { min-width: 26px; text-align: center; color: var(--ash); }
.map-controls .btn { padding: 5px 11px; }
.map-controls .btn:disabled { opacity: .35; cursor: default; }

.map-viewport {
    margin-top: 8px;
    max-height: 58vh;
    overflow: auto;
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    background: var(--void);
}
.map-canvas { position: relative; width: 100%; }
.map-img { display: block; width: 100%; cursor: crosshair; }
.map-pins { position: absolute; inset: 0; pointer-events: none; }
.map-pin {
    position: absolute;
    width: 16px; height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid var(--ember);
    border-radius: 50%;
    background: rgba(255, 106, 22, .3);
}
.map-pin b {
    position: absolute;
    left: 19px; top: -3px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--flare);
    text-shadow: 0 0 4px #000;
}

.points { margin-bottom: 12px; }

.manual-add {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    background: var(--concrete);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
}
.manual-add .field-label { margin-right: 4px; }
.manual-hint { font-size: 12.5px; color: var(--ash); }

/* Пометка внутри вкладки не должна слипаться с названием. */
.tab-mark { margin-left: 4px; }

/* ==========================================================
   Торговцы
   ========================================================== */

.split {
    display: grid;
    grid-template-columns: 268px 1fr;
    gap: 18px;
    align-items: start;
}
.split-side { position: sticky; top: 20px; }

.trader-search {
    width: 100%;
    margin-bottom: 10px;
}

.trader-list {
    max-height: 72vh;
    overflow-y: auto;
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    background: var(--concrete);
}
.trader-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--rebar);
    border-left: 2px solid transparent;
    color: var(--ash);
    font-family: var(--body);
    font-size: 13.5px;
    cursor: pointer;
}
.trader-item:last-child { border-bottom: none; }
.trader-item:hover { background: var(--panel); color: var(--bone); }
.trader-item.on {
    background: var(--panel);
    color: var(--bone);
    border-left-color: var(--ember);
}
.trader-name { display: block; }
.trader-meta {
    display: block;
    font-size: 11px;
    color: #5A606B;
    margin-top: 1px;
}
.trader-flag {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 6px;
    border: 1px solid var(--rust);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--rust);
}

.cat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}
.chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    background: var(--concrete);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    color: var(--ash);
    font-family: var(--body);
    font-size: 12.5px;
    cursor: pointer;
}
.chip-btn:hover { color: var(--bone); border-color: var(--ash); }
.chip-btn.on { color: var(--bone); border-color: var(--ember); background: var(--panel); }
.chip-btn.missing { border-style: dashed; color: var(--rust); }
.chip-count { font-size: 10.5px; color: #5A606B; }

.row-broken td { background: rgba(196, 67, 43, .08); }

.problem-list {
    background: var(--concrete);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    max-height: 340px;
    overflow-y: auto;
}
.problem-row {
    padding: 6px 12px;
    border-bottom: 1px solid var(--rebar);
    font-size: 12px;
    color: var(--ash);
    word-break: break-all;
}
.problem-row:last-child { border-bottom: none; }
.problem-row.muted { color: #5A606B; font-style: italic; }

td .class-field input { min-width: 210px; }
td input.narrow { width: 92px; min-width: 92px; }

@media (max-width: 1100px) {
    .split { grid-template-columns: 1fr; }
    .split-side { position: static; }
    .trader-list { max-height: 40vh; }
}

/* ==========================================================
   Зоны поиска и квесты
   ========================================================== */

.loot-card {
    padding: 12px 12px 10px;
    margin-bottom: 8px;
    background: var(--panel);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
}
.loot-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.loot-line:last-child { margin-bottom: 0; }
.loot-line .field-label { margin: 0 2px; }
.loot-line .class-field { flex: 1; min-width: 200px; }

.tool-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tool-chip {
    padding: 3px 9px;
    background: transparent;
    border: 1px solid var(--rebar);
    border-radius: 2px;
    color: #5A606B;
    font-family: var(--mono);
    font-size: 11px;
    cursor: pointer;
}
.tool-chip:hover { color: var(--bone); }
.tool-chip.on { border-color: var(--ember); color: var(--flare); }

.json-editor {
    width: 100%;
    min-height: 460px;
    background: var(--void);
    border: 1px solid var(--rebar);
    border-radius: var(--r);
    color: var(--bone);
    padding: 12px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.6;
    resize: vertical;
}
.json-editor:focus { border-color: var(--ember); outline: none; }
