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

:root {
  color-scheme: dark;
  --bg: #050b12;
  --panel: rgba(10, 22, 34, .9);
  --panel-2: rgba(15, 31, 47, .92);
  --line: #1d425a;
  --line-bright: #28688a;
  --text: #e8f4fb;
  --muted: #88a4b7;
  --cyan: #12d5f4;
  --green: #44ed8b;
  --amber: #ffb631;
  --red: #ff5c69;
  --blue: #4ea1ff;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Outfit, system-ui, sans-serif;
  background:
    linear-gradient(rgba(8, 28, 43, .42) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 28, 43, .42) 1px, transparent 1px),
    radial-gradient(circle at 78% -10%, rgba(18, 213, 244, .12), transparent 34%),
    #050b12;
  background-size: 38px 38px, 38px 38px, auto;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { width: min(1700px, 100%); margin: 0 auto; padding: 18px; }
.topbar {
  min-height: 70px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(5, 13, 22, .94); box-shadow: 0 18px 55px rgba(0,0,0,.28);
}
.brand { color: var(--text); display: flex; align-items: center; gap: 13px; text-decoration: none; font-weight: 800; letter-spacing: .08em; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.topbar-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font: 600 12px JetBrains Mono, monospace; }
.version { border-right: 1px solid var(--line); padding-right: 12px; }
.live-pill, .read-only-pill { display: inline-flex; align-items: center; gap: 7px; color: var(--green); border: 1px solid rgba(68,237,139,.35); background: rgba(68,237,139,.08); border-radius: 999px; padding: 7px 10px; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }

.panel { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); }
.hero { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: clamp(22px, 3vw, 42px); overflow: hidden; position: relative; }
.hero::after { content: ""; position: absolute; right: -90px; top: -160px; width: 420px; height: 420px; border: 1px solid rgba(18,213,244,.18); border-radius: 50%; box-shadow: 0 0 90px rgba(18,213,244,.08) inset; pointer-events: none; }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font: 700 11px JetBrains Mono, monospace; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 900px; margin-bottom: 10px; font-size: clamp(29px, 4vw, 54px); line-height: 1.04; letter-spacing: -.035em; }
h1 em { color: var(--green); font-style: normal; }
.hero-copy { max-width: 800px; color: var(--muted); font-size: 17px; margin-bottom: 0; }
.hero-actions { z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.button {
  display: inline-flex; justify-content: center; align-items: center; min-height: 42px; padding: 0 16px;
  color: var(--text); background: #102538; border: 1px solid #2d5872; border-radius: 9px;
  font-weight: 700; text-decoration: none; cursor: pointer; transition: .16s ease;
}
.button:hover { border-color: var(--cyan); transform: translateY(-1px); }
.button.primary { color: #001016; background: var(--cyan); border-color: var(--cyan); }
.button.green { color: #00150a; background: var(--green); border-color: var(--green); }
.button.small { min-height: 36px; padding: 0 12px; font-size: 13px; }

.view-tabs { display: flex; gap: 8px; align-items: center; margin: 14px 0; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5,13,22,.9); overflow-x: auto; }
.tab { white-space: nowrap; color: var(--muted); background: transparent; border: 0; border-radius: 8px; padding: 11px 14px; font-weight: 700; cursor: pointer; }
.tab:hover, .tab.active { color: var(--text); background: #12314a; box-shadow: inset 0 -2px var(--cyan); }
.read-only-pill { margin-left: auto; color: var(--amber); border-color: rgba(255,182,49,.28); background: rgba(255,182,49,.08); font-size: 10px; white-space: nowrap; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-card { min-height: 98px; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, rgba(16,38,56,.94), rgba(7,17,28,.94)); }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin-top: 5px; font: 700 30px JetBrains Mono, monospace; }
.stat-card.green strong { color: var(--green); }
.stat-card.cyan strong { color: var(--cyan); }
.stat-card.amber strong { color: var(--amber); }

.view-section { display: none; min-height: 520px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(6,15,24,.92); }
.view-section.active { display: block; }
.section-head { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 18px; }
.section-head h2 { margin-bottom: 0; font-size: 27px; }
.filters { display: flex; align-items: end; gap: 10px; }
.filters label { display: grid; gap: 5px; color: var(--muted); font: 600 10px JetBrains Mono, monospace; text-transform: uppercase; letter-spacing: .08em; }
input, select { min-height: 40px; min-width: 155px; color: var(--text); background: #081723; border: 1px solid #28506a; border-radius: 8px; padding: 0 11px; outline: 0; }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(18,213,244,.1); }
.search-field input { min-width: 270px; }

.notice { margin-bottom: 14px; padding: 12px 14px; color: var(--amber); background: rgba(255,182,49,.08); border: 1px solid rgba(255,182,49,.33); border-radius: 10px; }
.character-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(355px, 1fr)); gap: 12px; }
.character-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(155deg, rgba(16,36,53,.96), rgba(6,15,24,.96)); box-shadow: 0 16px 42px rgba(0,0,0,.22); }
.character-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--state-color, var(--muted)); }
.character-card[data-state="on_server"] { --state-color: var(--green); }
.character-card[data-state="uploaded"] { --state-color: var(--cyan); }
.character-card[data-state="conflict"] { --state-color: var(--amber); }
.card-head { display: flex; justify-content: space-between; gap: 12px; padding: 17px 17px 12px 20px; border-bottom: 1px solid rgba(45,88,114,.45); }
.character-title { font-size: 22px; margin-bottom: 4px; }
.player-line { color: var(--muted); font-size: 13px; }
.platform-badge { display: inline-flex; margin-left: 7px; padding: 3px 7px; border: 1px solid currentColor; border-radius: 999px; font: 700 9px JetBrains Mono, monospace; text-transform: uppercase; vertical-align: 1px; }
.platform-badge.ps5 { color: #72a8ff; background: rgba(44,91,255,.13); }
.platform-badge.steam { color: #66c0f4; background: rgba(27,73,101,.32); }
.platform-badge.epic { color: #f2f2f2; background: rgba(255,255,255,.08); }
.platform-badge.xbox { color: #76d34f; background: rgba(82,170,40,.13); }
.platform-badge.unknown { color: var(--muted); background: rgba(136,164,183,.08); }
.platform-evidence { margin: -4px 0 12px; color: var(--muted); font: 500 10px JetBrains Mono, monospace; }
.location-pill { align-self: start; max-width: 180px; padding: 7px 10px; border: 1px solid currentColor; border-radius: 999px; color: var(--state-color); background: rgba(0,0,0,.25); font: 700 10px JetBrains Mono, monospace; text-align: center; text-transform: uppercase; }
.card-body { padding: 15px 17px 17px 20px; }
.join-callout { margin-bottom: 12px; padding: 12px; border: 1px solid rgba(68,237,139,.24); background: rgba(68,237,139,.07); border-radius: 9px; }
.join-callout small { display: block; color: var(--muted); text-transform: uppercase; font: 700 9px JetBrains Mono, monospace; letter-spacing: .12em; }
.join-callout strong { display: block; color: var(--green); margin-top: 3px; font-size: 18px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-bottom: 13px; }
.meta-item span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.meta-item b { display: block; margin-top: 2px; font: 600 12px JetBrains Mono, monospace; overflow-wrap: anywhere; }
.card-actions { display: flex; gap: 8px; }
.card-actions .button { flex: 1; }
.evidence-line { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.attention { color: var(--amber); }

.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.map-card { padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2); }
.map-card h3 { margin-bottom: 4px; }
.map-card .map-server { color: var(--cyan); font: 600 12px JetBrains Mono, monospace; }
.map-card strong { display: block; color: var(--green); font: 700 32px JetBrains Mono, monospace; margin: 18px 0 4px; }
.map-card p { color: var(--muted); margin-bottom: 0; font-size: 12px; overflow-wrap: anywhere; }
.path-status { display: inline-flex; margin-top: 9px; padding: 4px 7px; border: 1px solid currentColor; border-radius: 999px; font: 700 9px JetBrains Mono, monospace; }
.path-status.visible { color: var(--green); }
.path-status.missing { color: var(--red); }
.map-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.source-status, .server-status { display: inline-flex; margin-top: 9px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 700 9px JetBrains Mono, monospace; text-transform: uppercase; }
.server-status.online { color: var(--green); border-color: currentColor; }
.server-status.offline { color: var(--amber); border-color: currentColor; }
.scan-diagnostic-panel { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: rgba(9,21,33,.95); }
.scan-diagnostic-panel h3 { margin-bottom: 7px; }
.scan-diagnostic-panel p { color: var(--amber); }
.diagnostic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 13px 0; }
.diagnostic-grid div { padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.diagnostic-grid span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.diagnostic-grid code { display: block; margin-top: 5px; overflow-wrap: anywhere; }
.scan-diagnostic-panel pre { max-height: 220px; overflow: auto; padding: 12px; color: var(--text); background: #030910; border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; }
.empty-state { min-height: 260px; place-content: center; text-align: center; color: var(--muted); }
.empty-state[hidden] { display: none; }
.empty-state:not([hidden]) { display: grid; }
.empty-state strong { color: var(--text); font-size: 22px; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 14px 4px 2px; color: var(--muted); font: 11px JetBrains Mono, monospace; }
.modal { width: min(760px, calc(100vw - 28px)); max-height: calc(100vh - 28px); padding: 0; color: var(--text); background: #08131f; border: 1px solid var(--line-bright); border-radius: 16px; box-shadow: 0 30px 100px rgba(0,0,0,.65); }
.modal::backdrop { background: rgba(0,5,10,.76); backdrop-filter: blur(4px); }
.modal-close { position: absolute; top: 11px; right: 13px; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: #102538; font-size: 24px; cursor: pointer; }
.modal-content { padding: 26px; }
.modal-content h2 { padding-right: 42px; }
.modal-state { color: var(--cyan); font: 700 12px JetBrains Mono, monospace; text-transform: uppercase; }
.location-list { display: grid; gap: 9px; margin: 18px 0; }
.location-row { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #0d1e2d; }
.location-row strong { color: var(--green); }
.location-row code { display: block; color: var(--muted); margin-top: 5px; font-size: 10px; overflow-wrap: anywhere; }
.steps { counter-reset: step; display: grid; gap: 10px; margin: 18px 0; }
.step { position: relative; min-height: 48px; padding: 12px 12px 12px 50px; border: 1px solid var(--line); border-radius: 10px; background: #0d1e2d; }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 13px; top: 11px; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: #001016; background: var(--cyan); font: 800 12px JetBrains Mono, monospace; }
.safety-box { padding: 12px; color: var(--amber); border: 1px solid rgba(255,182,49,.35); border-radius: 10px; background: rgba(255,182,49,.08); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.toast { position: fixed; z-index: 20; right: 20px; bottom: 20px; max-width: 420px; padding: 13px 16px; color: var(--text); background: #102b3f; border: 1px solid var(--cyan); border-radius: 10px; transform: translateY(90px); opacity: 0; transition: .2s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.skeleton { min-height: 260px; border-radius: 14px; background: linear-gradient(100deg, #0a1723 30%, #102a3d 50%, #0a1723 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -100% 0; } }

@media (max-width: 950px) {
  .hero, .section-head { align-items: stretch; flex-direction: column; }
  .hero-actions { justify-content: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-wrap: wrap; }
  .search-field, .search-field input { width: 100%; }
  .topbar-meta .version { display: none; }
  .diagnostic-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .app-shell { padding: 8px; }
  .brand span { font-size: 13px; }
  .topbar-meta #clock { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .character-grid { grid-template-columns: 1fr; }
  .character-card .card-head { flex-direction: column; }
  .location-pill { max-width: none; }
  .filters label, .filters select { width: 100%; }
  footer { flex-direction: column; }
}

/* Find Character Link */
.find-char-link { text-decoration: none; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; color: #fff !important; margin-left: auto; }
.find-char-link:hover { opacity: 0.9; transform: translateY(-1px); }
