:root {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #131c2e;
  --panel-2: #1a2440;
  --text: #eef2ff;
  --muted: #9fb0d0;
  --border: rgba(255, 255, 255, 0.08);
  --green: #3ddc97;
  --red: #ff6b6b;
  --amber: #ffb454;
  --blue: #6aa9ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #09111d 0%, var(--bg) 100%);
  color: var(--text);
}

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--blue);
  font-size: 0.76rem;
  margin: 0 0 6px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.subtle {
  color: var(--muted);
  margin: 10px 0 0;
}

.refresh-button {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}

.summary-grid,
.server-grid {
  display: grid;
  gap: 16px;
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 20px;
}

.summary-card,
.server-card,
.status-message {
  background: rgba(19, 28, 46, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.summary-card {
  padding: 18px;
}

.summary-label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
  font-size: 0.92rem;
}

.summary-card strong {
  font-size: 1.35rem;
}

.status-message {
  padding: 14px 16px;
  margin-bottom: 20px;
  color: var(--amber);
}

.server-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.server-card {
  overflow: hidden;
  padding: 0;
}

.server-hero {
  position: relative;
  min-height: 170px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: linear-gradient(135deg, #22304f 0%, #11192b 100%);
}

.server-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.45;
}

.server-hero[data-game="minecraft"] {
  background: linear-gradient(135deg, rgba(42, 102, 48, 0.95) 0%, rgba(19, 30, 24, 0.95) 100%);
}

.server-hero[data-game="valheim"] {
  background: linear-gradient(135deg, #4d2d1e 0%, #1c1210 100%);
}

.server-hero[data-game="palworld"] {
  background: linear-gradient(135deg, #245a8a 0%, #13273b 100%);
}

.server-hero[data-game="terraria"] {
  background: linear-gradient(135deg, #1f6d45 0%, #10261b 100%);
}

.server-hero[data-game="rust"] {
  background: linear-gradient(135deg, #8d4b28 0%, #241811 100%);
}

.server-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255,255,255,0.18), transparent 35%);
  pointer-events: none;
}

.hero-overlay {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-top: auto;
}

.server-name {
  margin: 8px 0 0;
  font-size: 1.6rem;
}

.server-module {
  margin: 0;
  color: rgba(255,255,255,0.82);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
}

.server-badge {
  position: relative;
  z-index: 1;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  backdrop-filter: blur(6px);
}

.server-badge.online {
  background: rgba(61, 220, 151, 0.16);
  color: var(--green);
}

.server-badge.offline {
  background: rgba(255, 107, 107, 0.14);
  color: var(--red);
}

.connect-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.connect-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.server-connect {
  font-size: 0.96rem;
  color: var(--text);
  background: rgba(255,255,255,0.05);
  padding: 8px 10px;
  border-radius: 10px;
  display: inline-block;
}

.copy-button {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  flex-shrink: 0;
}

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

.meta-grid dt {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.meta-grid dd {
  margin: 0;
  font-weight: 600;
  line-break: anywhere;
}

.ports-block {
  margin-top: 4px;
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
}

.ports-block h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.port-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.port-list li {
  color: var(--muted);
  font-size: 0.95rem;
}

.server-error {
  margin: 18px 0 0;
  color: var(--amber);
  font-size: 0.92rem;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .refresh-button,
  .copy-button {
    width: 100%;
  }

  .connect-block {
    flex-direction: column;
    align-items: stretch;
  }
}
