:root {
  --bg: #101113;
  --panel: rgba(20, 22, 25, 0.94);
  --panel-2: rgba(38, 40, 45, 0.96);
  --line: #6e6e6e;
  --line-bright: #c8c8c8;
  --text: #eeeeee;
  --muted: #a9a9a9;
  --green: #53d46b;
  --yellow: #f0d56b;
  --red: #e25b5b;
  --blue: #5ea7ff;
  --shadow: #000000;
  --focus: #ffffff;
  --site-background: url("/assets/backgrounds/panorama.png");
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: #101113;
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  width: 116vw;
  left: -8vw;
  background-image: var(--site-background);
  background-size: cover;
  background-position: center;
  image-rendering: auto;
  transform: translate3d(0, 0, 0) scale(1.04);
  animation: panorama-drift 42s ease-in-out infinite alternate;
}

body::after {
  z-index: -1;
  background:
    linear-gradient(rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.56)),
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.08), transparent 42%),
    linear-gradient(135deg, rgba(0, 0, 0, 0.20) 0 25%, rgba(0, 0, 0, 0.12) 25% 50%, rgba(0, 0, 0, 0.20) 50% 75%, rgba(0, 0, 0, 0.12) 75%);
  background-size: auto, auto, 32px 32px;
}

@keyframes panorama-drift {
  from {
    transform: translate3d(-2.5vw, 0, 0) scale(1.05);
  }

  to {
    transform: translate3d(2.5vw, -0.8vh, 0) scale(1.08);
  }
}

button,
a {
  font: inherit;
}

.page-shell {
  height: 100vh;
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(10px, 1.6vh, 18px);
  padding: clamp(14px, 2.6vh, 26px) 0 clamp(12px, 1.8vh, 18px);
  overflow: hidden;
}

.screen-header {
  text-align: center;
  text-shadow: 3px 3px 0 var(--shadow);
}

.screen-kicker {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.7rem);
  letter-spacing: 0;
}

.multiplayer-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(10px, 1.5vh, 16px);
  min-height: 0;
  align-content: stretch;
}

.server-list {
  min-height: 0;
  height: min(540px, 100%);
  border: 3px solid #1e1e1e;
  border-top-color: #555;
  border-left-color: #555;
  background: rgba(0, 0, 0, 0.42);
  padding: 10px 7px 10px 10px;
  overflow: hidden;
}

.server-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  overscroll-behavior: contain;
  scrollbar-color: #9b9b9b #171717;
  scrollbar-width: thin;
}

.server-scroll::-webkit-scrollbar {
  width: 14px;
}

.server-scroll::-webkit-scrollbar-track {
  background: #171717;
  border-left: 2px solid #050505;
}

.server-scroll::-webkit-scrollbar-thumb {
  background: #777;
  border: 3px solid #171717;
  box-shadow: inset -2px -2px 0 #353535, inset 2px 2px 0 #c2c2c2;
}

.server-scroll.dragging {
  cursor: grabbing;
  user-select: none;
}

.server-card {
  width: 100%;
  min-height: 118px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px;
  margin-bottom: 8px;
  color: var(--text);
  text-align: left;
  background: var(--panel);
  border: 3px solid #2a2a2a;
  border-top-color: #585858;
  border-left-color: #585858;
  box-shadow: inset -3px -3px 0 #050505, inset 3px 3px 0 #7c7c7c;
  cursor: pointer;
}

.server-card[aria-selected="true"] {
  background: var(--panel-2);
  outline: 2px solid var(--line-bright);
  outline-offset: 2px;
}

.server-card:focus-visible,
.mc-button:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.server-icon {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  background: #202226;
  border: 2px solid #050505;
  object-fit: cover;
}

.server-title {
  margin: 0 0 5px;
  color: #ffffff;
  font-size: 1.1rem;
}

.server-motd,
.server-address,
.server-meta,
.server-checked {
  margin: 3px 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.server-address {
  color: var(--blue);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.status-pill::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--red);
  box-shadow: 0 0 0 2px #310d0d;
}

.status-pill.online::before {
  background: var(--green);
  box-shadow: 0 0 0 2px #123417;
}

.server-side {
  min-width: 104px;
  display: grid;
  justify-items: end;
  gap: 8px;
}

.ping-bars {
  width: 34px;
  height: 30px;
  display: inline-grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  gap: 3px;
}

.ping-bars span {
  display: block;
  width: 4px;
  background: #454545;
}

.ping-bars span:nth-child(1) { height: 8px; }
.ping-bars span:nth-child(2) { height: 12px; }
.ping-bars span:nth-child(3) { height: 16px; }
.ping-bars span:nth-child(4) { height: 22px; }
.ping-bars span:nth-child(5) { height: 28px; }

.ping-bars.quality-1 span:nth-child(-n + 1),
.ping-bars.quality-2 span:nth-child(-n + 2),
.ping-bars.quality-3 span:nth-child(-n + 3),
.ping-bars.quality-4 span:nth-child(-n + 4),
.ping-bars.quality-5 span:nth-child(-n + 5) {
  background: var(--green);
}

.ping-bars.quality-2 span:nth-child(-n + 2),
.ping-bars.quality-3 span:nth-child(-n + 3) {
  background: var(--yellow);
}

.ping-bars.quality-1 span:nth-child(1) {
  background: var(--red);
}

.ping-bars.offline {
  position: relative;
}

.ping-bars.offline span {
  background: #343434;
  opacity: 0.45;
}

.ping-bars.offline::before,
.ping-bars.offline::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 1px;
  width: 5px;
  height: 31px;
  background: var(--red);
  box-shadow: 2px 2px 0 #2a0909;
  transform-origin: center;
}

.ping-bars.offline::before {
  transform: rotate(45deg);
}

.ping-bars.offline::after {
  transform: rotate(-45deg);
}

.actions {
  display: grid;
  gap: 10px;
  flex: 0 0 auto;
}

.primary-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mc-button,
.icon-button {
  min-height: 46px;
  color: #ffffff;
  background: #6b6b6b;
  border: 3px solid #171717;
  border-top-color: #b8b8b8;
  border-left-color: #b8b8b8;
  box-shadow: inset -3px -3px 0 #2b2b2b, inset 3px 3px 0 #8e8e8e;
  text-shadow: 2px 2px 0 #000;
  cursor: pointer;
}

.mc-button:hover:not(:disabled),
.icon-button:hover {
  background: #7a7a7a;
}

.mc-button:disabled {
  color: #9a9a9a;
  background: #3c3c3c;
  cursor: not-allowed;
  box-shadow: inset -3px -3px 0 #1c1c1c, inset 3px 3px 0 #555;
}

.mc-button--wide {
  width: 100%;
}

.compact {
  min-height: 38px;
}

.download-note,
.screen-footer {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.screen-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(92vw, 520px);
  padding: 12px 16px;
  color: #fff;
  background: rgba(20, 20, 20, 0.96);
  border: 2px solid #777;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(3px);
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: min(760px, 100%);
  max-height: min(820px, 92vh);
  overflow: auto;
  background:
    linear-gradient(rgba(19, 21, 24, 0.95), rgba(11, 12, 14, 0.95)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 25%, transparent 25% 50%, rgba(255, 255, 255, 0.03) 50% 75%, transparent 75%);
  background-size: auto, 24px 24px;
  border: 3px solid #202020;
  border-top-color: #9b9b9b;
  border-left-color: #9b9b9b;
  box-shadow:
    inset -4px -4px 0 #050505,
    inset 4px 4px 0 #6c6c6c,
    0 22px 80px rgba(0, 0, 0, 0.62);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  background:
    linear-gradient(180deg, rgba(112, 112, 112, 0.34), rgba(52, 52, 52, 0.22)),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 25%, rgba(0, 0, 0, 0.06) 25% 50%, rgba(255, 255, 255, 0.06) 50% 75%, rgba(0, 0, 0, 0.06) 75%);
  background-size: auto, 18px 18px;
  border-bottom: 3px solid #111;
  box-shadow: inset 0 -2px 0 #696969;
}

.modal-header h2 {
  margin: 4px 0 0;
  font-size: clamp(1.65rem, 4vw, 2.45rem);
  text-shadow: 3px 3px 0 #000;
}

.modal-kicker {
  display: block;
  color: #d2d2d2;
  font-size: 0.9rem;
  text-shadow: 2px 2px 0 #000;
}

.icon-button {
  width: 48px;
  min-height: 44px;
  font-size: 1.4rem;
  line-height: 1;
  background: #777;
  border-color: #171717;
  border-top-color: #d2d2d2;
  border-left-color: #d2d2d2;
}

.modal-body {
  display: grid;
  gap: 18px;
  padding: 22px 24px 24px;
}

.modal-lead {
  margin: 0;
  color: #eeeeee;
  line-height: 1.55;
}

.steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: var(--text);
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 2px solid #3d3d3d;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.08);
  line-height: 1.45;
}

.step-number {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #101113;
  background: #d5d5d5;
  border: 2px solid #151515;
  box-shadow: inset -2px -2px 0 #7b7b7b, inset 2px 2px 0 #ffffff;
  font-weight: 700;
}

.modal-note {
  color: var(--muted);
  line-height: 1.55;
  padding: 14px;
  border-left: 4px solid #8f8f8f;
  background: rgba(255, 255, 255, 0.06);
}

.skeleton {
  background: linear-gradient(90deg, #26282c, #3b3d42, #26282c);
}

.skeleton-line {
  height: 16px;
  width: 72%;
  margin: 8px 0;
  background: linear-gradient(90deg, #26282c, #3b3d42, #26282c);
}

.skeleton-line.short {
  width: 46%;
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 18px, 980px);
    padding-top: 14px;
  }

  h1 {
    font-size: clamp(1.7rem, 8vw, 2.6rem);
  }

  .screen-kicker {
    font-size: 0.82rem;
  }

  .server-card {
    grid-template-columns: 56px minmax(0, 1fr);
    min-height: 104px;
  }

  .server-icon {
    width: 52px;
    height: 52px;
  }

  .server-side {
    grid-column: 1 / -1;
    justify-items: start;
    grid-template-columns: repeat(3, auto);
    align-items: center;
  }

  .primary-actions {
    grid-template-columns: 1fr;
  }

  .screen-footer {
    grid-template-columns: 1fr;
    display: grid;
  }

  .modal {
    max-height: 90vh;
  }

  .modal-header,
  .modal-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .steps li {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 10px;
  }

  .step-number {
    width: 28px;
    height: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }

  body::before {
    animation: none !important;
  }
}
