:root {
  --bg: #0d0f14;
  --bg2: #13161e;
  --bg3: #1a1e28;
  --border: #252a38;
  --border2: #2e3548;
  --accent: #4a9eff;
  --accent2: #7c6aff;
  --survivor: #4a9eff;
  --beast: #ff5a4a;
  --text: #c8d0e0;
  --text2: #7a8499;
  --text3: #4a5060;
  --green: #3a9c5a;
  --yellow: #c4a035;
  --font-head: 'Rajdhani', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

.scanline {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
}

/* ─── HEADER ─── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,15,20,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.logo-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #fff;
  line-height: 1.1;
}

.logo-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text2);
  letter-spacing: 0.15em;
}

.version {
  color: var(--accent);
}

.role-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border2);
  border-radius: 4px;
  overflow: hidden;
}

.role-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  background: transparent;
  border: none;
  color: var(--text2);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.2s;
}

.role-btn:first-child { border-right: 1px solid var(--border2); }

.role-btn.active {
  background: var(--bg3);
  color: #fff;
}

.role-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.survivor-dot { background: var(--survivor); box-shadow: 0 0 6px var(--survivor); }
.beast-dot { background: var(--beast); box-shadow: 0 0 6px var(--beast); }

/* ─── LAYOUT ─── */
main {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 58px);
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.2em;
  padding: 0 16px 8px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

nav#mapNav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.map-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  cursor: pointer;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 0.04em;
  transition: all 0.15s;
  border-left: 2px solid transparent;
  position: relative;
}

.map-nav-item:hover {
  color: var(--text);
  background: var(--bg2);
}

.map-nav-item.active {
  color: var(--accent);
  background: rgba(74,158,255,0.07);
  border-left-color: var(--accent);
}

.map-nav-item .nav-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: auto;
  background: var(--bg3);
  color: var(--text3);
}

.map-nav-item.active .nav-badge {
  background: rgba(74,158,255,0.15);
  color: var(--accent);
}

/* ─── LEGEND ─── */
.legend-panel {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  color: var(--text2);
}

.leg-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.leg-circle.outline {
  background: transparent !important;
}

.leg-pill {
  width: 22px;
  height: 7px;
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0.85;
}

/* ─── MAP AREA ─── */
.map-area {
  flex: 1;
  padding: 20px 24px;
  min-width: 0;
}

.map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.map-name {
  font-family: var(--font-head);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  line-height: 1;
}

.map-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text2);
  margin-top: 5px;
  letter-spacing: 0.05em;
}

.map-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 3px;
  letter-spacing: 0.08em;
}

.badge-s { background: rgba(74,158,255,0.1); color: var(--survivor); border: 1px solid rgba(74,158,255,0.25); }
.badge-b { background: rgba(255,90,74,0.1); color: var(--beast); border: 1px solid rgba(255,90,74,0.25); }
.badge-n { background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }

/* ─── MAP VIEWER ─── */
.map-viewer {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-placeholder {
  text-align: center;
  color: var(--text3);
}

.placeholder-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.3;
}

.map-placeholder p {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
}

.map-img-wrap {
  width: 100%;
  position: relative;
  overflow: auto;
  cursor: zoom-in;
}

.map-img-wrap.zoomed {
  cursor: zoom-out;
}

.map-img-wrap img {
  width: 100%;
  display: block;
  transition: transform 0.25s ease;
  transform-origin: top left;
}

.map-img-wrap.zoomed img {
  width: auto;
  max-width: none;
}

.zoom-hint {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  background: rgba(13,15,20,0.8);
  padding: 4px 8px;
  border-radius: 3px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

/* ─── FLOOR TABS ─── */
.floor-tabs {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.floor-tab {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 6px 14px;
  border: 1px solid var(--border2);
  border-radius: 3px;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
}

.floor-tab:hover { color: var(--text); background: var(--bg3); }
.floor-tab.active { background: rgba(74,158,255,0.1); color: var(--accent); border-color: rgba(74,158,255,0.3); }

/* ─── TIPS ─── */
.tips-section {
  margin-top: 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.tips-header {
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0;
}

.tip-card {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.tip-card:last-child { border-right: none; }

.tip-card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tip-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tip-card-text {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  main { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  nav#mapNav { flex-direction: row; flex-wrap: wrap; padding: 0 8px; gap: 4px; }
  .map-nav-item { border-left: none; border-bottom: 2px solid transparent; padding: 7px 10px; font-size: 12px; }
  .map-nav-item.active { border-left: none; border-bottom-color: var(--accent); }
  .legend-panel { flex-direction: row; flex-wrap: wrap; gap: 8px 16px; }
  .map-area { padding: 14px 12px; }
  .tips-grid { grid-template-columns: 1fr; }
  .tip-card { border-right: none; }
}
