:root {
  --bg: #07101c;
  --bg-2: #0c1626;
  --panel: rgba(12, 20, 34, 0.92);
  --panel-solid: #101a2b;
  --line: rgba(232, 214, 160, 0.14);
  --text: #e7eef8;
  --muted: #93a0b4;
  --gold: #e8c56b;
  --gold-2: #f3e2a8;
  --yellow: #ffe14a;
  --grey-dot: #a8b0bd;
  --danger: #e15b64;
  --ok: #7dcea0;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(232, 197, 107, 0.08), transparent 55%),
    var(--bg);
  font-family: var(--sans);
  font-weight: 400;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; color: inherit; }
img { max-width: 100%; display: block; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 68px;
  padding: 0 22px;
  background: rgba(7, 16, 28, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.brand strong { display: block; letter-spacing: 0.16em; font-size: 14px; }
.brand small { display: block; color: var(--muted); letter-spacing: 0.08em; font-size: 10px; text-transform: uppercase; }
.main-nav { display: flex; gap: 18px; margin: 0 auto; }
.main-nav a {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.main-nav a.is-active, .main-nav a:hover { color: var(--gold); }
.top-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn, .lang-pill, .rev-menu-btn, .btn, .chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  border-radius: 999px;
}
.icon-btn, .lang-pill {
  width: 36px; height: 36px; display: grid; place-items: center;
  color: var(--gold-2); font-size: 14px;
}
.rev-menu { position: relative; }
.rev-menu-btn {
  height: 36px; padding: 0 14px; cursor: pointer; color: var(--gold);
  letter-spacing: 0.04em;
}
.rev-menu-panel {
  position: absolute; right: 0; top: 46px; width: 320px;
  max-height: 70vh; overflow: auto;
  background: #0e1828; border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 8px;
}
.rev-menu-panel h4 {
  margin: 10px 10px 6px; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--gold);
}
.rev-menu-panel button {
  width: 100%; text-align: left; background: transparent; border: 0;
  color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.rev-menu-panel button small { color: var(--muted); display: block; }
.rev-menu-panel button:hover { background: rgba(232, 197, 107, 0.08); }

.explore {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr) 300px;
  gap: 16px;
  padding: 18px 18px 8px;
  min-height: calc(100vh - 68px);
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.intro { padding: 22px 20px 16px; align-self: start; }
.kicker {
  color: var(--gold); letter-spacing: 0.2em; font-size: 11px; margin: 0 0 8px;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
.intro h1 { font-size: 46px; line-height: 0.92; letter-spacing: -0.02em; }
.intro .sub { color: var(--gold-2); margin: 10px 0 8px; font-size: 16px; }
.lede { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { padding: 10px; border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); }
.stat b { display: block; font-family: var(--serif); font-size: 26px; color: var(--gold-2); }
.stat span { color: var(--muted); font-size: 12px; }
.search-row, .admin-search { display: flex; gap: 8px; }
.search-row input, .filters select, .admin-form input, .admin-form select, .admin-form textarea, .admin-search input {
  width: 100%; background: #0b1422; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; outline: none;
}
.search-row button, .btn {
  cursor: pointer; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: linear-gradient(180deg, #3a3120, #241c10); color: var(--gold-2);
}
.btn.primary { background: linear-gradient(180deg, #f0d48a, #c6a15a); color: #1a1408; border-color: transparent; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: #ffd0d3; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.filters label, .field label { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.filter-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.linkish { background: none; border: 0; color: var(--gold); cursor: pointer; padding: 0; }

.map-wrap {
  position: relative;
  height: 540px;
  max-height: 64vh;
  min-height: 420px;
  overflow: hidden;
  z-index: 1;
}
#leaflet {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #0b1522;
  touch-action: none;
}
.leaflet-container {
  font-family: var(--sans);
  background: #0b1522;
  width: 100% !important;
  height: 100% !important;
}
.map-legend, .map-scale-note, .district-card, .detail-card {
  position: absolute; z-index: 5; background: rgba(8, 14, 24, 0.88);
  border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px);
}
.map-legend { top: 14px; left: 14px; padding: 12px 14px; width: 210px; }
.map-legend strong { display: block; margin-bottom: 8px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 4px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.yellow { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.dot.grey { background: var(--grey-dot); }
.map-tools { position: absolute; z-index: 5; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 6px; }
.map-tools button {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(8,14,24,0.88); color: var(--text); cursor: pointer;
}
.map-count {
  position: absolute; z-index: 5; left: 14px; bottom: 14px;
  background: rgba(8,14,24,0.88); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 12px; font-size: 13px;
}
.map-count b { color: var(--gold); }

/* DOT SIZE: change width and height together.
   3px = tiny, 5px = small, 8px = larger. Glow is the box-shadow line below. */
.pin { width: 3px; height: 3px; border-radius: 50%; position: relative; margin: 0; }
.pin.primary {
  background: #FCD34D;
  box-shadow: 0 0 0 1px rgba(252, 211, 77, 0.35);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.leaflet-marker-icon:hover .pin.primary {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px rgba(252, 211, 77, 0.4);
}
.pin.secondary { background: var(--grey-dot); box-shadow: 0 0 0 5px rgba(168, 176, 189, 0.18); }
.pin.primary::after, .pin.secondary::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid currentColor; opacity: 0;
}
.pin.primary { color: var(--yellow); }
.pin.secondary { color: var(--grey-dot); }
.pin:hover::after, .pin.is-hot::after { animation: pulse 1.4s ease-out infinite; opacity: 1; }
@keyframes pulse {
  from { transform: scale(0.7); opacity: 0.8; }
  to { transform: scale(1.8); opacity: 0; }
}

.detail-card {
  top: 74px; left: 14px; width: min(360px, calc(100% - 28px));
  padding: 14px; display: none;
}
.detail-card.open { display: block; }
.hover-box {
  position: absolute;
  z-index: 8;
  width: 230px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(243, 226, 168, 0.35);
  background: rgba(8, 14, 24, 0.55);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.leaflet-tooltip.dot-dialog,
.leaflet-tooltip.dot-dialog.leaflet-tooltip-top {
  min-width: 0 !important;
  width: 176px !important;
  max-width: 176px !important;
  white-space: normal !important;
  background: #0E3386 !important;
  background-color: #0E3386 !important;
  border: none !important;
  color: #ffffff !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45) !important;
  padding: 0 !important;
}
.leaflet-tooltip-top.dot-dialog::before {
  content: "" !important;
  position: absolute;
  left: calc(50% + var(--arrow-shift, 0px));
  bottom: -6px;
  width: 12px;
  height: 12px;
  margin-left: -6px !important;
  background: #0E3386 !important;
  background-color: #0E3386 !important;
  border: none !important;
  border-right: none !important;
  border-bottom: none !important;
  transform: rotate(45deg);
}
.leaflet-tooltip-bottom.dot-dialog::before {
  content: "" !important;
  position: absolute;
  left: calc(50% + var(--arrow-shift, 0px));
  top: -6px;
  bottom: auto;
  width: 12px;
  height: 12px;
  margin-left: -6px !important;
  background: #0E3386 !important;
  background-color: #0E3386 !important;
  border: none !important;
  transform: rotate(45deg);
}
@keyframes dotPop {
  from { opacity: 0; transform: translateY(8px) scale(0.92); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.spot-card {
  width: 276px;
  max-width: 176px;
  padding: 10px 10px 12px;
  box-sizing: border-box;
  background: #0E3386;
  border-radius: 16px;
}
.spot-top { display: flex; gap: 8px; align-items: center; }
.spot-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; }
.spot-icon svg { width: 34px; height: 34px; }
.spot-card b { display: block; font-size: 14px; font-weight: 700; line-height: 1.15; color: #ffffff; }
.spot-year { display: block; margin-top: 2px; color: #FCD34D; font-size: 12px; font-weight: 600; }
.spot-place { display: flex; align-items: center; gap: 4px; margin-top: 3px; color: #d5dbe3; font-size: 12px; font-weight: 400; }
.spot-card p {
  margin: 8px 0 0; padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12.5px; line-height: 1.4; color: #f3f5f8; font-weight: 400; text-align: left;
}
.hover-box.is-on { opacity: 1; transform: translateY(0) scale(1); }
.hover-box strong { display: block; font-family: var(--serif); font-size: 22px; line-height: 1; }
.hover-box p { margin: 6px 0 0; font-size: 12px; color: #d5deea; line-height: 1.4; }
.detail-card header { display: flex; gap: 12px; align-items: center; }
.detail-card h3 { font-size: 28px; line-height: 1; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; color: var(--muted); margin: 4px 0; }
.detail-card .actions { display: flex; gap: 8px; margin-top: 12px; }
.close-x { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; }

.avatar, .avatar-lg {
  border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(160deg, #3c3422, #182233 60%, #101820);
  color: var(--gold-2); font-weight: 600; letter-spacing: 0.04em;
  border: 1px solid var(--line); overflow: hidden; flex: 0 0 auto;
}
.avatar { width: 54px; height: 54px; }
.avatar-lg { width: 74px; height: 92px; font-size: 22px; }
.avatar img, .avatar-lg img, .hero-photo img { width: 100%; height: 100%; object-fit: cover; }

.side-list { padding: 14px; align-self: start; max-height: 760px; overflow: auto; }
.side-list h2 { font-size: 28px; }
.side-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.case {
  display: grid; grid-template-columns: 54px 1fr; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-bottom: 0;
  width: 100%; text-align: left;
}
.badge { display: inline-block; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: #1a1408; background: var(--gold); border-radius: 999px; padding: 2px 7px; }
.badge.grey { background: #c5ccd6; }

.dash {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.8fr 0.9fr;
  gap: 12px;
  padding: 8px 18px 22px;
}
.card { padding: 16px; }
.card h3 { font-size: 26px; margin-bottom: 4px; }
.timeline-line { position: relative; margin-top: 28px; height: 90px; }
.timeline-line .bar {
  position: absolute; left: 0; right: 0; top: 10px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--danger), var(--gold), transparent);
}
.ticks { display: flex; justify-content: space-between; position: relative; }
.tick { width: 18%; font-size: 12px; color: var(--muted); }
.tick b { display: block; color: var(--gold-2); margin-bottom: 18px; }
.tick i {
  width: 10px; height: 10px; border-radius: 50%; background: var(--gold); display: block; margin-bottom: 8px;
  box-shadow: 0 0 10px var(--gold);
}
.donut-wrap { display: flex; gap: 14px; align-items: center; margin-top: 12px; }
.donut {
  width: 120px; height: 120px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
}
.donut span {
  width: 78px; height: 78px; border-radius: 50%; background: #101a2b;
  display: grid; place-items: center; text-align: center; font-size: 12px; color: var(--muted);
}
.donut strong { display: block; color: var(--text); font-family: var(--serif); font-size: 28px; }
.legend-list { font-size: 13px; color: var(--muted); }
.legend-list div { margin: 6px 0; }
.bars { margin-top: 10px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 36px; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin: 6px 0; }
.bar-row .track { height: 7px; background: #1b2636; border-radius: 99px; overflow: hidden; }
.bar-row .fill { height: 100%; background: linear-gradient(90deg, #f0d48a, #e15b64); }
.feature { display: grid; grid-template-columns: 74px 1fr; gap: 12px; margin-top: 8px; }

.site-footer {
  display: flex; justify-content: space-between; gap: 18px; align-items: center;
  padding: 18px 22px 28px; color: var(--muted); border-top: 1px solid var(--line); font-size: 13px;
}
.site-footer .quote { color: var(--gold-2); font-family: var(--serif); font-size: 18px; }

.page { padding: 28px 22px 50px; max-width: 1180px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 18px; }
.page h1 { font-size: 58px; line-height: 0.9; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.toolbar select, .toolbar input { background: #0b1422; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.profile-card { padding: 14px; display: grid; gap: 8px; min-height: 220px; }
.profile-card:hover { border-color: rgba(232, 197, 107, 0.45); }
.profile-card h3 { font-size: 30px; }

.era-stack { display: grid; gap: 14px; }
.era-block { padding: 16px 18px 8px; }
.era-head h3 { font-size: 32px; color: var(--gold-2); }
.era-list { display: grid; gap: 0; }
.era-person {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(120px, 180px);
  gap: 12px;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.era-person strong { color: var(--gold-2); }
.era-person span { min-width: 0; }
.era-person em { font-style: normal; color: var(--muted); text-align: right; }
.era-person:hover span { color: var(--gold); }
@media (max-width: 720px) {
  .era-person { grid-template-columns: 64px 1fr; }
  .era-person em { grid-column: 2; text-align: left; }
}

.hero-profile { display: grid; grid-template-columns: 280px 1fr; gap: 22px; align-items: start; }
.hero-photo {
  height: 340px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line);
  background: linear-gradient(160deg, #3c3422, #121a28);
  display: grid; place-items: center; font-family: var(--serif); font-size: 72px; color: var(--gold-2);
}
.info-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.info-box div, .prose, .quote-card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stack { display: grid; gap: 12px; margin-top: 16px; }
.prose p { color: #d5deea; line-height: 1.6; }
.related { display: flex; gap: 10px; flex-wrap: wrap; }

.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 8px 18px 60px; }
.admin-nav {
  display: flex; flex-wrap: wrap; gap: 8px;
  max-width: 1100px; margin: 16px auto 0; padding: 0 18px;
}
.admin-nav a {
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px;
  color: var(--gold-2); font-size: 13px; letter-spacing: 0.04em;
}
.admin-nav a:hover { border-color: var(--gold); }
.move-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.admin-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-form .wide { grid-column: 1 / -1; }
#picker { height: 360px; border-radius: 14px; border: 1px solid var(--line); }
.note { color: var(--muted); font-size: 13px; }
.login-box { max-width: 420px; margin: 10vh auto; padding: 24px; }
.flash { background: rgba(125, 206, 160, 0.1); border: 1px solid rgba(125, 206, 160, 0.3); color: var(--ok); padding: 10px 12px; border-radius: 10px; }

.empty { padding: 28px; text-align: center; color: var(--muted); }

@media (max-width: 1100px) {
  .explore, .dash, .hero-profile { grid-template-columns: 1fr; }
  .map-wrap { height: 420px; min-height: 420px; max-height: none; }
  .main-nav { display: none; }
  .intro h1, .page h1 { font-size: 42px; }
  .side-list { max-height: none; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 12px; }
  .brand small { display: none; }
  .stats, .filters, .admin-form, .info-box { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; align-items: flex-start; }
}
