/* Layout: one wide column on a tiled "test chamber" ground, a top bar with a hazard edge,
   mods as numbered inventory tags, the blog as a dated lab log. No sidebar. */
:root {
  --ground: #e4e5e1;      /* concrete */
  --tile: #d6d8d3;        /* grid lines on the ground, like the in-game map */
  --sheet: #f7f7f4;       /* cards, panels */
  --ink: #16171a;
  --ink-2: #5c5f63;       /* secondary text */
  --rule: #c5c8c2;
  --hazard: #ffc21a;      /* the one loud colour */
  --on-hazard: #16171a;
  --signal: #c8372c;      /* danger */
  --go: #1d7f47;
  --wait: #a86b00;
  --field: #ffffff;
  --edge: #16171a;        /* outlines and hard shadows */

  --display: 'Big Shoulders Display', 'Arial Narrow', 'Roboto Condensed', Impact, sans-serif;
  --sans: 'Instrument Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --r: 3px;
  --max: 1180px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #141517; --tile: #1c1e21; --sheet: #1d1f22; --ink: #ecebe6; --ink-2: #9c9fa3;
    --rule: #33363a; --hazard: #ffc21a; --on-hazard: #16171a; --signal: #ff6b5e; --go: #4cc47f; --wait: #f0b440;
    --field: #141517; --edge: #55595f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #141517; --tile: #1c1e21; --sheet: #1d1f22; --ink: #ecebe6; --ink-2: #9c9fa3;
  --rule: #33363a; --hazard: #ffc21a; --on-hazard: #16171a; --signal: #ff6b5e; --go: #4cc47f; --wait: #f0b440;
  --field: #141517; --edge: #55595f; color-scheme: dark;
}

* { box-sizing: border-box; }
/* Атрибут hidden должен скрывать всегда, даже если у элемента в CSS задан display (grid, flex) */
[hidden] { display: none !important; }
html { background: var(--ground); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  color: var(--ink); font: 15px/1.6 var(--sans);
  background-color: var(--ground);
  background-image:
    linear-gradient(var(--tile) 1px, transparent 1px),
    linear-gradient(90deg, var(--tile) 1px, transparent 1px);
  background-size: 40px 40px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--edge); outline-offset: 2px; box-shadow: 0 0 0 4px var(--hazard); }
h1, h2, h3 { text-wrap: balance; }

.hazard { height: 6px; background: repeating-linear-gradient(-45deg, var(--hazard) 0 10px, var(--ink) 10px 20px); }
.label { font: 500 11px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- notice ---------- */
.notice { background: var(--ink); color: var(--ground); }
.notice-in { max-width: var(--max); margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.notice-tag { flex: none; padding: 3px 8px; background: var(--hazard); color: var(--on-hazard); font: 600 11px var(--mono); letter-spacing: .1em; }
.notice-in p { margin: 0; flex: 1; min-width: 0; }
.notice-in b { font-weight: 600; margin-right: 6px; }
.notice .x { flex: none; border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; font-size: 20px; line-height: 1; padding: 2px 6px; }
.notice .x:hover { opacity: 1; }

/* ---------- top bar ---------- */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--sheet); border-bottom: 1px solid var(--rule); }
.bar-in { max-width: var(--max); margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 24px; min-height: 64px; }
.mark { display: flex; align-items: stretch; flex: none; }
.mark-name { display: grid; place-items: center; padding: 0 10px; background: var(--hazard); color: var(--on-hazard); font: 600 21px/1 var(--mono); letter-spacing: .02em; height: 40px;  text-transform: uppercase; }
.mark-sub { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--edge); border-left: 0; font: 600 11px var(--mono); letter-spacing: .12em; height: 40px;  text-transform: uppercase; }

.nav { display: flex; gap: 2px; flex: 1; min-width: 0; }
.nav a { padding: 8px 12px; font: 700 17px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); border-radius: var(--r); }
.nav a:hover { color: var(--ink); background: var(--ground); }
.nav a.on { color: var(--ink); box-shadow: inset 0 -3px 0 var(--hazard); border-radius: 0; }

.bar-act { display: flex; align-items: center; gap: 8px; flex: none; position: relative; }
.who { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid var(--rule); border-radius: var(--r); background: none; cursor: pointer; font: 500 13px var(--mono); }
.who:hover { border-color: var(--edge); }
.avatar { width: 26px; height: 26px; display: grid; place-items: center; background: var(--ink); color: var(--sheet); font: 800 15px var(--display); border-radius: 2px; }
.menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; min-width: 210px; padding: 6px; background: var(--sheet); border: 1px solid var(--edge); box-shadow: 4px 4px 0 var(--edge); display: flex; flex-direction: column; }
.menu a, .menu button { text-align: left; border: 0; background: none; cursor: pointer; padding: 9px 10px; font-size: 14px; border-radius: 2px; }
.menu a:hover, .menu button:hover { background: var(--ground); }
.menu hr { border: 0; border-top: 1px solid var(--rule); margin: 4px 0; }
.menu .label { padding: 6px 10px 2px; }

/* ---------- page shell ---------- */
.wrap { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: 32px 16px 72px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 0 0 24px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.page-h h1 { margin: 0; font: 900 clamp(36px, 6vw, 56px)/.95 var(--display); text-transform: uppercase; letter-spacing: .01em; }
.page-h .label { padding-bottom: 4px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 48px 0 16px; }
.sec-h h2 { margin: 0; font: 800 28px/1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.sec-h a { font: 500 13px var(--mono); text-decoration: underline; text-underline-offset: 3px; }
.sec-h a:hover { background: var(--hazard); color: var(--on-hazard); }

/* ---------- home intro ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0; background: var(--sheet); border: 1px solid var(--edge); }
.intro-txt { padding: clamp(20px, 4vw, 40px); display: grid; gap: 16px; align-content: start; }
.intro-h { margin: 0; font: 900 clamp(40px, 7vw, 76px)/.9 var(--display); text-transform: uppercase; letter-spacing: -.005em; }
/* inline-block: жёлтая плашка получает свою высоту строки и не наезжает на соседние строки */
.intro-h mark { display: inline-block; margin-top: .1em; padding: .04em .1em 0; line-height: 1; background: var(--hazard); color: var(--on-hazard); }
.intro.solo { grid-template-columns: minmax(0, 1fr); }
.intro-txt p { margin: 0; max-width: 52ch; color: var(--ink-2); font-size: 16px; }
.readout { margin: 0; display: grid; grid-template-rows: repeat(3, 1fr); border-left: 1px solid var(--edge); }
.readout div { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--rule); }
.readout div:first-child { border-top: 0; }
.readout dt { font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.readout dd { margin: 0; font: 800 52px/1 var(--display); font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--edge); border-radius: var(--r); background: transparent; cursor: pointer; font: 700 16px/1 var(--display); text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
.btn:hover { background: var(--ink); color: var(--sheet); }
.btn.primary { background: var(--hazard); color: var(--on-hazard); border-color: var(--edge); box-shadow: 3px 3px 0 var(--edge); }
.btn.primary:hover { background: var(--hazard); color: var(--on-hazard); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--edge); }
.btn.primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--edge); }
.btn.ghost { border-color: var(--rule); }
.btn.danger { color: var(--signal); border-color: var(--signal); }
.btn.danger:hover { background: var(--signal); color: var(--sheet); }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; box-shadow: none; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 10px; font-size: 14px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--rule); border-radius: var(--r); background: none; color: var(--ink-2); cursor: pointer; font: 500 12px var(--mono); }
.chip:hover { border-color: var(--edge); color: var(--ink); }
.chip.on { color: var(--on-hazard); background: var(--hazard); border-color: var(--edge); }
.stat { display: inline-flex; align-items: center; gap: 5px; font: 500 12px var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 7px; font: 600 10px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase; border: 1px solid currentColor; vertical-align: middle; }
.badge.published { color: var(--go); }
.badge.rejected { color: var(--signal); }
.badge.pending { color: var(--on-hazard); border-color: var(--edge); background: repeating-linear-gradient(-45deg, var(--hazard) 0 6px, #f3d77a 6px 12px); }
.badge.tiered { color: var(--sheet); background: var(--ink); border-color: var(--edge); }
.badge.admin { color: var(--ink); border-color: var(--hazard); background: var(--hazard); color: var(--on-hazard); }

/* ---------- mod tags (cards) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.tag-card { position: relative; display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--edge); transition: transform .15s ease, box-shadow .15s ease; }
.tag-card:hover { transform: translate(-3px, -3px); box-shadow: 5px 5px 0 var(--edge); }
.tag-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; padding: 0 10px; border-bottom: 1px solid var(--edge); font: 600 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.tag-top .no { display: inline-flex; align-items: center; gap: 8px; }
.tag-top .no::before { content: ''; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--edge); background: var(--ground); } /* the hole of a hanging tag */
.cover { display: block; aspect-ratio: 4 / 3; background: var(--ground); overflow: hidden; border-bottom: 1px solid var(--edge); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.ph { width: 100%; height: 100%; display: grid; place-items: center; position: relative;
  background:
    linear-gradient(hsl(var(--h) 25% 50% / .18) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, hsl(var(--h) 25% 50% / .18) 1px, transparent 1px) 0 0 / 20px 20px,
    hsl(var(--h) 30% 82%);
  color: hsl(var(--h) 45% 22%); font: 900 clamp(48px, 9vw, 96px)/1 var(--display); letter-spacing: .02em; user-select: none; }
:root[data-theme="dark"] .ph { background-color: hsl(var(--h) 20% 18%); color: hsl(var(--h) 60% 75%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ph { background-color: hsl(var(--h) 20% 18%); color: hsl(var(--h) 60% 75%); } }
.tag-body { flex: 1; display: grid; grid-template-rows: auto 1fr; gap: 6px; padding: 14px 14px 12px; }
.tag-body h3 { margin: 0; font: 800 24px/1.02 var(--display); text-transform: uppercase; letter-spacing: .01em; }
.tag-body h3 a::after { content: ''; position: absolute; inset: 0; } /* whole card clickable */
.tag-body p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.tag-foot { display: flex; align-items: center; gap: 14px; padding: 9px 14px; border-top: 1px dashed var(--rule); }
.tag-foot .sp { flex: 1; }

/* ---------- lab log (blog) ---------- */
.log { display: grid; border-top: 2px solid var(--ink); }
.log-row { display: grid; grid-template-columns: 110px 200px minmax(0, 1fr); gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.log-date { font: 500 12px/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.log-date b { display: block; font: 800 40px/1 var(--display); color: var(--ink); letter-spacing: 0; }
.log-row .cover { aspect-ratio: 16 / 10; border: 1px solid var(--edge); }
.log-row h3 { margin: 0 0 6px; font: 800 30px/1 var(--display); text-transform: uppercase; }
.log-row h3 a:hover { background: var(--hazard); color: var(--on-hazard); }
.log-row p { margin: 0 0 12px; color: var(--ink-2); max-width: 62ch; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.meta .sp { flex: 1; }

/* ---------- article / mod sheet ---------- */
.article { max-width: 760px; margin: 0 auto; }
.article-h { margin: 0 0 12px; font: 900 clamp(40px, 7vw, 68px)/.92 var(--display); text-transform: uppercase; }
.article .cover { aspect-ratio: 16 / 9; border: 1px solid var(--edge); margin: 20px 0 24px; }
.article .meta { padding-bottom: 14px; border-bottom: 1px solid var(--rule); }

.sheet { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.sheet-main { min-width: 0; }
.sheet-main .cover { aspect-ratio: 16 / 9; border: 1px solid var(--edge); }
.sheet-title { margin: 22px 0 8px; font: 900 clamp(40px, 6.5vw, 64px)/.92 var(--display); text-transform: uppercase; }
.sheet-sum { margin: 0 0 20px; font-size: 18px; color: var(--ink-2); max-width: 60ch; }
.spec { position: sticky; top: 88px; background: var(--sheet); border: 1px solid var(--edge); }
.spec-h { display: flex; justify-content: space-between; padding: 8px 14px; background: var(--ink); color: var(--sheet); font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.spec dl { margin: 0; }
.spec dl div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--rule); }
.spec dt { font: 500 11px/1.8 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.spec dd { margin: 0; font: 600 14px var(--mono); text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.spec-act { display: grid; gap: 10px; padding: 14px; }
.spec-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 14px; }
.manage { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; border-top: 1px dashed var(--rule); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.prose { max-width: 68ch; font-size: 16px; }
.prose h3, .prose h4 { font-family: var(--display); text-transform: uppercase; letter-spacing: .02em; margin: 28px 0 8px; line-height: 1.05; }
.prose h3 { font-size: 28px; font-weight: 800; }
.prose h4 { font-size: 21px; font-weight: 700; }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0 0 14px; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.prose li { display: flex; gap: 10px; }
.prose li::before { content: ''; flex: none; width: 8px; height: 8px; margin-top: .6em; background: var(--hazard); outline: 1px solid var(--edge); }
.prose code { padding: 1px 5px; background: var(--ground); border: 1px solid var(--rule); font: 13px var(--mono); }
.prose a { text-decoration: underline; text-decoration-color: var(--hazard); text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* version history */
.versions { margin: 36px 0 0; }
.ver { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--rule); }
.ver-n { font: 800 24px/1 var(--display); }
.ver-n small { display: block; margin-top: 6px; font: 500 11px var(--mono); color: var(--ink-2); letter-spacing: .04em; }
.ver p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ver .label { margin-top: 6px; }
.ver.current .ver-n { color: var(--ink); }
.ver.current .ver-n::after { content: 'current'; display: inline-block; margin-left: 6px; padding: 1px 5px; vertical-align: 4px; background: var(--hazard); color: var(--on-hazard); font: 600 9px var(--mono); letter-spacing: .1em; text-transform: uppercase; }

/* ---------- catalogue ---------- */
.catalogue { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 32px; align-items: start; }
.filters { position: sticky; top: 88px; display: grid; gap: 22px; }
.filters .label { display: block; margin-bottom: 8px; }
.filters input[type=search] { width: 100%; padding: 10px 12px; background: var(--field); border: 1px solid var(--edge); border-radius: var(--r); }
.seg { display: grid; border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden; }
.seg a { padding: 8px 12px; font-size: 14px; border-top: 1px solid var(--rule); }
.seg a:first-child { border-top: 0; }
.seg a:hover { background: var(--ground); }
.seg a.on { background: var(--ink); color: var(--sheet); }
.taglist { display: grid; gap: 2px; }
.taglist a { display: flex; justify-content: space-between; padding: 5px 8px; font: 500 13px var(--mono); border-radius: 2px; }
.taglist a span { color: var(--ink-2); }
.taglist a:hover { background: var(--sheet); }
.taglist a.on { background: var(--hazard); color: var(--on-hazard); }
.taglist a.on span { color: inherit; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin: 28px 0 0; }

/* ---------- forms ---------- */
.panel { background: var(--sheet); border: 1px solid var(--edge); padding: clamp(18px, 3vw, 28px); }
.panel > p:first-child { margin-top: 0; }
.narrow { max-width: 760px; }
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; background: var(--field); border: 1px solid var(--rule); border-radius: var(--r); }
.field input[type=file] { padding: 8px; border-style: dashed; }
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--edge); outline: none; box-shadow: 0 0 0 3px var(--hazard); }
.field small { color: var(--ink-2); font-size: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.err { color: var(--signal); font-size: 14px; min-height: 1.2em; }
.hint { margin: 0 0 18px; padding: 10px 12px; border-left: 4px solid var(--hazard); background: var(--ground); font-size: 14px; }
.fieldset-h { margin: 8px 0 -6px; font: 800 22px/1 var(--display); text-transform: uppercase; }

/* ---------- comments ---------- */
.comments { margin-top: 44px; }
.comments h2 { margin: 0 0 4px; font: 800 28px/1 var(--display); text-transform: uppercase; }
.cm { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--rule); }
.cm .avatar { width: 34px; height: 34px; font-size: 18px; }
.cm-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font: 500 12px var(--mono); color: var(--ink-2); }
.cm-h b { color: var(--ink); font-size: 13px; }
.cm-h .sp { flex: 1; }
.cm p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm .del { border: 0; background: none; color: var(--ink-2); cursor: pointer; font: 12px var(--mono); text-decoration: underline; }
.cm .del:hover { color: var(--signal); }
.comments .form { margin-top: 16px; padding-top: 16px; border-top: 2px solid var(--edge); }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-2); border: 1px dashed var(--ink-2); background: var(--sheet); }

/* ---------- support tiers ---------- */
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.tier { display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--edge); }
.tier.current { box-shadow: 5px 5px 0 var(--hazard); }
.tier-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 16px; background: var(--c); color: #111; border-bottom: 1px solid var(--edge); }
.tier-h b { font: 900 44px/.9 var(--display); letter-spacing: .02em; }
.tier-h span { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.tier ul { flex: 1; list-style: none; margin: 0; padding: 16px; display: grid; gap: 8px; align-content: start; font-size: 14px; }
.tier li { display: flex; gap: 10px; }
.tier li::before { content: '+'; flex: none; font: 700 14px var(--mono); }
.tier .btn { margin: 0 16px 16px; }

/* ---------- footer ---------- */
.foot { background: var(--ink); color: var(--ground); }
.foot-in { max-width: var(--max); margin: 0 auto; padding: 32px 16px; display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 32px; }
.foot h4 { margin: 0 0 10px; font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; opacity: .65; }
.foot-name { font: 600 26px/1 var(--mono); text-transform: uppercase; }
.foot p { margin: 8px 0 0; font-size: 14px; opacity: .8; max-width: 44ch; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.foot a:hover { color: var(--hazard); }

/* ---------- cookie / modal / toast ---------- */
.cookie { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 45; width: min(400px, calc(100vw - 32px)); padding: 16px; display: grid; gap: 10px; background: var(--sheet); border: 1px solid var(--edge); box-shadow: 5px 5px 0 var(--edge); }
.cookie h4 { margin: 0; font: 800 20px/1 var(--display); text-transform: uppercase; }
.cookie p { margin: 0; color: var(--ink-2); font-size: 14px; }
.cookie .btn { justify-self: start; }

.modal-bg { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; overflow-y: auto; padding: 16px; background: rgb(10 10 12 / .6); }
.modal { margin: auto 0; width: min(420px, 100%); background: var(--sheet); border: 1px solid var(--edge); box-shadow: 6px 6px 0 var(--edge); }
.modal-in { padding: 24px; }
.modal h2 { margin: 0 0 18px; font: 900 36px/1 var(--display); text-transform: uppercase; }
.modal .sw { margin-top: 16px; color: var(--ink-2); font-size: 14px; }
.modal .sw button { border: 0; background: none; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--hazard); text-decoration-thickness: 2px; text-underline-offset: 3px; color: var(--ink); }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; }
.toast { padding: 10px 16px; background: var(--ink); color: var(--sheet); border-left: 6px solid var(--hazard); font: 500 13px var(--mono); }
.toast.bad { border-left-color: var(--signal); }

/* ---------- admin ---------- */
.table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--edge); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table th { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); background: var(--ground); }
.table small { color: var(--ink-2); font: 12px var(--mono); }
.table select { padding: 6px 8px; background: var(--field); border: 1px solid var(--rule); border-radius: var(--r); }
.section { margin-bottom: 40px; }
.section > h2 { margin: 0 0 12px; font: 800 26px/1 var(--display); text-transform: uppercase; }
.section > p { color: var(--ink-2); font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .sheet, .catalogue { grid-template-columns: minmax(0, 1fr); }
  .spec, .filters { position: static; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > :first-child, .filters > :last-child { grid-column: 1 / -1; }
  .taglist { display: flex; flex-wrap: wrap; gap: 6px; }
  .taglist a { border: 1px solid var(--rule); gap: 8px; }
  .intro { grid-template-columns: minmax(0, 1fr); }
  .readout { grid-template-rows: none; grid-template-columns: repeat(3, 1fr); border-left: 0; border-top: 1px solid var(--edge); }
  .readout div { flex-direction: column; border-top: 0; border-left: 1px solid var(--rule); padding: 14px 16px; }
  .readout div:first-child { border-left: 0; }
  .readout dd { font-size: 34px; }
  .log-row { grid-template-columns: 90px minmax(0, 1fr); }
  .log-row .cover { display: none; }
  .foot-in { grid-template-columns: 1fr 1fr; }
  .foot-in > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .bar-in { flex-wrap: wrap; gap: 0 12px; padding-top: 10px; }
  .bar-act { margin-left: auto; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; margin: 6px -16px 0; padding: 0 10px 2px; }
  .nav a { padding: 10px 10px; }
  .mark-sub { display: none; }
  .row, .filters { grid-template-columns: 1fr; }
  .log-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .log-date b { display: inline; font-size: 13px; font-family: var(--mono); font-weight: 600; margin-right: 4px; }
  .readout dd { font-size: 28px; }
  .readout div { padding: 12px; }
  .notice-tag { display: none; }
  .wrap { padding-top: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- crew above the footer ---------- */
.crew { --k: 1.15; position: relative; z-index: 0; overflow: hidden; width: 100%; max-width: var(--max); height: calc(170px * var(--k)); margin: 0 auto -1px; pointer-events: none; }
.crew-scene { position: absolute; bottom: 0; width: calc(var(--w) * 1px * var(--k)); height: calc(170px * var(--k)); overflow: visible; shape-rendering: crispEdges; }
.foot { position: relative; z-index: 1; }
/* цвета человечка и ящика взяты из игры, одинаковые в обеих темах */
.crew .sk { fill: #b0afba; stroke: #85848e; stroke-width: 1.5; }
.crew .bk { fill: #9f9eaa; stroke: #7a7984; stroke-width: 1.5; }
.crew .eye { fill: #85848e; }
.crew .hat.y, .crew .ridge.y { fill: #ffc21a; }
.crew .brim.y { fill: #e0a400; }
.crew .hat.o, .crew .ridge.o { fill: #ff8a1f; }
.crew .brim.o { fill: #d9690f; }
.crew .hat, .crew .brim { stroke: #5c3d00; stroke-width: 1.2; }
.crew .ridge { stroke: none; opacity: .5; }
.crew .tool rect { fill: #b3b2bc; stroke: #6d6c76; stroke-width: 1; }
.crew .cr-frame { fill: #7a5232; stroke: #2a1a0d; stroke-width: 1.5; }
.crew .cr-panel { fill: #6c4729; stroke: #3d2614; stroke-width: 1; }
.crew .cr-line { fill: #3d2614; }
.crew .cr-brace { fill: #7a5232; stroke: #3d2614; stroke-width: 1; }
.crew .cr-corner { stroke: #3d2614; stroke-width: 1; fill: none; }
.crew .cr-nail { fill: #a9a9b3; }
.crew .handle { fill: #8a5a2b; stroke: #3d2614; stroke-width: 1; }
.crew .tool-nail { fill: #c9c9d2; stroke: #5f5e68; stroke-width: .8; }
@media (max-width: 720px) { .crew .wide { display: none; } .crew { --k: .85; } }

/* ---------- video, sign-in options, notices ---------- */
.video { position: relative; aspect-ratio: 16 / 9; max-width: 100%; margin: 0 0 24px; background: #000; border: 1px solid var(--edge); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.oauth-list { display: grid; gap: 8px; }
.btn.oauth { justify-content: center; text-transform: none; letter-spacing: .02em; font-size: 17px; }
.btn.oauth.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn.oauth.discord:hover { background: #4752c4; }
.btn.oauth.google { background: var(--field); color: var(--ink); border-color: var(--rule); }
.btn.oauth.google:hover { border-color: var(--ink); background: var(--field); color: var(--ink); }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--ink-2); font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--rule); }
.notice + .notice { border-top: 1px solid rgb(127 127 127 / .3); }
.notice .btn { flex: none; color: inherit; border-color: currentColor; }
.notice .btn:hover { background: var(--hazard); color: var(--on-hazard); border-color: var(--hazard); }
.hint a { text-decoration: underline; text-decoration-color: var(--hazard); text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* Фото мода: редактор (js/media.js) и галерея на странице мода */
.byline { margin: 0 0 10px; font: 500 13px var(--mono); color: var(--ink-2); }
.byline b { color: var(--ink); font-weight: 600; }

.media-ed { display: grid; gap: 14px; }
.m-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.m-tile, .m-add { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; background: var(--ground); }
.m-tile.main { border: 2px solid var(--hazard); }
.m-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-badge { position: absolute; left: 4px; top: 4px; padding: 2px 6px; font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; background: var(--ink); color: var(--sheet); }
.m-tile.main .m-badge { background: var(--hazard); color: var(--on-hazard); }
.m-tools { position: absolute; right: 4px; bottom: 4px; display: flex; gap: 3px; }
.m-tools button { width: 26px; height: 26px; padding: 0; border: 1px solid var(--edge); border-radius: var(--r); background: var(--sheet); color: var(--ink); cursor: pointer; font-size: 13px; line-height: 1; }
.m-tools button:hover { background: var(--hazard); color: var(--on-hazard); }
.m-add { display: grid; place-content: center; gap: 4px; text-align: center; border-style: dashed; cursor: pointer; font: 700 15px var(--display); text-transform: uppercase; letter-spacing: .05em; }
.m-add:hover { border-color: var(--edge); background: var(--sheet); }
.m-add small { font: 500 11px var(--mono); color: var(--ink-2); text-transform: none; }
.m-crop-h { display: grid; gap: 2px; margin-bottom: 8px; }
.m-crop-h small { color: var(--ink-2); font-size: 12px; }
.m-crop { display: grid; gap: 8px; max-width: 520px; }

.crop-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #16171a; border: 1px solid var(--edge); border-radius: var(--r); cursor: grab; touch-action: none; user-select: none; }
.crop-frame.dragging { cursor: grabbing; }
.crop-frame:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--hazard); }
.crop-img { position: absolute; max-width: none; max-height: none; pointer-events: none; }
.crop-bg { position: absolute; inset: -10%; width: 120%; height: 120%; max-width: none; object-fit: cover; filter: blur(14px) brightness(.7); pointer-events: none; }
.crop-tag { position: absolute; left: 6px; top: 6px; padding: 3px 6px; font: 600 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; background: var(--ink); color: var(--sheet); pointer-events: none; }
.crop-bar { display: flex; align-items: center; gap: 10px; }
.crop-zoom { flex: 1; min-width: 0; accent-color: var(--hazard); }

.gal-main { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; border: 1px solid var(--edge); }
.gal-bg { position: absolute; inset: -8%; width: 116%; height: 116%; max-width: none; object-fit: cover; filter: blur(22px) brightness(.55); }
.gal-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; border: 1px solid var(--edge); background: rgb(22 23 26 / .65); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.gal-nav:hover { background: var(--hazard); color: var(--on-hazard); }
.gal-nav.prev { left: 8px; } .gal-nav.next { right: 8px; }
.gal-thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.gal-th { flex: 0 0 auto; width: 96px; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--rule); background: var(--ground); cursor: pointer; opacity: .7; }
.gal-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-th:hover, .gal-th.on { opacity: 1; }
.gal-th.on { border: 2px solid var(--hazard); }

/* Ошибка входа: заметный блок и короткое покачивание формы */
.modal .err:not(:empty) { padding: 10px 12px; border: 1px solid var(--signal); border-left-width: 4px; border-radius: var(--r); background: color-mix(in srgb, var(--signal) 10%, transparent); font-weight: 500; }
.form.bad input[name=password], .form.bad input[name=username] { border-color: var(--signal); }
.form.bad { animation: shake .35s ease-in-out; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .form.bad { animation: none; } }
.m-clear { justify-self: start; }

/* mod.json: переключатель в форме публикации (админ) */
.modjson { display: grid; gap: 8px; padding: 12px 14px; border: 1px dashed var(--hazard); border-radius: var(--r); background: color-mix(in srgb, var(--hazard) 6%, transparent); }
.modjson small { color: var(--ink-2); font-size: 12px; }
.mj-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font: 700 16px var(--display); text-transform: uppercase; letter-spacing: .05em; }
.mj-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mj-knob { position: relative; flex: none; width: 40px; height: 22px; border: 1px solid var(--edge); border-radius: 11px; background: var(--field); transition: background .15s; }
.mj-knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform .15s, background .15s; }
.mj-switch input:checked + .mj-knob { background: var(--hazard); }
.mj-switch input:checked + .mj-knob::after { transform: translateX(18px); background: var(--on-hazard); }
.mj-switch input:focus-visible + .mj-knob { box-shadow: 0 0 0 3px var(--hazard); }
.mj-prev { font-size: 14px; }
.mj-prev span { font-weight: 600; }
.mj-prev small { font-size: 13px; }
.mj-prev p { margin: 4px 0 0; color: var(--ink-2); }

/* Зависимости мода: поле выбора, блок на странице, окно скачивания */
.deps { display: grid; gap: 8px; }
.deps-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.deps-chips:empty { display: none; }
.dep-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--edge); border-radius: var(--r); background: var(--sheet); font-size: 14px; }
.dep-chip a { font-weight: 600; }
.dep-chip button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: var(--r); background: transparent; color: var(--ink-2); cursor: pointer; }
.dep-chip button:hover { background: var(--signal); color: var(--sheet); }
.deps-search { position: relative; }
.deps-sug { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); display: grid; max-height: 280px; overflow-y: auto; background: var(--sheet); border: 1px solid var(--edge); box-shadow: 4px 4px 0 var(--edge); }
.deps-sug button { display: grid; gap: 2px; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--rule); background: none; color: var(--ink); text-align: left; cursor: pointer; }
.deps-sug button:hover, .deps-sug button:focus-visible { background: var(--hazard); color: var(--on-hazard); outline: none; }
.deps-sug small { color: inherit; opacity: .7; font-size: 12px; }
.deps-none { padding: 10px 12px; color: var(--ink-2); font-size: 14px; }

.requires { display: grid; gap: 4px; margin: 0 0 20px; padding: 12px 14px; border: 1px solid var(--edge); border-left: 6px solid var(--hazard); background: var(--sheet); }
.requires p { margin: 0; font-size: 17px; font-weight: 600; }
.requires a, .spec dd a, .dl-deps a { text-decoration: underline; text-decoration-color: var(--hazard); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.requires small { color: var(--ink-2); font-size: 13px; }

.dl-lead { margin: 0 0 10px; }
.dl-deps { margin: 0 0 18px; padding-left: 20px; display: grid; gap: 6px; }
.dl-deps small { display: block; color: var(--ink-2); font-size: 12px; }
.dl-act { display: grid; gap: 8px; }
.dl-act small { color: var(--ink-2); font-size: 12px; margin-top: -2px; }

/* Теги у ников (назначаются в Admin desk) */
.utag { display: inline-block; margin-left: 6px; padding: 1px 6px 2px; border-radius: var(--r); font: 600 10px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; vertical-align: 2px; white-space: nowrap; color: #16171a; background: var(--tag); }
.utag.c-yellow { --tag: #ffc21a; }
.utag.c-blue { --tag: #7cb8ff; }
.utag.c-green { --tag: #5fd38d; }
.utag.c-red { --tag: #ff7b6e; }
.utag.c-purple { --tag: #c39bff; }
.utag-edit { display: flex; gap: 6px; }
.utag-edit input { width: 120px; padding: 6px 8px; background: var(--field); border: 1px solid var(--rule); border-radius: var(--r); }
.utag-prev { margin-top: 4px; min-height: 18px; }
.utag-prev .utag { margin-left: 0; }

/* Вкладки каталога: все моды / моды студии */
.cat-tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid var(--edge); }
.cat-tabs a { padding: 10px 16px 9px; margin-bottom: -2px; border: 2px solid transparent; border-bottom: 0; font: 800 18px/1 var(--display); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.cat-tabs a:hover { color: var(--ink); }
.cat-tabs a.on { color: var(--ink); background: var(--sheet); border-color: var(--edge); border-bottom: 2px solid var(--sheet); box-shadow: inset 0 3px 0 var(--hazard); }
.badge.studio { background: var(--hazard); color: var(--on-hazard); border-color: var(--edge); }

/* Подсказки тегов: вариант, выбранный стрелками */
.deps-sug button.on { background: var(--hazard); color: var(--on-hazard); }
