:root {
  --paper: #F2F4F7;
  --sheet: #FFFFFF;
  --ink: #1B2230;
  --muted: #586274;
  --grid: #D8DEE7;
  --jpg: #2F6FDB;
  --mp4: #7B4CC9;
  --zip: #A87308;
  --exe: #C93A32;
  --txt: #1F8A61;
  --face: "Bahnschrift", "DIN Alternate", "DIN Next", "Roboto", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --face-narrow: "Bahnschrift SemiCondensed", "Bahnschrift", "DIN Condensed", "Roboto Condensed", "Arial Narrow", var(--face);
  --measure: 38rem;
}

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

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--face);
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--jpg); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 {
  font-family: var(--face-narrow);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: clamp(2.6rem, 6.2vw, 4.6rem); max-width: 11ch; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); margin-bottom: 1.25rem; }
h3 { font-size: 1.35rem; margin-bottom: 0.35rem; }
p { margin: 0 0 1rem; max-width: var(--measure); }

.wrap { width: min(72rem, 100% - 2.5rem); margin-inline: auto; }

.skip {
  position: absolute; left: 1rem; top: -4rem;
  background: var(--ink); color: var(--paper); padding: 0.5rem 0.9rem; z-index: 10;
}
.skip:focus { top: 1rem; }

/* шапка */
.top { padding-block: 1.75rem 0; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.brand { display: block; line-height: 0; }
.brand img { width: clamp(13rem, 30vw, 17.75rem); height: auto; }
.nav { display: flex; gap: 1.5rem; align-items: center; font-size: 1rem; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.nav .login {
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 1rem; border-radius: 3px;
}
.nav .login:hover { text-decoration: none; background: #2C3548; }

/* первый экран */
.hero { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5.5rem); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 4vw, 3.5rem); align-items: start; }
.lead { font-size: 1.2rem; color: var(--muted); margin-top: 1.5rem; }
.lead strong { color: var(--ink); font-weight: 600; }
.cta { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; margin-top: 2rem; }
.button {
  display: inline-block; background: var(--ink); color: var(--paper);
  font: 600 1.1rem/1 var(--face-narrow); padding: 1rem 1.4rem; border-radius: 3px; text-decoration: none;
}
.button:hover { background: #2C3548; }
.invite { font-size: 0.95rem; color: var(--muted); margin: 0; max-width: 18rem; }

/* арена */
.arena {
  margin: 0;
  background: var(--sheet);
  border: 1px solid var(--grid);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--grid), 0 18px 40px -28px rgba(27, 34, 48, 0.45);
}
.arena-head {
  flex-wrap: wrap;
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--grid); font-size: 0.95rem;
}
.arena canvas { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; }
.log {
  list-style: none; margin: 0; padding: 0.75rem 1.1rem 0.9rem;
  border-top: 1px solid var(--grid); min-height: 6.4rem;
  font-size: 0.92rem; color: var(--muted);
}
.log li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; }
.log li:first-child { color: var(--ink); }
.replay {
  font: inherit; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 0.18em;
}

/* разделы */
.section { padding-block: clamp(3rem, 7vw, 5rem); border-top: 1px solid var(--grid); background: var(--paper); }
.section.sheet { background: var(--sheet); }
.intro { color: var(--muted); margin-bottom: 2.25rem; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem; counter-reset: step; }
.steps li { counter-increment: step; border-top: 3px solid var(--ink); padding-top: 1rem; }
.steps li::before {
  content: counter(step);
  display: block; font: 600 2.2rem/1 var(--face-narrow); margin-bottom: 0.75rem;
}
.steps p { font-size: 1rem; color: var(--muted); margin: 0; }

.roles { width: 100%; border-collapse: collapse; font-size: 1rem; }
.roles th, .roles td { text-align: left; vertical-align: top; padding: 0.9rem 1rem 0.9rem 0; border-bottom: 1px solid var(--grid); }
.roles thead th { font-weight: 600; font-size: 0.95rem; color: var(--muted); border-bottom: 2px solid var(--ink); }
.roles td:first-child { white-space: nowrap; }
.tag {
  display: inline-block; min-width: 3.2rem; text-align: center;
  font: 600 0.85rem/1 var(--face-narrow); color: #fff; padding: 0.35rem 0.45rem 0.3rem; border-radius: 2px;
  margin-right: 0.5rem;
}
.tag.jpg { background: var(--jpg); }
.tag.mp4 { background: var(--mp4); }
.tag.zip { background: var(--zip); }
.tag.exe { background: var(--exe); }
.tag.txt { background: var(--txt); }
.ext { color: var(--muted); }
.rule { margin-top: 2rem; padding: 1.25rem 1.4rem; background: var(--paper); border-left: 4px solid var(--ink); max-width: 46rem; }
.rule p { margin: 0; }

.luck { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.luck-list { margin: 1.5rem 0 0; padding: 0; list-style: none; max-width: var(--measure); }
.luck-list li { padding: 0.75rem 0 0.75rem 1.25rem; border-top: 1px solid var(--grid); position: relative; }
.luck-list li::before { content: ""; position: absolute; left: 0; top: 1.3rem; width: 0.5rem; height: 0.5rem; background: var(--ink); }
.bytes { margin: 0; }
.hex {
  background: var(--paper); border: 1px solid var(--grid); border-radius: 4px; padding: 1.25rem 1.4rem;
  font: 500 clamp(1.05rem, 2.2vw, 1.35rem)/1.9 var(--face); font-variant-numeric: tabular-nums; letter-spacing: 0.06em;
  color: var(--muted); white-space: nowrap;
}
.hex .pick { color: #fff; background: var(--jpg); padding: 0.05em 0.3em; border-radius: 2px; }
.bytes figcaption { font-size: 0.95rem; color: var(--muted); margin-top: 0.75rem; max-width: 26rem; }
.beta { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(2rem, 5vw, 4rem); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 2.5rem; }
.facts p { color: var(--muted); font-size: 1rem; margin: 0; }

/* дневник и тексты */
.page { padding-block: clamp(2.5rem, 6vw, 4rem) clamp(3rem, 7vw, 5rem); }
.page h1 { margin-bottom: 1.5rem; max-width: none; }
.entry { background: var(--sheet); border: 1px solid var(--grid); border-radius: 4px; padding: 1.5rem 1.6rem; margin-bottom: 1.25rem; max-width: 46rem; }
.entry time { display: block; color: var(--muted); font-size: 0.95rem; margin-bottom: 0.35rem; }
.entry p:last-child, .doc p:last-child { margin-bottom: 0; }
.doc { background: var(--sheet); border: 1px solid var(--grid); border-radius: 4px; padding: clamp(1.5rem, 4vw, 2.5rem); max-width: 46rem; }
.doc h2 { font-size: 1.5rem; margin: 2rem 0 0.75rem; }
.doc h2:first-of-type { margin-top: 0.5rem; }
.doc ul { padding-left: 1.2rem; max-width: var(--measure); }
.doc li { margin-bottom: 0.4rem; }

.lost { min-height: 60vh; display: flex; align-items: center; }
.lost h1 { max-width: 14ch; margin-bottom: 1.25rem; }

/* подвал */
.foot { border-top: 1px solid var(--grid); background: var(--sheet); padding-block: 2rem; font-size: 0.95rem; color: var(--muted); }
.foot .wrap { display: flex; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; }
.foot nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.foot p { margin: 0; }

@media (max-width: 60rem) {
  .hero .wrap, .beta, .luck { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 36rem) {
  body { font-size: 1rem; }
  .nav { gap: 1rem; }
  .nav .hide-s { display: none; }
  .steps, .facts { grid-template-columns: minmax(0, 1fr); }
  .roles thead { display: none; }
  .roles tr { display: block; border-bottom: 1px solid var(--grid); padding-block: 0.75rem; }
  .roles td { display: block; border: 0; padding: 0.15rem 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
