.directory-page {
  --directory-live: #08783f;
  --directory-live-soft: #e4f7eb;
  --directory-offline: #776c7d;
}

.directory-page :focus-visible {
  outline: 3px solid #f17b24;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.directory-breadcrumb {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  padding-top: 30px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
}

.directory-breadcrumb a:hover { color: var(--orange); }

.directory-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
  gap: 30px;
  align-items: center;
  padding: 44px 0 36px;
}

.directory-hero h1 {
  max-width: 850px;
  font-size: clamp(2.25rem, 5vw, 4.25rem);
}

.directory-hero-card {
  padding: 28px;
  border: 2px solid rgba(36, 18, 52, .13);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 253, 246, .98), rgba(255, 239, 181, .94));
  box-shadow: var(--shadow);
}

.directory-hero-icon { display: block; font-size: 3.7rem; line-height: 1; }
.directory-hero-card > strong { display: block; margin-top: 14px; font-size: 1.45rem; }
.directory-hero-card > p { margin: 8px 0 18px; }

.mini-stats { display: grid; gap: 10px; margin: 0; }
.mini-stats div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px dashed rgba(36, 18, 52, .2); }
.mini-stats dt { color: var(--muted); font-size: .87rem; font-weight: 800; }
.mini-stats dd { margin: 0; font-weight: 900; }

.freshness {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
}

.freshness-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(255, 212, 71, .23);
}

.freshness.is-live .freshness-dot { background: var(--directory-live); box-shadow: 0 0 0 5px rgba(8, 120, 63, .14); }
.freshness.is-error .freshness-dot { background: #b54727; box-shadow: 0 0 0 5px rgba(181, 71, 39, .14); }

.directory-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 24px;
}

.directory-stats article {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 18px;
  border: 2px solid rgba(36, 18, 52, .11);
  border-radius: 22px;
  background: rgba(255, 253, 246, .94);
  box-shadow: 0 12px 30px rgba(36, 18, 52, .08);
}

.directory-stats article > span { font-size: 1.8rem; }
.directory-stats strong,
.directory-stats small { display: block; }
.directory-stats strong { font-size: clamp(1.2rem, 2.3vw, 1.75rem); line-height: 1.2; }
.directory-stats small { margin-top: 4px; color: var(--muted); font-size: .78rem; font-weight: 800; }

.directory-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.directory-section-head > p { max-width: 540px; }
.section-kicker { color: #a44708; font-size: .82rem; font-weight: 900; }

.directory-table-card {
  border: 2px solid rgba(36, 18, 52, .12);
  border-radius: 28px;
  background: rgba(255, 253, 246, .96);
  box-shadow: 0 18px 54px rgba(36, 18, 52, .1);
}

.directory-toolbar {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto minmax(170px, .32fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  border: 2px solid rgba(36, 18, 52, .11);
  border-radius: 20px;
  background: rgba(255, 253, 246, .92);
}

.directory-toolbar label { font-size: .85rem; }
.directory-search-wrap { position: relative; }
.directory-search-wrap span { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.35rem; pointer-events: none; }
.directory-search-wrap input { padding-inline-start: 42px; }
.directory-toolbar input,
.directory-toolbar select { min-height: 46px; background: #fff; }

.directory-table-card { overflow: hidden; }
.directory-table { width: 100%; border-collapse: collapse; }
.directory-table th { padding: 15px 13px; background: var(--purple); color: #fff; text-align: right; font-size: .82rem; white-space: nowrap; }
.directory-table td { padding: 14px 13px; border-bottom: 1px solid rgba(36, 18, 52, .1); vertical-align: middle; }
.directory-table tbody tr:last-child td { border-bottom: 0; }
.directory-table tbody tr:nth-child(even) { background: rgba(255, 243, 207, .44); }
.directory-table tbody tr:hover { background: #fff2c2; }
.directory-table tbody tr.is-featured { background: linear-gradient(90deg, rgba(255, 212, 71, .32), rgba(255, 253, 246, .95)); box-shadow: inset -5px 0 0 var(--gold); }
.directory-table tbody tr.is-featured .server-name { font-size: 1.03rem; }
.rank-cell { color: var(--muted); font-weight: 900; font-variant-numeric: tabular-nums; }
.server-name { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-weight: 900; }
.server-address { direction: ltr; text-align: right; color: #4c2570; font: 800 .88rem/1.45 Consolas, "Segoe UI", sans-serif; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: .76rem; font-weight: 900; white-space: nowrap; }
.status-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status-chip.is-online { background: var(--directory-live-soft); color: #075f34; }
.status-chip.is-online::before { background: var(--directory-live); }
.status-chip.is-offline { background: #eee9ef; color: #5d5262; }
.status-chip.is-offline::before { background: #8a7f90; }
.server-statuses { display: flex; align-items: center; gap: 6px; }
.blacklist-tag { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: .76rem; font-weight: 900; white-space: nowrap; color: #8b201c; background: #ffebe7; }
.online-count { font-weight: 900; font-variant-numeric: tabular-nums; }
.connect-small { display: inline-flex; align-items: center; justify-content: center; min-width: 68px; min-height: 44px; padding: 7px 12px; border-radius: 12px; background: var(--purple); color: #fff; font-size: .8rem; font-weight: 900; white-space: nowrap; cursor: pointer; touch-action: manipulation; transition: background-color .15s ease, box-shadow .15s ease; }
.connect-small:hover { background: #4c2570; }
.server-connect-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.copy-server-small { min-height: 44px; padding: 7px 10px; border: 1px solid #8f7c98; border-radius: 12px; background: #fffdf6; color: #35174f; font: inherit; font-size: .76rem; cursor: pointer; white-space: nowrap; }
.copy-server-small:hover { background: #fff2c2; }
.connect-small:focus-visible, .copy-server-small:focus-visible { outline: 3px solid #67267d; outline-offset: 3px; }
.connection-help { margin-top: 18px; padding: 16px 20px; border: 1px solid #cfc2d1; border-radius: 16px; background: #fffdf6; }
.connection-help summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
.connection-help p { margin: 8px 0; }
.connect-small:active { background: #35174f; box-shadow: inset 0 2px 5px rgba(0, 0, 0, .2); }
.connect-feedback { position: fixed; z-index: 1000; inset-inline: 16px; bottom: 16px; max-width: 620px; margin-inline: auto; padding: 13px 18px; border: 2px solid rgba(255, 255, 255, .3); border-radius: 15px; background: #241234; color: #fff; box-shadow: 0 16px 48px rgba(36, 18, 52, .32); font-size: .88rem; font-weight: 900; text-align: center; opacity: 0; transform: translateY(18px); pointer-events: none; transition: opacity .15s ease, transform .15s ease; }
.connect-feedback.is-visible { opacity: 1; transform: translateY(0); }
.table-loading { height: 180px; text-align: center; color: var(--muted); font-weight: 800; }
.directory-empty { padding: 34px; text-align: center; color: var(--muted); font-weight: 900; }
.result-count { margin: 11px 3px 0; color: var(--muted); font-size: .84rem; font-weight: 800; }
.noscript-note { padding: 16px; border: 1px solid #d0a936; border-radius: 14px; background: #fff5ca; }

.method-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.method-card { position: relative; padding: 26px; border: 2px solid rgba(36, 18, 52, .11); border-radius: 25px; background: rgba(255, 253, 246, .94); box-shadow: 0 14px 36px rgba(36, 18, 52, .08); }
.method-number { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--gold); font-size: 1.15rem; font-weight: 900; }
.method-card h2 { margin: 14px 0 7px; font-size: 1.25rem; }
.method-card p { margin: 0; font-size: .91rem; }
.method-card a { color: #67267d; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; }
.directory-guide .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.directory-cta { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; padding: 24px; border: 2px solid rgba(36, 18, 52, .14); border-radius: 25px; background: linear-gradient(135deg, #fffdf6, #ffe7a0); box-shadow: 0 16px 40px rgba(36, 18, 52, .09); }
.directory-cta strong { font-size: 1.18rem; }
.directory-cta p { margin: 5px 0 0; }

@media (max-width: 1040px) {
  .directory-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .directory-hero { grid-template-columns: 1fr; padding-top: 32px; }
  .directory-section-head { align-items: start; flex-direction: column; gap: 7px; }
  .directory-toolbar { grid-template-columns: 1fr; }
  .directory-toolbar label { margin-top: 3px; }
  .directory-guide .grid { grid-template-columns: 1fr; }
  .directory-cta { align-items: flex-start; flex-direction: column; }

  .directory-table thead { display: none; }
  .directory-table,
  .directory-table tbody,
  .directory-table tr,
  .directory-table td { display: block; width: 100%; }
  .directory-table tbody { display: grid; gap: 12px; padding: 12px; }
  .directory-table tbody tr { padding: 13px; border: 1px solid rgba(36, 18, 52, .13); border-radius: 18px; background: #fffdf6; }
  .directory-table tbody tr:nth-child(even) { background: #fff9e8; }
  .directory-table tbody tr.is-featured { border-color: #c99516; box-shadow: inset -5px 0 0 var(--gold); }
  .directory-table td { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 9px 7px; border-bottom: 1px dashed rgba(36, 18, 52, .13); }
  .directory-table td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; font-weight: 900; }
  .directory-table td:last-child { border-bottom: 0; }
  .directory-table .table-loading { display: block; height: auto; }
  .directory-table .table-loading::before { content: none; }
}

@media (max-width: 620px) {
  .directory-breadcrumb { padding-top: 20px; }
  .directory-hero h1 { font-size: clamp(2.05rem, 11vw, 3rem); }
  .directory-stats { grid-template-columns: 1fr; }
  .directory-table tbody { padding: 8px; }
  .directory-table td { grid-template-columns: 92px minmax(0, 1fr); }
}

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