﻿:root {
    --bg: #292a2d;
    --bg-deep: #202124;
    --bg-card: #303134;
    --border: rgba(255,255,255,.08);
    --border-bright: rgba(255,255,255,.14);
    --text: #e8eaed;
    --muted: #9aa0a6;
    --dim: #5f6368;
    --accent: #8ab4f8;
    --accent-dim: rgba(138,180,248,.12);
    --accent-hover: rgba(138,180,248,.2);
    --yellow: #fdd663;
    --red: #f28b82;
    --orange: #fcad70;
    --purple: #c58af9;
    --scrollbar-track: rgba(255,255,255,.04);
    --scrollbar-thumb: rgba(138,180,248,.34);
    --scrollbar-thumb-hover: rgba(138,180,248,.55);
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

body {
    font-family: 'Google Sans', system-ui, 'Segoe UI', sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

.layout { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 240px;
    background: var(--bg-deep);
    border-right: 1px solid var(--border);
    padding: 16px 8px 12px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.sidebar-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    gap: 6px;
}

.sidebar-search-wrap {
    padding: 4px 8px 10px;
}

.sidebar-search {
    width: 100%;
    height: 32px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,.04);
    color: var(--text);
    padding: 0 12px;
    font-size: 12px;
    outline: none;
}

.sidebar-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.sidebar-search::placeholder {
    color: var(--dim);
}

.sidebar-nav {
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 12px;
}

.sidebar-logo {
    width: 132px;
    height: auto;
    object-fit: contain;
}

.sidebar-title small {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--dim);
    text-transform: uppercase;
}

.nav-group-label {
    font-size: 11px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
    padding: 14px 12px 4px;
    font-weight: 500;
}

.nav-group-label.nav-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-radius: 8px;
}

.nav-group-label.nav-group-toggle:hover {
    color: var(--text);
    background: rgba(255,255,255,.03);
}

.nav-group-label.nav-group-toggle::after {
    content: 'expand_more';
    font-family: 'Material Symbols Outlined';
    font-size: 16px;
    line-height: 1;
    color: var(--dim);
    transition: transform .12s ease, color .12s ease;
}

.nav-group-label.nav-group-toggle.is-collapsed::after {
    transform: rotate(-90deg);
}

.nav-list.nav-group-list.collapsed {
    display: none;
}

.nav-list { list-style: none; padding: 0; margin: 0; }
.nav-item { margin-bottom: 0; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 40px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
    text-decoration: none;
    cursor: pointer;
    transition: background .1s, color .1s;
    letter-spacing: 0;
    margin: 1px 0;
}

.nav-link:hover {
    background: rgba(255,255,255,.06);
    color: var(--text);
}

.nav-link.active {
    background: #394457;
    color: var(--accent);
    font-weight: 500;
}

.nav-link .nav-link-text {
    min-width: 0;
}

.nav-count-badge {
    margin-left: auto;
    min-width: 22px;
    height: 20px;
    padding: 0 7px;
    border-radius: 10px;
    background: rgba(242, 139, 130, 0.18);
    border: 1px solid rgba(242, 139, 130, 0.35);
    color: var(--red);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Material Symbols icon sizing inside nav */
.nav-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: inherit;
    font-variation-settings: 'opsz' 20, 'wght' 300, 'FILL' 0, 'GRAD' 0;
}

/* ── Header ──────────────────────────────────────────────── */
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

header {
    padding: 0 24px;
    height: 48px;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text);
}

#headerClock {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.header-session {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-identity {
    font-size: 12px;
    color: var(--dim);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-auth-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(3, 8, 19, 0.74);
    backdrop-filter: blur(4px);
    z-index: 500;
}

.admin-auth-card {
    width: min(460px, calc(100vw - 32px));
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 10px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
    padding: 22px;
}

.admin-auth-card h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

.admin-auth-card p {
    margin: 0;
    color: var(--dim);
}

.admin-auth-remember {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    user-select: none;
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border-bright);
    background: var(--bg-deep);
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    margin: 0;
    vertical-align: middle;
    transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}

input[type="checkbox"]::after {
    content: "";
    width: 9px;
    height: 9px;
    transform: scale(0);
    transition: transform .12s ease;
    background: var(--bg-card);
    clip-path: polygon(14% 52%, 0 67%, 37% 100%, 100% 24%, 84% 10%, 35% 73%);
}

input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

input[type="checkbox"]:checked::after {
    transform: scale(1);
}

input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(138,180,248,.18);
}

.admin-auth-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}

.access-denied-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 10% 0%, rgba(242, 139, 130, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 90% 100%, rgba(138, 180, 248, 0.12) 0%, transparent 40%),
        var(--bg);
}

.access-denied-card {
    width: min(720px, 100%);
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

.access-denied-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(242, 139, 130, 0.45);
    color: var(--red);
    background: rgba(242, 139, 130, 0.15);
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 12px;
}

.access-denied-card h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
}

.access-denied-card p {
    color: var(--muted);
    margin: 12px 0 0;
}

.access-denied-meta {
    margin-top: 18px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    display: grid;
    gap: 8px;
}

.access-denied-meta-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px;
    align-items: start;
}

.access-denied-meta-row strong {
    color: var(--text);
    font-size: 12px;
}

.access-denied-meta-row span {
    color: var(--dim);
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    word-break: break-all;
}

.access-denied-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

main { padding: 24px 24px 48px; overflow-y: auto; flex: 1; }

.page { display: none; }
.page.active { display: block; }
/* ── Action bar ──────────────────────────────────────────── */
.action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.action-bar .action-bar-spacer { flex: 1; }

/* ── Drawer (slide-out panel) ────────────────────────────── */
.drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    opacity: 0;
    transition: opacity .2s ease;
}

.drawer-backdrop.open {
    display: block;
    opacity: 1;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border-bright);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    box-shadow: -8px 0 32px rgba(0,0,0,.4);
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 52px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.drawer-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.drawer-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    font-size: 20px;
    transition: color .1s, background .1s;
}

.drawer-close:hover { color: var(--text); background: rgba(255,255,255,.06); }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.drawer-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    background: var(--bg-deep);
}

/* ── Online status indicator ─────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot-online {
    background: var(--green);
    box-shadow: 0 0 4px rgba(129,201,149,.5);
}

.status-dot-offline {
    background: var(--dim);
}

/* Composable badge: dot + optional label, with tooltip */
.online-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    cursor: default;
}

.online-badge .online-badge-label {
    font-size: 11px;
    font-weight: 500;
}

.online-badge-online .online-badge-label { color: var(--green); }
.online-badge-offline .online-badge-label { color: var(--dim); }

/* CSS-only tooltip */
.online-badge::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-deep);
    color: var(--text);
    font-size: 11px;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-bright);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 10;
}

.online-badge:hover::after {
    opacity: 1;
}

/* ── Stat cards ──────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    position: relative;
}

.stat-card .label {
    font-size: 11px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    color: var(--text);
}

.stat-card .sub { font-size: 11px; color: var(--dim); margin-top: 4px; }

.stat-card.dash-crusade-card {
    grid-column: span 2;
}

@media (max-width: 1200px) {
    .stat-card.dash-crusade-card {
        grid-column: span 1;
    }
}

.stat-card-players .label {
    font-size: 11px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.stat-card-players .value {
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    color: var(--text);
}

.stat-card-players .sub {
    font-size: 12px;
    color: var(--dim);
    margin-top: 4px;
}

.stat-card-players .players-online-layout {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 100%;
}

.stat-card-players .players-online-total .value {
    font-size: 42px;
    line-height: .9;
}

.stat-card-players .players-online-breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.stat-card-players .players-online-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.stat-card-players .players-online-row .pill-side {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1px 6px 1px 5px;
    font-size: 10px;
}

.stat-card-players .players-online-row .pill-side-logo {
    width: 12px;
    height: 12px;
}

.stat-card-players .players-online-count {
    flex: 0 0 auto;
    min-width: 2ch;
    text-align: right;
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ── Section ─────────────────────────────────────────────── */
.section { margin-bottom: 28px; }

.map-drilldown-columns {
    margin-bottom: 22px;
}

.map-server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 10px;
}

.map-server-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--muted);
}

.map-server-card {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    padding: 8px;
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;
    text-align: left;
    cursor: pointer;
    transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

.map-server-card:hover {
    border-color: rgba(138,180,248,.7);
    box-shadow: 0 0 0 1px rgba(138,180,248,.3);
    background: rgba(255,255,255,.02);
}

.map-server-card.selected {
    border-color: rgba(138,180,248,.95);
    box-shadow: 0 0 0 1px rgba(138,180,248,.5);
}

.map-server-card-preview {
    width: 128px;
    height: 128px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0,0,0,.22);
    display: grid;
    place-items: center;
}

.map-server-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.map-server-card-preview.missing {
    border-style: dashed;
}

.map-server-card-empty {
    color: var(--dim);
    font-size: 11px;
}

.map-server-card-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 128px;
    gap: 6px;
}

.map-server-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-server-card-sub {
    font-size: 11px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-server-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
}

.map-server-card-flags {
    margin-top: auto;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.map-adjacent-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.map-adjacent-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    padding: 8px;
    min-height: 210px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}

button.map-adjacent-card {
    width: 100%;
    cursor: pointer;
}

button.map-adjacent-card:hover {
    border-color: rgba(138,180,248,.7);
    box-shadow: 0 0 0 1px rgba(138,180,248,.3);
    background: rgba(255,255,255,.02);
}

.map-adjacent-card.current {
    border-color: rgba(129,201,149,.75);
    box-shadow: 0 0 0 1px rgba(129,201,149,.3);
}

.map-adjacent-card.missing {
    border-style: dashed;
}

.map-adjacent-dir {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: .03em;
}

.map-adjacent-preview {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0,0,0,.22);
}

.map-adjacent-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.map-adjacent-preview.missing {
    border-style: dashed;
}

.map-adjacent-title {
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-adjacent-meta,
.map-adjacent-cell {
    font-size: 11px;
    color: var(--muted);
}

.map-adjacent-empty {
    flex: 1;
    display: grid;
    place-items: center;
    color: var(--dim);
    font-size: 12px;
}

@media (max-width: 900px) {
    .map-server-grid {
        grid-template-columns: 1fr;
    }

    .map-adjacent-grid {
        grid-template-columns: 1fr;
    }
}

.map-drilldown-image-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(0,0,0,.10));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.map-drilldown-image-card img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 280px;
    object-fit: contain;
    background: rgba(0,0,0,.25);
}

.map-drilldown-image-caption {
    border-top: 1px solid var(--border);
    background: rgba(255,255,255,.02);
    color: var(--muted);
    font-size: 11px;
    padding: 8px 10px;
}

.map-drilldown-image-empty {
    min-height: 280px;
    display: grid;
    place-items: center;
    color: var(--dim);
    font-size: 12px;
    text-align: center;
    padding: 16px;
}

.map-drilldown-image-missing {
    border-style: dashed;
}

@media (max-width: 1100px) {
    .map-drilldown-image-card {
        min-height: 260px;
    }

    .map-drilldown-image-card img,
    .map-drilldown-image-empty {
        min-height: 220px;
    }
}

.section h2 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
}

.section-desc { font-size: 12px; color: var(--muted); margin-bottom: 10px; }

/* ── Tables ──────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    background: var(--bg-deep);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.03); }
td.mono { font-family: 'Roboto Mono', 'Cascadia Code', 'Fira Code', monospace; font-size: 12px; }

/* ── Pills ───────────────────────────────────────────────── */
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.pill-green   { background: rgba(129,201,149,.15); color: var(--green); }
.pill-yellow  { background: rgba(253,214,99,.12);  color: var(--yellow); }
.pill-red     { background: rgba(242,139,130,.12); color: var(--red); }
.pill-blue    { background: var(--accent-dim);     color: var(--accent); }
.pill-purple  { background: rgba(197,138,249,.12); color: var(--purple); }
.pill-orange  { background: rgba(252,173,112,.12); color: var(--orange); }
.pill-neutral { background: rgba(255,255,255,.07); color: var(--muted); }

.pill-side {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    padding: 2px 8px 2px 6px;
}

.pill-side-logo {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
}

.pill-side-aresden {
    background: rgba(158,64,66,.16);
    border-color: rgba(158,64,66,.35);
    color: #9E4042;
}

.pill-side-elvine {
    background: rgba(69,107,154,.16);
    border-color: rgba(69,107,154,.35);
    color: #456B9A;
}

.pill-side-neutral {
    background: rgba(55,136,71,.16);
    border-color: rgba(55,136,71,.35);
    color: #378847;
}

.side-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 6px;
}

.side-breakdown-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.side-breakdown-count {
    color: var(--text);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ── Cards / forms ───────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px 20px;
}

.card + .card { margin-top: 16px; }

/* Two-column card layout for detail pages */
.card-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
    align-items: start;
}
.card-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.card-column .card {
    margin-bottom: 0;
}
.card-column .card + .card {
    margin-top: 0;
}
@media (max-width: 900px) {
    .card-columns { grid-template-columns: 1fr; }
}

.card-title {
    font-size: 13px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
    margin-bottom: 12px;
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; }

.field label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.field input, .field select, .field textarea {
    background: var(--bg-deep);
    border: 1px solid var(--border-bright);
    border-radius: 4px;
    color: var(--text);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}

.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(138,180,248,.15);
}

.field small { font-size: 11px; color: var(--dim); margin-top: 3px; }

.form-actions { margin-top: 14px; display: flex; align-items: center; gap: 10px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    border-radius: 4px;
    border: 1px solid var(--border-bright);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background .1s, color .1s;
}

.btn:hover { background: rgba(255,255,255,.06); color: var(--text); }

.btn-primary {
    background: var(--accent-dim);
    border-color: rgba(138,180,248,.25);
    color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-danger {
    background: rgba(242,139,130,.12);
    border-color: rgba(242,139,130,.25);
    color: var(--red);
}
.btn-danger:hover { background: rgba(242,139,130,.22); }

.btn-success {
    background: rgba(129,201,149,.12);
    border-color: rgba(129,201,149,.25);
    color: var(--green);
}
.btn-success:hover { background: rgba(129,201,149,.22); }

.btn-warning {
    background: rgba(253,214,99,.1);
    border-color: rgba(253,214,99,.22);
    color: var(--yellow);
}
.btn-warning:hover { background: rgba(253,214,99,.18); }

/* ── Inline navigation links (.admin-link) ───────────────── */
/* Used by linkAccount(), linkGuild(), linkCharByName(), linkCharDirect() in api.js */
a.admin-link {
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
    border-bottom: 1px solid rgba(138,180,248,.3);
    transition: color .15s, border-color .15s;
}

a.admin-link:hover {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ── Misc ────────────────────────────────────────────────── */
.status-msg { font-size: 12px; color: var(--muted); }

.search-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: flex-end; }
.search-bar .field { flex: 1; min-width: 160px; }

.empty-row { text-align: center; padding: 24px !important; color: var(--dim); }

.inline-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.config-domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.config-domain-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    color: var(--text);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 190px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.config-domain-card:hover {
    border-color: rgba(138,180,248,.35);
    background: rgba(255,255,255,.04);
    transform: translateY(-1px);
}

.config-domain-card.is-disabled {
    cursor: default;
    opacity: .72;
}

.config-domain-card.is-disabled:hover {
    border-color: var(--border);
    background: var(--bg-card);
    transform: none;
}

.config-domain-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 22px;
}

.config-domain-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.config-domain-copy {
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
    flex: 1;
}

.config-domain-footer {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--accent);
    text-transform: uppercase;
}

@media (max-width: 1100px) {
    .inline-grid-2 {
        grid-template-columns: 1fr;
    }
}

.json-box {
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-deep);
}

.json-block {
    margin: 0;
    padding: 10px 12px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text);
    white-space: pre;
    font-family: 'Roboto Mono', 'Cascadia Code', 'Fira Code', monospace;
}

/* ── Collapsible sections ────────────────────────────────── */
.collapsed { display: none; }

/* ── Scrollable table wrapper ────────────────────────────── */
.scroll-x { overflow-x: auto; }

/* ── Tab Navigation ──────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    animation: fadeIn .15s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
}

/* ── Dashboard hierarchy / operations cockpit ───────────── */
.dashboard-status-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.dashboard-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.ops-kpi {
    background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 62px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2px;
}

.ops-kpi-label {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ops-kpi-value {
    color: var(--text);
    font-size: 19px;
    line-height: 1;
    font-weight: 600;
}

.ops-kpi-sub {
    color: var(--dim);
    font-size: 10px;
}

.ops-kpi-sub-sides {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.ops-side-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.ops-side-pill-compact {
    padding: 1px 5px;
    min-width: 22px;
    justify-content: center;
    gap: 0;
    font-size: 9px;
    line-height: 1;
}

.ops-side-pill-compact .pill-side-logo {
    width: 11px;
    height: 11px;
}

.ops-side-count {
    color: var(--text);
    font-weight: 600;
    font-size: 10px;
    min-width: 1.5ch;
    text-align: right;
}

.dashboard-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas: "hero rail";
    gap: 12px;
    align-items: start;
    margin-bottom: 14px;
}

.dashboard-hero {
    grid-area: hero;
    margin-bottom: 0;
    background: rgba(255,255,255,.015);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
}

.dashboard-hero .tabs {
    margin-bottom: 8px;
}

.dashboard-rail {
    grid-area: rail;
    position: sticky;
    top: 8px;
    width: 100%;
    max-height: calc(100vh - 92px);
    overflow: auto;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.dashboard-rail .section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.dashboard-rail .section:last-child {
    margin-bottom: 0;
}

.support-ticket-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.support-ticket-summary-item {
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
}

.support-ticket-summary-item .label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 4px;
}

.support-ticket-summary-item .value {
    font-size: 24px;
    line-height: 1.1;
    font-weight: 700;
    color: var(--text);
}

.support-ticket-summary-item .sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.support-ticket-summary-new {
    border-color: rgba(252, 173, 112, .35);
}

.support-ticket-summary-open {
    border-color: rgba(100, 181, 246, .35);
}

.support-ticket-summary-total {
    border-color: rgba(129, 201, 149, .35);
}

.support-ticket-summary-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.support-ticket-summary-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 10px;
}

.section-collapsible {
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255,255,255,.012);
    overflow: hidden;
}

.section-summary {
    cursor: pointer;
    user-select: none;
    list-style: none;
    padding: 9px 12px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .03em;
    text-transform: uppercase;
    font-weight: 600;
    background: rgba(255,255,255,.02);
    border-bottom: 1px solid var(--border);
}

.section-collapsible[open] .section-summary {
    color: var(--text);
}

.section-collapsible > *:not(summary) {
    padding: 10px;
}

.compact-grid {
    gap: 10px;
}

.compact-support {
    margin-bottom: 0;
}

.compact-support table {
    font-size: 12px;
}

.compact-support th,
.compact-support td {
    padding: 7px 10px;
}

.compact-support .empty-row {
    padding: 12px !important;
}

.compact-support.stat-card {
    padding: 10px 12px;
}

.ops-summary-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ops-summary-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255,255,255,.02);
    padding: 8px;
}

.ops-summary-item .label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.ops-summary-item .value {
    margin-top: 3px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.ops-summary-item .sub {
    margin-top: 3px;
    color: var(--dim);
    font-size: 10px;
}

@media (max-width: 1280px) {
    .dashboard-main {
        grid-template-columns: 1fr;
        grid-template-areas:
            "hero"
            "rail";
    }

    .dashboard-rail {
        position: static;
        max-height: none;
        overflow: visible;
    }
}

/* ── Realm Map / Chunk Tiles ─────────────────────────────── */
.realm-grid-shell {
    border: 1px solid var(--border);
    border-radius: 8px;
    background:
        radial-gradient(120% 100% at 50% 0%, rgba(138,180,248,.08), transparent 60%),
        radial-gradient(130% 120% at 50% 100%, rgba(0,0,0,.45), rgba(0,0,0,.65));
    padding: 10px;
}

.realm-grid-shell-explorer {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
}

.realm-grid-shell-explorer .realm-grid {
    flex: 1;
    min-height: 0;
    max-height: none;
    border: none;
    border-radius: 0;
    padding: 112px 0 0;
}

.realm-grid-shell-explorer .realm-grid-meta {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    z-index: 9;
    margin: 0;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: linear-gradient(180deg, rgba(8,10,14,.92), rgba(8,10,14,.72));
    backdrop-filter: blur(4px);
}

.realm-grid-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 11px;
    color: var(--muted);
}

.realm-auto-update-btn {
    padding: 3px 10px;
    font-size: 11px;
    line-height: 1.1;
}

.realm-last-refresh {
    font-size: 10px;
    color: var(--dim);
}

.realm-fullscreen-btn {
    padding: 3px 10px;
    font-size: 11px;
    line-height: 1.1;
}

.realm-explorer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,10,14,.995);
    z-index: 260;
    display: none;
    overflow: hidden;
}

.realm-explorer-overlay.open {
    display: block;
}

body.realm-explorer-active {
    overflow: hidden;
}

.realm-explorer-shell {
    height: 100vh;
    display: block;
    padding: 0;
}

.realm-explorer-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
}

.realm-explorer-body {
    height: 100%;
}

.realm-explorer-map-shell {
    position: relative;
    height: 100%;
}

.realm-explorer-map {
    border: none;
    border-radius: 0;
    background: transparent;
    height: 100%;
    overflow: hidden;
}

.realm-explorer-panel {
    position: absolute;
    top: 10px;
    right: 10px;
    width: min(320px, calc(100% - 20px));
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(20,22,27,.88);
    backdrop-filter: blur(4px);
    padding: 10px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 94px);
}

.realm-explorer-player-list {
    margin-top: 6px;
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.realm-explorer-player-row {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255,255,255,.02);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.realm-explorer-player-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.realm-explorer-player-name {
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}

.realm-explorer-player-meta {
    color: var(--muted);
    font-size: 10px;
}

.realm-explorer-player-actions {
    display: flex;
    gap: 6px;
}

.realm-explorer-player-actions .btn {
    padding: 4px 8px;
    font-size: 11px;
}

.realm-chunk-highlight {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    box-shadow: 0 0 0 2px rgba(138,180,248,.25);
}

@media (max-width: 1100px) {
    .realm-explorer-shell {
        height: auto;
        min-height: 100vh;
    }

    .realm-explorer-panel {
        position: static;
        width: calc(100% - 20px);
        margin: 10px;
        max-height: 42vh;
    }
}

.realm-grid {
    display: grid;
    gap: 7px;
    padding: 10px;
    min-height: 420px;
    max-height: 640px;
    overflow: auto;
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 6px;
    background:
        linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
        linear-gradient(180deg, rgba(20,22,25,.8), rgba(14,15,18,.85));
    background-size: 24px 24px, 24px 24px, 100% 100%;
    box-shadow: inset 0 0 48px rgba(0,0,0,.45);
}

.realm-chunk-tile {
    --tile-density: rgba(255,255,255,.04);
    --tile-status: rgba(255,255,255,.18);
    --tile-player: var(--accent);
    border-radius: 6px;
    border: 1px solid var(--tile-status);
    position: relative;
    min-height: 74px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3px;
    font-size: 10px;
    text-align: center;
    overflow: hidden;
    transition: transform .14s ease, box-shadow .18s ease, border-color .18s ease, filter .18s ease;
    box-shadow: 0 0 0 0 transparent;
}

.realm-chunk-tile > :not(.realm-chunk-art) {
    position: relative;
    z-index: 1;
}

.realm-chunk-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .78;
    pointer-events: none;
    z-index: 0;
    filter: saturate(.95) contrast(1.02) brightness(.92);
}

.realm-chunk-active {
    background:
        linear-gradient(180deg, rgba(255,255,255,.045), rgba(0,0,0,.12)),
        var(--tile-density);
    cursor: pointer;
    color: var(--text);
}

.realm-chunk-active:hover {
    transform: translateY(-2px) scale(1.03) translateZ(0);
    border-color: rgba(138,180,248,.95);
    box-shadow: 0 0 14px rgba(138,180,248,.36);
    z-index: 10;
    filter: saturate(1.08);
}

.realm-chunk-active:active {
    transform: scale(0.98) translateZ(0);
}

.realm-chunk-placeholder {
    cursor: default;
    color: var(--dim);
    background:
        linear-gradient(180deg, rgba(255,255,255,.02), rgba(0,0,0,.14)),
        rgba(40,42,45,.56);
    border-style: dashed;
    border-color: rgba(154,160,166,.26);
    opacity: .62;
}

.realm-chunk-placeholder:hover {
    opacity: .72;
    border-color: rgba(154,160,166,.36);
}

.realm-region-aresden { box-shadow: inset 0 0 0 9999px rgba(242,139,130,.035); }
.realm-region-middleland { box-shadow: inset 0 0 0 9999px rgba(138,180,248,.03); }
.realm-region-elvine { box-shadow: inset 0 0 0 9999px rgba(129,201,149,.03); }

.realm-chunk-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    min-height: 16px;
}

.realm-weather-icon {
    font-size: 13px;
}

.realm-flag {
    font-size: 10px;
    opacity: .9;
}

.realm-chunk-name {
    color: var(--text);
    font-weight: 600;
    font-size: 10px;
    line-height: 1.15;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-height: 24px;
    max-height: 2.3em;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.realm-chunk-coords {
    color: var(--muted);
    font-size: 8px;
    letter-spacing: .02em;
}

.realm-player-count {
    color: var(--tile-player);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 16px;
}

.realm-explorer-page {
    padding: 0;
    min-height: 100vh;
    overflow: auto;
    background:
        radial-gradient(140% 120% at 0% 0%, rgba(138,180,248,.12), transparent 48%),
        radial-gradient(120% 120% at 100% 100%, rgba(242,139,130,.09), transparent 46%),
        var(--bg);
}

.realm-explorer-page main {
    padding: 0;
    margin: 0;
}

.rx-feature-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(18,20,24,.88);
}

.rx-title-wrap {
    min-width: 0;
}

.rx-title {
    margin: 0;
    font-size: 17px;
    line-height: 1.1;
    color: var(--text);
}

.rx-subtitle {
    margin-top: 2px;
    font-size: 11px;
    color: var(--muted);
}

.rx-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.rx-stage {
    position: relative;
    min-height: 100vh;
}

.rx-map-host {
    min-height: 100vh;
}

.rx-map-host .realm-grid-shell-explorer {
    display: block;
    min-height: 100vh;
}

.rx-map-host .realm-grid-shell-explorer .realm-grid {
    min-height: 100vh;
    max-height: none;
    overflow-y: visible;
    overflow-x: auto;
}

.rx-find-panel {
    position: fixed;
    left: 12px;
    bottom: 12px;
    width: min(360px, calc(100vw - 24px));
    max-height: min(48vh, 420px);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(20,22,27,.92);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    z-index: 5;
}

.rx-find-panel.collapsed {
    display: none;
}

.rx-find-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rx-inspect-panel {
    position: fixed;
    right: 12px;
    bottom: 12px;
    width: min(380px, calc(100vw - 24px));
    max-height: min(76vh, 760px);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(20,22,27,.92);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    z-index: 6;
}

.rx-inspect-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rx-inspect-content {
    overflow: auto;
    min-height: 0;
}

.rx-inspect-hero {
    margin: 0 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,.02);
    width: 100%;
    aspect-ratio: 1 / 1;
}

.rx-inspect-hero img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: saturate(.95) contrast(1.02) brightness(.92);
}

.rx-inspect-title {
    margin: 0;
    font-size: 14px;
    color: var(--text);
}

.rx-inspect-sub {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

/* ── Account page: character card grid ─────────────────────────────── */
.acc-char-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.acc-char-card {
    display: flex;
    gap: 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    width: 300px;
    cursor: pointer;
    transition: border-color 0.15s;
    text-decoration: none;
}

.acc-char-card:hover {
    border-color: var(--accent);
}

.acc-char-card-portrait {
    flex-shrink: 0;
    position: relative;
    width: 60px;
    height: 100px;
}

.acc-char-card-portrait img {
    width: 60px;
    height: 100px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid var(--border);
    display: block;
}

.acc-char-card-placeholder {
    width: 60px;
    height: 100px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--dim);
}

.acc-char-card-level {
    position: absolute;
    bottom: 3px;
    left: 3px;
    background: rgba(0, 0, 0, .75);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1.4;
}

.acc-char-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.acc-char-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.acc-char-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.acc-char-card-meta {
    font-size: 11px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
}

.rx-inspect-grid {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.rx-inspect-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 7px;
    background: rgba(255,255,255,.02);
}

.rx-inspect-item .k {
    color: var(--dim);
    font-size: 10px;
}

.rx-inspect-item .v {
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}

.rx-inspect-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rx-inspect-players {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rx-inspect-player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.rx-inspect-player-name {
    font-size: 12px;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .rx-feature-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .rx-find-panel {
        width: calc(100vw - 24px);
        max-height: 50vh;
    }

    .rx-inspect-panel {
        width: calc(100vw - 24px);
        max-height: 62vh;
    }

    .realm-grid-shell-explorer .realm-grid {
        padding-top: 146px;
    }

    .realm-grid-shell-explorer .realm-grid-meta {
        top: 86px;
    }
}

.realm-player-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--tile-player);
    animation: pulse .6s ease-in-out infinite;
}

.realm-placeholder-tag {
    align-self: center;
    margin-top: 6px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--dim);
}

/* Pulse animation for active chunks */
.realm-chunk-active.pulse-active {
    animation: chunk-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes chunk-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(138, 180, 248, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(138, 180, 248, 0);
    }
}

/* Inline pulse for player indicator */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ── Character detail: hero card ──────────────────────────────────────────── */
.char-hero-card { margin-bottom: 16px; }

.char-hero-inner {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Portrait */
.char-portrait-wrap {
    position: relative;
    flex-shrink: 0;
    width: 120px;
    height: 200px;
}

.char-portrait {
    width: 120px;
    height: 200px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--border);
    display: block;
}

.char-portrait-placeholder {
    width: 120px;
    height: 200px;
    border-radius: 6px;
    border: 2px solid var(--border);
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--dim);
}

.char-portrait-level {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0, 0, 0, .75);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    line-height: 1.4;
}

/* Hero info (centre) */
.char-hero-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.char-hero-name {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.char-hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.char-hero-statrows {
    display: flex;
    gap: 8px;
}

.char-stat-box {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    min-width: 0;
}

.char-stat-label {
    font-size: 10px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 2px;
}

.char-stat-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Meta sidebar (right) */
.char-hero-meta {
    flex-shrink: 0;
    width: 350px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.char-meta-rows {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.char-meta-row {
    display: grid;
    grid-template-columns: 18px 90px minmax(0, 1fr);
    gap: 4px;
    align-items: baseline;
    font-size: 12px;
}

.char-meta-icon {
    font-size: 14px !important;
    color: var(--dim);
    line-height: 1.4;
}

.char-meta-field { color: var(--muted); white-space: nowrap; }

.char-meta-val {
    color: var(--text);
    text-align: right;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Location uses multiple per-line spans instead of <br> */
.char-meta-val-loc {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.char-meta-loc-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.char-hero-sigil {
    width: 64px;
    height: 64px;
    object-fit: contain;
    opacity: .06;
    filter: grayscale(1) brightness(2);
    pointer-events: none;
    user-select: none;
}

/* Three-column layout */
.char-three-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.char-detail-card { display: flex; flex-direction: column; }

/* Attribute grid */
.char-attr-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.char-attr-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    text-align: center;
}

.char-attr-label {
    font-size: 10px;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 2px;
}

.char-attr-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

@media (max-width: 1100px) {
    .char-three-col { grid-template-columns: 1fr 1fr; }
    .char-hero-meta { width: 200px; }
}

@media (max-width: 700px) {
    .char-hero-inner { flex-direction: column; }
    .char-hero-meta { width: 100%; align-items: flex-start; }
    .char-three-col { grid-template-columns: 1fr; }
}