:root {
  --bg: #0a0a0a;
  --fg: #ededed;
  --muted: #a1a1aa;
  --dim: #71717a;
  --line: rgba(255, 255, 255, 0.1);
  --panel: rgba(0, 0, 0, 0.6);
  --panel-2: rgba(24, 24, 27, 0.7);
  --orange: #ff6b00;
  --orange-hover: #ea580c;
  --green: #5c8a00;
  --green-hover: #4d7300;
  --red: #dc2626;
  --demon: #b91c1c;
  --radius: 2px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: Montserrat, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

.bg {
  position: fixed; inset: 0; z-index: -1;
  background: url('/background.png') center / cover no-repeat;
  filter: brightness(0.35);
}
.bg::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,.75) 100%);
}

/* ---------- header (как на dark-times.ru) ---------- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 24px 32px;
  background: linear-gradient(to bottom, rgba(0,0,0,.8), transparent);
  backdrop-filter: blur(4px);
}
.nav { display: flex; gap: 32px; }
.nav a, .user a, .user button.link {
  text-decoration: none; font-size: 14px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: rgba(237,237,237,.8); transition: color .2s, text-shadow .2s;
  background: none; border: 0; cursor: pointer; padding: 0;
}
.nav a:hover, .nav a.active, .user a:hover, .user button.link:hover {
  color: #fff; text-shadow: 0 0 8px rgba(255,255,255,.5);
}
.user { display: flex; align-items: center; gap: 16px; }
.user .name { font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.user .name::before { content: "●"; color: var(--green); margin-right: 8px; font-size: 10px; vertical-align: middle; }
.burger { display: none; width: 40px; height: 40px; border: 0; border-radius: 6px; background: rgba(255,255,255,.1); cursor: pointer; padding: 10px; }
.burger span { display: block; height: 2px; background: #fff; margin: 4px 0; }

@media (max-width: 860px) {
  .header { padding: 16px; }
  .burger { display: block; }
  .nav, .user { display: none; }
  .header.open { flex-wrap: wrap; background: rgba(0,0,0,.95); }
  .header.open .nav, .header.open .user {
    display: flex; flex-direction: column; align-items: flex-start; gap: 20px;
    width: 100%; order: 3; padding: 16px 0 8px;
  }
  .header.open .nav { border-top: 1px solid var(--line); padding-top: 24px; }
}

/* ---------- общие элементы ---------- */
.app { padding: 112px 32px 64px; max-width: 1400px; margin: 0 auto; }
@media (max-width: 860px) { .app { padding: 88px 16px 48px; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel h2, .h2 {
  margin: 0 0 16px; font-size: 14px; font-weight: 800; letter-spacing: .15em;
  text-transform: uppercase; color: var(--orange);
}
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border: 0; border-radius: var(--radius); cursor: pointer;
  font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  text-decoration: none; color: #fff; background: rgba(255,255,255,.1);
  transition: background .2s, box-shadow .2s, opacity .2s; white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,.2); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.orange { background: var(--orange); }
.btn.orange:hover { background: var(--orange-hover); box-shadow: 0 8px 24px rgba(255,107,0,.2); }
.btn.green { background: var(--green); }
.btn.green:hover { background: var(--green-hover); box-shadow: 0 8px 24px rgba(92,138,0,.2); }
.btn.red { background: rgba(220,38,38,.25); }
.btn.red:hover { background: rgba(220,38,38,.45); }
.btn.sm { padding: 8px 12px; font-size: 11px; }
.btn.block { width: 100%; }

.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: 56px; padding: 0 32px; border: 0; border-radius: var(--radius); cursor: pointer;
  color: #fff; text-decoration: none; white-space: nowrap;
  font-size: 14px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase;
  background: linear-gradient(180deg, #ff7d1f 0%, #ff6b00 55%, #e85f00 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 12px 32px -12px rgba(255,107,0,.7);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.cta:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 16px 40px -10px rgba(255,107,0,.8); }
.cta:active { transform: none; }
.cta:disabled { filter: grayscale(1) brightness(.6); box-shadow: none; transform: none; cursor: not-allowed; }
.cta svg, .join svg { width: 18px; height: 18px; flex: none; }

.join {
  display: flex; height: 56px; border: 1px solid rgba(255,255,255,.15); border-radius: var(--radius);
  background: rgba(0,0,0,.45); backdrop-filter: blur(6px); overflow: hidden; transition: border-color .2s;
}
.join:focus-within { border-color: var(--orange); }
.join input {
  width: 168px; min-width: 0; border: 0; outline: none; background: transparent; color: #fff; text-align: center;
  font-size: 20px; font-weight: 800; letter-spacing: .45em; padding: 0 0 0 .45em; text-transform: uppercase;
}
.join input::placeholder { color: #52525b; }
.join button {
  display: inline-flex; align-items: center; gap: 10px; padding: 0 24px; border: 0; cursor: pointer;
  border-left: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06); color: #fff;
  font-size: 13px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase;
  transition: background .2s;
}
.join button:hover { background: var(--green); }
.or { font-size: 11px; font-weight: 700; letter-spacing: .25em; text-transform: uppercase; color: var(--dim); }
.start-box { display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 13px; }

.input, .select {
  width: 100%; padding: 12px; background: rgba(24,24,27,.5); border: 1px solid var(--line);
  border-radius: var(--radius); outline: none; transition: border-color .2s; color: #fff;
}
.input:focus, .select:focus { border-color: var(--orange); }
.select option { background: #18181b; }
.code-input { text-transform: uppercase; letter-spacing: .4em; font-weight: 800; text-align: center; font-size: 20px; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius);
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  background: rgba(255,255,255,.08); color: var(--muted);
}
.tag.orange { background: rgba(255,107,0,.15); color: #fdba74; }
.tag.green { background: rgba(92,138,0,.25); color: #bef264; }
.tag.red { background: rgba(220,38,38,.2); color: #fca5a5; }

.fade-in { animation: fadeIn .5s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- главная ---------- */
.hero { min-height: calc(100vh - 176px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.hero .logo { height: 160px; width: auto; filter: drop-shadow(0 0 25px rgba(255,255,255,.2)); }
.hero .title {
  margin: 8px 0 4px; font-size: clamp(40px, 8vw, 84px); font-weight: 900; letter-spacing: .3em;
  text-transform: uppercase; padding-left: .3em;
  background: linear-gradient(180deg, #fff 0%, #a1a1aa 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .sub { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 24px; }
.hero .lead { max-width: 640px; color: #d4d4d8; line-height: 1.7; margin: 0 0 40px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; align-items: center; }
.hero .note { margin-top: 24px; font-size: 12px; color: var(--dim); letter-spacing: .05em; }
.hero .note a { color: var(--orange); }
.error-box { background: rgba(127,29,29,.5); border: 1px solid rgba(239,68,68,.5); color: #fecaca; padding: 12px 16px; margin-bottom: 24px; font-size: 14px; }

@media (max-width: 600px) {
  .hero .logo { height: 112px; }
  .hero .actions { width: 100%; flex-direction: column; align-items: stretch; gap: 12px; }
  .hero .actions .cta { width: 100%; }
  .join input { flex: 1; width: auto; }
  .or { text-align: center; }
}

/* ---------- комната ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; margin-bottom: 24px; }
.topbar .code { font-size: 32px; font-weight: 900; letter-spacing: .3em; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 22px; font-weight: 800; }
.stat b.ok { color: #bef264; }
.stat b.warn { color: var(--orange); }
.topbar .spacer { flex: 1; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }
.col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.scenario { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .scenario { grid-template-columns: 1fr; } }
.scenario h3 { margin: 4px 0 8px; font-size: 22px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.scenario p { color: #d4d4d8; line-height: 1.65; font-size: 14px; margin: 0 0 16px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; margin: 0; }
.facts dt { color: var(--dim); text-transform: uppercase; font-size: 11px; font-weight: 700; letter-spacing: .1em; padding-top: 2px; }
.facts dd { margin: 0; }
.features { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 6px; }
.features li { padding: 8px 12px; background: rgba(255,255,255,.04); border-left: 2px solid var(--orange); font-size: 13px; }
.features li.locked { border-left-color: var(--line); color: var(--dim); letter-spacing: .1em; }

.vote-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; border-color: rgba(255,107,0,.5); background: rgba(255,107,0,.08); }
.vote-banner b { font-size: 16px; text-transform: uppercase; letter-spacing: .1em; }

.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.pcard {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: border-color .2s, opacity .2s;
}
.pcard.me { border-color: rgba(255,107,0,.5); }
.pcard.out { opacity: .45; filter: grayscale(1); }
.pcard.rare { border-color: var(--demon); box-shadow: 0 0 24px rgba(185,28,28,.35), inset 0 0 24px rgba(185,28,28,.12); }
.pcard .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pcard .pname { font-weight: 800; font-size: 15px; letter-spacing: .05em; text-transform: uppercase; overflow-wrap: anywhere; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3f3f46; flex: none; }
.dot.on { background: #84cc16; box-shadow: 0 0 6px #84cc16; }
.attrs { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.attr { display: grid; grid-template-columns: 104px 1fr; gap: 8px; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.attr .k { color: var(--dim); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding-top: 2px; }
.attr .v { overflow-wrap: anywhere; }
.attr .v.hidden { color: #3f3f46; letter-spacing: .2em; }
.pcard .foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.voted-mark { position: absolute; top: 12px; right: 12px; }

.mycard .attr { grid-template-columns: 1fr auto; align-items: center; padding: 8px 0; }
.mycard .attr .k { display: block; margin-bottom: 2px; }
.mycard .attr.open .v::after { content: "  открыто"; color: #bef264; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.mycard.rare { border-color: var(--demon); box-shadow: 0 0 30px rgba(185,28,28,.3); }
.rare-note { color: #fca5a5; font-size: 12px; line-height: 1.5; margin: 0 0 12px; }

.host-tools { display: flex; flex-direction: column; gap: 12px; }
.host-tools .row { display: flex; gap: 8px; flex-wrap: wrap; }
.host-tools .row > * { flex: 1 1 140px; }
.host-tools .sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.log { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column-reverse; gap: 6px; max-height: 320px; overflow-y: auto; font-size: 13px; color: #d4d4d8; }
.log li { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.05); line-height: 1.5; }

.lobby-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.lobby-list li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(255,255,255,.04); }
.lobby-list li .pname { flex: 1; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; overflow-wrap: anywhere; }
.lobby { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.share { display: flex; gap: 8px; flex-wrap: wrap; }
.share .input { flex: 1 1 240px; font-size: 13px; }

.finale { text-align: center; padding: 32px; }
.finale h2 { font-size: 28px; color: #fff; letter-spacing: .2em; }

/* ---------- справочник ---------- */
.page-title { font-size: clamp(28px, 4vw, 40px); font-weight: 900; letter-spacing: .15em; text-transform: uppercase; margin: 0 0 8px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0; }
.tabs button { background: rgba(255,255,255,.06); border: 1px solid var(--line); padding: 10px 16px; cursor: pointer; border-radius: var(--radius); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.tabs button.active { background: var(--orange); border-color: var(--orange); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
@media (max-width: 400px) { .grid { grid-template-columns: 1fr; } }
.entry h3 { margin: 4px 0 8px; font-size: 18px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.entry p { color: #d4d4d8; line-height: 1.65; font-size: 14px; margin: 0 0 12px; }
.entry ul { margin: 0; padding-left: 18px; color: #d4d4d8; font-size: 13px; line-height: 1.7; }
.entry ul li::marker { color: var(--orange); }
.entry.rare { border-color: var(--demon); box-shadow: 0 0 24px rgba(185,28,28,.25); }
.subs { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.subs div { padding: 8px 12px; background: rgba(255,255,255,.04); font-size: 13px; line-height: 1.55; }
.subs b { text-transform: uppercase; letter-spacing: .05em; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chips span { padding: 4px 10px; background: rgba(255,255,255,.06); font-size: 12px; border-radius: var(--radius); }

.prose { max-width: 820px; color: #d4d4d8; line-height: 1.75; font-size: 15px; }
.prose h2 { color: #fff; font-size: 20px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid rgba(255,255,255,.08); padding-bottom: 6px; margin-top: 32px; }
.prose ol, .prose ul { padding-left: 22px; }
.prose li::marker { color: var(--orange); }
.prose strong { color: #fff; }

/* ---------- тосты ---------- */
.toasts { position: fixed; bottom: 16px; right: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: rgba(24,24,27,.95); border: 1px solid var(--line); border-left: 3px solid var(--orange); padding: 12px 16px; font-size: 14px; max-width: 420px; animation: fadeIn .3s ease both; }
.toast.err { border-left-color: var(--red); }

body.animate .room-anim { animation: fadeIn .5s ease both; }

