:root {
  --graphite: #20201e;
  --graphite-2: #30302d;
  --ink: #171715;
  --paper: #e8ddc3;
  --paper-light: #f5ecd5;
  --paper-dim: #c9bda5;
  --pink: #e34c83;
  --yellow: #f5cc35;
  --cyan: #55b9ba;
  --red: #bd372e;
  --green: #7a9e5a;
  --shadow: 7px 8px 0 rgba(9, 9, 8, .7);
  --rough-border: 3px solid var(--ink);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--paper-light);
  background:
    radial-gradient(circle at 12% 5%, rgba(227, 76, 131, .1), transparent 28%),
    radial-gradient(circle at 90% 70%, rgba(85, 185, 186, .08), transparent 22%),
    var(--graphite);
  font-family: 'Segoe Print', 'Comic Sans MS', cursive;
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button { color: inherit; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.topbar {
  height: 86px;
  padding: 10px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 20;
  border-bottom: 2px solid rgba(232, 221, 195, .18);
  background: rgba(26, 26, 24, .9);
  backdrop-filter: blur(10px);
}

.brand {
  appearance: none;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transform: rotate(-1deg);
}

.brand-mark {
  width: 65px;
  height: 61px;
  display: block;
  position: relative;
  filter: drop-shadow(3px 3px 0 #050505);
}

.brand-mark::after {
  content: '';
  position: absolute;
  left: 7px; right: 6px; bottom: 3px; height: 29px;
  background: var(--paper);
  border: 3px solid var(--ink);
  clip-path: polygon(0 100%, 0 32%, 13% 32%, 13% 4%, 28% 4%, 28% 35%, 68% 35%, 68% 10%, 84% 10%, 84% 36%, 100% 36%, 100% 100%);
}

.tower { position: absolute; background: var(--paper); border: 3px solid var(--ink); z-index: 1; }
.tower-left { width: 16px; height: 27px; left: 15px; top: 12px; transform: rotate(-4deg); }
.tower-main { width: 18px; height: 39px; left: 34px; top: 1px; transform: rotate(2deg); }
.tower-right { width: 13px; height: 23px; right: 5px; top: 16px; transform: rotate(5deg); }
.keyhole { position: absolute; width: 9px; height: 14px; border-radius: 10px 10px 2px 2px; background: var(--pink); left: 30px; bottom: 10px; z-index: 3; }

.brand-copy { display: grid; line-height: .7; text-align: center; }
.brand-copy strong { font: 700 42px/.7 'Segoe Print', cursive; letter-spacing: -2px; }
.brand-copy small { margin-top: 9px; font: 700 13px/1 'Arial Narrow', Impact, sans-serif; letter-spacing: 5px; color: var(--pink); }

.top-actions { display: flex; gap: 10px; align-items: center; }
.ink-button, .primary-button {
  appearance: none;
  cursor: pointer;
  border: var(--rough-border);
  border-radius: 5px 12px 4px 9px;
  padding: 12px 18px;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Arial Narrow', Impact, sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  box-shadow: 3px 4px 0 #090908;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.ink-button:hover, .primary-button:hover { transform: translate(-1px, -2px) rotate(-.4deg); box-shadow: 5px 6px 0 #090908; }
.ink-button:active, .primary-button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #090908; }
.ink-button.compact { padding: 8px 13px; font-size: 13px; }
.icon-button { width: 42px; height: 42px; padding: 0; border-radius: 50% 43% 48% 40%; }
.primary-button { background: var(--pink); color: white; padding: 16px 24px; font-size: 16px; }
.primary-button.yellow { background: var(--yellow); color: var(--ink); }
.primary-button.cyan { background: var(--cyan); color: var(--ink); }
.primary-button.danger { background: var(--red); }
.primary-button:disabled, .ink-button:disabled { opacity: .38; cursor: not-allowed; transform: none; }

#app { min-height: calc(100vh - 86px); }

.home-screen {
  min-height: calc(100vh - 86px);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(420px, .8fr);
  position: relative;
  overflow: hidden;
}

.hero-art { min-height: 650px; position: relative; overflow: hidden; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: 43% center; filter: saturate(.82) contrast(1.08); transform: scale(1.015); }
.hero-scrim { position: absolute; inset: 0; background: linear-gradient(90deg, transparent 62%, var(--graphite) 100%), linear-gradient(0deg, rgba(20,20,18,.75), transparent 35%); }

.paper-card {
  background: var(--paper);
  color: var(--ink);
  border: var(--rough-border);
  box-shadow: var(--shadow);
  position: relative;
}
.torn { clip-path: polygon(0 1%, 8% 0, 16% 1.2%, 25% .2%, 39% 1.1%, 51% 0, 64% 1.1%, 79% .2%, 91% 1%, 100% 0, 99% 15%, 100% 27%, 99% 39%, 100% 54%, 99% 70%, 100% 83%, 99% 100%, 88% 99%, 74% 100%, 60% 99%, 45% 100%, 31% 99%, 17% 100%, 0 99%, 1% 84%, 0 71%, 1% 55%, 0 42%, 1% 29%); }

.hero-copy { align-self: center; margin: 36px 6vw 36px -36px; padding: clamp(30px, 4vw, 58px); transform: rotate(.4deg); z-index: 3; max-width: 590px; }
.eyebrow { margin: 0 0 9px; font: 600 12px/1.2 'Oswald', sans-serif; letter-spacing: 2px; text-transform: uppercase; color: var(--red); }
.hero-copy h1 { font: 700 clamp(58px, 7vw, 105px)/.78 'Segoe Print', cursive; margin: 16px 0 30px; text-transform: uppercase; letter-spacing: -5px; }
.hero-copy h1 span { color: var(--pink); display: inline-block; transform: rotate(-3deg); }
.lead { font-size: 21px; line-height: 1.25; margin-bottom: 28px; }
.home-actions { display: flex; flex-wrap: wrap; gap: 13px; }
.join-box { border-top: 2px dashed var(--ink); margin-top: 28px; padding-top: 18px; }
.join-box label { display: block; margin-bottom: 7px; font-weight: 700; }
.join-row { display: flex; gap: 8px; }
input, select {
  width: 100%;
  border: 2px solid var(--ink);
  background: rgba(255,255,255,.35);
  color: var(--ink);
  border-radius: 4px 8px 3px 7px;
  padding: 10px 12px;
  outline: none;
}
input:focus, select:focus { box-shadow: 0 0 0 3px var(--yellow); }
.join-row input { max-width: 150px; font: 600 26px/1 'Oswald', sans-serif; letter-spacing: 8px; }
.feature-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 22px; font-size: 13px; text-transform: uppercase; }
.feature-row span::before { content: '✦'; color: var(--pink); margin-right: 5px; }
.corner-warning { position: absolute; left: 24px; bottom: 10px; z-index: 3; font-size: 15px; transform: rotate(-1deg); text-shadow: 2px 2px #000; }

.screen-enter { animation: screenIn .36s ease both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

.page-shell { max-width: 1420px; margin: 0 auto; padding: 34px clamp(18px, 4vw, 58px) 70px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 22px; margin-bottom: 28px; }
.page-head h1, .page-head h2 { font: 700 clamp(48px, 7vw, 84px)/.85 'Amatic SC', cursive; margin: 0; }
.page-head p { margin: 7px 0 0; color: var(--paper-dim); font-size: 18px; }
.page-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
.setup-panel { grid-column: span 7; padding: 28px; }
.preview-panel { grid-column: span 5; padding: 24px; background: #d8cbb0; }
.section-title { font: 700 30px/1.1 'Segoe Print', cursive; margin: 0 0 18px; }
.form-section { padding: 20px 0; border-bottom: 2px dashed rgba(23,23,21,.45); }
.form-section:first-child { padding-top: 0; }
.form-section:last-child { border-bottom: 0; }
.option-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.option-card { position: relative; }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card label { display: block; min-height: 115px; padding: 15px; border: 2px solid var(--ink); border-radius: 7px 14px 5px 12px; background: rgba(255,255,255,.25); cursor: pointer; }
.option-card input:checked + label { background: var(--yellow); box-shadow: 4px 5px 0 var(--ink); transform: rotate(-.6deg); }
.option-card strong { display: block; font: 600 16px/1.1 'Oswald', sans-serif; text-transform: uppercase; }
.option-card small { display: block; margin-top: 7px; line-height: 1.2; }
.control-row { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; margin: 14px 0; }
.control-copy strong { display: block; font-size: 18px; }
.control-copy small { opacity: .72; }
.switch { width: 58px; height: 31px; position: relative; }
.switch input { opacity: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border: 2px solid var(--ink); border-radius: 20px 16px 19px 14px; background: #867e6c; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper-light); transition: .18s; }
.switch input:checked + span { background: var(--pink); }
.switch input:checked + span::after { transform: translateX(27px); }
.range-row { display: flex; align-items: center; gap: 16px; }
input[type=range] { accent-color: var(--pink); padding: 0; border: 0; }
.number-stamp { min-width: 52px; font: 700 38px/1 'Amatic SC', cursive; text-align: center; border: 2px solid var(--ink); background: var(--pink); color: white; transform: rotate(2deg); }
.player-inputs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.player-input { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 5px; }
.player-input > span { position: absolute; z-index: 2; left: 9px; top: 8px; width: 26px; height: 26px; background: var(--graphite); color: white; border-radius: 50%; display: grid; place-items: center; }
.player-input > input { padding-left: 43px; }
.avatar-upload { display: grid; place-items: center; min-width: 62px; border: 2px solid var(--ink); background: var(--yellow); border-radius: 7px 4px 8px 3px; cursor: pointer; font: 700 11px/1 'Arial Narrow', Impact, sans-serif; text-transform: uppercase; }
.avatar-upload.has-avatar { background: var(--cyan); }
.setup-footer { display: flex; justify-content: flex-end; margin-top: 22px; }

.mascot-preview { height: 260px; margin: -24px -24px 22px; overflow: hidden; border-bottom: var(--rough-border); position: relative; }
.mascot-preview img { width: 100%; height: 100%; object-fit: cover; object-position: 29% 56%; transform: scale(1.65); }
.mascot-preview::after { content: 'ваш сомнительный ведущий'; position: absolute; right: 16px; bottom: 12px; max-width: 130px; background: var(--yellow); color: var(--ink); padding: 7px 9px; border: 2px solid var(--ink); transform: rotate(3deg); }
.summary-list { list-style: none; margin: 0; padding: 0; }
.summary-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed rgba(23,23,21,.35); }
.summary-list b { font-family: 'Oswald', sans-serif; }
.content-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 18px; }
.tag { background: var(--graphite); color: var(--paper); border-radius: 20px 16px 22px 14px; padding: 6px 10px; font-size: 12px; }

.room-code { display: inline-flex; align-items: center; gap: 12px; font: 600 42px/1 'Oswald', sans-serif; letter-spacing: 12px; color: var(--yellow); }
.lobby-grid { display: grid; grid-template-columns: 1fr 360px; gap: 24px; }
.roster { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 12px; }
.roster-card { padding: 16px; display: flex; gap: 14px; align-items: center; color: var(--ink); }
.avatar-dot { width: 52px; height: 52px; border: 3px solid var(--ink); border-radius: 51% 43% 48% 42%; background: var(--pink); display: grid; place-items: center; font-size: 27px; transform: rotate(-3deg); }
.avatar-dot img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.roster-card:nth-child(3n+2) .avatar-dot { background: var(--yellow); }
.roster-card:nth-child(3n+3) .avatar-dot { background: var(--cyan); }
.roster-card h3 { margin: 0; font: 600 19px/1 'Oswald', sans-serif; }
.roster-card small { opacity: .62; }
.ready-stamp { margin-left: auto; color: var(--green); font: 700 22px/1 'Segoe Print', cursive; transform: rotate(-8deg); border: 2px solid currentColor; background: transparent; padding: 5px 8px; cursor: pointer; }
.ready-stamp.waiting { color: var(--red); transform: rotate(5deg); }
.lobby-side { padding: 23px; }

.handoff-screen { min-height: calc(100vh - 86px); display: grid; place-items: center; padding: 30px; position: relative; overflow: hidden; }
.handoff-screen::before { content: ''; position: absolute; inset: 0; background: url('assets/bunker-hero.png') center/cover; opacity: .16; filter: grayscale(1) contrast(1.3); }
.handoff-card { width: min(560px, 94vw); min-height: 500px; padding: 38px; display: grid; place-items: center; text-align: center; z-index: 2; }
.card-back-symbol { width: 160px; height: 160px; display: grid; place-items: center; border: 7px double var(--ink); border-radius: 50% 43% 48% 40%; background: var(--pink); font-size: 76px; box-shadow: 8px 9px 0 var(--ink); transform: rotate(-3deg); }
.handoff-card h1 { font: 700 62px/.85 'Amatic SC', cursive; margin: 22px 0 8px; }
.handoff-card p { font-size: 18px; margin: 0 0 28px; }

.character-layout { display: grid; grid-template-columns: 360px 1fr; gap: 22px; align-items: stretch; }
.portrait-card { min-height: 570px; overflow: hidden; background: var(--graphite-2); border: 4px solid var(--ink); box-shadow: var(--shadow); position: relative; }
.portrait-card::before { content: ''; position: absolute; inset: 0; background: url('assets/bunker-hero.png') center/cover; opacity: .18; filter: grayscale(1); }
.creature-portrait { position: relative; z-index: 2; height: 400px; display: grid; place-items: center; font-size: 170px; filter: drop-shadow(8px 10px 0 rgba(0,0,0,.65)); animation: creatureBreath 2.4s ease-in-out infinite; }
@keyframes creatureBreath { 50% { transform: translateY(-5px) rotate(1deg) scale(1.02); } }
.creature-tags { position: relative; z-index: 3; padding: 22px; background: var(--paper); color: var(--ink); border-top: 4px solid var(--ink); }
.creature-tags h2 { font: 700 44px/.9 'Amatic SC', cursive; margin: 0 0 9px; }
.creature-tags p { margin: 0; font-size: 17px; }
.character-sheet { padding: 24px; }
.character-top { display: flex; justify-content: space-between; align-items: start; gap: 14px; border-bottom: 2px dashed var(--ink); padding-bottom: 16px; }
.character-top h1 { font: 700 54px/.9 'Amatic SC', cursive; margin: 0; }
.rofliks { background: var(--yellow); border: 2px solid var(--ink); padding: 9px 13px; text-align: center; transform: rotate(2deg); }
.rofliks strong { display: block; font: 700 28px/1 'Oswald', sans-serif; }
.rofliks small { text-transform: uppercase; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 17px; }
.stat-card { min-height: 92px; padding: 12px; border: 2px solid var(--ink); border-radius: 4px 10px 3px 8px; background: rgba(255,255,255,.24); position: relative; overflow: hidden; }
.stat-card.secret { background: repeating-linear-gradient(45deg, rgba(23,23,21,.08), rgba(23,23,21,.08) 7px, transparent 7px, transparent 14px); }
.stat-label { display: block; font: 600 11px/1 'Oswald', sans-serif; letter-spacing: 1.2px; text-transform: uppercase; color: var(--red); margin-bottom: 6px; }
.stat-value { font-size: 17px; line-height: 1.12; }
.stat-card.secret .stat-value { filter: blur(5px); user-select: none; opacity: .75; }
.stat-card.secret::after { content: 'неизвестно'; position: absolute; inset: 0; display: grid; place-items: center; font: 700 25px/1 'Amatic SC', cursive; transform: rotate(-5deg); }
.sheet-actions { margin-top: 20px; display: flex; justify-content: space-between; gap: 12px; align-items: center; }

.board-shell { padding-top: 20px; }
.board-top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; margin-bottom: 17px; }
.round-badge { justify-self: start; font: 700 34px/1 'Amatic SC', cursive; }
.timer { font: 600 36px/1 'Oswald', sans-serif; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); padding: 10px 18px; transform: rotate(-1deg); min-width: 120px; text-align: center; }
.board-controls { justify-self: end; display: flex; gap: 9px; }
.world-strip { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; margin-bottom: 16px; }
.world-card { min-height: 155px; padding: 18px; color: var(--ink); overflow: hidden; }
.world-card h3 { font: 700 32px/1 'Amatic SC', cursive; margin: 0 0 7px; }
.world-card p { margin: 0; line-height: 1.18; }
.world-card.catastrophe { background: #e2b7b3; }
.world-card.bunker { background: #b7d1c8; }
.reveal-meter { margin-top: 14px; height: 12px; border: 2px solid var(--ink); background: rgba(255,255,255,.35); }
.reveal-meter span { display: block; height: 100%; background: var(--pink); }
.table-area { padding: 18px; background: rgba(232,221,195,.08); border: 2px solid rgba(232,221,195,.25); border-radius: 20px 11px 22px 13px; }
.player-table { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.mini-player { min-height: 210px; padding: 14px; color: var(--ink); position: relative; cursor: pointer; transition: .15s; }
.mini-player:hover { transform: translateY(-4px) rotate(-.4deg); }
.mini-player.exiled { filter: grayscale(.8); background: #bba8a2; }
.mini-player.dead { opacity: .55; transform: rotate(2deg); }
.mini-avatar { font-size: 48px; float: right; margin-left: 5px; }
.mini-player h3 { font: 700 29px/.9 'Amatic SC', cursive; margin: 0 0 5px; }
.mini-player .owner { font-size: 12px; opacity: .65; text-transform: uppercase; }
.mini-stat { font-size: 13px; margin-top: 9px; padding-top: 7px; border-top: 1px dashed var(--ink); }
.status-stamp { position: absolute; right: 7px; bottom: 8px; font: 700 23px/1 'Amatic SC', cursive; color: var(--red); transform: rotate(-10deg); }
.board-bottom { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 16px; }
.active-hint { color: var(--paper-dim); }

.action-drawer { position: fixed; inset: auto 0 0 0; z-index: 50; background: var(--paper); color: var(--ink); border-top: 4px solid var(--ink); box-shadow: 0 -14px 40px rgba(0,0,0,.45); padding: 20px clamp(20px, 5vw, 70px); transform: translateY(105%); transition: .25s ease; }
.action-drawer.open { transform: translateY(0); }
.drawer-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.drawer-title { font: 700 34px/1 'Amatic SC', cursive; margin: 0 0 12px; }

.vote-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 25px 0; }
.vote-card input { position: absolute; opacity: 0; }
.vote-card label { display: block; min-height: 155px; padding: 17px; cursor: pointer; }
.vote-card input:checked + label { background: var(--pink); color: white; transform: rotate(-1deg); box-shadow: 7px 8px 0 #090908; }
.vote-card .vote-emoji { font-size: 44px; }
.vote-card h3 { font: 700 30px/1 'Amatic SC', cursive; margin: 6px 0; }
.vote-progress { display: flex; gap: 6px; }
.vote-progress span { width: 26px; height: 9px; background: rgba(232,221,195,.25); border: 1px solid var(--paper); }
.vote-progress span.done { background: var(--yellow); }

.final-screen { min-height: calc(100vh - 86px); position: relative; display: grid; place-items: center; padding: 34px; overflow: hidden; }
.final-screen::before { content: ''; position: absolute; inset: 0; background: url('assets/bunker-hero.png') center/cover; filter: grayscale(.4) contrast(1.2); opacity: .32; }
.final-card { width: min(980px, 95vw); padding: clamp(28px, 5vw, 64px); text-align: center; z-index: 2; }
.final-card h1 { font: 700 clamp(56px, 8vw, 96px)/.78 'Amatic SC', cursive; margin: 9px 0 20px; }
.mission-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; text-align: left; }
.mission-card { padding: 14px; border: 2px solid var(--ink); background: rgba(255,255,255,.22); cursor: pointer; }
.mission-card:hover, .mission-card.selected { background: var(--yellow); transform: rotate(-.5deg); }
.mission-card h3 { font: 700 24px/1 'Amatic SC', cursive; margin: 0 0 6px; }
.ending-list { text-align: left; max-width: 650px; margin: 20px auto; }
.ending-list li { margin: 8px 0; }

.paper-dialog { width: min(680px, 92vw); background: var(--paper); color: var(--ink); border: 4px solid var(--ink); box-shadow: 12px 14px 0 rgba(0,0,0,.7); padding: 32px; transform: rotate(-.3deg); }
.paper-dialog::backdrop { background: rgba(10,10,9,.82); backdrop-filter: blur(4px); }
.paper-dialog h2 { font: 700 50px/.9 'Amatic SC', cursive; margin: 0 0 22px; }
.dialog-close { position: absolute; right: 12px; top: 7px; border: 0; background: transparent; color: var(--ink); font-size: 38px; cursor: pointer; }
.rule-list { padding-left: 22px; }
.rule-list li { margin: 12px 0; line-height: 1.25; }
.scribble-note { padding: 12px; background: var(--yellow); border: 2px solid var(--ink); transform: rotate(1deg); }
.toast { position: fixed; z-index: 200; left: 50%; bottom: 26px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; background: var(--yellow); color: var(--ink); border: 3px solid var(--ink); box-shadow: 5px 6px 0 #000; padding: 12px 18px; transition: .2s; font-weight: 700; max-width: min(520px, 90vw); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0) rotate(-1deg); }

.network-page { min-height: calc(100vh - 86px); }
.connection-pill {
  align-self: center;
  padding: 8px 12px;
  border: 2px solid var(--green);
  color: var(--green);
  background: rgba(32, 32, 30, .82);
  font: 700 12px/1 'Arial Narrow', Impact, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 18px 14px 19px 12px;
}
.connection-pill.lost { color: var(--red); border-color: var(--red); }
.network-offline .topbar::after {
  content: 'переподключение…';
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  padding: 5px 14px;
  background: var(--red);
  color: white;
  font-size: 12px;
}
.join-panel {
  width: min(900px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
.join-illustration { min-height: 430px; overflow: hidden; border-right: var(--rough-border); }
.join-illustration img { width: 100%; height: 100%; object-fit: cover; object-position: 27% center; }
.join-fields { padding: clamp(28px, 5vw, 54px); display: grid; gap: 19px; align-content: center; }
.avatar-picker {
  padding: 11px 14px;
  border: 2px dashed var(--ink);
  background: rgba(255,255,255,.2);
  cursor: pointer;
}
.avatar-picker input { margin-top: 8px; padding: 5px; font-size: 12px; }
.network-invite {
  color: var(--ink);
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.network-invite strong { display: block; max-width: 600px; overflow: hidden; text-overflow: ellipsis; }
.roster-card.disconnected { opacity: .55; filter: grayscale(1); }
.waiting-copy, .network-waiting {
  text-align: center;
  color: var(--paper-dim);
  font-size: 18px;
  padding: 18px;
}
.network-center-button { display: block; margin: 24px auto; }
.network-character-grid { display: grid; gap: 20px; }
.network-character {
  padding: 24px;
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 24px;
  color: var(--ink);
}
.network-character h2 { margin: 0 0 15px; font: 700 40px/1 'Segoe Print', cursive; }
.network-creature {
  min-height: 300px;
  display: grid;
  place-items: center;
  font-size: 130px;
  border: 3px solid var(--ink);
  background: var(--graphite-2);
  filter: drop-shadow(5px 6px 0 rgba(0,0,0,.45));
  animation: creatureBreath 2.4s ease-in-out infinite;
}
.network-action-panel {
  margin-top: 16px;
  padding: 18px;
  color: var(--ink);
  display: grid;
  grid-template-columns: minmax(180px, .6fr) minmax(180px, .6fr) minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.network-action-panel h2 { margin: 0; font: 700 28px/1 'Segoe Print', cursive; }
.vote-choice {
  appearance: none;
  color: var(--ink);
  padding: 18px;
  text-align: left;
  cursor: pointer;
  transition: .15s;
}
.vote-choice:hover { background: var(--pink); color: white; transform: translateY(-4px) rotate(-1deg); }
.vote-choice span { display: block; font-size: 54px; }
.vote-choice strong { display: block; font: 700 27px/1 'Segoe Print', cursive; }
.vote-choice small { display: block; margin-top: 6px; }
.mission-card.clickable { cursor: pointer; }
.mission-card.clickable:hover { background: var(--yellow); transform: translateY(-4px) rotate(-.5deg); }

@media (max-width: 1000px) {
  .home-screen { grid-template-columns: 1fr; }
  .hero-art { min-height: 48vh; }
  .hero-copy { margin: -80px 6vw 40px; max-width: none; }
  .page-grid, .lobby-grid, .character-layout { display: block; }
  .setup-panel, .preview-panel, .lobby-side, .portrait-card { margin-bottom: 20px; }
  .character-layout .portrait-card { min-height: 420px; }
  .creature-portrait { height: 260px; font-size: 120px; }
  .world-strip { grid-template-columns: 1fr; }
  .network-action-panel { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .topbar { height: 70px; padding: 8px 12px; }
  #app { min-height: calc(100vh - 70px); }
  .brand-mark { width: 48px; height: 47px; transform: scale(.8); margin-left: -6px; }
  .brand-copy strong { font-size: 32px; }
  .brand-copy small { font-size: 10px; letter-spacing: 3px; }
  #rulesButton { display: none; }
  .hero-copy { margin: -45px 14px 30px; padding: 28px 22px; }
  .hero-copy h1 { font-size: 72px; }
  .hero-art { min-height: 390px; }
  .lead { font-size: 18px; }
  .option-grid, .stats-grid, .player-inputs, .roster, .mission-options { grid-template-columns: 1fr; }
  .page-head { display: block; }
  .preview-panel { display: none; }
  .setup-panel { padding: 20px; }
  .board-top { grid-template-columns: 1fr auto; }
  .timer { grid-column: 2; grid-row: 1; }
  .board-controls { grid-column: 1 / -1; justify-self: stretch; }
  .board-controls button { flex: 1; }
  .drawer-grid { grid-template-columns: 1fr; }
  .corner-warning { display: none; }
  .join-panel, .network-character { grid-template-columns: 1fr; }
  .join-illustration { min-height: 230px; border-right: 0; border-bottom: var(--rough-border); }
  .network-action-panel { grid-template-columns: 1fr; }
}

@media (orientation: portrait) and (min-width: 681px) {
  body::after { content: 'Поверни устройство. Таксе так удобнее.'; position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; padding: 25vw; text-align: center; background: var(--graphite); color: var(--paper); font: 700 58px/.9 'Amatic SC', cursive; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
