:root {
  color-scheme: dark;
  --bg: #120806;
  --bg-deep: #070302;
  --card: rgba(31, 18, 14, 0.86);
  --card-strong: rgba(44, 24, 17, 0.94);
  --line: rgba(255, 161, 80, 0.24);
  --text: #fff5e7;
  --muted: #d7b99a;
  --gold: #ffc857;
  --lava: #ff5a1f;
  --lava-hot: #ffe08a;
  --ember: #ff9b3d;
  --ok: rgba(51, 214, 122, 0.18);
  --ok-line: rgba(89, 255, 161, 0.38);
  --error: rgba(255, 70, 70, 0.18);
  --error-line: rgba(255, 112, 112, 0.36);
  --warn: rgba(255, 198, 74, 0.18);
  --warn-line: rgba(255, 212, 98, 0.36);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.44);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  font-family: "Bahnschrift", "Trebuchet MS", Verdana, sans-serif;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 113, 35, 0.22), transparent 34rem),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--text);
  overflow-x: hidden;
}

.lava-scene {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 26%, rgba(255, 83, 16, 0.22), transparent 18rem),
    radial-gradient(circle at 86% 18%, rgba(255, 179, 72, 0.16), transparent 20rem),
    linear-gradient(120deg, #090302 0%, #1b0704 50%, #070202 100%);
}

.lava-river {
  position: absolute;
  top: -12vh;
  bottom: -16vh;
  width: 18vw;
  min-width: 170px;
  filter: blur(0.4px) saturate(1.25);
  opacity: 0.72;
  background:
    radial-gradient(ellipse at 50% 15%, rgba(255, 239, 152, 0.95), transparent 10%),
    radial-gradient(ellipse at 52% 38%, rgba(255, 105, 24, 0.9), transparent 22%),
    linear-gradient(180deg, rgba(255, 221, 111, 0.92), rgba(255, 75, 17, 0.78) 40%, rgba(92, 15, 7, 0.34));
  box-shadow: 0 0 64px rgba(255, 86, 25, 0.38), inset 0 0 28px rgba(255, 238, 142, 0.28);
  animation: lavaPulse 7s ease-in-out infinite alternate;
}

.lava-left {
  left: -8vw;
  transform: rotate(5deg);
  clip-path: polygon(28% 0, 72% 0, 95% 100%, 8% 100%);
}

.lava-right {
  right: -9vw;
  transform: rotate(-6deg);
  clip-path: polygon(20% 0, 70% 0, 92% 100%, 18% 100%);
  animation-delay: -2.4s;
}

.ember-field::before,
.ember-field::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 204, 110, 0.78) 0 1px, transparent 2px),
    radial-gradient(circle, rgba(255, 93, 31, 0.5) 0 1px, transparent 2px);
  background-size: 170px 170px, 230px 230px;
  animation: emberDrift 18s linear infinite;
  opacity: 0.28;
}

.ember-field::after {
  animation-duration: 27s;
  animation-direction: reverse;
  opacity: 0.2;
}

@keyframes lavaPulse {
  from { filter: blur(0.4px) saturate(1.1) brightness(0.9); }
  to { filter: blur(0.7px) saturate(1.5) brightness(1.18); }
}

@keyframes emberDrift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(40px, -180px, 0); }
}

.wrap {
  width: min(1180px, 92vw);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 6, 4, 0.78);
  backdrop-filter: blur(18px);
}

.auth-page .topbar {
  position: static;
  top: auto;
  z-index: auto;
}

.auth-page .nav-shell {
  position: relative;
  z-index: 0;
}

.auth-page .page-shell {
  position: relative;
  z-index: 1;
}

.nav-shell {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 18px;
  align-items: center;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #230b03;
  background: linear-gradient(135deg, var(--lava-hot), var(--lava));
  box-shadow: 0 0 26px rgba(255, 102, 28, 0.48);
}

.main-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.main-nav a,
.ghost-button,
.primary-button,
.button-like,
button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  text-decoration: none;
  font: inherit;
}

.main-nav a:hover,
.ghost-button:hover,
.button-like:hover {
  border-color: rgba(255, 198, 87, 0.55);
  background: rgba(255, 133, 41, 0.12);
}

.server-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #40ff87;
  box-shadow: 0 0 14px rgba(64, 255, 135, 0.8);
}

.online-dot.offline {
  background: #7d756b;
  box-shadow: none;
}

.page-shell { padding: 34px 0 56px; }

.card {
  background: linear-gradient(145deg, var(--card), rgba(18, 8, 6, 0.9));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.narrow { max-width: 520px; }
.auth-card { margin-top: 7vh; }

h1, h2, h3 { margin-top: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 4vw, 4.2rem); line-height: 0.95; }
h2 { color: var(--gold); }

.eyebrow {
  color: var(--ember);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 800;
}

.stack { display: grid; gap: 12px; }

.plain-register-form {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  isolation: isolate;
}

.plain-register-form input,
.plain-register-form a {
  position: relative;
  z-index: 3;
  pointer-events: auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  font: inherit;
  padding: 12px 13px;
}

button { cursor: pointer; }
button:disabled,
.primary-button.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.primary-button.is-soft-disabled {
  opacity: 0.72;
  filter: grayscale(0.25);
}

.primary-button {
  display: inline-flex;
  justify-content: center;
  border: 0;
  color: #1e0902;
  background: linear-gradient(135deg, var(--lava-hot), var(--lava));
  font-weight: 800;
  box-shadow: 0 0 28px rgba(255, 100, 26, 0.34);
}

.alert {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
}
.alert.ok { background: var(--ok); border-color: var(--ok-line); }
.alert.error { background: var(--error); border-color: var(--error-line); }
.alert.warn { background: var(--warn); border-color: var(--warn-line); }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.profile-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
}

.side-menu {
  display: grid;
  gap: 8px;
  align-content: start;
}

.side-menu a {
  color: var(--text);
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

.pending-item,
.trusted-item,
.feed-post,
.social-row {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.pending-item header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
}
.badge.pending { background: rgba(255, 198, 74, 0.18); }
.badge.approved { background: rgba(51, 214, 122, 0.18); }
.badge.denied,
.badge.high_risk_denied,
.badge.expired,
.badge.cancelled { background: rgba(255, 70, 70, 0.18); }

.inline { display: inline; }
.inline-buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.checkline { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.checkline input { width: auto; }
.env-snippet { width: 100%; font-family: Consolas, "Cascadia Mono", monospace; padding: 10px; }
.flat-list { margin: 0; padding-left: 18px; }

table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }

@media (max-width: 820px) {
  .nav-shell { grid-template-columns: 1fr; gap: 10px; padding: 12px 0; }
  .server-pill { white-space: normal; }
  .grid-2, .profile-layout { grid-template-columns: 1fr; }
  .lava-river { opacity: 0.38; }
}

@media (prefers-reduced-motion: reduce) {
  .lava-river,
  .ember-field::before,
  .ember-field::after { animation: none; }
}

.magma-core {
  position: absolute;
  inset: -20vh -10vw;
  background:
    radial-gradient(circle at 50% 62%, rgba(255, 222, 130, 0.22), transparent 12rem),
    radial-gradient(circle at 32% 72%, rgba(255, 82, 22, 0.24), transparent 16rem),
    radial-gradient(circle at 68% 78%, rgba(244, 40, 12, 0.18), transparent 18rem);
  filter: blur(18px) saturate(1.4);
  animation: magmaBreath 10s ease-in-out infinite alternate;
}

.magma-veins {
  position: absolute;
  inset: 0;
  opacity: 0.34;
  background:
    linear-gradient(120deg, transparent 0 18%, rgba(255, 105, 30, 0.16) 19%, transparent 22% 100%),
    linear-gradient(58deg, transparent 0 38%, rgba(255, 225, 125, 0.13) 39%, transparent 41% 100%),
    repeating-linear-gradient(92deg, rgba(255, 96, 28, 0.08) 0 1px, transparent 1px 78px);
  filter: blur(1px);
  animation: veinFlow 14s linear infinite;
}

@keyframes magmaBreath {
  from { transform: scale(1) translateY(0); opacity: 0.75; }
  to { transform: scale(1.05) translateY(-2vh); opacity: 0.95; }
}

@keyframes veinFlow {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 140px -220px, -180px 120px, 220px -120px; }
}

.account-area {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-menu {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
}

.notification-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--gold);
  background: rgba(255, 255, 255, 0.045);
  text-decoration: none;
}

.avatar-fallback {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #210803;
  background: linear-gradient(135deg, var(--lava-hot), var(--lava));
  font-weight: 900;
}

.avatar-fallback.small {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 13px;
}

.online-dot.mini {
  width: 7px;
  height: 7px;
}

.compact-button { padding-inline: 18px; }

.server-state {
  color: #40ff87;
  font-weight: 800;
}

.server-count {
  color: var(--gold);
  font-weight: 800;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 320px);
  gap: 22px;
  align-items: stretch;
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 290px;
  padding: clamp(24px, 5vw, 52px);
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -8rem;
  bottom: -9rem;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 199, 87, 0.2), rgba(255, 83, 22, 0.12), transparent 68%);
  filter: blur(6px);
  pointer-events: none;
}

.status-card {
  position: relative;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 198, 87, 0.28);
  border-radius: 24px;
  padding: 22px;
  background:
    linear-gradient(145deg, rgba(255, 118, 31, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 0 38px rgba(255, 95, 24, 0.1);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.feature-card {
  min-height: 210px;
}

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  margin-bottom: 14px;
  color: #230b03;
  font-weight: 900;
  background: linear-gradient(135deg, var(--lava-hot), var(--lava));
}

.pending-home-widget {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
  padding: 22px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 198, 87, 0.42);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 198, 87, 0.15), rgba(255, 90, 31, 0.09)),
    rgba(10, 4, 3, 0.86);
  box-shadow: 0 22px 80px rgba(255, 82, 22, 0.16), var(--shadow);
}

.pending-item.compact {
  margin-bottom: 0;
}

.section-heading,
.post-header,
.user-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.user-chip {
  justify-content: flex-start;
}

.user-chip img {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  object-fit: cover;
}

.user-chip p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.premium-post {
  backdrop-filter: blur(16px);
}

.post-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.empty-state {
  text-align: center;
  padding: 42px 22px;
}

.compact-empty { padding: 24px 16px; }

.page-heading p { max-width: 760px; }

.social-workspace { align-items: start; }

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.player-card {
  display: grid;
  gap: 14px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.player-card-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.admin-action-stack,
.compact-form {
  display: grid;
  gap: 8px;
}

.compact-form {
  grid-template-columns: minmax(130px, 1fr) auto;
  align-items: center;
}

.compact-form input {
  min-width: 0;
}

.conversation-link {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.message-thread {
  min-height: 520px;
}

.message-list {
  max-height: 460px;
  overflow: auto;
  padding-right: 4px;
}

.message-bubble {
  width: min(82%, 620px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.055);
}

.message-bubble.own {
  margin-left: auto;
  background: rgba(255, 147, 42, 0.14);
  border-color: rgba(255, 198, 87, 0.36);
}

.message-bubble span {
  color: var(--muted);
  font-size: 12px;
}

.message-compose {
  margin-top: 16px;
}

.post-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.profile-header-line {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.profile-avatar-fallback {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  font-size: 34px;
}

.profile-facts {
  margin-top: 18px;
}

.form-hint,
.muted-line {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.muted-line a,
.form-hint a {
  color: var(--gold);
}

@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-hero,
  .pending-home-widget { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .grid-4 { grid-template-columns: 1fr; }
  .account-area { justify-content: flex-start; }
  .section-heading,
  .post-header { align-items: flex-start; flex-direction: column; }
  .hero-card { min-height: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .magma-core,
  .magma-veins { animation: none; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(6, 3, 2, 0.72);
  backdrop-filter: blur(10px);
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 198, 87, 0.32);
  border-radius: 28px;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 147, 42, 0.28), transparent 42%),
    linear-gradient(145deg, rgba(24, 12, 8, 0.98), rgba(9, 5, 4, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55), 0 0 40px rgba(255, 91, 15, 0.16);
}

.modal-card h2 {
  margin-top: 0;
}

.modal-actions {
  margin-top: 22px;
}

.full-width {
  grid-column: 1 / -1;
}

.role-sync-result {
  align-items: flex-start;
}

.role-badge {
  --role-color: #f59e0b;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 2px 4px 2px 0;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--role-color), #fff 18%);
  border-radius: 999px;
  color: #fff8e6;
  background: linear-gradient(135deg, color-mix(in srgb, var(--role-color), #000 25%), rgba(20, 8, 4, 0.72));
  box-shadow: 0 0 18px color-mix(in srgb, var(--role-color), transparent 68%);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 7px;
  max-height: 360px;
  overflow: auto;
}

.permission-grid label {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid rgba(255, 171, 84, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.82rem;
}
