:root {
  color-scheme: dark;
  --bg: #272727;
  --light: #efefef;
  --text: #e2e8f0;
  --muted: #a8adb3;
  --panel: #1b1b1b;
  --panel-alt: #2d3748;
  --line: #3a4046;
  --green: #22543d;
  --green-bright: #48bb78;
  --green-soft: #c6f6d5;
  --yellow: #d69e2e;
  --teal: #2c7a7b;
  --teal-soft: #b2f5ea;
  --red: #e53e3e;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(351deg, rgba(218,218,218,.04) 0%, rgba(218,218,218,.04) 46%, rgba(145,145,145,.04) 46%, rgba(145,145,145,.04) 75%, rgba(71,71,71,.04) 75%, rgba(71,71,71,.04) 100%),
    linear-gradient(57deg, rgba(218,218,218,.04) 0%, rgba(218,218,218,.04) 43%, rgba(145,145,145,.04) 43%, rgba(145,145,145,.04) 49%, rgba(71,71,71,.04) 49%, rgba(71,71,71,.04) 100%),
    linear-gradient(204deg, rgba(218,218,218,.04) 0%, rgba(218,218,218,.04) 63%, rgba(145,145,145,.04) 63%, rgba(145,145,145,.04) 86%, rgba(71,71,71,.04) 86%, rgba(71,71,71,.04) 100%),
    linear-gradient(90deg, rgb(20,20,20), rgb(20,20,20));
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

a { transition: color .2s ease, border-color .2s ease; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

/* Шапка в стиле Moonrise: логотип, имя сервера, индикатор, статус. */
.topbar { border-bottom: 1px solid rgba(255,255,255,.08); }

.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--light);
  text-decoration: none;
  user-select: none;
}

.brand img {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}

.brand-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .01em;
}

.indicator { color: var(--muted); font-size: 12px; }
.indicator.is-online { color: var(--green-bright); }
.indicator.is-offline { color: var(--red); }

.topbar-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
}

.nav a {
  color: var(--teal-soft);
  text-decoration: none;
}

.nav a:hover,
.nav a:focus-visible,
.nav a[aria-current="page"] { color: var(--light); }

.topbar-status {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}

.topbar-status .dot { margin-right: 7px; }

/* Главный блок */
.hero {
  text-align: center;
  padding: 56px 0 28px;
}

.hero-title {
  margin: 0;
  color: var(--light);
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 600;
  letter-spacing: .01em;
}

.hero-sub {
  margin: 16px 0 0;
  color: var(--text);
  font-size: clamp(17px, 3vw, 24px);
  font-weight: 400;
}

.badge {
  display: inline-block;
  margin-top: 24px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--yellow);
  color: #1a202c;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}

.address-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 30px;
}

.address-panel {
  flex: 1 1 260px;
  max-width: 460px;
  padding: 20px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #f7fafc;
  font-family: var(--mono);
  font-size: clamp(17px, 3vw, 22px);
  text-align: center;
  cursor: pointer;
  user-select: all;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  transition: transform .2s ease;
}

.address-panel:hover { transform: translateY(-2px); }

.address-panel .label {
  display: block;
  margin-bottom: 8px;
  color: var(--green-soft);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero-note {
  margin: 18px auto 0;
  max-width: 72ch;
  color: var(--muted);
  font-size: 13px;
}

/* Разделы */
.section { padding-top: 36px; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

h2 {
  margin: 0;
  color: var(--light);
  font-size: 18px;
  font-weight: 600;
}

h3 {
  margin: 0;
  color: var(--light);
  font-size: 15px;
  font-weight: 600;
}

.intro p {
  max-width: 72ch;
  margin: 0;
  color: var(--muted);
}

.section-note,
.section-note-inline {
  color: var(--muted);
  font-size: 12px;
}

.section-note { margin: 14px 0 0; max-width: 82ch; }

code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #1a1a1a;
  font-family: var(--mono);
  font-size: .92em;
  overflow-wrap: anywhere;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 92px;
  padding: 18px 20px;
  border-right: 1px solid var(--line);
}

.stat:last-child { border-right: 0; }

.stat-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.stat-value {
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: middle;
}

[data-state="online"] .dot { background: var(--green-bright); }
[data-state="offline"] .dot { background: var(--red); }
[data-state="unknown"] .dot { background: var(--muted); }

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

.service {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.service-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.service p { margin: 0; max-width: 60ch; color: var(--text); }
.service .service-address { color: var(--green-bright); font-family: var(--mono); font-size: 22px; }
.service-meta { color: var(--muted); font-size: 12px; }

.donate {
  margin-top: 36px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green-bright);
  border-radius: 8px;
  background: var(--panel);
}

.donate p { max-width: 62ch; color: var(--muted); }

.button {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid #4a5568;
  border-radius: 6px;
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.button:hover,
.button:focus-visible { border-color: var(--teal); color: var(--teal-soft); }

/* Карточки-ссылки внизу главной */
.cells {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  padding: 40px 0 8px;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, #2d3748, #1a202c);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  text-decoration: none;
  overflow: hidden;
  transition: transform .3s ease;
}

.cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 2px, transparent 2px 12px);
  pointer-events: none;
}

.cell:hover { transform: scale(1.03); }

.cell-inner { position: relative; z-index: 1; text-align: center; }

.cell-button {
  display: inline-block;
  padding: 12px 22px;
  border: 1px solid #4a5568;
  border-radius: 6px;
  background: rgba(45,55,72,.95);
  color: var(--light);
  font-size: 18px;
}

.cell:hover .cell-button { border-color: var(--teal); color: var(--teal-soft); }

.cell-caption {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.fade-in { animation: fadeIn .5s ease both; }

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

/* Внутренние страницы */
.layoutpage {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 0 48px;
}

.layoutpage h1 {
  margin: 0 0 20px;
  color: var(--light);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 600;
}

.snackbar {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 30px;
  visibility: hidden;
  min-width: 8em;
  padding: 12px 18px;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  text-align: center;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity .3s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

.snackbar.show { visibility: visible; opacity: 1; }

.layoutfooter {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
  padding: 24px 0 32px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: #888;
  font-size: 12px;
}

.layoutfooter a { color: #888; text-decoration: none; }
.layoutfooter a:hover { color: #bbb; }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(2n) { border-right: 0; }
  .services { grid-template-columns: minmax(0, 1fr); }
  .topbar-status { white-space: normal; }
}

@media (max-width: 520px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .address-panel { max-width: none; }
  .cell { height: 160px; }
}
