/* Телефон: mobile-first, крупные кнопки, шрифт в полях ≥16px — чтобы iOS не зумил при вводе. */
body.play {
  font-size: 17px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overscroll-behavior: none;
}

.play .stage {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1rem;
  min-height: calc(100dvh - 4rem);
}

.play .stage > * {
  margin-top: 1rem;
}

/* --- шапка игрока --- */
.me-bar {
  --c: var(--violet);
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: 34rem;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  background: rgba(20, 5, 45, 0.55);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--c);
}

.me-bar[hidden] {
  display: none;
}

.me-name {
  font-weight: 800;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-score {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.me-score small {
  font-weight: 600;
  opacity: 0.7;
}

.me-code {
  padding: 0.2rem 0.5rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 800;
  letter-spacing: 0.1em;
  font-size: 0.85rem;
}

/* --- карточки --- */
.card {
  padding: 1.4rem;
  border-radius: 1.4rem;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
}

.center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
}

.card h1,
.card h2 {
  margin: 0;
  font-weight: 900;
  line-height: 1.15;
}

.card h1 {
  font-size: 1.8rem;
}

.card h2 {
  font-size: 1.6rem;
}

.muted {
  margin: 0;
  color: rgba(29, 16, 51, 0.7);
  font-size: 1.05rem;
}

.emoji-big {
  font-size: 4.5rem;
  line-height: 1;
}

.avatar.huge {
  font-size: 3.5rem;
}

.vip-note {
  margin: 0;
  padding: 0.6rem 0.9rem;
  border-radius: 0.8rem;
  background: #fff3bf;
  font-weight: 600;
}

/* --- вход --- */
.join {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1.5rem;
}

.join .logo {
  display: block;
  width: min(100%, 300px);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}

.tagline {
  margin: -0.4rem 0 0.6rem;
  text-align: center;
  font-weight: 600;
  opacity: 0.85;
}

.host-link {
  margin: 0.4rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.75;
}

.host-link a {
  color: var(--yellow);
  font-weight: 700;
}

.label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 700;
}

.input {
  width: 100%;
  font: inherit;
  font-size: 1.2rem; /* ≥16px — без автозума на iOS */
  font-weight: 700;
  padding: 0.9rem 1rem;
  border: 3px solid transparent;
  border-radius: 1rem;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

.input:focus {
  outline: none;
  border-color: var(--yellow);
}

.code-input {
  text-align: center;
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 0.4em;
  padding-left: 1.4rem;
  text-transform: uppercase;
}

.code-input::placeholder {
  color: rgba(29, 16, 51, 0.2);
}

.form-error {
  padding: 0.8rem 1rem;
  border-radius: 1rem;
  background: #c9184a;
  font-weight: 700;
  animation: wiggle 0.3s ease-in-out 2;
}

.form-error[hidden] {
  display: none;
}

.big-btn {
  width: 100%;
  min-height: 3.6rem;
  font-size: 1.3rem;
}

.start-btn:not(:disabled) {
  background: var(--mint);
  animation: pulse 0.8s ease-in-out infinite alternate;
}

.hint {
  margin: 0;
  text-align: center;
  opacity: 0.75;
}

.link-btn {
  border: 0;
  background: none;
  color: rgba(29, 16, 51, 0.55);
  text-decoration: underline;
  padding: 0.6rem;
  font-size: 0.95rem;
}

/* --- ответы --- */
.write,
.vote {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.row-between .btn {
  flex: 1;
  max-width: 14rem;
}

.step {
  font-weight: 800;
  color: var(--bg-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.9rem;
}

.prompt {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.25;
}

.prompt.small {
  font-size: 1.15rem;
}

.answer-input {
  resize: none;
  min-height: 6.5rem;
  border-color: #e9d8fd;
  box-shadow: none;
}

.counter {
  color: rgba(29, 16, 51, 0.5);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer.small {
  font-size: 0.75rem;
}

.card .timer::before {
  background: var(--paper);
}

.card .timer {
  color: var(--ink);
  background: conic-gradient(var(--bg-2) calc(var(--p) * 360deg), rgba(0, 0, 0, 0.1) 0);
}

.card .timer.urgent {
  background: conic-gradient(var(--pink) calc(var(--p) * 360deg), rgba(0, 0, 0, 0.1) 0);
}

/* --- голосование --- */
.vote-options {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.vote-btn {
  min-height: 5rem;
  padding: 1rem;
  border: 0;
  border-radius: 1.2rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
  overflow-wrap: anywhere;
  touch-action: manipulation;
  transition: transform 0.1s, opacity 0.2s;
}

.vote-btn.a {
  background: #ffe066;
}

.vote-btn.b {
  background: #8ce99a;
}

.vote-btn:active {
  transform: translateY(4px);
}

.vote-btn:disabled {
  opacity: 0.4;
}

.vote-btn.chosen {
  opacity: 1;
  outline: 4px solid var(--bg-2);
}

/* ================= сборник ================= */
.field-error {
  padding: 0.6rem 0.8rem;
  border-radius: 0.8rem;
  background: #ffe3e8;
  color: #c9184a;
  font-weight: 700;
}

.field-error[hidden] {
  display: none;
}

.game-chip {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 1rem;
  background: #f3e8ff;
}

.game-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
}

.game-option {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.7rem 0.9rem;
  border: 3px solid #e9d8fd;
  border-radius: 1rem;
  background: #fff;
  color: var(--ink);
  text-align: left;
  touch-action: manipulation;
}

.game-option b {
  font-size: 1.1rem;
}

.game-option span,
.game-option small {
  color: rgba(29, 16, 51, 0.65);
}

.game-option.selected {
  border-color: var(--bg-2);
  background: #fff3bf;
}

/* --- выбор игрока («Кто из нас?») --- */
.player-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.player-choice {
  --c: var(--violet);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-height: 6rem;
  padding: 0.8rem 0.4rem;
  border: 0;
  border-radius: 1.2rem;
  background: color-mix(in srgb, var(--c) 25%, #fff);
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
  overflow-wrap: anywhere;
  touch-action: manipulation;
}

.player-choice .avatar {
  font-size: 1.5rem;
}

.player-choice:disabled {
  opacity: 0.4;
}

.player-choice.chosen {
  opacity: 1;
  outline: 4px solid var(--bg-2);
}

.my-titles {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 1rem;
  background: #fff3bf;
  text-align: left;
}

.my-titles ul {
  margin: 0.3rem 0 0;
  padding: 0;
  list-style: none;
}

/* --- холст («Каляки») --- */
.draw {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
}

.secret {
  padding: 0.5rem 0.8rem;
  border-radius: 0.8rem;
  background: #fff3bf;
}

.sketch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 1rem;
  border: 3px solid #e9d8fd;
  background: #fff;
  touch-action: none; /* рисуем, а не прокручиваем страницу */
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}

.toolbox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.swatches,
.tools {
  display: flex;
  gap: 0.4rem;
}

.swatch {
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--c);
  box-shadow: 0 0 0 2px #e9d8fd;
  touch-action: manipulation;
}

.swatch.active {
  box-shadow: 0 0 0 3px var(--ink);
  transform: scale(1.1);
}

.tool-btn {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 0.8rem;
  background: #f3e8ff;
  color: var(--ink);
  font-size: 1.2rem;
  touch-action: manipulation;
}

.tool-btn.active {
  background: var(--bg-2);
  color: #fff;
}

.tool-btn.brush i {
  display: block;
  border-radius: 50%;
  background: currentColor;
}

/* ================= «Смертельный квиз» ================= */
.ghost-note {
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: 0.8rem;
  background: #ede7f6;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
}

.pick-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
  gap: 0.7rem;
}

.pick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.9rem 0.4rem;
  border: 0;
  border-radius: 1.2rem;
  background: #fde2e7;
  color: var(--ink);
  font-size: 2.4rem;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
  touch-action: manipulation;
}

.pick-btn b {
  font-size: 1rem;
}

.pick-btn:disabled {
  opacity: 0.4;
}

.pick-btn.chosen {
  opacity: 1;
  outline: 4px solid #c9184a;
}

.equation {
  font-size: 2.6rem;
  font-weight: 900;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.math-input {
  text-align: center;
  font-size: 2rem;
}

.toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 4rem;
  padding: 0.8rem 1rem;
  border: 3px solid #e9d8fd;
  border-radius: 1.2rem;
  background: #fff;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  text-align: left;
  touch-action: manipulation;
}

.toggle-btn .check {
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.5rem;
  border: 3px solid var(--bg-2);
}

.toggle-btn[aria-pressed='true'] {
  border-color: var(--mint);
  background: #d8f8ee;
}

.toggle-btn[aria-pressed='true'] .check {
  background: var(--mint);
  border-color: var(--mint);
}

.toggle-btn[aria-pressed='true'] .check::after {
  content: '✓';
  display: grid;
  place-items: center;
  height: 100%;
  color: #fff;
  font-weight: 900;
}
