/* Public-site polish layer. Removing the two polish tags from index.html switches it all off.
   Everything is scoped away from #admin so the staff panel is untouched. */
:root { --lg-ease: cubic-bezier(.22, 1, .36, 1); --lg-glass: rgba(9, 16, 30, .68); --lg-line: rgba(148, 190, 225, .16); }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }

/* Scroll progress and top bar */
#lgProgress { position: fixed; inset: 0 auto auto 0; z-index: 2000; width: 100%; height: 2px; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, var(--accent), var(--accent2)); pointer-events: none; }
nav { transition: background .3s, box-shadow .3s; backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); }
body.lg-scrolled nav { background: rgba(4, 9, 18, .9) !important; box-shadow: 0 10px 34px rgba(0, 0, 0, .4); }

/* Cards: glass, depth and a soft light that follows the pointer */
.world-card, .stat-card, .about-fact, .join-step, .ban-stat-card, .slither-home {
  position: relative; background: var(--lg-glass) !important; border: 1px solid var(--lg-line) !important;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: transform .35s var(--lg-ease), border-color .25s, box-shadow .35s var(--lg-ease);
}
.world-card:hover, .stat-card:hover, .join-step:hover, .about-fact:hover { transform: translateY(-5px); border-color: rgba(125, 215, 255, .42) !important; box-shadow: 0 22px 54px rgba(0, 0, 0, .45); }
.lg-spot::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s; background: radial-gradient(340px circle at var(--lg-x, 50%) var(--lg-y, 50%), rgba(90, 210, 255, .11), transparent 70%); }
.lg-spot:hover::after { opacity: 1; }
.slither-home .world-btn.solid { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 4px; padding: 0 18px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #03131c !important; }
.btn, .world-btn { transition: transform .2s var(--lg-ease), box-shadow .2s, background .2s, border-color .2s; }
.btn:hover, .world-btn:hover { transform: translateY(-2px); }
.btn:active, .world-btn:active { transform: translateY(0) scale(.98); }

/* Things rise into view as you scroll */
.lg-rise { opacity: 0; transform: translateY(26px); }
.lg-rise.lg-in { opacity: 1; transform: none; transition: opacity .7s var(--lg-ease) var(--lg-delay, 0s), transform .7s var(--lg-ease) var(--lg-delay, 0s); }
.page.active > * { animation: lgPageIn .45s var(--lg-ease) both; }
@keyframes lgPageIn { from { opacity: 0; transform: translateY(10px); } }

/* Moving feature strip on the home page */
.lg-marquee { width: 100%; flex-shrink: 0; max-width: 1180px; margin: 6px auto 30px; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.lg-marquee-track { display: flex; width: max-content; gap: 12px; animation: lgSlide 42s linear infinite; }
.lg-marquee:hover .lg-marquee-track { animation-play-state: paused; }
.lg-marquee span { flex-shrink: 0; padding: 8px 15px; border: 1px solid var(--lg-line); border-radius: 99px; background: var(--lg-glass); color: #cfe3f5; font-size: .84rem; font-weight: 600; white-space: nowrap; }
@keyframes lgSlide { to { transform: translateX(calc(-50% - 6px)); } }

/* ===== Rules page ===== */
#rules .section-wrap { max-width: 1200px; }
.lg-rules-bar { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 18px; padding: 12px; background: var(--lg-glass); border: 1px solid var(--lg-line); border-radius: 16px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.lg-rules-bar .rules-search { flex: 1 1 260px; width: auto; min-height: 46px; margin: 0; padding: 0 14px; background: rgba(2, 7, 15, .6); border: 1px solid var(--lg-line); border-radius: 11px; font-size: 16px; }
.lg-rules-count { padding: 0 6px; color: var(--muted); font-size: .84rem; white-space: nowrap; }
.lg-rules-btn { min-height: 46px; padding: 0 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--lg-line); border-radius: 11px; color: var(--text); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; transition: background .2s; }
.lg-rules-btn:hover { background: rgba(255, 255, 255, .1); }

#rules .rules-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; align-items: start; }
#rules .rules-nav { position: sticky; top: 88px; max-height: calc(100vh - 108px); overflow-y: auto; scrollbar-width: thin; }
#rules .rules-nav-inner { position: static; padding: 12px; background: var(--lg-glass); border: 1px solid var(--lg-line); border-radius: 16px; box-shadow: none; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
#rules .rules-nav h3 { margin: 4px 8px 8px; }
#rules .rules-nav-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
#rules .rules-nav-list a { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 6px 9px; border: 0; border-radius: 9px; color: #a9bfd3; font-size: .85rem; font-weight: 500; line-height: 1.25; transition: background .2s, color .2s; }
#rules .rules-nav-list a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
#rules .rules-nav-list a.active { background: rgba(0, 229, 255, .12); color: #fff; }
.lg-rule-num { flex-shrink: 0; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: rgba(255, 255, 255, .06); color: #cfe3f5; font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
#rules a.active .lg-rule-num { background: var(--accent); color: #03131c; }

#rulesContent { display: grid; gap: 10px; min-width: 0; }
#rules .rule-section { margin: 0; scroll-margin-top: 88px; background: var(--lg-glass); border: 1px solid var(--lg-line); border-radius: 16px; box-shadow: none; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); transition: border-color .25s; }
#rules .rule-section.open { border-color: rgba(125, 215, 255, .34); }
#rules .rule-section-head { display: flex; align-items: center; gap: 13px; min-height: 66px; padding: 12px 18px; background: none; border: 0; cursor: pointer; }
#rules .rule-section-head:hover { background: rgba(255, 255, 255, .03); }
#rules .rule-section-head .lg-rule-num { width: 34px; height: 34px; border-radius: 10px; font-size: .88rem; }
#rules .rule-section.open .rule-section-head .lg-rule-num { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #03131c; }
#rules .rule-section-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 1.08rem; letter-spacing: 0; text-transform: none; }
.lg-rule-meta { flex-shrink: 0; color: var(--muted); font-size: .78rem; }
#rules .rule-section-head .toggle { flex-shrink: 0; font-size: .7rem; color: var(--muted); transition: transform .3s var(--lg-ease); }
#rules .rule-section-body { display: grid !important; grid-template-rows: 0fr; padding: 0 !important; max-height: none !important; transition: grid-template-rows .35s var(--lg-ease); }
#rules .rule-section.open .rule-section-body { grid-template-rows: 1fr; }
.lg-rule-inner { min-height: 0; overflow: hidden; }
#rules .rule-section.open .lg-rule-inner { border-top: 1px solid var(--lg-line); }
#rules .rule-article { padding: 16px 18px 16px 65px; border-bottom: 1px solid rgba(148, 190, 225, .09); }
#rules .rule-article:last-child { border-bottom: 0; }
#rules .rule-article.lg-hide, #rules .lg-no-results[hidden] { display: none; }
#rules .rule-article h3 { margin: 0 0 7px; font-size: .98rem; letter-spacing: 0; text-transform: none; color: #eaf6ff; }
#rules .rule-article p, #rules .rule-article li { color: #b6c9da; font-size: .93rem; line-height: 1.65; }
#rules .rule-article ul { margin: 6px 0 0; padding-left: 18px; }
#rules .rule-article li { margin: 4px 0; }
#rules .rule-highlight { margin: 9px 0; padding: 10px 13px; background: rgba(255, 180, 60, .08); border: 0; border-left: 3px solid var(--warn); border-radius: 8px; color: #ffdca6; font-size: .9rem; }
#rules .rule-image-grid img { border-radius: 10px; }
#rules mark { padding: 0 2px; background: rgba(0, 229, 255, .28); border-radius: 3px; color: #fff; }
.lg-no-results { padding: 34px 18px; background: var(--lg-glass); border: 1px dashed var(--lg-line); border-radius: 16px; color: var(--muted); text-align: center; }

@media (max-width: 860px) {
  html { scroll-padding-top: 130px; }
  #rules .rules-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #rules .rules-nav { position: sticky; top: 64px; z-index: 20; max-height: none; overflow: visible; margin: 0 -14px; }
  #rules .rules-nav-inner { padding: 8px 14px; border-width: 1px 0; border-radius: 0; background: rgba(4, 9, 18, .92); }
  #rules .rules-nav h3 { display: none; }
  #rules .rules-nav-list { display: flex; flex-direction: row !important; flex-wrap: nowrap !important; gap: 6px; max-height: none; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  #rules .rules-nav-list::-webkit-scrollbar { display: none; }
  #rules .rules-nav-list li { flex-shrink: 0; }
  #rules .rules-nav-list a { white-space: nowrap; min-height: 40px; background: rgba(255, 255, 255, .04); }
  #rules .rule-section { scroll-margin-top: 130px; }
  #rules .rule-section-head { padding: 11px 13px; gap: 10px; }
  #rules .rule-section-head h2 { font-size: .98rem; }
  .lg-rule-meta { display: none; }
  #rules .rule-article { padding: 14px; }
  .lg-rules-bar .rules-search { flex-basis: 100%; }
  .lg-rules-btn { flex: 1; }
  .lg-rules-count { flex-basis: 100%; order: 3; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lg-rise { opacity: 1; transform: none; }
  .page.active > * { animation: none; }
  .lg-marquee { display: none; }
}
