/* Вёрстка пишется от телефона к компьютеру. Цвета только из переменных тем (themes.css). */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--noise), var(--bg); background-size: 64px 64px, auto;
  color: var(--ink); font: 16px/1.5 var(--font-body); image-rendering: pixelated;
  min-height: 100vh; display: flex; flex-direction: column;
}
body.noscroll { overflow: hidden; }
main { flex: 1 0 auto; }
a { color: var(--link); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px dashed var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; }
.wrap { max-width: 1180px; margin: 0 auto; width: 100%;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Пиксельная панель: контур и фаска */
.panel { background: var(--surface); border: 2px solid var(--edge); box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--lo); }
.mcbtn { display: inline-block; font-family: var(--font-body); font-weight: 700; font-size: 16px; text-decoration: none; text-align: center;
  background: var(--btn); color: var(--btn-ink); border: 2px solid var(--edge);
  box-shadow: inset 2px 2px 0 var(--hi), inset -2px -3px 0 var(--lo); padding: 5px 12px; border-radius: 0; }
.mcbtn:active { box-shadow: inset -2px -2px 0 var(--hi), inset 2px 3px 0 var(--lo); }
.mcbtn.green, .mcbtn.on { background: var(--accent); color: var(--accent-ink); }
.mcbtn.on { box-shadow: inset -2px -2px 0 var(--hi), inset 2px 3px 0 var(--lo); }
@media (hover: hover) { .mcbtn:hover { filter: brightness(1.06); } }

/* Шапка */
header.top { background: var(--top-color) var(--top-tex); background-size: 32px 32px; }
.top-row { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding-block: 12px 8px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--brand-ink); text-decoration: none; text-shadow: 2px 2px 0 var(--brand-shadow);
  display: flex; align-items: center; gap: 10px; margin-right: auto; min-height: 44px; }
.brand svg { width: 28px; height: 28px; shape-rendering: crispEdges; filter: drop-shadow(2px 2px 0 var(--brand-shadow)); }
.menu { display: flex; gap: 0 18px; font-weight: 700; flex-wrap: wrap; order: 3; width: 100%; }
.menu a { color: var(--menu-ink); text-decoration: none; text-shadow: 1px 1px 0 var(--brand-shadow); min-height: 44px; display: inline-flex; align-items: center; }
.menu a.on { color: var(--menu-on); text-decoration: underline; text-underline-offset: 4px; }
.menu-toggle { display: none; }
.dirt { height: 22px; background: var(--edge-color) var(--edge-tex); background-size: 32px 22px; border-bottom: 2px solid var(--edge); }
.themes { position: relative; }
.themes-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 6px; list-style: none; width: 220px; }
.themes-list button { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; background: none; border: 0; text-align: left; font-weight: 600; }
.themes-list button[aria-pressed="true"] { background: var(--accent-soft); }
.swatches svg { display: block; width: 42px; height: 14px; border: 2px solid var(--edge); }
@media (hover: hover) { .themes-list button:hover { background: var(--surface-2); } }
@media (scripting: none) { .themes { display: none; } }
@media (scripting: enabled) and (max-width: 860px) {
  .menu-toggle { display: inline-block; }
  .menu { display: none; }
  .menu.open { display: flex; }
}

.stale { background: var(--gold); color: var(--badge-ink); font-weight: 600; border-bottom: 2px solid var(--edge); }
.stale .wrap { padding-block: 8px; }

/* Поиск */
.hero .wrap { padding-block: 20px 14px; display: grid; gap: 12px; }
.hero h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; margin: 0; text-wrap: balance; }
.searchbox { position: relative; }
.searchbox input[type="search"] { width: 100%; font: 500 18px var(--font-body); padding: 14px 16px; border: 2px solid var(--field-edge); border-radius: 0; background: var(--surface); color: var(--ink);
  box-shadow: inset 3px 3px 0 var(--lo); -webkit-appearance: none; appearance: none; }
.searchbox input[type="search"]:focus { outline: none; border-color: var(--accent); box-shadow: inset 3px 3px 0 var(--lo), 0 0 0 2px var(--accent); }
.searchbox kbd { display: none; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font: 600 14px var(--font-display); color: var(--muted); border: 2px solid var(--edge); padding: 0 7px; background: var(--btn); box-shadow: inset 1px 1px 0 var(--hi), inset -1px -2px 0 var(--lo); }
@media (hover: hover) and (pointer: fine) {
  .searchbox kbd { display: block; }
  .searchbox input[type="search"] { padding-right: 56px; }
}
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--tip-bg); color: var(--tip-ink); border: 2px solid var(--tip-outer); box-shadow: inset 0 0 0 2px var(--tip-edge), 4px 4px 0 var(--shadow); z-index: 15; padding: 6px; max-height: 40vh; overflow-y: auto; }
.suggest button { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 44px; border: 0; background: none; padding: 6px 10px; text-align: left; color: var(--tip-ink); }
.suggest button.sel { background: rgb(255 255 255 / .12); }
@media (hover: hover) { .suggest button:hover { background: rgb(255 255 255 / .12); } }
.suggest .k { margin-left: auto; color: var(--tip-muted); font-size: 14px; text-align: right; }
.suggest svg, .suggest img { width: 24px; height: 24px; flex: none; }
.suggest .tagico { width: 24px; height: 24px; flex: none; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 14px var(--font-display); }
.understood { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; color: var(--muted); font-size: 15px; min-height: 26px; }
.understood:empty { display: none; }
.why { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: baseline; background: var(--surface); border: 2px solid var(--edge); padding: 1px 9px; }
.why b { color: var(--ink); font-weight: 600; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 15px; }
.examples a { display: inline-flex; align-items: center; border: 2px dashed var(--muted); padding: 2px 9px; font: 14px var(--font-mono); color: var(--ink); text-decoration: none; }
@media (hover: hover) { .examples a:hover { border-color: var(--accent); border-style: solid; } }

/* Каталог */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-block: 8px 48px; align-items: start; }
.filters { padding: 4px 0; }
.fgroup { padding: 10px 14px; border-top: 2px solid var(--surface-2); }
.fgroup:first-child { border-top: 0; }
.fgroup h2 { margin: 0 0 6px; font: 700 14px var(--font-body); color: var(--muted); }
.optrow { display: flex; align-items: center; gap: 4px; }
.opt { display: flex; flex: 1; min-width: 0; align-items: center; gap: 10px; padding: 4px; color: inherit; text-decoration: none; font-size: 15px; }
.opt .label { min-width: 0; }
.opt .box { width: 20px; height: 20px; flex: none; background: var(--slot); box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--slot-hi); display: grid; place-items: center; color: var(--accent-ink); }
.opt .box svg { width: 12px; height: 12px; shape-rendering: crispEdges; visibility: hidden; }
.opt.on .box { background: var(--accent); }
.opt.on .box svg { visibility: visible; }
.opt.on .label { font-weight: 700; }
.opt .n { margin-left: auto; color: var(--muted); font: 600 15px var(--font-display); font-variant-numeric: tabular-nums; }
.opt.zero, .opt.zero .n, .pill.zero, .pill.zero small { color: var(--muted); }
@media (hover: hover) { .opt:hover { background: var(--surface-2); } }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 15px; background: var(--btn); color: var(--btn-ink); border: 2px solid var(--edge); box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--lo); padding: 2px 8px; text-decoration: none; }
.pill.on { background: var(--accent); color: var(--accent-ink); box-shadow: inset -2px -2px 0 var(--hi), inset 2px 2px 0 var(--lo); }
.pill small { margin-left: 4px; font-size: 14px; }
.filters-done { display: none; }

@media (scripting: enabled) and (max-width: 860px) {
  .filters { display: none; }
  .filters.open { display: block; position: fixed; inset: 0; z-index: 30; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .filters.open .filters-done { display: block; position: sticky; bottom: 0; padding: 12px; background: var(--surface); border-top: 2px solid var(--edge); }
  .filters-done .mcbtn { width: 100%; min-height: 48px; }
}

.reshead { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.reshead h2 { margin: 0; font-size: 22px; }
.reshead h2 span { color: var(--muted); font-weight: 500; }
#mobfilters { display: none; }
@media (scripting: enabled) and (max-width: 860px) { #mobfilters { display: inline-block; } }
.sort { display: none; margin-left: auto; gap: 4px; flex-wrap: wrap; }
.sort .mcbtn { font-size: 15px; padding: 3px 10px; }
.sort-select { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.sort-select label { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 15px; }
.sort-select select { font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 2px solid var(--field-edge); border-radius: 0; padding: 6px; min-height: 44px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); border: 2px solid var(--edge); padding: 1px 3px 1px 10px; font-size: 15px; font-weight: 600; }
.chip.fromq { border-style: dashed; border-color: var(--accent-text); }
.chip a { width: 24px; height: 24px; display: grid; place-items: center; color: var(--ink); font: 700 18px var(--font-display); line-height: 1; text-decoration: none; }
@media (hover: hover) { .chip a:hover { background: var(--red); color: var(--on-red); } }
.reset { color: var(--link); font-size: 15px; }

.list { display: grid; gap: 12px; }
.card { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; padding: 14px; align-items: start; }
.card > * { min-width: 0; }
.card.down { background: var(--surface-2); }
.ava svg, .ava img { width: 100%; height: auto; aspect-ratio: 1; display: block; border: 2px solid var(--edge); shape-rendering: crispEdges; image-rendering: pixelated; }
.card h3 { margin: 0; font-size: 21px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.15; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.badge { font: 700 14px var(--font-body); border: 2px solid var(--edge); padding: 0 6px; background: var(--gold); color: var(--badge-ink); }
.badge.newbie { background: var(--newbie); color: var(--newbie-ink); }
.badge.offb { background: var(--red); color: var(--on-red); }
.slogan { margin: 4px 0 8px; color: var(--muted); font-size: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; padding: 0 7px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--lo); }
.tag.hit { background: var(--accent-soft); font-weight: 700; border-color: var(--accent-text); }
.card.down .tag { background: var(--surface); }
mark { background: var(--mark); color: var(--mark-ink); padding: 0 1px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin: 8px 0 0; color: var(--muted); font-size: 14px; }

/* Объяснения открываются нажатием: details работает и без JS */
.tip { display: inline-block; position: relative; }
.tip summary { list-style: none; cursor: pointer; }
.tip summary::-webkit-details-marker { display: none; }
.tip summary:not(.tip-text) { display: inline-grid; place-items: center; width: 22px; height: 22px; font: 700 14px var(--font-body); background: var(--btn); color: var(--btn-ink); border: 1px solid var(--edge); }
.tip-text { text-decoration: underline dotted; text-underline-offset: 3px; }
.tip-body { position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 25; padding: 10px 12px; font-size: 15px; font-weight: 400; background: var(--tip-bg); color: var(--tip-ink); border: 2px solid var(--tip-outer); box-shadow: inset 0 0 0 2px var(--tip-edge); }
@media (min-width: 861px) {
  .tip-body { position: absolute; left: 0; right: auto; bottom: auto; top: calc(100% + 4px); width: 280px; }
  .stats .tip-body { left: auto; right: 0; }
}

.stats { grid-column: 1 / -1; display: grid; gap: 10px; font-size: 15px; }
.plat { display: grid; gap: 5px; }
.plat + .plat { border-top: 2px solid var(--surface-2); padding-top: 10px; }
.card.down .plat + .plat { border-top-color: var(--surface); }
.plat-head { font-size: 14px; font-weight: 700; color: var(--muted); }
.plat-meta { color: var(--muted); font-size: 14px; }
.online { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-items: center; }
.dot { width: 12px; height: 12px; background: var(--muted); border: 2px solid var(--edge); }
.plat[data-state="online"] .dot { background: var(--good); }
.plat[data-state="offline"] .dot { background: var(--bad); }
.online b { font: 700 19px var(--font-display); font-variant-numeric: tabular-nums; }
.state-text { font-weight: 600; }
.xp { grid-column: 1 / -1; position: relative; height: 12px; background: var(--xp-bg); border: 2px solid var(--edge); }
.xp svg { display: block; width: 100%; height: 100%; }
.xp-top { fill: var(--xp-1); }
.xp-fill { fill: var(--xp-2); }
.xp::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), var(--edge) calc(10% - 2px) 10%); }
.ip { display: flex; flex-direction: column; gap: 6px; }
.ip code, .port { font: 500 14px var(--font-mono); background: var(--surface-2); border: 2px solid var(--edge); padding: 4px 7px; overflow-wrap: anywhere; }
.card.down .ip code { background: var(--surface); }
.ip .mcbtn { width: 100%; min-height: 44px; }
.onlypc { margin: 0; font-size: 14px; font-weight: 700; color: var(--accent-text); }
@media (scripting: none) { [data-copy] { display: none; } }

.empty { padding: 22px; display: grid; gap: 10px; justify-items: start; }
.empty h1, .empty h3 { margin: 0; font-size: 22px; }
.empty p { margin: 0; color: var(--muted); }
.status-page { padding-block: 32px; }

.joinhelp { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); bottom: max(12px, env(safe-area-inset-bottom, 0px)); z-index: 22; padding: 14px 16px; max-height: 70vh; overflow-y: auto; }
.joinhelp h2 { margin: 0 44px 6px 0; font-size: 20px; }
.joinhelp ol { margin: 0 0 8px; padding-left: 22px; }
.joinhelp-warn { margin: 0 0 8px; color: var(--muted); }
.joinhelp-close { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; background: none; border: 0; font: 700 22px var(--font-display); }

.foot { margin-top: auto; background: var(--surface-2); border-top: 2px solid var(--edge); color: var(--muted); font-size: 15px; }
.foot .wrap { padding-block: 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
.foot p { margin: 0 0 4px; }

/* Страница сервера */
.server-page { padding-block: 14px 48px; display: grid; gap: 14px; }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.srv-head { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; padding: 16px; align-items: start; }
.srv-head h1 { margin: 0; font-size: 28px; line-height: 1.15; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.srv-head .slogan { margin: 6px 0 10px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs .mcbtn { min-height: 44px; display: inline-flex; align-items: center; }
.srv-status, .srv-section { padding: 16px; display: grid; gap: 12px; }
.srv-section h2, .srv-status h2 { margin: 0; font-size: 22px; }
.bigstate { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; flex-wrap: wrap; }
.bigstate b { font: 700 28px var(--font-display); }
.bigstate .dot { width: 16px; height: 16px; }
.srv-status[data-state="online"] .dot { background: var(--good); }
.srv-status[data-state="offline"] .dot { background: var(--bad); }
.address { display: grid; gap: 8px; }
.address-fields { display: grid; gap: 8px; }
.field-label { display: block; font-size: 14px; font-weight: 700; color: var(--muted); }
.address code { display: block; font: 500 18px var(--font-mono); background: var(--surface-2); border: 2px solid var(--edge); padding: 8px 10px; overflow-wrap: anywhere; }
.address .mcbtn { min-height: 52px; font-size: 18px; width: 100%; }
.srv-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 15px; margin: 0; }
.steps { margin: 0; padding-left: 24px; display: grid; gap: 6px; }
.warn { margin: 0; padding: 8px 12px; background: var(--accent-soft); border-left: 6px solid var(--accent-text); }
.note { margin: 0; color: var(--muted); }
.facts { display: grid; gap: 6px; margin: 0; }
.facts div { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }

.chart-top { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.ranges { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.ranges .mcbtn { min-height: 44px; display: inline-flex; align-items: center; font-size: 15px; }
.plot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; }
.yaxis { display: flex; flex-direction: column; justify-content: space-between; text-align: right; color: var(--muted); font-size: 14px; height: 180px; font-variant-numeric: tabular-nums; }
.chart svg { display: block; width: 100%; height: 180px; border: 2px solid var(--edge); background: var(--surface-2); cursor: pointer; shape-rendering: crispEdges; }
.bar { fill: var(--chart-bar); }
.bar.down { fill: var(--chart-down); }
.bar.sel { fill: var(--chart-sel); }
.grid-line { stroke: var(--chart-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.xaxis { grid-column: 2; display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.xaxis .extra { display: none; }
.chart-read { min-height: 24px; margin: 0; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 5px; border: 1px solid var(--edge); vertical-align: -1px; }
.legend .l-up { background: var(--chart-bar); }
.legend .l-down { background: var(--chart-down); }
.insight { margin: 0; font-weight: 600; }

/* Страница помощи */
.help-page { padding-block: 16px 48px; display: grid; gap: 14px; max-width: 860px; }
.help-page h1 { margin: 0; font-size: clamp(28px, 4vw, 36px); }
.glossary { display: grid; gap: 8px; margin: 0; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0 0 6px; color: var(--muted); }

/* Сенсорные экраны: все нажимаемые элементы не меньше 44×44 */
@media (pointer: coarse) {
  .mcbtn, .pill, .examples a, .reset { min-height: 44px; }
  .mcbtn, .pill, .examples a { display: inline-flex; align-items: center; justify-content: center; }
  .opt { min-height: 44px; }
  .chip a { width: 44px; height: 44px; }
  .tip summary:not(.tip-text) { width: 44px; height: 44px; }
  .tip-text { display: inline-flex; align-items: center; min-height: 44px; }
  .reset { display: inline-flex; align-items: center; }
  .crumbs a, .foot a, .card h3 a, .srv-section > a, .joinhelp > a { min-height: 44px; display: inline-flex; align-items: center; }
}

/* Компьютер */
@media (min-width: 861px) {
  body { font-size: 17px; }
  .brand { margin-right: 0; }
  .menu { order: 0; width: auto; margin-right: auto; margin-left: 12px; }
  .layout { grid-template-columns: 260px minmax(0, 1fr); gap: 22px; }
  .filters { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
  .sort { display: flex; }
  .sort-select { display: none; }
  .card { grid-template-columns: 56px minmax(0, 1fr) 320px; gap: 16px; padding: 14px 16px; }
  .stats { grid-column: auto; }
  .ip { flex-direction: row; align-items: stretch; }
  .ip code { flex: 1; min-width: 0; }
  .ip .mcbtn { width: auto; min-height: 0; flex: none; font-size: 15px; padding: 2px 8px; }
  .joinhelp { left: auto; right: 16px; bottom: 16px; width: 380px; }
  .srv-head { grid-template-columns: 64px minmax(0, 1fr); }
  .address-fields.two { grid-template-columns: minmax(0, 1fr) 140px; }
  .address .mcbtn { width: auto; justify-self: start; padding-inline: 28px; }
  .xaxis .extra { display: inline; }
}
@media (hover: hover) and (min-width: 861px) {
  .card { transition: transform .08s, box-shadow .08s; }
  .card:hover { transform: translate(-2px, -2px); box-shadow: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--lo), 4px 4px 0 var(--edge); }
}
@media (prefers-reduced-motion: reduce) { .card, .card:hover { transition: none; transform: none; } }
