/* «Смена» — экран на весь Телеграм, без прокрутки и выделения. */
:root {
  --ink: #2b2118;
  --paper: #fff8ec;
  --orange: #ff8a00;
  --orange-dark: #d96f00;
  --muted: #7a6a58;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ink); color: var(--ink);
  font-family: var(--font);
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#app { position: fixed; inset: 0; }

/* Заставка и заглушка */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); text-align: center;
  background: radial-gradient(circle at 50% 30%, #fff3d6 0%, #f4d9a6 60%, #e2bb7a 100%);
}
.screen .logo { width: 150px; height: auto; }
.screen h1 {
  margin: 0; font-size: 56px; font-weight: 900; letter-spacing: 0.08em; color: var(--orange);
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink);
}
.screen .lead { margin: 0; font-size: 20px; font-weight: 700; }
.muted { margin: 0; color: var(--muted); font-size: 14px; }

.btn {
  font: 800 20px var(--font); color: #fff; background: var(--orange);
  border: 3px solid var(--ink); border-radius: 16px; padding: 14px 34px; min-width: 220px;
  box-shadow: 0 5px 0 var(--ink); cursor: pointer; touch-action: manipulation;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.btn.ghost { background: var(--paper); color: var(--ink); }

/* Смена */
.game { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.touch { position: absolute; inset: 0; touch-action: none; }
.layer:empty { display: none; }
.layer { position: absolute; inset: 0; }

/* Плавающий джойстик */
.joy {
  position: absolute; left: -60px; top: -60px; width: 120px; height: 120px; border-radius: 50%;
  border: 3px solid rgba(43, 33, 24, 0.55); background: rgba(255, 255, 255, 0.18); pointer-events: none;
}
.joy[hidden] { display: none; }
.joy-knob {
  position: absolute; left: 34px; top: 34px; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255, 138, 0, 0.85); border: 3px solid var(--ink);
}

/* Окна поверх смены */
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(43, 33, 24, 0.55);
}
.card {
  width: 100%; max-width: 360px; max-height: 100%; overflow: auto; background: var(--paper);
  border: 3px solid var(--ink); border-radius: 18px; padding: 18px 16px; box-shadow: 0 6px 0 var(--ink);
  display: flex; flex-direction: column; gap: 10px; text-align: center;
}
.card h2 { margin: 0; font-size: 22px; font-weight: 900; }
.pick {
  display: flex; flex-direction: column; gap: 2px; text-align: left; font: 15px var(--font); color: var(--ink);
  background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 12px 14px; cursor: pointer;
}
.pick b { font-size: 17px; }
.pick span { color: var(--muted); }
.naryad dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; text-align: left; }
.naryad dt { color: var(--muted); }
.naryad dd { margin: 0; font-weight: 700; }
.naryad ul { margin: 0; padding: 0; list-style: none; font-weight: 700; }
.naryad .btn { min-width: 0; }

/* ── Экраны (таск 05) ── */
.screen { padding-top: calc(20px + env(safe-area-inset-top)); }
.screen h2 { margin: 0; font-size: 22px; font-weight: 900; }
.screen .logo.small { width: 96px; }
.btn[disabled] { opacity: 0.6; }
a.btn { text-decoration: none; display: inline-block; }
.stack { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.who { display: flex; flex-direction: column; gap: 2px; font-size: 16px; }
.who b { font-size: 18px; }
.center { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 24px 0; }
.howto { margin: 0; padding: 0 0 0 22px; max-width: 340px; text-align: left; font-size: 17px; line-height: 1.35; font-weight: 600; }
.howto li + li { margin-top: 10px; }

/* Доступ */
.access { gap: 12px; }
.ask { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 340px; text-align: left; }
.field-label { font-weight: 800; font-size: 16px; }
.input {
  font: 600 18px var(--font); color: var(--ink); background: #fff; width: 100%;
  border: 3px solid var(--ink); border-radius: 12px; padding: 11px 12px; -webkit-user-select: text; user-select: text;
}
.hint { margin: 0; color: var(--muted); font-size: 14px; min-height: 1em; }
.error { margin: 0; color: #b3261e; font-weight: 700; font-size: 15px; min-height: 1.2em; }
.ask .btn { align-self: center; margin-top: 4px; }

/* Списки: выбор персонажа, доска, наряд */
.screen.list { justify-content: flex-start; align-items: stretch; gap: 10px; padding-left: 12px; padding-right: 12px; }
.screen.list > h2, .screen.list > .tabs { align-self: center; }
.screen.list > .btn { align-self: center; flex: none; }
.scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; width: 100%;
  max-width: 480px; align-self: center; display: flex; flex-direction: column; gap: 10px; }
.lvl { background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; padding: 10px; text-align: left;
  display: flex; flex-direction: column; gap: 8px; flex: none; }
.lvl-head { display: flex; flex-direction: column; gap: 1px; }
.lvl-head b { font-size: 17px; }
.lvl-head span { color: var(--muted); font-size: 13px; }
.lvl.locked { background: #e9dcc6; }
.lock { margin: 0; font-weight: 800; font-size: 15px; }
.heroes { display: flex; flex-direction: column; gap: 8px; }
.hero-card {
  display: flex; flex-direction: column; gap: 1px; text-align: left; font: 14px var(--font); color: var(--ink);
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 9px 12px; cursor: pointer;
  box-shadow: 0 3px 0 var(--ink); touch-action: manipulation;
}
.hero-card b { font-size: 17px; }
.hero-card span { color: var(--muted); }
.hero-card .perk { color: var(--ink); font-weight: 700; }
.hero-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.hero-card[disabled] { opacity: 0.5; box-shadow: none; cursor: default; }

.tabs { display: flex; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; flex: none; }
.tab { font: 800 16px var(--font); color: var(--ink); background: var(--paper); border: 0; padding: 9px 18px; cursor: pointer; }
.tab + .tab { border-left: 3px solid var(--ink); }
.tab.on { background: var(--orange); color: #fff; }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px;
  padding: 6px 10px; font-size: 15px; text-align: left; }
.row.me { background: #ffd89a; border-width: 3px; }
.row .pl { width: 26px; flex: none; font-weight: 900; text-align: right; }
.row .nm { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.row .fio { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.row .sc { flex: none; font-weight: 900; }
.badge, .done { font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 5px; color: #fff; background: #7a6a58; }
.badge.l2 { background: #2f6f8f; } .badge.l3 { background: #3f8f4f; } .badge.l4 { background: #8f3f7a; } .badge.l5 { background: #b3261e; }
.done { background: var(--orange-dark); }
.pinned { max-width: 480px; margin: 0 auto; width: 100%; }
.empty { margin: 24px 8px; font-size: 17px; font-weight: 700; text-align: center; }

/* Наряд */
.naryad-screen .scroll { justify-content: flex-start; }
.naryad-screen .card { max-width: 480px; margin: 0 auto; flex: none; max-height: none; overflow: visible; }
.naryad h2 { letter-spacing: 0.04em; }
.naryad dl { grid-template-columns: max-content 1fr; font-size: 15px; }
.itog { margin: 4px 0 0; font-size: 20px; font-weight: 900; }
.itog.won { color: #2e7d32; }
.itog.lost { color: #b3261e; }
.promo { margin: 0; font-size: 18px; font-weight: 900; color: var(--orange-dark); }
.best { margin: 0; font-weight: 700; }
.row3 { display: flex; gap: 8px; justify-content: center; flex: none; flex-wrap: wrap; }
.row3 .btn { min-width: 0; padding: 12px 14px; font-size: 16px; flex: 1 1 0; max-width: 200px; }

/* Пауза — вверху справа, под таймером смены */
.pause-btn {
  position: absolute; right: 10px; top: calc(64px + env(safe-area-inset-top)); width: 44px; height: 44px;
  border: 3px solid var(--ink); border-radius: 12px; background: rgba(255, 248, 236, 0.9); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0; touch-action: manipulation;
}
.pause-btn i { display: block; width: 6px; height: 18px; background: var(--ink); border-radius: 2px; }

/* Невысокие экраны (360×640 и ниже) */
@media (max-height: 700px) {
  .screen { gap: 10px; padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .screen .logo { width: 110px; }
  .screen .logo.small { width: 72px; }
  .screen h1 { font-size: 44px; }
  .screen .lead { font-size: 18px; }
  .btn { padding: 11px 28px; font-size: 18px; }
  .stack { gap: 10px; }
}
