:root {
    --bg: #08090a;
    --panel: #0f1012;
    --surface: rgba(255,255,255,.025);
    --surface-hover: rgba(255,255,255,.045);
    --border: rgba(255,255,255,.075);
    --border-soft: rgba(255,255,255,.045);
    --text: #f4f5f7;
    --text-2: #c5cad2;
    --muted: #858b95;
    --dim: #5b6069;
    --accent: #7170ff;
    --accent-soft: rgba(113,112,255,.14);
    --green: #31c48d;
    --amber: #f0a96b;
    --cyan: #57c4d3;
    --danger: #e66b73;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-feature-settings: "cv01", "ss03"; }
body { margin: 0; min-height: 100vh; background: radial-gradient(900px 520px at 50% -220px, rgba(113,112,255,.16), transparent 70%), var(--bg); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .22; background-image: linear-gradient(rgba(255,255,255,.012) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to bottom, black, transparent 70%); }

.topbar { height: 68px; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-soft); background: rgba(8,9,10,.82); backdrop-filter: blur(20px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: linear-gradient(145deg, #8b8aff, #5250cf); box-shadow: 0 0 24px rgba(113,112,255,.22), inset 0 1px rgba(255,255,255,.25); font-weight: 650; font-size: 15px; }
.brand-name { font-size: 13px; line-height: 1.1; letter-spacing: .06em; font-weight: 620; }
.brand-subtitle { margin-top: 4px; color: var(--dim); font: 500 9px/1 ui-monospace, monospace; letter-spacing: .12em; }
.connection-pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; background: rgba(255,255,255,.025); color: var(--text-2); font-size: 12px; }
.connection-pill.offline { color: var(--muted); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(49,196,141,.1), 0 0 14px rgba(49,196,141,.45); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 0 4px rgba(230,107,115,.1); }
.divider { color: var(--dim); }

.shell { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 68px 0 32px; position: relative; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; padding: 0 4px 38px; }
.eyebrow, .panel-kicker, .metric-label, .subsection-label, .location-label { color: var(--muted); font: 550 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .11em; }
h1 { margin: 14px 0 12px; font-size: clamp(38px, 4.2vw, 62px); line-height: .98; letter-spacing: -.045em; font-weight: 520; }
h1 span { color: #a7a6ff; }
.hero-copy { margin: 0; color: var(--text-2); font-size: 15px; display: flex; align-items: center; gap: 9px; }
.activity-orb { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px rgba(113,112,255,.55); }
.hero-location { min-width: 215px; padding: 18px 20px; border-left: 1px solid var(--border); }
.location-value { font-size: 22px; margin: 8px 0 5px; color: var(--text); }
.location-meta { color: var(--muted); font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(260px, 1.35fr); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.012); margin-bottom: 16px; }
.metric-card { min-height: 138px; padding: 22px 24px; border-right: 1px solid var(--border-soft); background: var(--surface); }
.metric-card:last-child { border-right: 0; }
.metric-value { margin-top: 13px; font-size: 39px; line-height: 1; letter-spacing: -.045em; font-weight: 520; }
.metric-value.compact { font-size: 31px; margin-top: 19px; }
.metric-note { margin-top: 9px; color: var(--dim); font-size: 11px; }
.vitals-card { display: flex; flex-direction: column; justify-content: center; }
.vital-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.vital-row strong { color: var(--text-2); font: 500 12px ui-monospace, monospace; }
.vital-row.second { margin-top: 16px; }
.bar { display: block; width: 100%; height: 5px; margin-top: 8px; appearance: none; border: 0; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.07); }
.bar::-webkit-progress-bar { background: rgba(255,255,255,.07); }
.bar::-webkit-progress-value { border-radius: 10px; background: var(--green); }
.bar::-moz-progress-bar { background: var(--green); }
.bar.energy::-webkit-progress-value { background: var(--accent); }
.bar.energy::-moz-progress-bar { background: var(--accent); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(360px, .85fr); gap: 16px; }
.panel { background: linear-gradient(180deg, rgba(255,255,255,.028), rgba(255,255,255,.016)); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; min-width: 0; }
.panel-head { min-height: 76px; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-soft); }
h2 { margin: 5px 0 0; font-size: 16px; letter-spacing: -.01em; font-weight: 520; }
.live-badge { color: #80dfbc; background: rgba(49,196,141,.08); border: 1px solid rgba(49,196,141,.18); border-radius: 999px; padding: 5px 8px; font: 550 9px ui-monospace, monospace; letter-spacing: .12em; }

.map-panel { min-height: 510px; }
.map-actions { display: flex; align-items: center; gap: 7px; }
.map-action { height: 29px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); border-radius: 6px; padding: 0 9px; background: rgba(255,255,255,.025); color: var(--muted); font: 500 10px ui-sans-serif, system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.map-action:hover { color: var(--text-2); background: rgba(255,255,255,.045); }
.map-action.active { color: #aaa9ff; border-color: rgba(113,112,255,.26); background: rgba(113,112,255,.08); }
.follow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.map-action.active .follow-dot { background: var(--accent); box-shadow: 0 0 9px rgba(113,112,255,.7); }
.map-wrap { height: 395px; position: relative; background: radial-gradient(circle at center, rgba(113,112,255,.05), transparent 52%), #0b0c0e; }
.native-map-wrap { background: #08090a; }
#native-map { width: 100%; height: 100%; display: block; border: 0; background: #08090a; }
.map-corner { position: absolute; right: 10px; top: 10px; padding: 5px 7px; border: 1px solid rgba(255,255,255,.08); border-radius: 5px; background: rgba(8,9,10,.75); backdrop-filter: blur(8px); color: #777d86; font-size: 9px; pointer-events: none; }
.map-caption { height: 38px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; color: var(--dim); font-size: 10px; border-top: 1px solid var(--border-soft); }

.timeline-panel { min-height: 510px; }
.timeline { height: 433px; overflow-y: auto; padding: 8px 16px 18px; scrollbar-color: #333 transparent; }
.timeline-row { display: flex; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--border-soft); }
.timeline-icon { width: 26px; height: 26px; flex: 0 0 26px; border: 1px solid var(--border); border-radius: 7px; display: grid; place-items: center; color: var(--muted); background: rgba(255,255,255,.025); font-size: 11px; }
.kind-level .timeline-icon { color: #aaa9ff; background: var(--accent-soft); border-color: rgba(113,112,255,.25); }
.kind-combat .timeline-icon { color: var(--amber); }
.kind-life .timeline-icon { color: var(--danger); }
.kind-inventory .timeline-icon { color: #f2d57e; }
.timeline-copy { min-width: 0; }
.timeline-text { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.timeline-time { margin-top: 4px; color: var(--dim); font-size: 9px; }
.empty-state { color: var(--dim); font-size: 12px; padding: 24px 4px; }

.skills-panel, .loadout-panel, .messages-panel, .nearby-panel { min-height: 340px; }
.skills-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 10px 14px 16px; }
.skill-row { min-height: 51px; display: grid; grid-template-columns: minmax(0, 1fr) auto 32px; align-items: center; gap: 8px; padding: 0 9px; border-bottom: 1px solid var(--border-soft); }
.skill-name { color: var(--text-2); font-size: 12px; }
.skill-xp { color: var(--dim); font-size: 9px; }
.skill-level { color: var(--text); font-size: 16px; font-weight: 520; text-align: right; }
.slot-count { color: var(--muted); font: 10px ui-monospace, monospace; }
.subsection-label { padding: 16px 20px 8px; color: var(--dim); }
.inventory-label { padding-top: 19px; }
.item-list { padding: 0 18px; display: flex; flex-wrap: wrap; gap: 7px; }
.item-chip { min-height: 34px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-soft); border-radius: 7px; background: rgba(255,255,255,.023); padding: 5px 9px 5px 6px; }
.item-chip.equipped { border-color: rgba(113,112,255,.2); background: rgba(113,112,255,.06); }
.item-gem { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; background: rgba(255,255,255,.06); color: var(--muted); font: 550 9px ui-monospace, monospace; }
.item-chip.equipped .item-gem { color: #aaa9ff; background: rgba(113,112,255,.13); }
.item-name { color: var(--text-2); font-size: 11px; }
.item-count { color: var(--muted); font-size: 9px; }
.muted { color: var(--dim); font-size: 11px; }

.messages { padding: 5px 18px 16px; max-height: 260px; overflow-y: auto; }
.message-row { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 11px; line-height: 1.45; }
.message-source { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-source.player-message { color: var(--cyan); }
.message-text { color: var(--text-2); }
.dialog-card { margin: 14px 18px 5px; padding: 13px 14px; border: 1px solid rgba(113,112,255,.2); border-radius: 8px; background: rgba(113,112,255,.065); }
.dialog-card.hidden { display: none; }
.dialog-label { color: #aaa9ff; font: 550 9px ui-monospace, monospace; letter-spacing: .1em; }
.dialog-text { margin-top: 7px; color: var(--text-2); font-size: 12px; line-height: 1.5; }
.dialog-options { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.dialog-option { padding: 4px 7px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); font-size: 10px; }
.nearby-columns { display: grid; grid-template-columns: 1fr 1fr; padding: 0 10px 14px; }
.nearby-columns > div + div { border-left: 1px solid var(--border-soft); }
.nearby-row { min-height: 35px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 10px; border-bottom: 1px solid var(--border-soft); }
.nearby-name { color: var(--text-2); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearby-multiple { color: var(--dim); font-size: 9px; }
.nearby-detail { flex: 0 0 auto; color: var(--dim); font-size: 9px; }
.nearby-list .muted { display: block; padding: 10px; }

footer { min-height: 72px; padding: 26px 4px 0; display: flex; justify-content: space-between; color: var(--dim); font-size: 10px; }

@media (max-width: 1050px) {
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .metric-card:nth-child(2) { border-right: 0; }
    .metric-card:nth-child(-n+2) { border-bottom: 1px solid var(--border-soft); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .skills-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 680px) {
    .topbar { padding: 0 16px; }
    .brand-subtitle, .divider, #state-age { display: none; }
    .shell { width: min(100% - 24px, 1480px); padding-top: 42px; }
    .hero { display: block; }
    .hero-location { margin-top: 28px; padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--border); }
    .metrics { grid-template-columns: 1fr 1fr; }
    .metric-card { padding: 18px; min-height: 124px; }
    .metric-value { font-size: 32px; }
    .vitals-card { grid-column: 1 / -1; }
    .map-panel, .timeline-panel { min-height: 450px; }
    .map-wrap { height: 330px; }
    .timeline { height: 373px; }
    .map-actions .map-action:last-child { display: none; }
    .map-action { padding: 0 8px; }
    .skills-grid { grid-template-columns: 1fr 1fr; }
    .skill-row { grid-template-columns: minmax(0, 1fr) 30px; }
    .skill-xp { display: none; }
    .nearby-columns { grid-template-columns: 1fr; }
    .nearby-columns > div + div { border-left: 0; margin-top: 12px; }
    footer { display: block; line-height: 2; }
}
