:root {
  --bg: #020817;
  --panel: #101827;
  --panel-2: #0b1324;
  --line: #233047;
  --text: #f8fbff;
  --muted: #9fc0e8;
  --accent: #6047f7;
  --accent-2: #0ea5e9;
  --danger: #ef4444;
  --topbar: rgba(3, 8, 23, .95);
  --input-bg: #091122;
  --post-text: #eef6ff;
}

:root.light-mode {
  --bg: #eef4fb;
  --panel: #ffffff;
  --panel-2: #f3f7fc;
  --line: #d5e0ee;
  --text: #102033;
  --muted: #55708f;
  --accent: #4f46e5;
  --accent-2: #0284c7;
  --topbar: rgba(255, 255, 255, .95);
  --input-bg: #ffffff;
  --post-text: #14243a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 58% 0%, rgba(14,165,233,.18), transparent 34%), var(--bg);
  color: var(--text);
  font: 15px/1.6 "Segoe UI", Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--topbar);
  border-bottom: 1px solid rgba(148, 163, 184, .16);
  backdrop-filter: blur(16px);
}
.nav-wrap { height: 64px; display: flex; align-items: center; gap: 26px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  overflow: hidden; background: #020817; border: 1px solid var(--line);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; }
.main-nav a, .nav-login {
  padding: 9px 14px; border-radius: 8px; color: #d6e2f3; font-weight: 800; font-size: 14px;
}
.main-nav a.active, .main-nav a:hover, .nav-login:hover { background: #172236; color: white; }
.light-mode .main-nav a, .light-mode .nav-login { color: #4f6685; }
.light-mode .main-nav a.active, .light-mode .main-nav a:hover, .light-mode .nav-login:hover {
  background: #e8f0fb;
  color: #102033;
}
.light-mode .brand { color: #102033; }
.light-mode .topbar { box-shadow: 0 1px 0 rgba(2, 132, 199, .45); }
.light-mode .circle, .light-mode .user-pill { color: #102033; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.circle {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
}
.user-pill {
  display: flex; align-items: center; gap: 9px; padding: 7px 14px 7px 7px;
  border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 800;
}
.user-pill img { width: 30px; height: 30px; border-radius: 50%; }

.hero {
  min-height: 284px;
  background:
    linear-gradient(110deg, rgba(48,67,210,.76), rgba(14,165,233,.5), rgba(2,8,23,.92)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 1px, transparent 1px 74px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 1px, transparent 1px 74px);
  border-bottom: 1px solid rgba(148,163,184,.13);
}
.hero-grid { min-height: 284px; display: grid; grid-template-columns: 1fr 1.4fr 1fr; align-items: center; gap: 24px; }
.hero-title { text-align: center; }
.hero-title h1 { margin: 0; font-size: clamp(44px, 6vw, 68px); line-height: 1; letter-spacing: 0; }
.hero-title p, .hero-side span, .hero-side a { color: #dbeafe; }
.hero-side { display: flex; align-items: center; gap: 18px; }
.hero-side.right { justify-content: flex-end; text-align: right; }
.play-icon {
  width: 0; height: 0; border-top: 21px solid transparent; border-bottom: 21px solid transparent;
  border-left: 35px solid #b9c6ff; filter: drop-shadow(0 8px 18px rgba(0,0,0,.25));
}
.discord-dot { color: #93c5fd; font-size: 34px; letter-spacing: 2px; }

.page { padding: 34px 0; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 262px; gap: 24px; align-items: start; }
.server-board, .admin-board { min-width: 0; }
.breadcrumb, .server-tools, .server-filter, .server-card, .panel, .form-card, .category {
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,.18);
}
.breadcrumb { padding: 9px 20px; margin-bottom: 24px; font-weight: 800; }
.server-tools {
  padding: 22px 24px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.server-tools h2, .form-card h2, .category h2 { margin: 0; font-size: 22px; }
.server-tools p, .muted, small { color: var(--muted); }
.server-filter {
  padding: 16px; margin-bottom: 22px; display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 10px;
}
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--input-bg); color: var(--text);
  padding: 12px 14px; font: inherit; outline: none;
}
textarea { resize: vertical; min-height: 170px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(14,165,233,.14); }
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px; color: white; font-weight: 900; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: linear-gradient(135deg, var(--accent), #6d5dfc); }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: var(--danger); }

.server-card { overflow: hidden; margin-bottom: 22px; }
.server-card.featured { border-color: rgba(96, 71, 247, .72); box-shadow: 0 0 0 1px rgba(96,71,247,.18), 0 28px 80px rgba(0,0,0,.24); }
.mc-server-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 138px;
  gap: 14px;
  align-items: center;
  min-height: 94px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12px 12px, rgba(255,255,255,.04) 0 2px, transparent 2px 10px),
    #050505;
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}
.mc-server-row.featured { border-color: #ffaa00; }
.mc-server-icon img {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  image-rendering: pixelated;
  background: #111;
}
.mc-server-main { min-width: 0; }
.mc-server-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-family: Consolas, "Lucida Console", monospace;
  font-size: 18px;
  line-height: 1.15;
}
.mc-server-title a { color: #ffffff; }
.mc-server-title span {
  padding: 1px 7px;
  border-radius: 999px;
  background: #ffaa00;
  color: #111;
  font: 800 12px "Segoe UI", Arial, sans-serif;
}
.mc-server-title .advertiser-pill {
  background: #1f2937;
  color: #9cc7f4;
}
.mc-server-address {
  margin-top: 2px;
  color: #55ffff;
  font-family: Consolas, "Lucida Console", monospace;
  font-size: 14px;
}
.mc-list-motd {
  margin-top: 3px;
  min-height: 36px;
}
.mc-server-stats {
  display: grid;
  gap: 2px;
  justify-items: end;
  align-self: start;
  color: #aaaaaa;
  font-family: Consolas, "Lucida Console", monospace;
  font-size: 15px;
}
.mc-server-stats strong {
  color: #d7d7d7;
  font-size: 17px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mc-server-stats span {
  color: #777;
  max-width: 138px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ping-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  user-select: none;
}
.offline-ping {
  filter: grayscale(1) opacity(.55);
}
.mc-copy-ip {
  margin-top: 4px;
  border: 1px solid #1f8f3a;
  border-radius: 4px;
  background: #06140a;
  color: #55ff55;
  font: 800 12px Consolas, "Lucida Console", monospace;
  padding: 5px 7px;
  cursor: pointer;
}
.mc-copy-ip:hover {
  border-color: #55ff55;
}
.rss-feed-list {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  overflow: hidden;
}
.rss-feed-list header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.rss-feed-list h2,
.rss-feed-list h3 {
  margin: 0;
}
.rss-feed-group {
  padding: 16px 20px 6px;
  border-bottom: 1px solid var(--line);
}
.rss-feed-group:last-child {
  border-bottom: 0;
}
.rss-feed-group h3 {
  margin-bottom: 10px;
  color: #9cc7f4;
  font-size: 15px;
}
.rss-feed-row {
  padding: 12px 0;
  border-top: 1px solid rgba(148, 163, 184, .14);
}
.rss-feed-row a {
  color: var(--text);
  font-weight: 900;
}
.rss-feed-row p {
  margin: 4px 0;
  color: var(--muted);
}
.rss-feed-row small {
  display: block;
}
.signal {
  font-style: normal;
  font-weight: 900;
  letter-spacing: -2px;
}
.online-signal { color: #00ff40; }
.offline-signal { color: #ff3333; letter-spacing: 0; }
.ad-banner {
  min-height: 160px;
  padding: 24px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  background:
    linear-gradient(90deg, rgba(2,8,23,.9), rgba(14,165,233,.2)),
    repeating-linear-gradient(135deg, rgba(255,255,255,.08) 0 1px, transparent 1px 22px),
    linear-gradient(135deg, #1d2b7c, #0284c7 55%, #0f172a);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--line);
  color: white;
}
.ad-banner h2 { margin: 6px 0 0; font-size: 31px; line-height: 1.08; }
.ad-banner p { margin: 4px 0 0; color: #dbeafe; font-weight: 900; }
.light-mode .ad-banner h2 { color: white; text-shadow: 0 2px 14px rgba(0,0,0,.5); }
.light-mode .ad-banner p { color: #eef6ff; text-shadow: 0 2px 10px rgba(0,0,0,.45); }
.badge {
  display: inline-flex; width: fit-content; padding: 4px 10px; border-radius: 999px;
  background: #f59e0b; color: #111827; font-weight: 900; font-size: 12px;
}
.online, .offline {
  padding: 7px 12px; border-radius: 999px; background: rgba(2,8,23,.74); border: 1px solid rgba(255,255,255,.18);
}
.online { color: #86efac; }
.offline { color: #fca5a5; }
.xf-post { display: grid; grid-template-columns: 172px minmax(0, 1fr); }
.xf-post.no-advertiser { grid-template-columns: 1fr; }
.post-user {
  padding: 20px; background: var(--panel-2); border-right: 1px solid var(--line); text-align: center;
}
.post-user img {
  width: 94px; height: 94px; margin: 0 auto 12px; border-radius: 18px; image-rendering: pixelated;
  background: var(--bg); border: 1px solid var(--line);
}
.post-user strong, .post-user em, .post-user small { display: block; }
.post-user em { margin-top: 4px; color: #9cc7f4; font-style: normal; font-weight: 900; }
.post-main { min-width: 0; }
.post-main header {
  padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px;
  color: var(--muted); font-weight: 800;
}
.post-main header span, .post-main header a {
  padding: 4px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
}
.post-main p, .server-description { margin: 0; padding: 20px 18px; color: var(--post-text); overflow-wrap: anywhere; }
.collapsed-description {
  position: relative;
  max-height: 154px;
  margin: 18px;
  overflow: hidden;
  border: 1px solid rgba(249, 115, 22, .16);
  border-radius: 12px;
  background: rgba(249, 115, 22, .1);
  cursor: pointer;
}
.collapsed-description-inner {
  padding: 18px;
  color: var(--post-text);
  overflow-wrap: anywhere;
}
.collapsed-description::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(249,115,22,.18) 55%, var(--panel));
  pointer-events: none;
}
.collapsed-description > span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 1;
  text-align: center;
  color: #ff7a63;
  font-weight: 800;
}
.collapsed-description.open {
  max-height: none;
}
.collapsed-description.open::after,
.collapsed-description.open > span {
  display: none;
}
.post-main blockquote, .motd-box {
  margin: 18px 18px 0;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-left: 4px solid #55ff55;
  border-radius: 8px;
  background: #050505;
  color: #f8fbff;
}
.motd-box strong {
  display: block;
  margin-bottom: 6px;
  color: #aaaaaa;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.minecraft-motd {
  color: #ffffff;
  font-family: Consolas, "Lucida Console", monospace;
  font-size: 14px;
  line-height: 1.35;
  text-shadow: 0 1px 0 #000;
  overflow-wrap: anywhere;
}
.light-mode .motd-box {
  border-color: #1f2937;
  background: #050505;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.post-main a { color: #7dd3fc; }
.post-main footer {
  border-top: 1px solid var(--line); padding: 18px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px;
}

.sidebar { display: grid; gap: 24px; }
.search-box { display: grid; grid-template-columns: 1fr 48px; gap: 8px; }
.search-box button { border: 0; border-radius: 10px; background: var(--accent); color: white; font-size: 24px; cursor: pointer; }
.panel { overflow: hidden; }
.panel h3 { margin: 0; padding: 18px 20px; color: #9cc7f4; font-size: 14px; letter-spacing: .08em; }
.panel footer { border-top: 1px solid var(--line); padding: 16px 20px; }
.member-card, .empty-card {
  margin: 0 20px 18px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2);
}
.empty-card.standalone { margin: 0; }
.member-card { display: flex; align-items: center; gap: 14px; }
.member-card img { width: 36px; height: 36px; border-radius: 50%; }
.member-card strong { color: #ff243d; display: block; }
.member-card em {
  display: inline-block; margin-top: 2px; padding: 2px 10px; border-radius: 999px; background: #ff4056;
  color: white; font-style: normal; font-weight: 800;
}
.stats p { display: flex; justify-content: space-between; margin: 0; padding: 4px 20px 12px; }

.auth-shell { max-width: 520px; margin: 0 auto; }
.form-card { padding: 26px; }
.wide-card { width: 100%; }
.form-card form { display: grid; gap: 16px; }
.form-card label { display: grid; gap: 7px; color: var(--muted); font-weight: 800; }
.inline-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; }
.password-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; }
.banner-preview {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-size: cover;
  background-position: center;
}
.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  flex-direction: row;
  align-items: center;
}
.check-row input { width: auto; }
.category { overflow: hidden; }
.category header {
  padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px;
}
.member-row, .admin-row {
  padding: 18px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.member-row img { width: 48px; height: 48px; border-radius: 50%; background: var(--bg); }
.member-row div { flex: 1; }
.member-row strong, .member-row small, .admin-row strong, .admin-row small { display: block; }
.admin-row form, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 18px; }
.active-tab { box-shadow: inset 0 0 0 1px var(--accent); }

.flash { padding: 13px 16px; margin-bottom: 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.flash.error { border-color: #7f1d1d; background: #2a1018; }
.flash.success, .success-text { color: #86efac; }
.site-footer { color: var(--muted); padding: 20px 0 40px; }

@media (max-width: 980px) {
  .content-grid { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-box { grid-column: 1 / -1; }
  .hero-grid { grid-template-columns: 1fr; text-align: center; padding: 36px 0; }
  .hero-side, .hero-side.right { justify-content: center; text-align: center; }
  .main-nav { display: none; }
}

@media (max-width: 680px) {
  .wrap { width: min(100% - 20px, 1120px); }
  .circle, .nav-login { display: none; }
  .hero-title h1 { font-size: 42px; }
  .server-tools { align-items: stretch; flex-direction: column; }
  .server-filter, .xf-post, .inline-form, .password-grid { grid-template-columns: 1fr; }
  .post-user { border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar { grid-template-columns: 1fr; }
  .admin-row { align-items: stretch; flex-direction: column; }
  .mc-server-row { grid-template-columns: 58px minmax(0, 1fr); }
  .mc-server-icon img { width: 48px; height: 48px; }
  .mc-server-stats {
    grid-column: 2;
    justify-items: start;
    grid-auto-flow: column;
    justify-content: start;
    gap: 10px;
  }
}
