/* Меню после входа: сохранения, сценарии, новая игра, личный кабинет.
   Устройство — как у alterra (шапка с разделами, надзаголовок, крупный заголовок, карточки, плашка внизу экрана создания),
   облик — свой: бумага, эмаль, шрифт реплик в заголовках и газовая жёлтая кнопка. */
#lobby { position: fixed; inset: 0; z-index: 25; overflow-y: auto; background: #f3f5f9; color: var(--ink); }
body.in-lobby #corner, body.in-lobby #hud, body.in-lobby #dock, body.in-lobby #ticker, body.in-lobby #pins { display: none !important; }
:root { --lb-display: "Balsamiq Sans", "Comic Sans MS", var(--font); --lb-line: #e1e5ee; --lb-card: #fff; }

/* ---- шапка ---- */
.lb-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; height: 60px; padding: 0 max(16px, env(safe-area-inset-left)); background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--lb-line); }
.lb-brand { margin-right: 14px; color: var(--ink); }
.lb-nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.lb-link { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 10px; font-weight: 600; color: var(--muted); white-space: nowrap; text-decoration: none; }
.lb-link:hover { color: var(--ink); background: var(--soft); }
.lb-link.here { color: var(--ink); background: var(--soft); }
.lb-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--enamel); color: #fff; font-size: 11px; display: inline-grid; place-items: center; }
.lb-gap { flex: 1; }
.lb-user { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 4px; border-radius: 19px; color: var(--ink); }
.lb-user:hover { background: var(--soft); }
.lb-ava { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #e7ebf4; color: var(--enamel); font-weight: 700; }
.lb-mail { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.lb-out { min-height: 38px; }

/* ---- поле ---- */
.lb-main { width: min(1080px, 100%); margin: 0 auto; padding: 36px max(16px, env(safe-area-inset-left)) 120px; }
.lb-head { margin-bottom: 28px; }
.lb-eyebrow { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.lb-title { margin: 0; font: 700 clamp(30px, 4vw, 42px)/1.1 var(--lb-display); letter-spacing: -.01em; }
.lb-lede { max-width: 580px; margin: 12px 0 0; font-size: 15px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.lb-empty, .lb-note { color: var(--muted); }
.lb-note { padding: 12px 16px; border-radius: 12px; background: #fff7d9; color: #6b5200; margin: -8px 0 22px; }
.lb-error { padding: 12px 16px; border-radius: 12px; background: var(--alarm-soft); color: #8a1f23; margin: 0 0 20px; }
.lb-back { margin: 0 0 18px; padding: 4px 0; color: var(--muted); font-weight: 600; }
.lb-back:hover { color: var(--ink); }

/* ---- каталог ---- */
.lb-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.lb-card { width: 100%; height: 100%; display: flex; flex-direction: column; text-align: left; border-radius: 16px; overflow: hidden; background: var(--lb-card); border: 1px solid var(--lb-line); color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
button.lb-card:not(:disabled):hover { border-color: #c8d0e0; box-shadow: 0 10px 30px rgba(20, 30, 60, .1); transform: translateY(-2px); }
button.lb-card:focus-visible { outline: 3px solid var(--enamel); outline-offset: 3px; }
.lb-card:disabled { cursor: default; opacity: .7; }
.lb-art { display: block; aspect-ratio: 16 / 9; background: #99d9ea center / cover no-repeat; }
.lb-art-soon { display: grid; place-items: center; background: repeating-linear-gradient(-45deg, #eef1f6 0 14px, #f6f8fb 14px 28px); }
.lb-art-soon span { font: 700 54px var(--lb-display); color: #c3cad8; }
.lb-soon { border-style: dashed; }
.lb-body { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 20px; flex: 1; }
.lb-year { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--enamel); }
.lb-name { font: 700 26px/1.15 var(--lb-display); }
.lb-sub { color: var(--muted); font-weight: 500; }
.lb-meta { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.lb-desc { margin: 4px 0 0; line-height: 1.55; color: #3c4456; text-wrap: pretty; }
.lb-cta { margin-top: auto; padding-top: 12px; font-weight: 700; color: var(--enamel); }

/* ---- новая игра ---- */
.lb-setup { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
.lb-col .lb-desc { margin-top: 14px; }
.lb-col .lb-meta { margin-top: 8px; }
.lb-art-big { border-radius: 16px; border: 1px solid var(--lb-line); }
.lb-h2 { margin: 0 0 10px; font: 700 20px var(--lb-display); }
.lb-h2 ~ .lb-h2 { margin-top: 26px; }
.lb-field { display: grid; gap: 6px; }
.lb-hint { margin: 0 0 10px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.lb-field .lb-hint { margin: 0; }
.lb-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.lb-tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; text-align: left; border-radius: 12px; background: #fff; border: 1.5px solid var(--lb-line); color: var(--ink); min-height: 92px; }
.lb-tile b { font-size: 15px; }
.lb-tile span { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.lb-tile:hover { border-color: #c8d0e0; }
.lb-tile.on { border-color: var(--gas-deep); background: #fffbea; box-shadow: 0 0 0 2px rgba(242, 178, 0, .25); }
.lb-tile:focus-visible { outline: 3px solid var(--enamel); outline-offset: 2px; }
.lb-dock { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(1048px, calc(100% - 32px)); display: flex; align-items: center; gap: 16px; padding: 12px 12px 12px 20px; border-radius: 16px; background: #fff; border: 1px solid var(--lb-line); box-shadow: var(--shadow); }
.lb-dock-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.lb-dock-txt b { color: var(--ink); }
.lb-go { min-width: 170px; }

/* ---- сохранения ---- */
.lb-hero { position: relative; display: grid; grid-template-columns: 1.3fr 1fr; align-items: stretch; margin-bottom: 28px; border-radius: 18px; overflow: hidden; background: #fff; border: 1px solid var(--lb-line); }
.lb-hero-txt { padding: 28px 30px; }
.lb-hero-art { background: center 35% / cover no-repeat; -webkit-mask-image: linear-gradient(90deg, transparent, #000 35%); mask-image: linear-gradient(90deg, transparent, #000 35%); }
.lb-saves { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.lb-save { display: flex; flex-direction: column; border-radius: 16px; background: #fff; border: 1px solid var(--lb-line); overflow: visible; }
.lb-save.asking { border-color: #f0b4b6; }
.lb-save-art { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 15px 15px 0 0; background: #99d9ea center / cover no-repeat; }
.lb-save-art::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, transparent 55%, rgba(10, 16, 30, .45)); }
.lb-day, .lb-live { position: absolute; z-index: 1; bottom: 10px; padding: 3px 9px; border-radius: 9px; font-size: 12px; font-weight: 700; }
.lb-day { left: 10px; background: #fff; color: var(--ink); }
.lb-live { right: 10px; background: var(--ok); color: #fff; }
.lb-play { position: absolute; z-index: 1; left: 50%; top: 45%; transform: translate(-50%, -50%) scale(.9); width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--gas); color: var(--ink); opacity: 0; transition: opacity .15s, transform .15s; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.lb-save-art:hover .lb-play, .lb-save-art:focus-visible .lb-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.lb-save-art:focus-visible { outline: 3px solid var(--enamel); outline-offset: 2px; }
.lb-save-body { padding: 14px 16px 4px; }
.lb-save-name { margin: 0; font: 700 20px/1.2 var(--lb-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-save-line { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.lb-rename { width: 100%; }
.lb-save-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; }
.lb-when { flex: 1; font-size: 12.5px; color: var(--muted); }
.lb-more-wrap { position: relative; }
.lb-more { width: 38px; height: 38px; border-radius: 10px; font-weight: 800; letter-spacing: 1px; color: var(--muted); }
.lb-more:hover, .lb-more[aria-expanded="true"] { background: var(--soft); color: var(--ink); }
.lb-menu { position: absolute; right: 0; bottom: 44px; z-index: 3; min-width: 170px; padding: 6px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); display: grid; }
.lb-menu button { padding: 9px 12px; border-radius: 8px; text-align: left; font-weight: 500; }
.lb-menu button:hover { background: var(--soft); }
.lb-menu .danger { color: var(--alarm); }
.lb-continue { min-height: 38px; }
.lb-save-foot.ask { flex-wrap: wrap; background: var(--alarm-soft); border-radius: 0 0 15px 15px; }
.lb-ask { flex: 1 1 100%; font-size: 13px; font-weight: 600; color: #8a1f23; }
.lb-ask-acts { display: flex; gap: 8px; margin-left: auto; }
.btn.danger { background: var(--alarm); color: #fff; }
.btn.danger:hover { background: #b92e33; }
.lb-none { padding: 30px; border-radius: 16px; background: #fff; border: 1px dashed #cfd6e3; text-align: center; }
.lb-none p { margin: 0 0 14px; color: var(--muted); }
.lb-account { max-width: 560px; padding: 22px 24px; border-radius: 16px; background: #fff; border: 1px solid var(--lb-line); }

/* ---- знак: адресная табличка на доме — синее поле, белая окантовка, номер за чертой ---- */
.addr { position: relative; display: inline-flex; align-items: stretch; flex: none; padding: 5px; border-radius: 9px; background: #1d4596;
  color: #fff; font-family: "Golos Text", system-ui, sans-serif; line-height: 1; box-shadow: 0 1px 0 rgba(10, 30, 80, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.addr::after { content: ""; position: absolute; inset: 2.5px; border: 1.5px solid #fff; border-radius: 6.5px; pointer-events: none; }
.addr-st { display: grid; align-content: center; gap: 2px; padding: 3px 9px 3px 8px; text-align: left; }
.addr-st small { font-size: 9px; font-weight: 500; letter-spacing: .02em; opacity: .92; white-space: nowrap; }
.addr-st b { font-size: 17px; font-weight: 800; letter-spacing: -.005em; white-space: nowrap; }
.addr-no { display: grid; place-items: center; min-width: 34px; padding: 0 7px 1px; border-left: 1.5px solid #fff; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.logo:hover .addr, .logo:focus-visible .addr { background: #2251b0; }
.addr.big { padding: 9px; border-radius: 16px; }
.addr.big::after { inset: 4.5px; border-width: 2.5px; border-radius: 11.5px; }
.addr.big .addr-st { gap: 4px; padding: 6px 18px 6px 16px; }
.addr.big .addr-st small { font-size: 16px; }
.addr.big .addr-st b { font-size: 34px; }
.addr.big .addr-no { min-width: 70px; padding: 0 14px 2px; border-left-width: 2.5px; font-size: 50px; }
.logo { display: flex; align-items: center; gap: 11px; text-decoration: none; border-radius: 10px; }
.logo-word { font: 700 23px/1 var(--lb-display); letter-spacing: -.01em; color: var(--ink); white-space: nowrap; }

/* ---- экран загрузки ---- */
#boot { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: #f3f5f9; transition: opacity .35s; }
#boot.gone { opacity: 0; pointer-events: none; }
.boot-in { display: grid; justify-items: center; gap: 6px; padding: 24px; text-align: center; }
.boot-in .addr { margin-bottom: 4px; }
.boot-word { margin-bottom: 16px; font-size: 34px; }
.boot-dots { display: inline-flex; gap: 6px; margin-bottom: 4px; }
.boot-dots i { width: 7px; height: 7px; border-radius: 50%; background: #1d4596; animation: boot-dot 1.2s infinite; }
.boot-dots i:nth-child(2) { animation-delay: .18s; } .boot-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes boot-dot { 0%, 60%, 100% { opacity: .25; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
#boot-text { min-height: 1.5em; max-width: 340px; margin: 0; color: var(--muted); font-size: 15px; }
#boot-text.fresh { animation: rise .4s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .boot-dots i, #boot-text.fresh { animation: none; } }

/* ---- «вы в другом доме» ---- */
#elsewhere { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(20, 28, 50, .45); }
#elsewhere .card { width: min(420px, 100%); padding: 24px; }
#elsewhere h2 { margin: 0 0 8px; font: 700 22px var(--lb-display); }
#elsewhere p { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }
#elsewhere .btn { width: 100%; text-decoration: none; color: var(--ink); }
#menu a { display: block; padding: 9px 12px; border-radius: 10px; font-weight: 500; color: inherit; text-decoration: none; }
#menu a:hover { background: var(--soft); }

@media (max-width: 760px) {
  .lb-mail { display: none; }
  .lb-brand .addr-st small { display: none; }
  .lb-bar { flex-wrap: wrap; height: auto; row-gap: 4px; padding-top: 8px; padding-bottom: 6px; }
  .lb-nav { order: 3; flex: 1 1 100%; }
  .lb-brand { margin-right: 4px; }
  .lb-setup, .lb-hero { grid-template-columns: 1fr; }
  .lb-hero-art { min-height: 120px; order: -1; -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent); mask-image: linear-gradient(180deg, #000 60%, transparent); }
  .lb-tiles { grid-template-columns: 1fr; }
  .lb-tile { min-height: 0; }
  .lb-main { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) { .lb-card, .lb-play { transition: none; } }
