:root {
  --bg: #060a12;
  --bg2: #0a1424;
  --navy: #081426;
  --navy2: #0f2340;
  --card: rgba(255, 255, 255, 0.075);
  --card2: rgba(255, 255, 255, 0.12);
  --text: #f3f7ff;
  --muted: #a8b8d1;
  --line: rgba(255, 255, 255, 0.14);
  --accent: #d7b45d;
  --accent2: #ffda7a;
  --blue: #4c8cff;
  --purple: #b05cff;
  --red: #ff4f5f;
  --green: #58e58c;
  --shadow: 0 24px 90px rgba(0,0,0,.45);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    linear-gradient(rgba(6,10,18,.86), rgba(6,10,18,.94)),
    radial-gradient(circle at 18% 8%, rgba(31, 83, 150, .42) 0, transparent 31rem),
    radial-gradient(circle at 85% 20%, rgba(215, 180, 93, .18) 0, transparent 23rem),
    radial-gradient(circle at 60% 115%, rgba(76, 140, 255, .18) 0, transparent 28rem),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
body:before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}
a { color: inherit; text-decoration: none; }
.top-strip {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 7px 16px;
  color: #101522;
  background: linear-gradient(90deg, #c69a3d, #ffe29a, #c69a3d);
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-align: center;
  flex-wrap: wrap;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px min(5vw, 70px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 13, 24, 0.86);
  backdrop-filter: blur(20px);
}
.brand { display: flex; align-items: center; gap: 13px; min-width: max-content; }
.brand img { width: 58px; height: 58px; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(0,0,0,.45)); }
.brand strong { display: block; letter-spacing: .18em; font-size: 20px; }
.brand small { display: block; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.nav { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.nav-toggle { display: none; }
.nav a, .ghost-link, .ghost, .admin-actions button, .admin-sidebar button, .login-card button, .editor-panel button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.055);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: .18s ease;
  font-weight: 850;
  font-size: 14px;
}
.nav a:hover, .nav a.active, .ghost-link:hover, .ghost:hover, .admin-actions button:hover, .admin-sidebar button:hover, .login-card button:hover, .editor-panel button:hover {
  background: rgba(255,255,255,.15);
  border-color: rgba(215,180,93,.55);
  transform: translateY(-1px);
}
.admin-link { color: var(--accent2) !important; }
.app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 78px; }
.hero {
  min-height: 610px;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 42px;
  align-items: center;
  position: relative;
}
.la-grid:after {
  content: "LOS SANTOS";
  position: absolute;
  right: -3vw;
  bottom: 18px;
  color: rgba(255,255,255,.035);
  font-size: clamp(58px, 12vw, 170px);
  font-weight: 1000;
  letter-spacing: -.08em;
  z-index: -1;
}
.eyebrow { color: var(--accent2); letter-spacing: .22em; text-transform: uppercase; font-size: 13px; font-weight: 1000; }
.hero h1 { font-size: clamp(48px, 7vw, 98px); line-height: .9; margin: 12px 0 22px; letter-spacing: -0.075em; text-transform: uppercase; }
.hero p { color: #d3def1; font-size: 18px; line-height: 1.7; max-width: 760px; }
.fiction-pill {
  display: inline-flex;
  margin-top: 10px;
  padding: 10px 13px;
  border: 1px solid rgba(215,180,93,.38);
  background: rgba(215,180,93,.11);
  color: #ffe8a9;
  border-radius: 16px;
  font-weight: 850;
  line-height: 1.35;
}
.hero-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 38px;
  padding: 34px;
  min-height: 450px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.15), rgba(255,255,255,.04)),
    linear-gradient(180deg, rgba(10,26,48,.74), rgba(5,9,17,.82));
  box-shadow: var(--shadow);
}
.hero-card:before {
  content: "";
  position: absolute;
  inset: -90px -100px auto auto;
  width: 290px;
  height: 290px;
  border-radius: 50%;
  background: rgba(215,180,93,.18);
  filter: blur(6px);
}
.hero-card:after {
  content: "PROTECT · SERVE · LEAD";
  position: absolute;
  left: 28px;
  bottom: 24px;
  color: rgba(255,255,255,.08);
  font-weight: 1000;
  letter-spacing: .18em;
}
.hero-card img { width: min(290px, 84%); display: block; margin: 14px auto 22px; filter: drop-shadow(0 28px 34px rgba(0,0,0,.5)); }
.hero-card h2 { text-align: center; margin: 0; font-size: 38px; letter-spacing: .18em; }
.hero-card p { text-align: center; margin: 8px auto 20px; color: var(--muted); font-size: 15px; }
.signal-row { position: absolute; top: 22px; left: 22px; display: flex; gap: 7px; }
.signal-row span { width: 12px; height: 12px; border-radius: 50%; background: rgba(76,140,255,.7); box-shadow: 0 0 26px rgba(76,140,255,.8); }
.signal-row span:nth-child(2) { background: rgba(215,180,93,.85); box-shadow: 0 0 26px rgba(215,180,93,.8); }
.signal-row span:nth-child(3) { background: rgba(255,79,95,.7); box-shadow: 0 0 26px rgba(255,79,95,.7); }
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(76, 140, 255, .35);
  background: rgba(76, 140, 255, .12);
  color: #dce9ff;
  padding: 12px 14px;
  border-radius: 18px;
  line-height: 1.4;
  position: relative;
  z-index: 2;
}
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 8px rgba(88,229,140,.11); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.primary-btn, .secondary-btn {
  display: inline-flex;
  padding: 14px 19px;
  border-radius: 999px;
  font-weight: 1000;
  border: 1px solid var(--line);
}
.primary-btn { background: linear-gradient(135deg, var(--accent2), var(--accent)); color: #0b1322; }
.secondary-btn { background: rgba(255,255,255,.075); }
.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0 0 44px; }
.quick-stats article { border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 24px; padding: 20px; }
.quick-stats span { color: var(--accent2); font-size: 12px; font-weight: 1000; letter-spacing: .14em; text-transform: uppercase; }
.quick-stats strong { display: block; font-size: 22px; margin: 8px 0 4px; }
.quick-stats small { color: var(--muted); }
.section-title { margin: 28px 0 18px; }
.section-title h2 { font-size: clamp(30px, 4vw, 58px); line-height: 1; margin: 0; letter-spacing: -0.055em; text-transform: uppercase; }
.section-title p { color: var(--muted); max-width: 860px; line-height: 1.65; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.card, .rank-card, .division-card, .rule-card, .loading-card, .legal-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255,255,255,.085), rgba(255,255,255,.045));
  border-radius: 26px;
  padding: 23px;
  box-shadow: 0 18px 52px rgba(0,0,0,.22);
}
.card h3, .division-card h3, .rule-card h3, .legal-card h3 { margin: 0 0 10px; font-size: 24px; }
.card p, .division-card p, .rule-card p, .rank-card p, .legal-card p { color: #cbd8ea; line-height: 1.62; }
.badge { display: inline-flex; margin-bottom: 14px; padding: 7px 10px; border-radius: 999px; background: rgba(215,180,93,.12); color: #ffe9a5; border: 1px solid rgba(215,180,93,.28); font-size: 13px; font-weight: 1000; }
.leadership-chief { outline: 1px solid rgba(215,180,93,.44); background: linear-gradient(145deg, rgba(215,180,93,.16), rgba(255,255,255,.06)); }
.intro-list { display: grid; gap: 12px; margin: 18px 0 44px; }
.intro-item { padding: 17px 18px; border-left: 3px solid var(--accent); background: rgba(255,255,255,.06); border-radius: 18px; color: #d8e4f5; line-height: 1.58; }
.rank-list { display: grid; gap: 14px; }
.rank-card { position: relative; overflow: hidden; }
.rank-card:before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--blue); }
.rank-card.leadership:before { background: var(--red); }
.rank-card.higher:before { background: var(--purple); }
.rank-card.special:before { background: var(--accent); }
.rank-head { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.rank-title { margin: 0; font-size: 24px; }
.rank-name { font-weight: 1000; color: var(--blue); }
.rank-card.leadership .rank-name { color: var(--red); }
.rank-card.higher .rank-name { color: var(--purple); }
.rank-card.special .rank-name { color: var(--accent2); }
.limit { color: var(--muted); font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.legend span { padding: 8px 11px; border-radius: 999px; border: 1px solid var(--line); font-weight: 850; }
.legend .leadership { color: var(--red); }
.legend .higher { color: var(--purple); }
.legend .patrol { color: var(--blue); }
.legal-page { max-width: 940px; margin: 0 auto; }
.legal-card { margin-bottom: 14px; }
.legal-card.warning { border-color: rgba(215,180,93,.42); background: rgba(215,180,93,.1); }
.muted { color: var(--muted) !important; }
.footer { border-top: 1px solid var(--line); padding: 24px min(5vw, 70px); color: var(--muted); display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: rgba(5,9,17,.72); }
.footer strong { display: block; color: var(--text); margin-bottom: 4px; }
.footer-links { display: flex; gap: 12px; flex-wrap: wrap; }
.footer-links a { color: #dbe7ff; }
.login-page { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); border: 1px solid var(--line); background: rgba(255,255,255,.08); border-radius: 28px; padding: 30px; box-shadow: var(--shadow); }
.login-logo { width: 160px; display: block; margin: 0 auto 14px; }
.login-card h1 { margin: 0; }
.login-card p { color: var(--muted); }
.login-card form, .field-grid { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #d9e5f4; font-weight: 850; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 16px;
  padding: 12px 13px;
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
select option { color: #111; }
.form-status { min-height: 24px; margin-top: 12px; color: #ffe9a5; font-weight: 850; }
.back-link { display: inline-block; margin-top: 14px; color: var(--muted); }
.admin-page { background: #0a1020; }
.admin-topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: rgba(8,17,31,.92); position: sticky; top: 0; z-index: 20; }
.admin-brand { display: flex; align-items: center; gap: 10px; font-weight: 1000; }
.admin-brand img { width: 48px; height: 48px; object-fit: contain; }
.admin-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.autosave { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; color: var(--muted); }
.autosave input { width: auto; }
.admin-layout { display: grid; grid-template-columns: 275px 1fr; min-height: calc(100vh - 72px); }
.admin-sidebar { border-right: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 10px; background: rgba(255,255,255,.035); }
.admin-sidebar button { border-radius: 16px; text-align: left; }
.admin-sidebar button.active { background: rgba(215,180,93,.16); border-color: rgba(215,180,93,.34); }
.user-box { margin-top: auto; color: var(--muted); line-height: 1.45; font-size: 13px; border-top: 1px solid var(--line); padding-top: 14px; }
.editor-panel { padding: 22px; max-width: 1100px; width: 100%; }
.editor-header { margin-bottom: 18px; }
.editor-header h1 { margin: 0 0 8px; font-size: 34px; }
.editor-header p { color: var(--muted); margin: 0; }
.editor-card { border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 24px; padding: 18px; margin-bottom: 14px; }
.editor-card h3 { margin: 0 0 14px; }
.editor-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor-row.three { grid-template-columns: 1fr 1fr 1fr; }
.item-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.danger { color: #ffadb5 !important; border-color: rgba(255,79,95,.35) !important; }
.add-btn { margin: 10px 0 24px; }
.json-editor { min-height: 540px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.sticky-status { position: sticky; bottom: 16px; background: rgba(8,17,31,.92); padding: 10px 14px; border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(10px); }
@media (max-width: 1040px) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .nav { justify-content: flex-start; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 20px; }
  .quick-stats, .grid, .grid.two { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; overflow: auto; }
  .user-box { display: none; }
  .editor-row, .editor-row.three { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .top-strip { font-size: 9px; }
  .site-header { padding: 12px 16px; }
  .nav-toggle { display: inline-flex; align-self: flex-end; margin-top: -55px; border: 1px solid var(--line); background: rgba(255,255,255,.08); color: var(--text); border-radius: 14px; padding: 9px 12px; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; }
  .nav.open { display: flex; }
  .nav a { width: 100%; text-align: center; }
  .app-shell { width: min(100% - 22px, 1180px); padding-top: 26px; }
  .hero h1 { font-size: clamp(40px, 14vw, 70px); }
}

/* Admin rank sorting */
.editor-help {
  border: 1px dashed rgba(215,180,93,.42);
  background: rgba(215,180,93,.08);
  border-radius: 18px;
  padding: 12px 14px;
  margin: 0 0 14px;
  color: var(--muted);
}

.rank-card {
  transition: transform .16s ease, border-color .16s ease, background .16s ease, opacity .16s ease;
}

.rank-card.dragging {
  opacity: .55;
  transform: scale(.99);
}

.rank-card.drag-over {
  border-color: rgba(215,180,93,.85);
  background: rgba(215,180,93,.12);
}

.rank-card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.drag-handle {
  cursor: grab;
  user-select: none;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  color: var(--accent2);
}

.drag-handle:active {
  cursor: grabbing;
}

.rank-position {
  color: var(--muted);
  font-size: .92rem;
  font-weight: 800;
}

.rank-move-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rank-move-buttons button:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.rank-jump-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 850;
}

.rank-jump-label select {
  width: auto;
  min-width: 128px;
  padding: 8px 10px;
  border-radius: 999px;
}
