:root {
    color-scheme: dark;
    --bg: #0a0a0a;
    --bg-soft: rgba(18, 18, 18, 0.92);
    --panel: #161616;
    --panel-strong: #121212;
    --ink: #f2ede6;
    --ink-soft: #cfc6bc;
    --muted: #8f8880;
    --line: rgba(242, 237, 230, 0.1);
    --line-strong: rgba(242, 237, 230, 0.18);
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --accent: #3b82f6;            /* подменяется по фракции */
    --accent-soft: rgba(59, 130, 246, 0.16);
    --blue: #3b82f6;
    --green: #22c55e;
    --font-sans: "Inter", "Segoe UI", "Helvetica Neue", sans-serif;
    --font-mono: "IBM Plex Mono", "SFMono-Regular", "Consolas", monospace;
}

body[data-faction="blue"]  { --accent: var(--blue);  --accent-soft: rgba(59, 130, 246, 0.16); }
body[data-faction="green"] { --accent: var(--green); --accent-soft: rgba(34, 197, 94, 0.16); }

[x-cloak] { display: none !important; }

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    -webkit-tap-highlight-color: transparent;
}

#map {
    position: absolute;
    inset: 0;
}

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

/* ---- кнопки ---- */
.btn {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    padding: 12px 18px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
    background: var(--accent);
    border-color: transparent;
    color: #06121f;
    font-weight: 600;
}
.btn.primary:hover { box-shadow: 0 0 0 4px var(--accent-soft); }
.btn.ghost { background: transparent; padding: 8px 12px; font-size: 13px; color: var(--ink-soft); }
.btn.round {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    background: var(--bg-soft);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- гейт (вход / фракция) ---- */
.gate {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 20% 10%, var(--accent-soft), transparent 40%),
        radial-gradient(circle at 85% 90%, rgba(255, 255, 255, 0.04), transparent 35%),
        var(--bg);
    z-index: 30;
}
.gate-card {
    width: min(340px, 88vw);
    padding: 36px 28px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    text-align: center;
    backdrop-filter: blur(12px);
}
.logo {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--ink);
}
.logo::after { content: "_"; color: var(--accent); }
.gate-sub { color: var(--muted); margin: 10px 0 26px; }
.faction-choices { display: flex; gap: 12px; }
.btn.faction { flex: 1; font-weight: 700; font-size: 16px; }
.btn.faction.blue  { color: var(--blue);  border-color: var(--blue); }
.btn.faction.green { color: var(--green); border-color: var(--green); }
.btn.faction:hover { background: var(--panel-strong); box-shadow: 0 0 18px -6px currentColor; }

/* ---- верхняя панель ---- */
.topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
    z-index: 20;
    pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.player-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    backdrop-filter: blur(8px);
}
.avatar { width: 26px; height: 26px; border-radius: 50%; }
.player-name { font-size: 14px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge.blue  { color: var(--blue);  background: rgba(59, 130, 246, 0.14); }
.badge.green { color: var(--green); background: rgba(34, 197, 94, 0.14); }
.badge.neutral, .badge[class="badge"] { color: var(--muted); background: rgba(140, 140, 140, 0.14); }

/* ---- кнопки карты ---- */
.map-buttons {
    position: absolute;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom) + 104px); /* над кнопкой АТАКА */
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
}

/* ---- карточка портала ---- */
.portal-card {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom) + 12px);
    max-width: 420px;
    margin: 0 auto;
    background: var(--bg-soft);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    overflow: hidden;
    z-index: 25;
    backdrop-filter: blur(12px);
}
.portal-photo {
    display: block;
    width: 100%;
    height: 170px;
    object-fit: cover;
}
.portal-card .close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: var(--ink);
    font-size: 18px;
    cursor: pointer;
}
.portal-body { padding: 14px 16px 16px; }
.portal-body h2 { margin: 0 0 8px; font-size: 17px; line-height: 1.3; }
.portal-meta { margin: 0 0 6px; color: var(--ink-soft); font-size: 14px; }
.portal-coords { margin: 0; color: var(--muted); font-size: 12px; }

/* ---- гео-заметка ---- */
.geo-note {
    position: absolute;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom) + 90px);
    transform: translateX(-50%);
    padding: 10px 16px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--ink-soft);
    z-index: 22;
    max-width: 86vw;
    text-align: center;
}

/* ---- энергия и слоты портала ---- */
.portal-energy { margin: 4px 0 10px; }
.bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}
.bar.big { height: 12px; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s; }
.bar-fill.blue { background: var(--blue); }
.bar-fill.green { background: var(--green); }
.bar-fill.neutral { background: #8a8a8a; }
.energy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
    color: var(--ink-soft);
}
.slots { display: flex; gap: 4px; }
.slot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid var(--line-strong);
    background: transparent;
}
.slot.filled.neutral { background: #9a9a9a; border-color: #9a9a9a; }
.slot.filled.blue { background: var(--blue); border-color: var(--blue); }
.slot.filled.green { background: var(--green); border-color: var(--green); }
.dist { color: var(--muted); }

/* ---- действия в карточке ---- */
.portal-actions { display: flex; gap: 8px; margin: 8px 0; }
.btn.act {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
    background: var(--panel-strong);
    border-color: var(--line-strong);
}
.btn.act:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn.act:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.act.danger:hover:not(:disabled) { border-color: var(--danger, #f87171); }
.lvl-select {
    padding: 10px;
    background: var(--panel-strong);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    font: inherit;
}

/* ---- инвентарь ---- */
.inv-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 40;
    display: grid;
    place-items: end center;
}
.inv-panel {
    width: 100%;
    max-width: 480px;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--bg-soft);
    border: 1px solid var(--line-strong);
    border-bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 16px 18px calc(env(safe-area-inset-bottom) + 18px);
    backdrop-filter: blur(12px);
}
.inv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.inv-progress { margin-bottom: 14px; }
.inv-energy {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 14px;
}
.inv-items { list-style: none; margin: 0; padding: 0; }
.inv-items li {
    display: flex;
    justify-content: space-between;
    padding: 8px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.muted { color: var(--muted); }

/* ---- тосты ---- */
.toasts {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 58px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 50;
    pointer-events: none;
}
.toast {
    padding: 10px 16px;
    background: var(--bg-soft);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--ink);
    white-space: nowrap;
    backdrop-filter: blur(8px);
    animation: toast-in 0.2s ease-out;

    max-width: calc(100vw - 32px);
    white-space: normal;
    word-break: break-word;
}
.toast.good { border-color: var(--accent); }
.toast.bad { border-color: var(--danger, #f87171); color: #f87171; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- кнопка атаки ---- */
.fire-wrap {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex; flex-direction: column; align-items: stretch;
    width: min(420px, calc(100vw - 24px));
}
.btn.fire { width: 100%; }
.btn.fire {
    padding: 14px 26px;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.06em;
    color: #fff;
    background: linear-gradient(180deg, #ff6a3d, #d92c12);
    border: 1px solid rgba(255, 128, 90, 0.6);
    border-radius: 999px;
    box-shadow: 0 0 24px -4px rgba(255, 90, 40, 0.8);
}
.btn.fire:disabled { opacity: 0.35; box-shadow: none; }
.btn.fire:active:not(:disabled) { transform: translateY(1px) scale(0.98); }

/* ---- счёт фракций ---- */
.topbar .left { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.score-chip {
    display: inline-flex;
    gap: 10px;
    padding: 3px 10px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    backdrop-filter: blur(8px);
}
.score-chip .blue { color: var(--blue); }
.score-chip .green { color: var(--green); }
.linkmode-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--accent);
}
.inv-sub { margin: 16px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.inv-top { list-style: none; margin: 0; padding: 0; }
.inv-top li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.inv-top li .mono { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---- профиль (фуллскрин) ---- */
.profile {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 8%, var(--accent-soft), transparent 40%),
        var(--bg);
    z-index: 45;
    overflow-y: auto;
    padding: calc(env(safe-area-inset-top) + 12px) 16px 24px;
}
.profile-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    align-items: center;
}
.profile-tabs button {
    flex: 1;
    padding: 9px 6px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--ink-soft);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.profile-tabs button.on { border-color: var(--accent); color: var(--accent); }
.profile-tabs .close-tab { flex: 0 0 44px; font-size: 18px; }
.profile-head { display: flex; gap: 14px; margin-bottom: 18px; align-items: center; }
.avatar.big { width: 64px; height: 64px; border-radius: var(--radius-lg); border: 1px solid var(--line-strong); }
.profile-nick { font-size: 22px; font-weight: 700; }
.profile-lvl { margin-top: 4px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.nick-input {
    width: 100%;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: var(--panel-strong);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    color: var(--ink);
    font: inherit;
    text-align: center;
}
.nick-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.bad-text { color: #f87171; }
.score-big { display: flex; justify-content: space-around; font-size: 18px; margin-bottom: 10px; }
.score-big .blue { color: var(--blue); }
.score-big .green { color: var(--green); }
.admin-stats { font-size: 13px; color: var(--ink-soft); margin-bottom: 8px; }

.settings { margin-top: 16px; }
.admin-grant { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.admin-grant .btn { padding: 6px 10px; font-size: 12px; }

.link-modal {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(0,0,0,.55);
    display: flex; align-items: flex-end; justify-content: center;
}
.link-modal-box {
    width: 100%; max-width: 420px; max-height: 70vh;
    background: var(--panel); border-radius: 16px 16px 0 0;
    padding: 16px; overflow-y: auto;
}
.link-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.link-hint { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }
.link-list {
    list-style: none; margin: 0; padding: 0;
    max-height: 50vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.link-list li {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 8px; border-bottom: 1px solid var(--line);
    cursor: pointer;
}
.ln-thumb {
    width: 40px; height: 40px; border-radius: 8px; object-fit: cover;
    flex: 0 0 40px; background: var(--line);
}
.ln-thumb.noimg { visibility: hidden; }
.ln { flex: 1 1 auto; }
.link-list li:active { background: var(--line); }
.link-list .lt { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* крестик модалки линковки — как у карточки портала */
.link-modal-head .close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

/* tabler-иконки в кнопках */
.ic { width: 22px; height: 22px; display: block; filter: invert(1); }
.btn.fire .ic { width: 20px; height: 20px; display: inline-block; vertical-align: -4px; margin-right: 6px; }

/* моды портала */
.portal-mods { display: flex; align-items: center; gap: 6px; margin: 10px 0 4px; }
.mod-slot {
    width: 34px; height: 34px; border-radius: 8px;
    border: 1px dashed var(--line-strong);
    display: flex; align-items: center; justify-content: center;
}
.mod-slot.filled { border-style: solid; background: rgba(255,255,255,0.06); }
.mod-slot .ic { width: 20px; height: 20px; filter: invert(0.85); }
.mods-label { margin-left: auto; font-size: 11px; color: var(--muted); }

/* ---- HUD (как в Ingress): AP и XM шкалы + ник ---- */
.hud {
    display: flex; flex-direction: column; gap: 3px;
    background: var(--bg-soft); border: 1px solid var(--line);
    border-radius: var(--radius-md); padding: 8px 10px;
    backdrop-filter: blur(8px);
    min-width: 220px; cursor: pointer;
}
.hud-bar {
    position: relative; height: 12px; border-radius: 6px;
    background: rgba(255,255,255,0.08); overflow: hidden;
}
.hud-fill { height: 100%; border-radius: 6px; transition: width .4s; }
.hud-fill.ap { background: linear-gradient(90deg, #7dd3fc, #38bdf8); }
.hud-fill.xm { background: linear-gradient(90deg, #86efac, #22c55e); }
.hud-label {
    position: absolute; inset: 0; display: flex; align-items: center;
    justify-content: center; font-size: 9px; color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.hud-row { display: flex; align-items: center; gap: 8px; }
.hud-lvl { color: var(--muted); }
.hud-lvl.blue b, .hud-lvl.green b { color: inherit; }
.hud-lvl.blue { color: var(--blue); }
.hud-lvl.green { color: var(--green); }
.player-name.blue { color: var(--blue); }
.player-name.green { color: var(--green); }
.player-name.neutral { color: var(--ink); }

/* иконки малых размеров */
.ic.sm { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }
.ic.xs { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; filter: invert(0.8); }

/* заголовок карточки портала */
.portal-title { display: flex; align-items: baseline; gap: 8px; }
.plvl { font-size: 15px; font-weight: 700; }
.plvl.blue { color: var(--blue); }
.plvl.green { color: var(--green); }
.plvl.neutral { color: var(--muted); }
.mods-label .ic.sm { filter: invert(0.85); }

/* ---- лоток оружия (как в Ingress) ---- */
.weapon-tray {
    display: flex; flex-direction: column; gap: 8px;
    background: var(--bg-soft); border: 1px solid var(--line);
    border-radius: var(--radius-md); padding: 8px;
    backdrop-filter: blur(8px); margin-bottom: 8px;
}
.tray-cards {
    display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}
.wcard {
    position: relative; flex: 0 0 64px; height: 64px;
    border: 2px solid var(--line-strong); border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; background: var(--panel);
}
.wcard.sel { border-color: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }
.wcard.empty { flex: 0 0 auto; width: 120px; display: flex; align-items: center; justify-content: center; }
.wicon { display: flex; align-items: center; justify-content: center; }
.wicon svg { width: 34px; height: 34px; }
.wqty {
    position: absolute; top: 2px; right: 5px;
    font-size: 10px; color: var(--ink);
}
.wlvl {
    position: absolute; bottom: 2px; right: 5px;
    font-size: 11px; font-weight: 700;
}
.tray-done { padding: 8px; font-size: 13px; }

/* ---- инвентарь: сетка карточек с вертикальным скроллом ---- */
.inv-scroll {
    max-height: calc(100vh - 260px);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding-right: 2px;
}
.inv-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 8px;
}
.icard {
    position: relative; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
    border: 2px solid var(--line-strong); border-radius: 10px;
    background: var(--panel); padding: 10px 4px 6px; min-height: 78px;
}
.icard.r1 { border-color: #7DD3FC; }
.icard.r2 { border-color: #F0ABFC; }
.icard.key { border-color: #FECE00; }
.icard .wicon svg { width: 30px; height: 30px; }
.icard .wicon { display: flex; }
.icard img.wicon { width: 30px; height: 30px; filter: invert(0.85); }
.ilabel {
    font-size: 10px; color: var(--muted); text-align: center;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.profile-nick.blue { color: var(--blue); }
.profile-nick.green { color: var(--green); }

/* фильтры инвентаря */
.inv-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.fbtn {
    padding: 6px 12px; border-radius: 16px; font-size: 12px;
    border: 1px solid var(--line-strong); background: var(--panel); color: var(--muted);
    cursor: pointer;
}
.fbtn.on { border-color: var(--blue); color: var(--ink); background: rgba(59,130,246,0.15); }

/* карточка ключа с фото портала на весь фон */
.icard.photo { padding: 0; overflow: hidden; min-height: 86px; justify-content: flex-end; }
.icard.photo .card-photo {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; z-index: 0;
}
.icard.photo .card-photo.noimg { display: none; }
.icard.photo .card-shade {
    position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(180deg, rgba(0,0,0,0.15), rgba(0,0,0,0.75));
}
.icard.photo .keymark {
    position: absolute; top: 6px; left: 8px; width: 16px; height: 16px;
    z-index: 2; filter: invert(1) sepia(1) saturate(5) hue-rotate(5deg);
}
.icard.photo .ilabel {
    position: relative; z-index: 2; color: #fff; width: 100%;
}
.icard.photo .kdist {
    position: relative; z-index: 2; color: #cbd5e1; font-size: 10px; width: 100%;
}
.icard.photo .wqty { z-index: 2; }

/* ---- карточка агента ---- */
.agent-modal {
    position: fixed; inset: 0; z-index: 70;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.agent-card {
    position: relative; width: 100%; max-width: 380px;
    border-radius: 16px; padding: 20px 18px;
    background:
        radial-gradient(circle at 15% 8%, var(--accent-soft), transparent 40%),
        var(--bg);
    border: 1px solid var(--line);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.agent-card.blue {
    background:
        radial-gradient(circle at 15% 8%, rgba(59, 130, 246, 0.25), transparent 45%),
        var(--bg);
    border-color: var(--blue);
}
.agent-card.green {
    background:
        radial-gradient(circle at 15% 8%, rgba(34, 197, 94, 0.25), transparent 45%),
        var(--bg);
    border-color: var(--green);
}
.agent-card.neutral { border-color: var(--line-strong); }

.agent-avatar { width: 56px; height: 56px; border-radius: 50%; margin-bottom: 8px; }
.agent-name { font-size: 19px; font-weight: 800; display: flex; align-items: baseline; gap: 8px; }
.agent-name.blue { color: var(--blue); }
.agent-name.green { color: var(--green); }
.agent-faction { font-size: 12px; opacity: 0.75; margin: 2px 0 8px; }
.agent-ap { font-size: 13px; opacity: 0.9; margin-bottom: 12px; }
.agent-medals h4 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; color: var(--muted); }

/* кликабельные ники — всегда цвет фракции игрока */
.owner-link, .agent-link {
    color: var(--blue); text-decoration: underline; cursor: pointer;
}
.owner-link.blue, .agent-link.blue { color: var(--blue); }
.owner-link.green, .agent-link.green { color: var(--green); }
.owner-link:active, .agent-link:active { opacity: 0.7; }
.portal-owner { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }

/* лента событий */
.feed-list { list-style: none; margin: 0; padding: 0; }
.feed-list li {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px 4px; border-bottom: 1px solid var(--line);
}
.feed-text { font-size: 13px; line-height: 1.5; }
.feed-text .muted { font-size: 11px; margin-left: 6px; }

/* агенты портала: кликабельные чипы */
.portal-agents { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.agent-chip {
    font-size: 12px; padding: 4px 10px; border-radius: 12px;
    border: 1px solid var(--line-strong); background: var(--panel);
    color: var(--ink); cursor: pointer;
}
.agent-chip:active { background: var(--line); }

.agent-link.blue { color: var(--blue); }
.agent-link.green { color: var(--green); }
.fdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.fdot.blue { background: var(--blue); }
.fdot.green { background: var(--green); }
.fdot { background: var(--muted); }


/* заставка с лого */
.splash {
    position: absolute; inset: 0; z-index: 15;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; background: rgba(10, 10, 10, 0.72); backdrop-filter: blur(2px);
}
.splash-logo { width: 96px; height: 96px; opacity: 0.95; }
.splash-text { color: var(--muted); font-size: 13px; }

/* круглый крестик карточки агента — как в карточке портала */
.agent-card .close {
    position: absolute; top: 10px; right: 10px;
    width: 32px; height: 32px;
    border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: var(--ink); font-size: 18px; line-height: 1;
    cursor: pointer;
}

/* медали */
.medal-grid { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 2px 12px; }
.medal-hex {
    width: 78px; height: 86px;
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    display: flex; cursor: pointer;
}
.medal-hex.t0 { background: #3a3f46; }
.medal-hex.t1 { background: #b87333; }
.medal-hex.t2 { background: #c0c7ce; }
.medal-hex.t3 { background: #f0c330; }
.medal-hex.t4 { background: #9fd3e0; }
.medal-hex.t5 { background: #7b68b5; }
.medal-hex-in {
    flex: 1; margin: 3px;
    clip-path: inherit;
    background: #151a20;
    display: flex; align-items: center; justify-content: center;
}
.medal-hex .medal-ic { color: var(--ink); display: flex; }
.medal-hex.t0 .medal-ic { color: #6a7078; }
.medal-hex.t1 .medal-ic { color: #d89b66; }
.medal-hex.t2 .medal-ic { color: #dde3e9; }
.medal-hex.t3 .medal-ic { color: #f6d866; }
.medal-hex.t4 .medal-ic { color: #c4e9f2; }
.medal-hex.t5 .medal-ic { color: #a99bd8; }
.medal-hex.big { width: 110px; height: 122px; margin: 0 auto; cursor: default; }
.medal-card {
    position: relative;
    background: var(--panel, #14181d); border: 1px solid var(--line-strong, #2a313a);
    border-radius: 14px; padding: 22px 20px 18px; width: min(340px, 92vw);
    text-align: center;
}
.medal-card .close {
    position: absolute; top: 10px; right: 10px;
    width: 32px; height: 32px;
    border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: var(--ink); font-size: 18px; line-height: 1;
    cursor: pointer;
}
.medal-card .medal-name { margin: 10px 0 2px; font-size: 18px; }
.medal-card .medal-about { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.medal-card .medal-tier-line { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.medal-card .medal-desc { margin: 0; font-size: 13px; color: var(--ink); }
