:root {
  --ink: #0d0f1c;
  --ink-2: #161a2e;
  --panel: #151829;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #ecebe6;
  --muted: #9a9cab;
  --amber: #f0c36a;
  --amber-ink: #241a06;
  --amber-soft: rgba(240, 195, 106, 0.14);
  --danger: #f0a08c;
  --serif: "Lora", Georgia, serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: Onest, system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(#0a0c17, var(--ink-2)) fixed;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ночь: редкие звёзды, тонкий месяц, силуэт холмов */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.stars {
  position: absolute; inset: 0 0 30% 0;
  background-image:
    radial-gradient(1px 1px at 22px 34px, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 158px 96px, rgba(255,255,255,.45), transparent),
    radial-gradient(1.3px 1.3px at 262px 48px, rgba(255,255,255,.8), transparent),
    radial-gradient(1px 1px at 338px 180px, rgba(255,255,255,.4), transparent),
    radial-gradient(1px 1px at 84px 230px, rgba(255,255,255,.5), transparent);
  background-size: 380px 300px;
}
.stars.far { display: none; }
.moon {
  position: absolute; top: max(26px, env(safe-area-inset-top)); right: 26px;
  width: 26px; height: 26px; border-radius: 50%;
  box-shadow: -6px 3px 0 0 #e9dcc0; opacity: 0.85;
}
.in-room .moon { display: none; }
.hills { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 18vh; stroke: none; }
.hills path:first-child { fill: #11142a; }
.hills path:last-child { fill: #090b15; }

/* кнопки */
.btn {
  background: var(--amber); color: var(--amber-ink); font-weight: 600;
  padding: 12px 18px; border-radius: 10px; font-size: 15px;
}
.btn:active { transform: translateY(1px); }
.btn.big { padding: 15px 22px; font-size: 16px; width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line-2); color: var(--text); flex-shrink: 0;
}
.round {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--amber); color: var(--amber-ink); flex-shrink: 0;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
  border-radius: 10px; border: 1px solid var(--line-2); font-size: 14px; font-weight: 500;
}
.pill svg { width: 16px; height: 16px; }
.link { color: var(--amber); font-size: 15px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.sub { font-size: 13px; color: var(--muted); }
.err { color: var(--danger); font-size: 13px; }

/* главная */
.home {
  position: relative; z-index: 1; min-height: 100dvh;
  display: flex; align-items: center; padding: 32px 24px 22vh;
}
.home-card { max-width: 420px; width: 100%; margin: 0 auto; display: grid; gap: 20px; }
.home h1 { font-family: var(--serif); font-size: 46px; line-height: 1.02; font-weight: 500; letter-spacing: -0.5px; }
.home h1 em { font-style: italic; color: var(--amber); }
.lead { color: var(--muted); font-size: 16px; line-height: 1.55; max-width: 32ch; }
.steps { list-style: none; display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 18px; counter-reset: s; }
.steps li { display: flex; gap: 12px; font-size: 14px; color: var(--muted); line-height: 1.4; counter-increment: s; }
.steps li::before { content: counter(s); font-family: var(--serif); font-style: italic; color: var(--amber); min-width: 12px; }

/* комната */
.room {
  position: relative; z-index: 1; height: 100dvh; max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
}
.top { display: flex; align-items: center; gap: 10px; padding-right: 44px; }
.top-text { flex: 1; min-width: 0; }
.top h1 { font-family: var(--serif); font-size: 21px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avs { display: flex; }
.av {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 600; background: #262a42; border: 2px solid var(--ink); color: var(--text);
}
.av.me { background: var(--amber); color: var(--amber-ink); }
.av + .av { margin-left: -8px; }

.stage { margin-top: 14px; flex-shrink: 0; }
.screen {
  position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden;
  background: #000; border: 1px solid var(--line);
}
.screen video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.empty, .join {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center;
  gap: 14px; text-align: center; padding: 16px; background: #05060c; color: var(--muted); font-size: 14px;
}
.join { background: rgba(5, 6, 12, 0.8); color: var(--text); font-weight: 500; }
.beam { display: none; }
.controls { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.time { font-size: 12px; color: var(--muted); min-width: 38px; text-align: center; font-variant-numeric: tabular-nums; }
#seek {
  flex: 1; min-width: 0; height: 28px; -webkit-appearance: none; appearance: none; background: transparent;
  --p: 0%;
}
#seek::-webkit-slider-runnable-track {
  height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--amber) var(--p), rgba(255, 255, 255, 0.16) var(--p));
}
#seek::-moz-range-track { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); }
#seek::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--amber); }
#seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); margin-top: -5.5px;
}
#seek::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: var(--text); }
.status-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.status-row .sub.bad { color: var(--danger); }

.talk { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px 0 10px; scrollbar-width: none; }
.chat::-webkit-scrollbar { display: none; }
.msg {
  max-width: 82%; align-self: flex-start; padding: 9px 12px; font-size: 15px; line-height: 1.4;
  background: rgba(255, 255, 255, 0.06); border-radius: 12px; overflow-wrap: anywhere;
}
.msg .who { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; font-weight: 500; }
.msg.me { align-self: flex-end; background: var(--amber-soft); color: #f5e6c4; }
.msg.sys { align-self: center; background: none; padding: 2px 8px; font-size: 12px; color: var(--muted); text-align: center; }
.inp { display: flex; gap: 8px; }
.inp input {
  flex: 1; min-width: 0; padding: 12px 14px; font-size: 16px; /* 16px — чтобы iPhone не увеличивал страницу */
  border-radius: 10px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2); outline: none;
}
.inp input::placeholder { color: var(--muted); }
.inp input:focus { border-color: var(--amber); }
.send { width: 46px; border-radius: 10px; display: grid; place-items: center; background: var(--amber); color: var(--amber-ink); flex-shrink: 0; }

/* выезжающие окна */
.sheet { position: fixed; inset: 0; z-index: 10; background: rgba(3, 4, 10, 0.65); display: flex; align-items: flex-end; justify-content: center; }
.sheet.center { align-items: center; padding: 20px; }
.sheet-panel {
  width: 100%; max-width: 560px; max-height: 82dvh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-bottom: none;
  border-radius: 16px 16px 0 0; padding: 18px 16px max(18px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
}
.sheet-panel.small { max-width: 380px; border-radius: 16px; border-bottom: 1px solid var(--line); }
.sheet-panel.small input {
  padding: 12px 14px; font-size: 16px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2); outline: none;
}
.sheet-panel.small input:focus { border-color: var(--amber); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-panel h2 { font-family: var(--serif); font-size: 22px; font-weight: 500; }
.movies, .jobs { display: flex; flex-direction: column; }
.movie {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.movie:last-child { border-bottom: none; }
.movie.now b { color: var(--amber); }
.movie .ico { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; border: 1px solid var(--line-2); color: var(--amber); flex-shrink: 0; }
.movie .ico svg { width: 14px; height: 14px; }
.movie b { display: block; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.movie small { font-size: 12px; color: var(--muted); }
.job { padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.job .bar { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); margin-top: 8px; overflow: hidden; }
.job .bar i { display: block; height: 100%; background: var(--amber); transition: width 0.4s; }
.job small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.job.bad small { color: var(--danger); }
.none { color: var(--muted); font-size: 14px; padding: 16px 4px; line-height: 1.5; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 20;
  background: var(--text); color: var(--ink); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
}

/* большой экран: видео слева, чат справа */
@media (min-width: 900px) {
  .room {
    max-width: 1280px; display: grid; grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-rows: auto 1fr; column-gap: 28px; padding: 24px 32px;
  }
  .top { grid-column: 1 / -1; }
  .stage { margin-top: 20px; align-self: start; }
  .talk { grid-column: 2; grid-row: 2; margin-top: 20px; min-height: 0; border-top: none; border-left: 1px solid var(--line); padding: 0 0 0 20px; }
  .top h1 { font-size: 26px; }
}
