@charset "UTF-8";
/* Титул и лобби */
.stage { min-height: calc(100vh - 56px); min-height: calc(100dvh - 56px); display: grid; }
.screen[hidden] { display: none; }
.screen { animation: screen-in .35s ease-out; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Искры на фоне */
.embers { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.embers i { position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%; background: #ffcf7a; box-shadow: 0 0 10px 2px rgba(255, 190, 90, .55); opacity: 0; animation: ember 11s linear infinite; }
.embers i:nth-child(1) { left: 8%; animation-delay: 0s; } .embers i:nth-child(2) { left: 18%; animation-delay: 2.5s; width: 3px; height: 3px; }
.embers i:nth-child(3) { left: 27%; animation-delay: 5s; } .embers i:nth-child(4) { left: 36%; animation-delay: 1.2s; width: 2px; height: 2px; }
.embers i:nth-child(5) { left: 45%; animation-delay: 7s; } .embers i:nth-child(6) { left: 53%; animation-delay: 3.6s; width: 3px; height: 3px; }
.embers i:nth-child(7) { left: 61%; animation-delay: 8.5s; } .embers i:nth-child(8) { left: 70%; animation-delay: .8s; width: 2px; height: 2px; }
.embers i:nth-child(9) { left: 78%; animation-delay: 6.2s; } .embers i:nth-child(10) { left: 86%; animation-delay: 4.1s; width: 3px; height: 3px; }
.embers i:nth-child(11) { left: 93%; animation-delay: 9.3s; } .embers i:nth-child(12) { left: 14%; animation-delay: 10.2s; width: 2px; height: 2px; }
@keyframes ember { 0% { transform: translate3d(0, 0, 0); opacity: 0; } 10% { opacity: .9; } 50% { transform: translate3d(18px, -45vh, 0); opacity: .7; } 100% { transform: translate3d(-14px, -95vh, 0); opacity: 0; } }

/* Титул */
.title-screen { display: grid; align-content: center; justify-items: center; text-align: center; gap: 28px; padding: 5vh 20px 7vh; }
.title-block .eyebrow { margin-bottom: 14px; animation: fade-up .7s ease-out both; }
.game-title { font-size: clamp(46px, 9vw, 118px); line-height: .92; letter-spacing: .06em; color: #f4e6c6; animation: fade-up .8s .1s ease-out both;
  text-shadow: 0 2px 0 #5a4216, 0 0 50px rgba(216, 179, 106, .35), 0 20px 60px rgba(0, 0, 0, .7); }
.game-title span { display: block; font-family: var(--serif); font-style: italic; font-weight: 400; text-transform: none; font-size: .2em; letter-spacing: .12em; color: var(--gold); margin: .35em 0 0; text-shadow: none; }
.tagline { margin-top: 18px; font-family: var(--serif); font-size: clamp(1rem, 2.2vw, 1.35rem); color: #d9d2c2; font-style: italic; animation: fade-up .8s .25s ease-out both; }
.menu { display: grid; gap: 12px; width: min(360px, 100%); animation: fade-up .8s .4s ease-out both; }
.menu .btn.xl { flex-direction: column; gap: 2px; }
.title-foot { font-size: .72rem; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Парад рас на титуле */
.title-races { display: flex; gap: 8px; width: min(1100px, 100%); justify-content: center; flex-wrap: wrap; animation: fade-up .8s .55s ease-out both; }
.title-races button { position: relative; width: 72px; height: 72px; padding: 0; border: 1px solid var(--line); border-radius: 50%; overflow: hidden; background: #0a0f14; cursor: pointer; transition: transform .2s, border-color .2s, box-shadow .2s; }
.title-races img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.8) brightness(.8); transition: filter .2s, transform .35s; }
.title-races button:hover, .title-races button:focus-visible { transform: translateY(-6px) scale(1.08); border-color: var(--c, var(--gold)); box-shadow: 0 10px 24px rgba(0, 0, 0, .6), 0 0 0 1px var(--c, var(--gold)); outline: none; }
.title-races button:hover img { filter: none; transform: scale(1.1); }
.title-races button::after { content: attr(data-name); position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%); white-space: nowrap; font-size: .62rem; letter-spacing: .12em; color: var(--text); opacity: 0; transition: opacity .2s; }
@media (max-width: 700px) { .title-races button { width: 48px; height: 48px; } }

/* Лобби */
.lobby-screen { padding: 8px clamp(14px, 3vw, 32px) 40px; align-content: start; gap: 16px; }
.lobby-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lobby-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.codex-btn { margin-left: auto; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.panel.match { display: flex; flex-direction: column; } .panel.match .ready-zone { margin-top: auto; }
@media (max-width: 900px) { .lobby-grid { grid-template-columns: 1fr; } }

/* Плитки рас: портрет целиком (contain), без обрезки */
.factions { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; padding: 14px 18px 0; }
.faction { position: relative; display: block; padding: 0; border: 2px solid var(--line); border-radius: 6px; background: #0a0f14; cursor: pointer; overflow: hidden; aspect-ratio: 1; transition: border-color .15s, transform .12s, box-shadow .15s; --accent: var(--gold); }
.faction img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.8) brightness(.82); transition: filter .2s, transform .3s; }
.faction:hover:not(:disabled) img, .faction[aria-checked="true"] img { filter: saturate(1.05) brightness(1); }
.faction:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.faction[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(0, 0, 0, .5); }
.faction:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.faction:disabled { cursor: not-allowed; opacity: .55; }
.faction .label { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-align: center; background: linear-gradient(180deg, transparent, rgba(5, 8, 12, .92)); }
.faction .roster-mark { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.faction.playable .roster-mark { background: var(--good); box-shadow: 0 0 6px var(--good); }
@media (max-width: 600px) { .factions { grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px 12px 0; } .faction .label { font-size: .58rem; padding: 10px 2px 4px; } }

/* Карточка выбранной расы: полный кадр арта */
.race-detail { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: center; margin: 14px 18px 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: rgba(0, 0, 0, .28); border-left: 3px solid var(--accent, var(--gold)); }
.race-portrait { width: 220px; height: 220px; object-fit: contain; background: #0a0f14; border-radius: 4px; border: 1px solid var(--line-strong); animation: fade-up .3s ease-out; }
.race-copy { display: grid; gap: 4px; justify-items: start; }
.race-copy strong { font-family: var(--serif); font-size: 1.9rem; font-weight: 500; line-height: 1.1; }
.race-copy .kicker { color: var(--accent, var(--gold)); }
.race-status { font-size: .78rem; display: inline-flex; align-items: center; gap: 6px; }
.race-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.race-status.playable { color: var(--good); } .race-status.playable::before { background: var(--good); }
.race-status.roster { color: var(--warn); }
#race-more { padding-left: 0; }
@media (max-width: 560px) { .race-detail { grid-template-columns: 1fr; } .race-portrait { width: min(100%, 320px); height: auto; aspect-ratio: 1; margin: 0 auto; } }

#profile-form { padding: 16px 18px 18px; }
.field-row { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 6px; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* Места */
.seats { display: grid; gap: 10px; padding: 16px 18px 6px; }
.seat { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(0, 0, 0, .25); border-left-width: 3px; }
.seat.north { border-left-color: var(--north); } .seat.south { border-left-color: var(--south); }
.seat.empty { border-style: dashed; opacity: .75; }
.seat.self { background: rgba(216, 179, 106, .07); }
.seat-image { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.seat-placeholder { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 4px; border: 1px dashed var(--line-strong); font-family: var(--serif); font-size: 1.6rem; color: var(--muted); }
.seat-kicker { font-size: .66rem; letter-spacing: .2em; color: var(--muted); }
.seat.north .seat-kicker { color: var(--north); } .seat.south .seat-kicker { color: var(--south); }
.seat-name { font-size: 1.25rem; display: flex; align-items: center; gap: 8px; }
.seat-you { font-family: var(--sans); font-size: .6rem; letter-spacing: .18em; color: #1a1208; background: var(--gold); padding: 2px 6px; border-radius: 3px; }
.seat-race { font-size: .8rem; color: var(--muted); }
.seat-state { display: grid; justify-items: end; gap: 4px; font-size: .78rem; }
.seat-state strong { color: var(--good); } .seat-state strong.unready { color: var(--muted); font-weight: 500; }
.seat-state span { color: var(--muted); } .seat-state span.disconnected { color: var(--warn); }
@media (max-width: 480px) { .seat { grid-template-columns: 44px 1fr; } .seat-state { grid-column: 1 / -1; justify-items: start; grid-auto-flow: column; gap: 12px; } .seat-image, .seat-placeholder { width: 44px; height: 44px; } }

/* VS */
.versus { flex: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 6px 18px 0; min-height: 180px; }
.vs-side { position: relative; aspect-ratio: 1; max-height: 260px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); justify-self: stretch; }
.vs-side img { width: 100%; height: 100%; object-fit: contain; filter: saturate(.95); transition: opacity .4s; background: #0a0f14; }
.vs-side.empty img { opacity: .12; filter: grayscale(1); object-fit: contain; padding: 22%; }
.vs-side span { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 8px; text-align: center; font-family: var(--serif); font-size: 1.05rem; background: linear-gradient(180deg, transparent, rgba(5, 8, 12, .9)); }
.vs-side.empty span { color: var(--muted); font-family: var(--sans); font-size: .78rem; }
.vs-side.north { border-bottom: 3px solid var(--north); } .vs-side.south { border-bottom: 3px solid var(--south); }
.vs-side.ready::after { content: "ГОТОВ"; position: absolute; top: 8px; left: 8px; font-size: .6rem; letter-spacing: .18em; padding: 3px 7px; border-radius: 3px; background: var(--good); color: #0d1a10; font-weight: 700; }
.vs-mark { font-family: var(--serif); font-size: 2rem; color: var(--gold-2); text-shadow: 0 0 18px rgba(216, 179, 106, .45); }
@media (max-width: 480px) { .versus { min-height: 0; } .vs-mark { font-size: 1.3rem; } }

.ready-zone { padding: 10px 18px 18px; display: grid; gap: 12px; }
.ready-row { display: flex; align-items: center; gap: 14px; }
.ready-count { font-family: var(--serif); font-size: 2rem; color: var(--gold-2); line-height: 1; }
.ready-count span { color: var(--muted); font-size: .6em; margin: 0 2px; }
.pips { display: flex; gap: 6px; margin-left: auto; }
.pips span { width: 42px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .1); transition: background .2s, box-shadow .2s; }
.pips span.on { background: var(--good); box-shadow: 0 0 10px var(--good); }
.room-status { min-height: 1.4em; color: var(--muted); font-size: .9rem; }
.ready-btn { width: 100%; }
body[data-phase="countdown"] .ready-btn { display: none; }

/* Нижняя полоса */
.lobby-strip { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 900px) { .lobby-strip { grid-template-columns: 1fr; } }
.strip-body { padding: 14px 18px 18px; }
.strip-body.arena { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: center; }
.strip-body.arena img { width: 100%; height: auto; border-radius: 5px; border: 1px solid var(--line); }
@media (max-width: 600px) { .strip-body.arena { grid-template-columns: 1fr; } }
.rules-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: .9rem; color: var(--muted); }
.rules-list b { color: var(--text); }
.flow { margin: 0; padding: 14px 18px 18px; list-style: none; display: grid; gap: 10px; }
.flow li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.flow li span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--gold); color: var(--gold); font-size: .75rem; }
.flow li b { display: block; font-family: var(--serif); font-size: 1.1rem; font-weight: 500; }
.flow li small { color: var(--muted); font-size: .82rem; }
.flow li:last-child span { border-color: var(--line-strong); color: var(--muted); }

/* Кодекс */
.codex { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: clamp(8px, 2vw, 28px); background: rgba(5, 8, 12, .8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: screen-in .25s ease-out; }
.codex[hidden] { display: none; }
.codex-frame { position: relative; width: min(1180px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.codex-frame::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.codex-head { flex: none; display: flex; align-items: center; gap: 18px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.codex-head h2 { font-size: 1.6rem; }
.codex-tabs { display: flex; gap: 4px; }
.codex-tabs .tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; font-weight: 600; letter-spacing: .02em; }
.codex-tabs .tab[aria-selected="true"] { color: var(--gold-2); border-bottom-color: var(--gold); }
.codex-tabs .tab:hover { color: var(--text); }
#codex-close { margin-left: auto; }
.codex-page { flex: 1; min-height: 0; overflow: auto; padding: 20px; animation: fade-up .3s ease-out; }
.codex-page[hidden] { display: none; }

.codex-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: stretch; }
.codex-steps.three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.codex-step { position: relative; display: grid; grid-template-rows: 170px 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: rgba(0, 0, 0, .3); animation: fade-up .5s ease-out both; }
.codex-step:nth-child(2) { animation-delay: .08s; } .codex-step:nth-child(3) { animation-delay: .16s; } .codex-step:nth-child(4) { animation-delay: .24s; }
.codex-step img { width: 100%; height: 170px; object-fit: cover; filter: saturate(.95); transition: transform .4s; }
.codex-step:hover img { transform: scale(1.04); }
.codex-step > div { padding: 14px 16px 18px; display: grid; gap: 6px; }
.codex-step:not(:has(img)) { grid-template-rows: auto; }
.codex-step h3 { font-size: 1.3rem; }
.codex-step p { color: #d7d0c2; font-size: .92rem; line-height: 1.5; }
.codex-step .step { margin-bottom: 4px; }

.codex-races { display: grid; grid-template-columns: 230px 1fr; gap: 18px; min-height: 420px; }
@media (max-width: 760px) { .codex-races { grid-template-columns: 1fr; } }
.codex-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; align-content: start; }
.codex-list button { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; width: 100%; padding: 5px 8px 5px 5px; border: 1px solid transparent; border-left: 3px solid transparent; border-radius: 5px; background: none; color: var(--text); text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
.codex-list button:hover { background: rgba(255, 255, 255, .04); }
.codex-list button[aria-selected="true"] { background: rgba(216, 179, 106, .08); border-color: var(--line); border-left-color: var(--c, var(--gold)); }
.codex-list img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; }
.codex-list b { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.02rem; line-height: 1.1; }
.codex-list small { color: var(--muted); font-size: .7rem; }
@media (max-width: 760px) { .codex-list { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 148px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; } .codex-list li { scroll-snap-align: start; } .codex-list small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; } }

.codex-race { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-content: start; animation: fade-up .3s ease-out; }
@media (max-width: 1000px) { .codex-race { grid-template-columns: 240px 1fr; } }
@media (max-width: 760px) { .codex-race { grid-template-columns: 1fr; } }
.codex-hero { position: relative; grid-row: 1 / span 5; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); border-bottom: 3px solid var(--c, var(--gold)); background: #0a0f14; align-self: start; }
@media (max-width: 760px) { .codex-hero { grid-row: auto; max-width: 360px; margin: 0 auto; } }
.codex-hero img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; display: block; }
.codex-hero-text { padding: 12px 14px 14px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, .35); }
.codex-hero-text .kicker { color: var(--c, var(--gold)); }
.codex-hero-text h3 { font-size: 1.9rem; line-height: 1.05; margin: 2px 0 6px; }
.codex-motto { font-family: var(--serif); font-style: italic; font-size: 1rem; color: var(--gold-2); }
.codex-lore { color: #d7d0c2; line-height: 1.55; }
.codex-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .codex-cols { grid-template-columns: 1fr; } }
.codex-cols ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .9rem; color: #d7d0c2; }
.codex-cols li { padding-left: 16px; position: relative; }
.codex-cols li::before { content: ""; position: absolute; left: 0; top: .5em; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.codex-cols div:last-child li::before { background: var(--bad); }
.eyebrow.good { color: var(--good); } .eyebrow.bad { color: var(--bad); }
.codex-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.codex-meta #codex-status.playable { color: var(--good); } .codex-meta #codex-status.roster { color: var(--warn); }
.overlay-actions.left { justify-content: flex-start; margin-top: 4px; }
