:root {
  color-scheme: dark;
  --bg: #061018;
  --panel: rgba(9, 27, 39, 0.82);
  --panel-strong: rgba(10, 34, 48, 0.96);
  --line: rgba(174, 224, 235, 0.15);
  --line-strong: rgba(174, 224, 235, 0.28);
  --text: #effbff;
  --muted: #9bb6c2;
  --cyan: #66d7e8;
  --blue: #4295ff;
  --green: #62e3a2;
  --yellow: #f5c86e;
  --red: #ff7780;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -20%, rgba(52, 143, 177, 0.2), transparent 50%),
    linear-gradient(155deg, #07141d 0%, #061018 58%, #071721 100%);
}

button {
  font: inherit;
}

.sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.glow {
  position: absolute;
  display: block;
  width: 38rem;
  height: 38rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.13;
}

.glow-one {
  top: -18rem;
  right: -10rem;
  background: #48bde8;
}

.glow-two {
  bottom: -24rem;
  left: -12rem;
  background: #3a77e0;
}

.star-field {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    radial-gradient(circle at 14% 18%, #fff 0 1px, transparent 1.4px),
    radial-gradient(circle at 83% 12%, #99eaff 0 1px, transparent 1.4px),
    radial-gradient(circle at 68% 42%, #fff 0 1px, transparent 1.4px),
    radial-gradient(circle at 29% 67%, #99eaff 0 1px, transparent 1.4px),
    radial-gradient(circle at 91% 78%, #fff 0 1px, transparent 1.4px);
  background-size: 29rem 23rem, 37rem 31rem, 41rem 28rem, 33rem 39rem, 47rem 35rem;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 28px;
  min-height: 360px;
  margin-bottom: 20px;
  padding: 30px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background-image:
    linear-gradient(90deg, rgba(3, 14, 22, 0.94) 0%, rgba(3, 14, 22, 0.7) 34%, rgba(3, 14, 22, 0.14) 72%),
    linear-gradient(0deg, rgba(3, 14, 22, 0.82) 0%, transparent 56%),
    url("/assets/palworld-hero.webp");
  background-position: center;
  background-size: cover;
  box-shadow: var(--shadow);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 80px rgba(1, 8, 13, 0.42);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.pal-sphere {
  position: relative;
  width: 88px;
  height: 88px;
  border: 3px solid rgba(225, 250, 255, 0.88);
  border-radius: 50%;
  background:
    linear-gradient(to bottom, #2bb8d3 0 45%, #e9f8fb 45% 55%, #172a35 55% 100%);
  box-shadow: 0 0 34px rgba(74, 199, 225, 0.23), inset 0 0 20px rgba(255, 255, 255, 0.2);
  transform: rotate(-9deg);
}

.pal-sphere::before,
.pal-sphere::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.pal-sphere::before {
  width: 34px;
  height: 34px;
  border: 5px solid #eafcff;
  background: #132a37;
  box-shadow: 0 0 0 3px rgba(7, 21, 31, 0.78);
}

.pal-sphere::after {
  width: 13px;
  height: 13px;
  background: var(--cyan);
  box-shadow: 0 0 15px rgba(102, 215, 232, 0.95);
}

.eyebrow,
.section-kicker,
.metric-label {
  margin: 0;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 5px;
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
  text-shadow: 0 3px 20px rgba(0, 0, 0, 0.6);
}

h2 {
  margin: 5px 0 0;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  letter-spacing: -0.025em;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 168px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(5, 15, 22, 0.6);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.state-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 5px rgba(245, 200, 110, 0.1);
}

body[data-state="online"] .state-badge {
  border-color: rgba(98, 227, 162, 0.35);
  color: var(--green);
}

body[data-state="online"] .state-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(98, 227, 162, 0.11), 0 0 18px rgba(98, 227, 162, 0.5);
}

body[data-state="offline"] .state-badge,
body[data-state="error"] .state-badge {
  border-color: rgba(255, 119, 128, 0.35);
  color: var(--red);
}

body[data-state="offline"] .state-dot,
body[data-state="error"] .state-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(255, 119, 128, 0.11);
}

.join-card,
.status-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.join-card {
  display: grid;
  grid-template-columns: auto minmax(290px, 1fr);
  align-items: center;
  gap: 22px 32px;
  padding: 25px 28px;
  border-radius: 22px;
}

.address-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid rgba(102, 215, 232, 0.26);
  border-radius: 14px;
  color: var(--text);
  background: rgba(31, 91, 112, 0.22);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.address-button:hover {
  border-color: rgba(102, 215, 232, 0.58);
  background: rgba(31, 91, 112, 0.36);
  transform: translateY(-1px);
}

.address-button:focus-visible {
  outline: 3px solid rgba(102, 215, 232, 0.5);
  outline-offset: 3px;
}

#server-address {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(0.92rem, 2vw, 1.08rem);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-label {
  flex: 0 0 auto;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-panel {
  margin-top: 20px;
  padding: 28px;
  border-radius: 22px;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 200, 110, 0.32);
  border-radius: 12px;
  color: #f9d992;
  background: rgba(113, 77, 22, 0.18);
  font-size: 0.84rem;
}

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

.metric {
  min-height: 148px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(5, 17, 25, 0.54);
}

.metric-value {
  margin: 19px 0 7px;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 760;
  letter-spacing: -0.035em;
}

.metric-value-date {
  font-size: clamp(1.12rem, 2.4vw, 1.5rem);
}

.metric-detail {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.last-update {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.76rem;
}

.last-update time {
  color: var(--text);
}

.last-update .age::before {
  content: "·";
  margin-right: 8px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 2px 0;
  color: #718c98;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

noscript {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 10;
  padding: 12px;
  border-radius: 10px;
  color: #fff;
  background: #9d3f45;
  text-align: center;
}

@media (max-width: 820px) {
  .shell {
    padding-top: 36px;
  }

  .hero {
    grid-template-columns: auto 1fr;
    min-height: 330px;
    background-position: 62% center;
  }

  .state-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 580px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 25px;
  }

  .hero {
    gap: 16px;
    min-height: 310px;
    padding: 20px;
    border-radius: 18px;
    background-image:
      linear-gradient(90deg, rgba(3, 14, 22, 0.92) 0%, rgba(3, 14, 22, 0.55) 48%, rgba(3, 14, 22, 0.14) 100%),
      linear-gradient(0deg, rgba(3, 14, 22, 0.9) 0%, transparent 64%),
      url("/assets/palworld-hero.webp");
    background-position: 68% center;
  }

  .pal-sphere {
    width: 68px;
    height: 68px;
  }

  .pal-sphere::before {
    width: 27px;
    height: 27px;
    border-width: 4px;
  }

  .join-card,
  .status-panel {
    padding: 20px;
    border-radius: 18px;
  }

  .join-card {
    grid-template-columns: 1fr;
  }

  .address-button {
    width: 100%;
    gap: 10px;
    padding: 14px 13px;
  }

  #server-address {
    font-size: 0.82rem;
    text-overflow: clip;
  }

  .copy-label {
    font-size: 0.68rem;
  }

  .panel-heading {
    display: block;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 128px;
  }

  footer {
    display: grid;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
