:root {
  --ink: #e8f0f4;
  --muted: #9fb1b8;
  --paper: #0b1216;
  --sand: #111b22;
  --ember: #2f8cff;
  --pine: #2ec4b6;
  --mist: rgba(232, 240, 244, 0.08);
  --card: rgba(17, 26, 33, 0.92);
  --shadow: 0 18px 50px rgba(7, 12, 16, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 15% 15%, #11202a 0%, #0d1820 35%, #0a1116 100%);
  min-height: 100vh;
  font-family: "Gill Sans", "Century Gothic", "Trebuchet MS", sans-serif;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(232, 240, 244, 0.08) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
  opacity: 0.35;
  z-index: 0;
}

.bg-orbit {
  position: fixed;
  inset: -30% -20% auto auto;
  width: 520px;
  height: 520px;
  background: conic-gradient(from 120deg, rgba(47, 140, 255, 0.35), rgba(46, 196, 182, 0.35), rgba(47, 140, 255, 0.3));
  filter: blur(40px);
  opacity: 0.6;
  border-radius: 50%;
  animation: drift 18s ease-in-out infinite;
  z-index: 0;
}

@keyframes drift {
  0%, 100% { transform: translate(-10%, -5%) scale(1); }
  50% { transform: translate(5%, 8%) scale(1.08); }
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px 12px;
  gap: 16px;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--ember), #6fd4ff);
  color: white;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: var(--shadow);
}

.brand-title {
  font-family: "Copperplate", "Goudy Old Style", "Palatino Linotype", serif;
  font-size: 24px;
  letter-spacing: 0.5px;
}

.brand-sub {
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  gap: 12px;
}

.status-pill {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(17, 26, 33, 0.7);
  border: 1px solid rgba(232, 240, 244, 0.12);
  color: var(--muted);
}

.action-status {
  margin: 0 auto 20px;
  max-width: 1200px;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(232, 240, 244, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  text-align: center;
}

.action-status.error {
  background: rgba(239, 96, 96, 0.14);
  border-color: rgba(239, 96, 96, 0.35);
  color: #ffb6b6;
}

.update-log {
  margin: 0 auto 20px;
  max-width: 1200px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(10, 17, 25, 0.95);
  border: 1px solid rgba(232, 240, 244, 0.08);
  color: rgba(232, 240, 244, 0.95);
  font-size: 13px;
  overflow: auto;
  white-space: pre-wrap;
  text-align: left;
}

.update-log pre {
  margin: 0;
  font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 1.5;
}

.status-pill.running {
  background: rgba(46, 196, 182, 0.12);
  color: var(--pine);
  border-color: rgba(46, 196, 182, 0.35);
}

.status-pill.stopped {
  background: rgba(239, 96, 96, 0.15);
  color: #ef6060;
  border-color: rgba(239, 96, 96, 0.35);
}

button {
  border: none;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 10px 16px;
  border-radius: 999px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

.accent {
  background: var(--ember);
  color: white;
  box-shadow: 0 10px 30px rgba(47, 140, 255, 0.35);
}

.ok {
  background: var(--pine);
  color: white;
  box-shadow: 0 10px 30px rgba(46, 196, 182, 0.3);
}

.warn {
  background: #ef6060;
  color: white;
}

.ghost {
  background: rgba(17, 26, 33, 0.7);
  color: var(--ink);
  border: 1px solid rgba(232, 240, 244, 0.15);
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 320px minmax(320px, 1fr);
  gap: 24px;
  padding: 12px 40px 40px;
}

.card {
  background: var(--card);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: rise 0.6s ease;
}

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

.stat {
  padding: 12px;
  border-radius: 16px;
  background: rgba(14, 24, 30, 0.9);
  border: 1px solid rgba(232, 240, 244, 0.08);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 14px;
  font-weight: 600;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.server-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.server-item {
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(24, 35, 44, 0.92), rgba(17, 26, 33, 0.85));
  border: 1px solid rgba(232, 240, 244, 0.12);
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
  display: grid;
  gap: 10px;
}

.server-item:hover {
  transform: translateY(-1px);
}

.server-item.active {
  border: 2px solid var(--ember);
}

.server-meta {
  font-size: 12px;
  color: var(--muted);
}

.server-actions {
  display: flex;
  gap: 8px;
}

.mini {
  padding: 6px 10px;
  font-size: 12px;
}

.overview {
  grid-column: 2 / 3;
}

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

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  position: relative;
}

input, textarea {
  border-radius: 12px;
  border: 1px solid rgba(232, 240, 244, 0.15);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: rgba(13, 23, 29, 0.9);
  color: var(--ink);
}

input.locked {
  background: rgba(13, 23, 29, 0.6);
  color: var(--muted);
  cursor: not-allowed;
}

select {
  border-radius: 12px;
  border: 1px solid rgba(232, 240, 244, 0.15);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: rgba(13, 23, 29, 0.9);
  color: var(--ink);
}

.help {
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  background: rgba(232, 240, 244, 0.1);
  color: var(--ink);
  cursor: help;
}

.help::after {
  content: attr(data-tip);
  position: absolute;
  top: 22px;
  right: 0;
  background: #0d151b;
  color: #e8f0f4;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}

.help:hover::after {
  opacity: 1;
  transform: translateY(0);
}

textarea {
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.log {
  grid-column: 1 / -1;
}

.players {
  grid-column: 2 / 3;
}

.whitelist {
  grid-column: 2 / 3;
}

.sessions {
  grid-column: 2 / 3;
}

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

.players-sub {
  font-size: 12px;
  color: var(--muted);
}

.players-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(13, 23, 29, 0.8);
  border: 1px solid rgba(232, 240, 244, 0.08);
  gap: 10px;
}

.player-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(232, 240, 244, 0.08);
  color: var(--muted);
}

.tag.online {
  background: rgba(46, 196, 182, 0.2);
  color: var(--pine);
}

.tag.owner {
  background: rgba(47, 140, 255, 0.18);
  color: var(--ember);
}

.tag.mod {
  background: rgba(232, 240, 244, 0.16);
  color: var(--ink);
}

.tag.banned {
  background: rgba(239, 96, 96, 0.2);
  color: #ff9b86;
}

.player-actions {
  display: flex;
  gap: 6px;
}

.player-actions.right {
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
}

.players-actions {
  margin-bottom: 12px;
}

.players-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.role-form {
  margin-top: 10px;
}

#logBox {
  background: #0f0d0c;
  color: #f4f1ea;
  padding: 14px;
  border-radius: 16px;
  max-height: 320px;
  overflow: auto;
  font-size: 12px;
}

.footnote {
  padding: 0 40px 24px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .editor {
    grid-column: auto;
  }

  .log {
    grid-column: auto;
  }

  .players {
    grid-column: auto;
  }

  .whitelist {
    grid-column: auto;
  }

  .sessions {
    grid-column: auto;
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 5, 5, 0.7);
  display: grid;
  place-items: center;
  z-index: 10;
  padding: 24px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(980px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--card);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.modal-sub {
  color: var(--muted);
  font-size: 12px;
}

.login-body {
  display: grid;
  place-items: center;
}

.login-orbit {
  position: fixed;
  inset: auto auto 10% -10%;
  width: 420px;
  height: 420px;
  background: conic-gradient(from 60deg, rgba(47, 140, 255, 0.3), rgba(46, 196, 182, 0.35));
  filter: blur(50px);
  opacity: 0.6;
  border-radius: 50%;
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 2;
  background: var(--card);
  border-radius: 24px;
  padding: 28px;
  width: min(420px, 92vw);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-error {
  color: #ff9b86;
  font-size: 12px;
  min-height: 16px;
}
