:root {
  --bg-dark: #11100e;
  --bg-panel: #191714;
  --bg-card: #221f1a;
  --border-gold: #bc9a58;
  --border-dim: #463c2b;
  --text-main: #f4efe3;
  --text-muted: #b6aa94;
  --gold: #f6ce68;
  --green: #7cf692;
  --red: #ff6c5c;
  --rebel: #d64541;
  --wood: #d8b282;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: radial-gradient(circle at 50% 0%, #242118 0%, var(--bg-dark) 55%);
  color: var(--text-main);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* TOP CUTOFF ANNOUNCEMENT BAR */
.cutoff-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(90deg, #241910 0%, #342112 50%, #241910 100%);
  border-bottom: 2px solid var(--border-gold);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}

.cutoff-bar.is-closed {
  background: linear-gradient(90deg, #2f1210 0%, #441714 50%, #2f1210 100%);
  border-bottom-color: #e85549;
}

.cutoff-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 9px 14px;
}

.cutoff-status-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  flex-shrink: 0;
}

.cutoff-bar.is-closed .status-dot {
  background: #ffbe55;
  box-shadow: 0 0 8px #ffbe55;
}

.cutoff-timer {
  margin-left: auto;
  background: rgba(14, 12, 10, 0.72);
  border: 1px solid rgba(246, 206, 104, 0.5);
  color: var(--gold);
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

.cutoff-desc {
  margin-top: 3px;
  font-size: 0.78rem;
  color: #dfd4be;
}

/* MAIN LAYOUT */
.shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 14px 12px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* HERO HEADER */
.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

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

.brand-crest {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--border-gold);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  object-fit: cover;
}

.brand-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.header-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--border-dim);
  background: var(--bg-panel);
}

.pill-danger {
  background: rgba(96, 20, 18, 0.85);
  border-color: #e85549;
  color: #ffd0ca;
}

.pill-gold {
  background: rgba(46, 36, 18, 0.9);
  border-color: var(--border-gold);
  color: var(--gold);
}

.pill-green {
  background: rgba(20, 54, 28, 0.9);
  border-color: #62d679;
  color: var(--green);
}

/* EXACT VIDEO RPG HUD BAR */
.rpg-hud {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(18, 16, 14, 0.95);
  border: 2px solid var(--border-gold);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.hud-cell {
  padding: 9px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.hud-cell + .hud-cell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 1px;
  background: rgba(188, 154, 88, 0.35);
}

.hud-lbl {
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  color: #c2b69e;
  font-weight: 600;
}

.hud-val {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.val-gold { color: var(--gold); }
.val-green { color: var(--green); }
.val-wood { color: var(--wood); }
.val-red { color: var(--red); }

/* CARDS */
.card {
  background: var(--bg-panel);
  border: 1.5px solid var(--border-dim);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.section-head h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  color: var(--gold);
}

.wib-clock, .founder-counter, .meta-muted {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.founder-counter {
  color: var(--gold);
  font-weight: 700;
}

/* INTERACTIVE MAP SECTION */
.map-section {
  padding: 10px;
  border-color: rgba(188, 154, 88, 0.65);
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.zone-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.zone-btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-dim);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.zone-btn.active, .zone-btn:hover {
  background: #332a1b;
  border-color: var(--border-gold);
  color: var(--gold);
}

.zoom-controls {
  display: flex;
  gap: 5px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-dim);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  border-color: var(--border-gold);
  color: var(--gold);
}

.map-stage {
  position: relative;
  width: 100%;
  height: 410px;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid #3c3424;
  background: #2f3b1e;
  touch-action: none;
  cursor: grab;
}

.map-stage:active {
  cursor: grabbing;
}

#worldCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(16, 14, 12, 0.85);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.9rem;
}

.map-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 14, 12, 0.78);
  border: 1px solid rgba(188, 154, 88, 0.45);
  color: #e5dac4;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  white-space: nowrap;
  pointer-events: none;
}

.selected-toast {
  position: absolute;
  bottom: 38px;
  left: 10px;
  right: 10px;
  max-width: 440px;
  margin: 0 auto;
  background: rgba(20, 18, 15, 0.95);
  border: 2px solid var(--border-gold);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7);
}

.selected-toast-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sel-sprite {
  width: 46px;
  height: 54px;
  object-fit: contain;
  background: rgba(68, 84, 44, 0.45);
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 3px;
}

.sel-meta {
  flex: 1;
  min-width: 0;
}

.sel-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.92rem;
}

.sel-sub {
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.close-toast {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}

.founder-tag {
  font-size: 0.68rem;
  font-weight: 800;
  color: #1c1508;
  background: var(--gold);
  padding: 1px 6px;
  border-radius: 6px;
}

/* PLATFORM MINI BADGES (MATCHING VIDEO BADGE_HELPER.PY!) */
.plat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 17px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  vertical-align: middle;
}

.plat-yt {
  background: #dc2626;
  border: 1px solid rgba(255, 200, 200, 0.65);
}

.plat-ig {
  background: linear-gradient(135deg, #c83282 0%, #e8843c 100%);
  border: 1px solid rgba(252, 204, 112, 0.75);
}

/* SEARCH FINDER */
.search-form {
  display: flex;
  gap: 8px;
}

.search-input {
  flex: 1;
  background: #12100e;
  border: 1.5px solid var(--border-dim);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--border-gold);
}

.btn-primary {
  background: linear-gradient(180deg, #d7af5e 0%, #a57f36 100%);
  color: #161108;
  border: none;
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.search-feedback {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  border: 1px solid var(--border-dim);
  background: var(--bg-card);
}

.search-feedback.found {
  border-color: #62d679;
  background: rgba(20, 48, 26, 0.6);
}

.search-feedback.missing {
  border-color: #d9822b;
  background: rgba(58, 34, 14, 0.55);
}

/* CITIZEN DIRECTORY */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.filter-chip {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-dim);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-chip.active {
  background: #332a1b;
  border-color: var(--border-gold);
  color: var(--gold);
}

.role-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.role-pill {
  font-size: 0.73rem;
  background: #141210;
  border: 1px solid #352e22;
  border-radius: 8px;
  padding: 4px 8px;
  color: #d8ccb4;
}

.citizen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 8px;
}

.citizen-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-dim);
  border-radius: 12px;
  padding: 9px 10px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
  text-align: left;
  color: inherit;
  width: 100%;
}

.citizen-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-1px);
}

.citizen-card.is-rebel {
  border-color: rgba(214, 69, 65, 0.7);
  background: rgba(52, 18, 18, 0.7);
}

.citizen-card.is-founder {
  border-color: rgba(246, 206, 104, 0.75);
}

.citizen-thumb {
  width: 42px;
  height: 50px;
  object-fit: contain;
  background: rgba(68, 84, 44, 0.42);
  border-radius: 8px;
  padding: 2px;
  flex-shrink: 0;
}

.citizen-info {
  flex: 1;
  min-width: 0;
}

.citizen-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.citizen-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.locate-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(188, 154, 88, 0.15);
  border: 1px solid rgba(188, 154, 88, 0.4);
  padding: 3px 7px;
  border-radius: 7px;
}

/* RULES & ROLE SHOWCASE */
.rule-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.rule-box {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.81rem;
  color: #dfd4be;
}

.rule-box strong {
  display: block;
  color: var(--gold);
  margin-bottom: 3px;
  font-size: 0.86rem;
}

.rule-box-warn {
  border-color: rgba(232, 85, 73, 0.65);
  background: rgba(54, 20, 16, 0.45);
}

.roles-showcase {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.role-item {
  background: #25211b;
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 8px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.role-item img {
  width: 52px;
  height: 62px;
  object-fit: contain;
}

.role-item strong {
  font-size: 0.76rem;
  color: var(--text-main);
}

.role-item span {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.role-item.role-rebel {
  border-color: rgba(214, 69, 65, 0.75);
  background: rgba(56, 16, 18, 0.55);
}

.role-item.role-rebel strong {
  color: #ff9c94;
}

/* CHRONICLE */
.chronicle-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chronicle-item {
  background: var(--bg-card);
  border-left: 3px solid var(--border-gold);
  border-radius: 0 10px 10px 0;
  padding: 9px 12px;
  font-size: 0.83rem;
}

.chronicle-day {
  font-weight: 800;
  color: var(--gold);
  margin-right: 6px;
}

/* FOOTER */
.site-footer {
  text-align: center;
  padding: 12px 8px 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.footer-note {
  margin-top: 3px;
  font-size: 0.73rem;
  opacity: 0.85;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .roles-showcase {
    grid-template-columns: repeat(3, 1fr);
  }
  .map-stage {
    height: 360px;
  }
  .hud-val {
    font-size: 1.1rem;
  }
}

@media (max-width: 420px) {
  .roles-showcase {
    grid-template-columns: repeat(2, 1fr);
  }
  .brand-title {
    font-size: 1.3rem;
  }
  .cutoff-status-row {
    font-size: 0.78rem;
  }
}
