/* Escape Duo — prototype UI. Colours from the approved style «Н1 · Классический нуар». */
:root {
  --bg: #0d0d0d;
  --panel: #161616;
  --line: #2a2a2a;
  --text: #ededed;
  --muted: #9a9a9a;
  --blue: #3a8dff;
  --orange: #ff7a2f;
  --green: #16c45a;
  /* the phone's notch / home bar, and — if Telegram ever opens us full screen — its floating header buttons
     (Telegram sets --tg-*safe-area-inset-* itself; in the normal mode they are 0 and its header is outside the page) */
  --safe-t: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-b: max(env(safe-area-inset-bottom, 0px), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
  --safe-l: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --safe-r: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
#app { height: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- menu screens */
.screen { min-height: 100%; display: flex; justify-content: center; padding: calc(28px + var(--safe-t)) 16px calc(28px + var(--safe-b)); }
.col { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.col.tight { gap: 10px; }
.center { text-align: center; }
.muted { color: var(--muted); line-height: 1.45; }
.small { font-size: 13px; }
h2 { font-size: 22px; }
h3 { font-size: 15px; color: var(--muted); font-weight: 500; margin-top: 6px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 12px 0 6px; }
.brand h1 { font-size: 28px; letter-spacing: 0.5px; }
.brand-robots { display: flex; gap: 14px; }
.bot { display: inline-block; width: 22px; height: 28px; border-radius: 7px; position: relative; flex-shrink: 0; }
.bot::after { content: ''; position: absolute; left: 5px; top: 7px; width: 13px; height: 7px; border-radius: 4px; background: var(--bg); }
.bot.b { background: var(--blue); }
.bot.o { background: var(--orange); }
.brand .bot { width: 34px; height: 44px; border-radius: 11px; }
.brand .bot::after { left: 8px; top: 11px; width: 20px; height: 11px; border-radius: 6px; }

.btn { min-height: 50px; border-radius: 14px; border: 1px solid #3a3a3a; background: var(--panel); padding: 0 18px; font-size: 16px; font-weight: 600; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.btn:disabled { opacity: 0.4; }
.btn:focus-visible, .level:focus-visible, .ctl:focus-visible, .icon-btn:focus-visible, .field:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.row { display: flex; gap: 10px; }
.row .field { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { min-height: 50px; border-radius: 14px; border: 1px solid #3a3a3a; background: #111; color: var(--text); padding: 0 16px; font-size: 18px; -webkit-user-select: text; user-select: text; }
.field.code { text-transform: uppercase; letter-spacing: 6px; font-weight: 700; text-align: center; }

.room-code { font-size: 26px; text-align: center; letter-spacing: 1px; }
.members { display: flex; flex-direction: column; gap: 8px; }
.member { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border-left: 3px solid var(--blue); }
.member.o { border-left-color: var(--orange); }
.member.off { opacity: 0.55; }
.member em { margin-left: auto; color: var(--muted); font-style: normal; font-size: 13px; }
.levels { display: grid; grid-template-columns: 1fr; gap: 10px; }
.level { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); text-align: left; }
.level:disabled { opacity: 0.45; }
.level-num { color: var(--muted); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; }
.level-name { font-size: 17px; font-weight: 600; }

/* toasts (core) */
.toast { position: fixed; left: 50%; bottom: calc(170px + var(--safe-b)); transform: translate(-50%, 20px); padding: 10px 16px; border-radius: 12px; background: #262626; color: var(--text); font-size: 14px; opacity: 0; transition: 0.25s; pointer-events: none; z-index: 10; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
