/* Same palette and type as the chocomarsh.com landing (projects/sites, landing/css/index.css). */
:root {
  --bg: #07080d;
  --bg-2: #0d1019;
  --card: #12141f;
  --card-2: #181b29;
  --card-border: #22263a;
  --ink: #eef1f8;
  --ink-dim: #8a90a6;
  --accent: #6ee7d8;
  --accent-2: #a78bfa;
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
  --on-accent: #06080c;
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, .14);
  --glass: rgba(18, 20, 31, .72);
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(110, 231, 216, .10), transparent 40%),
    radial-gradient(circle at 85% 30%, rgba(167, 139, 250, .12), transparent 45%);
  pointer-events: none;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }

code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .92em; }

.icon { width: 20px; height: 20px; flex: none; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo {
  --logo-knock: var(--bg);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -.035em;
  white-space: nowrap;
}
.logo-mark { width: 1.1em; height: 1.1em; flex: none; }

.eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  color: var(--ink-dim);
  font-size: 13px;
}

/* ───────── buttons & inputs ───────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .2s, transform .2s, box-shadow .2s, opacity .2s;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--gradient); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(110, 231, 216, .22); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--card-border); font-weight: 600; }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color .2s, background-color .2s;
}
.icon-btn:hover { color: var(--ink); background: var(--card-2); }

input[type="text"] {
  width: 100%;
  height: 50px;
  padding: 0 18px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--bg-2);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input[type="text"]::placeholder { color: var(--ink-dim); }
input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(110, 231, 216, .12); }

.form-error { color: var(--danger); font-size: 14px; }

/* ───────── toast ───────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 112px;
  transform: translate(-50%, 16px);
  max-width: calc(100% - 32px);
  padding: 11px 20px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--bg-2);
}
.link-box code { flex: 1; min-width: 0; color: var(--accent); word-break: break-all; line-height: 1.45; }

/* ───────── home: a launcher screen, not a landing ───────── */

.page-home { min-height: 100vh; display: flex; flex-direction: column; }

.launcher {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}
.launcher-head { margin-bottom: 28px; }
.launcher-head h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.launcher-head p { margin-top: 6px; color: var(--ink-dim); }

.launcher-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card);
  transition: border-color .2s, box-shadow .2s;
}
.panel:focus-within { border-color: rgba(110, 231, 216, .45); }
.panel-create.is-ready { border-color: rgba(110, 231, 216, .45); box-shadow: 0 0 0 4px rgba(110, 231, 216, .06); }
.panel-top { display: flex; gap: 16px; align-items: flex-start; }
.panel-top h2 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.panel-hint { margin-top: 2px; color: var(--ink-dim); font-size: 14px; }
.panel-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--gradient);
  color: var(--on-accent);
}
.panel-icon-muted { background: var(--card-2); border: 1px solid var(--card-border); color: var(--accent); }
.panel-body { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.panel-actions { display: flex; gap: 10px; }
.panel-actions .btn { flex: 1; padding: 13px 18px; }
.btn-block { width: 100%; }

.recent { margin-top: 40px; }
.recent-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.recent-head h2 { font-size: 17px; font-weight: 700; }
.recent-note { color: var(--ink-dim); font-size: 13px; }
.recent-list {
  list-style: none;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card);
  overflow: hidden;
}
.recent-list:empty { display: none; }
.recent-item { display: flex; align-items: center; gap: 4px; padding: 8px 10px 8px 8px; }
.recent-item + .recent-item { border-top: 1px solid var(--card-border); }
.recent-item:hover { background: var(--card-2); }
.recent-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 6px 8px; border-radius: 12px; }
.recent-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--card-border);
  color: var(--accent);
}
.recent-icon .icon { width: 18px; height: 18px; }
.recent-text { min-width: 0; display: flex; flex-direction: column; }
.recent-title { font-weight: 600; font-size: 14px; }
.recent-code { color: var(--ink-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-empty {
  padding: 28px 24px;
  border: 1px dashed var(--card-border);
  border-radius: 20px;
  color: var(--ink-dim);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 760px) {
  .launcher { padding: 28px 16px 48px; }
  .launcher-grid { grid-template-columns: 1fr; }
  .recent-note { display: none; }
}

/* ───────── message pages (404, left the call) ───────── */

.message { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.page-call .message { min-height: calc(100vh - 64px); }
.message-card {
  width: min(480px, 100%);
  padding: 40px 32px;
  border: 1px solid var(--card-border);
  border-radius: 28px;
  background: var(--card);
  text-align: center;
}
.message-card .logo { --logo-knock: var(--card); margin-bottom: 28px; }
.message-card h1 { margin-bottom: 12px; font-size: clamp(26px, 4vw, 34px); font-weight: 800; letter-spacing: -.02em; }
.message-card p { color: var(--ink-dim); }
.message-card p:empty { display: none; }
.message-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }

/* ───────── call page ───────── */

.page-call { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(7, 8, 13, .7);
  backdrop-filter: blur(10px);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}
.chip .icon { width: 16px; height: 16px; }
.chip-button { cursor: pointer; transition: border-color .2s, color .2s; }
.chip-button:hover { border-color: var(--accent); color: var(--ink); }

/* lobby */
.lobby {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
  align-items: center;
  gap: 40px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px;
  overflow-y: auto;
}
.lobby-preview { aspect-ratio: 16 / 9; }
.lobby-controls {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  z-index: 2;
}
.lobby-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 28px;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  background: var(--card);
}
.lobby-card .eyebrow { align-self: flex-start; }
.lobby-card h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.lobby-card p { color: var(--ink-dim); font-size: 15px; }

/* meeting */
.meeting { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.grid {
  --cols: 1;
  --rows: 1;
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: 12px;
  padding: 16px 16px 0;
}

/* one other participant: they fill the stage, the self view floats in a corner */
.grid[data-count="2"] .tile-self {
  position: absolute;
  right: 32px;
  bottom: 16px;
  width: clamp(150px, 20vw, 260px);
  aspect-ratio: 16 / 9;
  z-index: 3;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
}

.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-2);
}
.tile-self video { transform: scaleX(-1); }

.tile.speaking {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(110, 231, 216, .22), 0 0 36px rgba(167, 139, 250, .22);
}

.tile-avatar {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(110, 231, 216, .08), transparent 55%),
    radial-gradient(circle at 75% 80%, rgba(167, 139, 250, .10), transparent 55%),
    var(--card);
}
.tile-avatar span {
  display: grid;
  place-items: center;
  width: clamp(52px, 20%, 112px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--gradient);
  color: var(--on-accent);
  font-size: clamp(20px, 3vw, 44px);
  font-weight: 800;
}
.tile:not(.tile-self):nth-child(3n+1) .tile-avatar span { background: linear-gradient(135deg, #a78bfa, #f0abfc); }
.tile:not(.tile-self):nth-child(3n+2) .tile-avatar span { background: linear-gradient(135deg, #6ee7d8, #38bdf8); }
.tile:not(.tile-self):nth-child(3n) .tile-avatar span { background: linear-gradient(135deg, #fcd34d, #6ee7d8); }
.tile[data-video="off"] .tile-avatar { display: grid; }
.tile[data-video="off"] video { visibility: hidden; }
.tile.speaking .tile-avatar span { box-shadow: 0 0 0 6px rgba(110, 231, 216, .18); }

.tile-notice {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  display: none;
  color: var(--ink-dim);
  font-size: 14px;
  text-align: center;
  z-index: 1;
}
#preview-tile[data-video="off"] .tile-notice { display: block; }

.tile-name {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 24px);
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(8px);
  font-size: 13px;
  font-weight: 600;
  z-index: 1;
}
.tile-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-muted { display: none; color: var(--danger); }
.tile-muted .icon { width: 15px; height: 15px; }
.tile[data-audio="off"] .tile-muted { display: inline-flex; }
.tile[data-audio="off"] .tile-name { padding-left: 9px; }

.tile[data-connection="new"]::after,
.tile[data-connection="connecting"]::after,
.tile[data-connection="disconnected"]::after,
.tile[data-connection="failed"]::after {
  content: "Соединяемся…";
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--glass);
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 600;
  z-index: 1;
}

/* control dock */
.dock-row { flex: none; display: flex; justify-content: center; padding: 14px 16px 18px; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.dock {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--card-border);
  border-radius: 22px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
}
.dock-sep { width: 1px; height: 28px; margin: 0 4px; background: var(--card-border); }

.ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 52px;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card-2);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s;
}
.ctl:hover { border-color: var(--accent); }
.ctl .off { display: none; }
.ctl .on, .ctl.is-off .off { display: contents; }
.ctl.is-off .on { display: none; }
.ctl.is-off { background: var(--danger-soft); border-color: rgba(251, 113, 133, .35); color: var(--danger); }
.ctl.is-off:hover { border-color: var(--danger); }
.ctl-leave { padding: 0 20px; background: var(--danger); border-color: var(--danger); color: var(--on-accent); }
.ctl-leave:hover { border-color: #fda4af; background: #fda4af; }

.banner {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  z-index: 5;
}

.unlock {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 6;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .6);
}
.unlock:hover:not(:disabled) { transform: translate(-50%, calc(-50% - 1px)); }

.debug {
  position: absolute;
  top: 72px;
  left: 8px;
  max-width: calc(100% - 16px);
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .75);
  color: #9fe;
  font: 11px/1.4 'JetBrains Mono', ui-monospace, monospace;
  white-space: pre-wrap;
  pointer-events: none;
  z-index: 7;
}

@media (max-width: 860px) {
  .lobby { grid-template-columns: 1fr; align-items: start; gap: 20px; padding: 16px; }
  .lobby-card { padding: 24px 20px; }
}
@media (max-width: 560px) {
  .topbar { height: 56px; padding: 0 16px; }
  .grid { gap: 8px; padding: 8px 8px 0; }
  .grid[data-count="2"] .tile-self { right: 16px; bottom: 12px; width: 108px; aspect-ratio: 3 / 4; }
  .dock { gap: 6px; }
  .ctl { min-width: 48px; height: 48px; padding: 0 12px; }
  .ctl-leave span { display: none; }
}
