:root,
:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --border-strong: #3d4452;
  --text: #e8eaf0;
  --text-dim: #9aa3b2;
  --text-faint: #6f7888;
  --accent: #8b6cff;
  --accent-hover: #9d83ff;
  --accent-soft: rgba(139, 108, 255, 0.14);
  --on-accent: #ffffff;
  --good: #4ade80;
  --good-soft: rgba(74, 222, 128, 0.12);
  --warn: #facc15;
  --bad: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e0e4ea;
  --border-strong: #c7cdd8;
  --text: #14171f;
  --text-dim: #4b5565;
  --text-faint: #7a8494;
  --accent: #6a49f2;
  --accent-hover: #5836de;
  --accent-soft: rgba(106, 73, 242, 0.1);
  --on-accent: #ffffff;
  --good: #15803d;
  --good-soft: rgba(21, 128, 61, 0.1);
  --warn: #b45309;
  --bad: #dc2626;
  --bad-soft: rgba(220, 38, 38, 0.08);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  color-scheme: light;
}

:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

[hidden] {
  display: none !important;
}

h1, h2, h3, p {
  margin: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 880px;
  margin: 0 auto;
  padding: 12px clamp(16px, 4vw, 24px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  image-rendering: pixelated;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.icon-link:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-strong);
  text-decoration: none;
}

.icon-link svg {
  width: 20px;
  height: 20px;
}

#theme-toggle .icon-sun,
#theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] #theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="light"] #theme-toggle .icon-moon {
  display: block;
}

.container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 24px) 64px;
  flex: 1;
}

.hero {
  padding: clamp(36px, 8vw, 72px) 0 28px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.9rem, 5.5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero p {
  margin-top: 12px;
  color: var(--text-dim);
  font-size: clamp(1rem, 2.4vw, 1.1rem);
}

.search {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.edition {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.edition input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.edition label {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, color 0.2s;
}

.edition label:hover {
  color: var(--text);
}

.edition input:checked + label {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.edition input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field {
  position: relative;
  min-width: 0;
}

.field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.field input {
  width: 100%;
  padding: 12px 40px 12px 40px;
  background: transparent;
  border: 0;
  outline: none;
  font-family: var(--mono);
  font-size: 0.95rem;
}

.field input::placeholder {
  color: var(--text-faint);
}

.field input.invalid {
  color: var(--bad);
  animation: shake 0.35s;
}

.hint {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.75rem;
  pointer-events: none;
}

.field input:focus ~ .hint,
.field input:not(:placeholder-shown) ~ .hint {
  display: none;
}

@keyframes shake {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, color 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  flex: none;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-icon.is-spinning svg {
  animation: spin 0.8s linear infinite;
}

.btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-primary.is-loading .btn-spinner {
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.recent {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.recent-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.chip:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.link-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 0.8rem;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--accent);
}

.results {
  margin-top: 28px;
}

.card {
  padding: clamp(18px, 3.4vw, 28px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fade 0.35s var(--ease) both;
}

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

.status-head {
  display: flex;
  align-items: center;
  gap: 18px;
}

.icon-wrap {
  flex: none;
  width: 80px;
  height: 80px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.server-icon,
.server-icon-fallback {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.server-icon-fallback {
  background: url("../img/endereye.png") center / cover no-repeat;
  opacity: 0.85;
}

.identity {
  flex: 1;
  min-width: 0;
}

.identity-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.server-host {
  font-size: clamp(1.2rem, 3.4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.badge.online {
  color: var(--good);
  background: var(--good-soft);
}

.badge.offline {
  color: var(--bad);
  background: var(--bad-soft);
}

.address-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.address {
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.btn-copy {
  padding: 5px 12px;
  font-size: 0.82rem;
  border-radius: 8px;
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-copy svg {
  width: 15px;
  height: 15px;
}

.btn-copy .icon-check {
  display: none;
}

.btn-copy.copied {
  background: var(--good-soft);
  border-color: var(--good);
  color: var(--good);
}

.btn-copy.copied .icon-copy {
  display: none;
}

.btn-copy.copied .icon-check {
  display: block;
}

.head-actions {
  display: flex;
  gap: 8px;
  align-self: flex-start;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-text {
  font-size: 1.1rem;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.stat-muted {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0;
}

.stat-note {
  font-size: 0.78rem;
  color: var(--text-faint);
}

.meter {
  display: block;
  height: 6px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.8s var(--ease);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 18px;
  margin-top: 2px;
}

.bars i {
  width: 7px;
  border-radius: 2px;
  background: var(--border-strong);
  transition: background 0.3s;
}

.bars i:nth-child(1) { height: 25%; }
.bars i:nth-child(2) { height: 50%; }
.bars i:nth-child(3) { height: 75%; }
.bars i:nth-child(4) { height: 100%; }

.bars[data-level="excellent"] i:nth-child(-n+4),
.bars[data-level="good"] i:nth-child(-n+3) {
  background: var(--good);
}

.bars[data-level="fair"] i:nth-child(-n+2) {
  background: var(--warn);
}

.bars[data-level="poor"] i:nth-child(-n+1) {
  background: var(--bad);
}

.section-title {
  margin-bottom: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.motd-block {
  margin-top: 24px;
}

.motd {
  padding: 16px 18px;
  background: #16181d;
  border: 1px solid #2a2f3a;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.6;
  color: #aaaaaa;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 4em;
}

.motd .empty {
  color: #8a93a3;
  font-style: italic;
  font-family: var(--font);
}

.motd-line {
  display: block;
  min-height: 1.6em;
}

.mc-obfuscated {
  animation: flicker 0.12s steps(2) infinite;
}

@keyframes flicker {
  50% { opacity: 0.55; }
}

.player-section {
  margin-top: 24px;
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.player-list li {
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.player-list .more {
  color: var(--text-faint);
  background: transparent;
  border-style: dashed;
}

.status-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.tag {
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.foot-note {
  font-size: 0.78rem;
  color: var(--text-faint);
}

.sep {
  margin: 0 4px;
  opacity: 0.6;
}

.error-card {
  display: flex;
  align-items: center;
  gap: 16px;
  border-color: var(--bad);
}

.error-card > div {
  flex: 1;
  min-width: 0;
}

.error-icon {
  flex: none;
  width: 36px;
  height: 36px;
  color: var(--bad);
}

.error-card h2 {
  font-size: 1.05rem;
  margin-bottom: 2px;
}

.error-card p {
  color: var(--text-dim);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.skeleton {
  display: block;
  border-radius: 10px;
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--border) 50%, var(--surface-2) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.skeleton-icon {
  width: 80px;
  height: 80px;
  flex: none;
  border-radius: 14px;
}

.skeleton-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-line {
  height: 16px;
}

.w60 { width: 60%; }
.w35 { width: 35%; }

.skeleton-stat {
  height: 100px;
}

.skeleton-motd {
  height: 76px;
  margin-top: 24px;
}

.site-footer {
  padding: 24px 16px 32px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}

.credit {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.fine {
  font-size: 0.78rem;
  color: var(--text-faint);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

  .edition {
    width: 100%;
  }

  .edition label {
    flex: 1;
    text-align: center;
  }

  .btn-primary {
    width: 100%;
  }

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

  .status-head {
    flex-wrap: wrap;
  }

  .head-actions {
    position: absolute;
    top: 16px;
    right: 16px;
  }

  .card {
    position: relative;
  }

  .icon-wrap {
    width: 64px;
    height: 64px;
  }

  .error-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

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