/* Sonviz — мастер первого запуска и плашка браузера.
   Отдельный файл, чтобы не раздувать css/app.css: стили живут рядом со своим
   кодом (js/studio/start.js, js/studio/browser-support.js). Цвета — только
   переменные палитры из app.css: тёплый акцент для действия, бирюзовый —
   «всё в порядке» (как значок «OBS на связи»). */

/* ---------- кнопка в шапке ---------- */
header .howto {
  padding: 5px 11px; font-size: 13px; color: var(--dim);
  background: transparent; border-color: var(--line);
}
header .howto:hover { color: var(--text); border-color: var(--accent); background: transparent; }

/* ---------- плашка браузера ---------- */
.caps-bar {
  flex: none; background: var(--tint);
  border-bottom: 1px solid var(--line2);
  font-size: 12.5px; color: #d5d9de;
}
.caps-line { display: flex; align-items: center; gap: 10px; padding: 7px 14px; }
.caps-icon {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
  background: var(--accent); color: var(--accent-ink);
}
.caps-text { flex: 1; min-width: 0; }
.caps-text b { color: var(--accent); font-weight: 600; }
.caps-more, .caps-close {
  flex: none; background: transparent; border: 1px solid transparent; color: var(--dim);
  padding: 3px 8px; font-size: 12px; border-radius: var(--r);
}
.caps-more:hover, .caps-close:hover { color: var(--text); border-color: var(--line2); background: transparent; }
.caps-details { margin: 0; padding: 0 14px 9px 42px; color: var(--dim); font-size: 12px; line-height: 1.55; }
.caps-details li { margin: 2px 0; }

/* ---------- мастер: окно ---------- */
.start-back {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 24px 16px;
  background: rgba(6, 7, 10, .58);
  backdrop-filter: blur(2px);
}
.start {
  width: min(980px, 100%); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0d1013, var(--panel) 140px);
  border: 1px solid var(--line2); border-radius: var(--r2);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .02) inset;
  outline: none;
}
.start-head {
  position: relative; padding: 22px 28px 16px;
  border-bottom: 1px solid var(--line);
}
.start-kick { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim2); }
.start-head h2 { margin: 4px 0 14px; font-size: 22px; font-weight: 650; letter-spacing: .2px; outline: none; }
.start-x {
  position: absolute; right: 18px; top: 18px; width: 34px; height: 34px; padding: 0;
  border-radius: 50%; background: transparent; border-color: transparent; color: var(--dim); font-size: 15px;
}
.start-x:hover { background: var(--panel2); border-color: var(--line2); color: var(--text); }

.start-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.start-steps li {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px;
  border-radius: var(--r); font-size: 12.5px; color: var(--dim2); border: 1px solid transparent;
}
.start-steps li + li::before { content: ""; width: 18px; height: 1px; background: var(--line2); margin: 0 4px 0 -8px; }
.start-num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: var(--panel2); color: var(--dim);
}
.start-steps li.cur { color: var(--text); border-color: var(--line2); background: var(--tint); }
.start-steps li.cur .start-num { background: var(--accent); color: var(--accent-ink); }
.start-steps li.done { color: var(--dim); }
.start-steps li.done .start-num { background: rgba(159, 224, 188, .14); color: var(--ok); }

.start-body { padding: 22px 28px; overflow-y: auto; min-height: 0; }
.start-foot {
  display: flex; align-items: center; gap: 10px; padding: 14px 28px;
  border-top: 1px solid var(--line); background: rgba(11, 12, 16, .45);
  border-radius: 0 0 var(--r2) var(--r2);
}
.start-sp { flex: 1; }
.start-count { font-size: 12px; color: var(--dim2); }
.start-foot button { padding: 8px 18px; font-size: 13.5px; }
.start-foot .primary { min-width: 120px; }

.start-lead { margin: 0 0 18px; color: #c9ced4; font-size: 14px; max-width: 760px; }
.start-note { margin: 14px 0 0; color: var(--dim); font-size: 12.5px; }
.start-body button:focus-visible, .start-x:focus-visible, .start-foot button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- шаг 1: карточки ---------- */
.start-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(164px, 1fr)); gap: 12px; }
.start-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left;
  padding: 0 0 12px; overflow: hidden; border-radius: var(--r2); white-space: normal;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.start-card:hover { border-color: var(--line2); background: var(--panel2); transform: translateY(-2px); }
.start-card[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 10px 30px rgba(214, 224, 234, .08);
}
.start-thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; margin-bottom: 8px;
  background: var(--field); overflow: hidden;
}
.start-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.start-check {
  position: absolute; right: 8px; top: 8px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: var(--accent); color: var(--accent-ink); opacity: 0; transform: scale(.6);
  transition: opacity .15s, transform .15s;
}
.start-card[aria-pressed="true"] .start-check { opacity: 1; transform: none; }
.start-use { padding: 0 12px; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); }
.start-name { padding: 0 12px; font-size: 14.5px; font-weight: 600; }
.start-text { padding: 0 12px; font-size: 12px; color: var(--dim); line-height: 1.45; }
.start-warn {
  margin: 6px 12px 0; padding: 5px 8px; border-radius: var(--r); font-size: 11.5px; line-height: 1.4;
  color: var(--warn); background: rgba(229, 197, 143, .08);
}

/* ---------- шаг 2: звук ---------- */
.start-src { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.start-opt {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; white-space: normal;
  padding: 14px; border-radius: var(--r2); background: var(--panel2); border: 1px solid var(--line); color: var(--text);
}
.start-opt:hover { border-color: var(--line2); background: var(--panel2); }
.start-opt[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.start-opt.off { opacity: .62; cursor: not-allowed; border-style: dashed; }
.start-opt.off:hover { border-color: var(--line); }
.start-ico {
  flex: none; width: 34px; height: 34px; padding: 7px; border-radius: var(--r2);
  background: var(--field); stroke: var(--accent); fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.start-opt.off .start-ico { stroke: var(--dim2); }
.start-opt-tx { display: flex; flex-direction: column; gap: 3px; }
.start-opt-name { font-weight: 600; font-size: 14px; }
.start-opt-text { font-size: 12px; color: var(--dim); line-height: 1.45; }
.start-opt.off .start-opt-text { color: var(--warn); }

.start-dev { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 12px; margin-top: 14px; font-size: 13px; color: #c9ced4; }
.start-dev[hidden] { display: none; }
.start-dev .start-note { grid-column: 1 / -1; margin: 0; }

.start-run { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.start-go { padding: 10px 20px; font-size: 14px; flex: none; }
.start-meter {
  flex: 1; height: 12px; border-radius: 99px; overflow: hidden;
  background: var(--field); border: 1px solid var(--line);
}
.start-meter i {
  display: block; height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .08s linear;
}
.start-meter.on { border-color: rgba(159, 224, 188, .45); }
.start-status { margin-top: 10px; min-height: 20px; font-size: 13px; color: var(--dim); }
.start-status.ok { color: var(--ok); }
.start-status.bad { color: var(--err); }
.start-textbtn, .start-link-btn {
  background: transparent; border: none; padding: 0; margin-top: 10px;
  color: var(--dim); font-size: 12.5px; text-decoration: underline; text-decoration-color: var(--line2);
  text-underline-offset: 3px;
}
.start-textbtn:hover, .start-link-btn:hover { background: transparent; color: var(--text); }

/* ---------- шаг 3: OBS ---------- */
.start-warnbox {
  margin: 0 0 16px; padding: 10px 14px; border-radius: var(--r2); font-size: 13px; line-height: 1.5;
  background: var(--tint); border: 1px solid rgba(229, 197, 143, .3); color: #d5d9de;
}
.start-warnbox[hidden] { display: none; }
.start-warnbox b { color: var(--accent); }
.start-warnbox code, .start-howto code { background: var(--field); padding: 1px 5px; border-radius: 4px; color: var(--accent); }
.start-url { display: flex; gap: 10px; }
.start-url-box {
  flex: 1; font-family: var(--mono); font-size: 12px !important; color: var(--dim) !important;
  padding: 9px 12px !important; text-overflow: ellipsis;
}
.start-copy { flex: none; padding: 9px 18px; font-size: 14px; }
.start-copy:disabled { opacity: .5; cursor: default; }
.start-cols { display: grid; grid-template-columns: 1fr 1.05fr; gap: 26px; margin-top: 22px; align-items: start; }
.start-howto { margin: 0; padding: 0; list-style: none; counter-reset: st; }
.start-howto li {
  position: relative; padding: 2px 0 14px 40px; counter-increment: st;
  font-size: 14px; line-height: 1.5; color: #d5d9de;
}
.start-howto li::before {
  content: counter(st); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--accent); color: var(--accent-ink);
}
.start-howto b { color: var(--text); }
.start-scheme svg { display: block; width: 100%; height: auto; }
.start-link {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; margin-top: 16px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--r); font-size: 13px; color: var(--dim);
}
.start-link[hidden] { display: none; }
.start-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim2); }
.start-link.on { color: var(--ok); border-color: rgba(159, 224, 188, .4); background: rgba(159, 224, 188, .06); }
.start-link.on .start-dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(159, 224, 188, .14); }
.start-link.bad { color: var(--err); border-color: rgba(226, 87, 76, .4); }
.start-link.bad .start-dot { background: var(--err); }
.start-link:not(.on):not(.bad) .start-dot { animation: startPulse 1.4s ease-in-out infinite; }
@keyframes startPulse { 50% { opacity: .3; } }
.start-link-btn { display: block; }

/* ---------- шаг 4: готово ---------- */
.start-sum { list-style: none; margin: 0 0 22px; padding: 4px 16px; border-radius: var(--r2); background: var(--field); border: 1px solid var(--line); }
.start-sum li { display: grid; grid-template-columns: 22px 90px 1fr; align-items: center; padding: 8px 0; font-size: 13.5px; }
.start-sum li + li { border-top: 1px solid var(--line); }
.start-sum-mark { color: var(--dim2); font-weight: 700; }
.start-sum li.ok .start-sum-mark { color: var(--ok); }
.start-sum-k { color: var(--dim); }
.start-sum-v { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.start-next { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.start-tile {
  display: flex; flex-direction: column; gap: 6px; text-align: left; white-space: normal;
  padding: 16px; border-radius: var(--r2); background: var(--panel2); border: 1px solid var(--line); color: var(--text);
}
.start-tile:hover { border-color: var(--accent); background: var(--panel2); }
.start-tile-name { font-weight: 600; font-size: 15px; }
.start-tile-name::after { content: " →"; color: var(--accent); }
.start-tile-text { font-size: 12.5px; color: var(--dim); line-height: 1.45; }

/* ---------- узкое окно ---------- */
@media (max-width: 760px) {
  .start-head, .start-body, .start-foot { padding-left: 18px; padding-right: 18px; }
  .start-src, .start-next, .start-cols { grid-template-columns: 1fr; }
  .start-url { flex-direction: column; }
}

/* ---------- студия на телефоне (js/studio/phone.js, 21.10) ----------
   Весь экран: студия под ним не рисуется. Поверх мастера (z 50), под окном
   отзыва (z 1000) — отзыв с телефона оставить можно. */
.phone-gate {
  position: fixed; inset: 0; z-index: 90; overflow-y: auto;
  display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(120% 80% at 50% 0%, #11151b 0%, var(--bg) 70%);
}
html.pg-on header, html.pg-on main, html.pg-on .caps-bar { display: none; }
html.pg-on body { display: block; overflow: auto; }
.pg-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.pg-logo { color: var(--text); }
.pg-logo svg { height: 22px; width: auto; display: block; }
.pg-title { margin: 8px 0 0; font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; outline: none; }
.pg-text { margin: 0; color: var(--dim); font-size: 15px; line-height: 1.55; }
.pg-acts { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.pg-acts button, .pg-acts a { min-height: 46px; font-size: 15px; text-align: center; }
.pg-cab {
  display: flex; align-items: center; justify-content: center; border-radius: var(--r);
  border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.pg-status { margin: 0; font-size: 14px; color: var(--ok); word-break: break-word; }
.pg-status.bad { color: var(--err); }
.pg-status[hidden] { display: none; }
.pg-anyway { align-self: center; background: none; border: 0; color: var(--dim2); font-size: 13px; text-decoration: underline; margin-top: 8px; }

/* Своя сцена в мастере (27.10): карточка — только показ, насовсем — «Взять». */
.start-tryrow { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.start-tryrow [hidden] { display: none; }
.start-trynote { margin: 8px 0 0; color: var(--accent); font-size: 12.5px; }
.start-trynote[hidden] { display: none; }

/* Гость /try на телефоне (12.11, js/studio/phone.js): письмо для входа. */
.pg-form { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.pg-email { min-height: 46px; box-sizing: border-box; padding: 0 14px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--field); border: 1px solid var(--line2); border-radius: var(--r); }
.pg-form button { min-height: 46px; font-size: 15px; }
