body.phone { height: 100dvh; overflow: hidden; overscroll-behavior: none; font-size: 16px; }
.screen {
  height: 100dvh; display: flex; flex-direction: column; gap: 14px;
  padding: max(18px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
}
.screen.center { justify-content: center; align-items: center; text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.bottom { margin-top: auto; }
.center-text { text-align: center; }
.logo { font-size: 40px; font-weight: 900; color: var(--ok); }
.lead { font-size: 18px; line-height: 1.45; max-width: 30ch; margin: 0 0 12px; }
.hint { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.4; }
h2 { font-size: 22px; }
label { font-weight: 700; text-align: left; }
input {
  width: 100%; font: inherit; font-size: 20px; padding: 14px 16px; border-radius: 14px;
  border: 2px solid var(--ink); background: var(--sheet); color: var(--ink);
}
.link { color: var(--ink-soft); text-decoration: underline; padding: 8px; font-size: 14px; }

.avatar.huge { width: 84px; height: 84px; font-size: 50px; box-shadow: 0 0 0 4px var(--c); }
.me { display: flex; align-items: center; gap: 18px; padding: 8px 4px 4px; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.people li { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; background: var(--sheet); border-radius: 14px; font-weight: 700; }
.people li .avatar { width: 40px; height: 40px; font-size: 24px; }
.people li .tag { margin-left: auto; font-weight: 400; font-size: 13px; color: var(--ink-soft); }
.people li.off { opacity: .5; }
.people li.me-row { box-shadow: 0 0 0 2px var(--pen) inset; }
.ranking li { counter-increment: place; }
.ranking li::before { content: counter(place); font-family: var(--display); width: 22px; text-align: center; }
.ranking .pts { margin-left: auto; font-family: var(--display); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;
  padding: 18px; border-radius: 16px; background: var(--sheet);
  box-shadow: 0 0 0 2px var(--ink) inset, 0 4px 0 var(--ink);
}
.option:active { transform: translateY(3px); box-shadow: 0 0 0 2px var(--ink) inset, 0 1px 0 var(--ink); }
.option b { font-family: var(--display); font-size: 21px; font-weight: 700; display: block; }
.option small { color: var(--ink-soft); font-size: 13px; }
.option .level { font-family: var(--display); font-size: 13px; padding: 6px 10px; border-radius: 99px; background: var(--marker); white-space: nowrap; }

/* drawing: header, the biggest square that fits, one tool strip */
.screen.draw {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; max-width: 640px;
  padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
}
.draw-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px; min-width: 0; }
.draw-head .timer { width: 46px; height: 46px; font-size: 17px; }
.secret { font-size: 22px; background: var(--marker); padding: 0 6px; line-height: 1.25; overflow-wrap: anywhere; }
.secret.big { font-size: 30px; }
.pad-wrap { min-height: 0; display: grid; place-items: center; }
.pad { position: relative; width: 200px; height: 200px; background: var(--sheet); border-radius: 6px; box-shadow: 0 0 0 2px var(--ink); }
.pad canvas { display: block; width: 100%; height: 100%; touch-action: none; border-radius: 6px; }
.toolbar { display: flex; flex-direction: column; gap: 8px; }
.swatches { display: flex; justify-content: space-between; gap: 4px; }
.swatch {
  width: clamp(28px, calc((100vw - 52px) / 9), 40px); aspect-ratio: 1; flex: none; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 2px var(--sheet), 0 0 0 3px #c6cfdf;
}
.swatch.eraser { background: var(--sheet); display: grid; place-items: center; font-size: 15px; }
.swatch[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--sheet), 0 0 0 5px var(--ink); }
.tool-row { display: flex; align-items: center; gap: 6px; }
.sizes { display: flex; gap: 6px; }
.size, .tool { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--sheet); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--grid) inset; font-size: 20px; }
.tool.wide { flex: 1; width: auto; font-family: var(--display); font-weight: 700; font-size: 14px; }
.tool.armed { background: var(--margin); color: #fff; box-shadow: none; font-size: 12px; font-family: var(--display); }
.size i { display: block; border-radius: 50%; background: var(--ink); }
.size[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--ink) inset; }
.pop {
  position: fixed; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 5;
  display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px;
  background: var(--sheet); box-shadow: 0 0 0 2px var(--ink), 0 12px 40px rgba(30, 42, 74, .25);
}
#act .chips { justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 99px; background: var(--sheet); box-shadow: 0 0 0 2px var(--grid) inset; font-weight: 700; font-size: 14px; }
.chip .avatar { width: 30px; height: 30px; font-size: 18px; box-shadow: none; }
.chip.done { background: #e3f6ec; box-shadow: 0 0 0 2px var(--ok) inset; }

/* guessing */
.guess { gap: 10px; }
.mini { width: min(100%, 40dvh); align-self: center; aspect-ratio: 1; background: var(--sheet); border-radius: 6px; box-shadow: 0 0 0 2px var(--ink); flex: none; }
.mini canvas { display: block; width: 100%; height: 100%; border-radius: 6px; }
.guess .cells { --w: min(30px, calc((100vw - 32px) / var(--n, 8))); }
.category { margin: 0; text-align: center; color: var(--ink-soft); font-size: 14px; }
.mine { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; overflow: auto; flex: 1; }
.mine li { padding: 4px 10px; border-radius: 99px; background: var(--sheet); font-size: 14px; color: var(--ink-soft); text-decoration: line-through; }
.mine li.close { background: var(--marker); color: var(--ink); text-decoration: none; font-weight: 700; }
.guess-form { display: flex; gap: 8px; }
.guess-form .btn { padding: 0 16px; font-size: 15px; }
.got { padding: 18px; border-radius: 16px; background: var(--ok); color: #fff; text-align: center; font-family: var(--display); font-weight: 700; font-size: 20px; }

.gain-big { font-family: var(--display); font-weight: 900; font-size: 36px; color: var(--ok); margin: 6px 0; }
#reveal .cells { --w: min(34px, calc((100vw - 32px) / var(--n, 8))); }

.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%); margin: 0; z-index: 10;
  padding: 12px 22px; border-radius: 16px; font-family: var(--display); font-weight: 700; font-size: 20px;
  background: var(--ink); color: #fff; animation: toast .9s ease both; pointer-events: none;
}
.toast.close { background: var(--marker); color: var(--ink); }
.toast.correct { background: var(--ok); }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 8px); } 15%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.timer { width: 54px; height: 54px; font-size: 19px; flex: none; }
.offline { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); margin: 0; padding: 8px 16px; border-radius: 99px; background: var(--margin); color: #fff; font-weight: 700; font-size: 14px; white-space: nowrap; }

/* lobby: which game */
.games { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.game-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 14px; border-radius: 16px;
  background: var(--sheet); box-shadow: 0 0 0 2px var(--grid) inset;
}
.game-card b { font-family: var(--display); font-size: 18px; }
.game-card small { color: var(--ink-soft); font-size: 12px; line-height: 1.35; }
.game-card[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--pen) inset; }
.game-card:disabled { cursor: default; }

/* «Апож»: the record button and the loudness meter */
.rec {
  display: grid; place-items: center; align-content: center; gap: 10px; width: 168px; height: 168px; border-radius: 50%; padding: 0 12px;
  background: var(--sheet); box-shadow: 0 0 0 4px var(--margin) inset, 0 6px 0 #c9434c;
  font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--margin);
  transition: transform .08s, box-shadow .08s;
}
.rec:active { transform: translateY(4px); box-shadow: 0 0 0 4px var(--margin) inset, 0 2px 0 #c9434c; }
.rec-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--margin); }
.rec.on { background: var(--margin); color: #fff; }
.rec.on .rec-dot { background: #fff; border-radius: 6px; animation: pulse 1s ease-in-out infinite; }
.rec:disabled { opacity: .5; }
@keyframes pulse { 50% { transform: scale(.82); } }
.meter { width: min(260px, 70%); height: 8px; border-radius: 99px; background: #e4e9f3; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 99px; transition: width .06s; }
#apChunks { --w: 30px; }
#apChunks span.done { background: var(--ok); }
#apChunks span.now { background: var(--marker); }
#apSing .stack, #apMimic .stack, #apGuess .stack, #apReveal .stack { max-width: 340px; }
