/* Hallmark · checked: 2026-12-01 · genre: utilitarian (inferred)
   built: the project · redesign: polish */
/* critique: tokens and focus were missing, the tile labels were joined with a middle dot and the disabled state was opacity alone; the dark palette, the lobby and the call layout are kept */

:root {
  color-scheme: dark;
  --bg: #15171b;
  --panel: #1f2228;
  --panel-raised: #272b33;
  --border: #333844;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #2a5fd6;
  --accent-hover: #2350b8;
  --on-accent: #f3f6ff;
  --danger: #b91c1c;
  --danger-hover: #991b1b;
  --success: #15803d;
  --success-hover: #166534;
  --success-ink: #4ade80;
  --overlay: rgba(0, 0, 0, 0.55);
  --shade: rgba(0, 0, 0, 0.6);
  --scrim: linear-gradient(to top, var(--shade), rgba(0, 0, 0, 0));
  --accent-ink: #7aa7ff;
  --accent-soft: #223154;
  --danger-ink: #f87171;
  --focus: #93c5fd;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;
  --radius-sm: 8px;
  --control-min: 44px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body { display: flex; flex-direction: column; }

#lobby {
  margin: auto;
  width: min(92vw, 360px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#lobby h1 { margin: 0; font-size: 1.5rem; text-wrap: balance; }
#lobby p { margin: 0; color: var(--muted); }

input {
  min-height: var(--control-min);
  padding: 0.75rem;
  font: inherit;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  transition: border-color 150ms ease-out;
}

input:hover { border-color: var(--muted); }

button {
  min-height: var(--control-min);
  padding: 0.7rem 1rem;
  font: inherit;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--panel-raised);
  color: var(--text);
  cursor: pointer;
  transition: background-color 150ms ease-out, color 150ms ease-out, opacity 150ms ease-out, transform 120ms ease-out;
}

button:hover { background: var(--border); }
button:active { transform: scale(0.96); }
button:disabled { cursor: not-allowed; background: var(--panel); color: var(--muted); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

#join { background: var(--accent); color: var(--on-accent); }
#join:hover { background: var(--accent-hover); }
#leave { background: var(--danger); color: var(--on-accent); }
#leave:hover { background: var(--danger-hover); }

/* выключенные микрофон и камера: красный фон, чтобы состояние читалось без текста */
button.off { background: var(--danger); color: var(--on-accent); }
button.off:hover { background: var(--danger-hover); }

#error { color: var(--danger); min-height: 1em; }

#grid {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr));
  gap: 2px;
  background: var(--bg);
}

.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  overflow: hidden;
}

.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile .label {
  position: absolute;
  left: 12px;
  bottom: 84px;
  z-index: 1;
  max-width: calc(100% - 24px);
  font-size: 0.9rem;
  font-weight: 500;
  text-shadow: 0 1px 3px var(--shade);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile .badge {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-ink);
  text-shadow: 0 1px 3px var(--shade);
}

.tile button.promote {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
}

#admin {
  position: fixed;
  left: 0;
  bottom: 68px;
  z-index: 2;
  width: min(320px, 100%);
  padding: 12px;
  border-radius: 0;
  background: var(--panel);
}

#admin h2 { margin: 0 0 0.5rem; font-size: 1rem; text-wrap: balance; }

#waitlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#waitlist li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#waitlist li span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#waitlist .icon-btn { width: 36px; height: 36px; padding: 0; }
#waitlist button.approve { background: transparent; color: var(--success-ink); }
#waitlist button.approve:hover { background: transparent; color: var(--success-ink); }
#waitlist button.reject { background: transparent; color: var(--danger-ink); }
#waitlist button.reject:hover { background: transparent; color: var(--danger-ink); }

#controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
  background: var(--scrim);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.toolbar-center { flex: 1; justify-content: center; }
.toolbar-right { flex: 0 0 auto; }

#status {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#notice {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 68px;
  z-index: 2;
  margin: 0 auto;
  max-width: 420px;
  padding: 8px 12px;
  border-radius: 0;
  background: var(--panel-raised);
  color: var(--text);
  font-size: 0.85rem;
  text-align: center;
}

.badge-btn { position: relative; }

.badge-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.7rem;
  line-height: 16px;
  text-align: center;
}

.icon-btn .badge-count { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

.icon-btn {
  position: relative;
  width: var(--control-min);
  height: var(--control-min);
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
}

.icon-btn svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 160ms ease-out, transform 160ms ease-out;
}

.js .icon-btn .icon-b { opacity: 0; transform: scale(0.7); }
.js .icon-btn.off .icon-a,
.js .icon-btn.done .icon-a { opacity: 0; transform: scale(0.7); }
.icon-btn.off .icon-b,
.icon-btn.done .icon-b { opacity: 1; transform: none; }

.icon-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--panel-raised);
  color: var(--text);
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  translate: 0 4px;
  transition: opacity 150ms ease-out, translate 150ms ease-out;
}

.icon-btn.tip-bottom[data-tip]::after {
  bottom: auto;
  top: calc(100% + 8px);
  translate: 0 -4px;
}

.icon-btn[data-tip]:hover::after,
.icon-btn[data-tip]:focus-visible::after { opacity: 1; translate: 0 0; }

.icon-btn.tip-left[data-tip]::after {
  bottom: auto;
  top: 50%;
  left: auto;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  translate: 4px 0;
}

.icon-btn.tip-left[data-tip]:hover::after,
.icon-btn.tip-left[data-tip]:focus-visible::after { translate: 0 0; }

.tile::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40%;
  background: var(--scrim);
  pointer-events: none;
}

.tile .label,
.tile .badge,
.tile button.promote { z-index: 1; }

.tile button.promote:hover {
  background: transparent;
  color: var(--accent-ink);
}

#transcript {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: min(380px, 100%);
  margin: 0;
  padding: 16px 16px 84px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 0;
  background: var(--panel);
}

.no-js #transcript { display: none; }

.js #transcript {
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 260ms cubic-bezier(0.2, 0.7, 0.2, 1), visibility 260ms;
}

.js #transcript.open {
  transform: none;
  visibility: visible;
}

.transcript-actions { display: flex; gap: 4px; }

.transcript-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#transcript h2 { margin: 0; font-size: 0.95rem; text-wrap: balance; }

.transcript-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }

#record-state {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

#record-state.live { color: var(--danger-ink); }

#transcript-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

#rec-error {
  margin: 0;
  padding: 8px 12px;
  border-radius: 0;
  background: var(--danger);
  color: var(--on-accent);
  font-size: 0.85rem;
}

#interim {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#lines {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}

#lines li { display: flex; flex-direction: column; }
#lines .meta { color: var(--muted); font-size: 0.8rem; }

#lines li.own { background: var(--accent-soft); padding: 4px 8px; }
#lines li.own .meta { color: var(--text); opacity: 0.72; }
#lines li.own .body { cursor: text; }
#lines li.own .body:hover { text-decoration: underline dotted; }
#lines li.own .body:focus { outline: 1px solid var(--focus); outline-offset: 2px; }

#edit-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}


.icon-btn:hover {
  background: transparent;
  opacity: 0.75;
}

.tile.sharing video { object-fit: contain; }

.icon-btn[data-tip]::after { z-index: 3; }
.icon-btn.tip-end[data-tip]::after { left: auto; right: 0; transform: none; }
#controls .icon-btn:first-child[data-tip]::after { left: 0; transform: none; }
#controls .icon-btn:last-child[data-tip]::after { left: auto; right: 0; transform: none; }

.icon-btn.active,
.icon-btn.active:hover { background: transparent; color: var(--accent-ink); }
.icon-btn.off,
.icon-btn.off:hover { background: transparent; color: var(--danger-ink); }
#leave,
#leave:hover { background: transparent; color: var(--danger-ink); }
.icon-btn:disabled { background: transparent; color: var(--muted); cursor: not-allowed; }

.icon-btn.attention { animation: nudge 900ms ease-in-out 2; }

@keyframes nudge {
  50% { transform: scale(1.14); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
}

@keyframes tile-in {
  from { opacity: 0; transform: scale(0.97); }
}

.tile { animation: tile-in 240ms ease-out both; }
#lobby,
#notice:not([hidden]),
#admin:not([hidden]) { animation: rise 200ms ease-out both; }
#lines li,
#waitlist li { animation: rise 180ms ease-out both; }

.icon-btn svg.filled { fill: currentColor; stroke: none; }

.js .icon-btn.rec .icon-b { opacity: 0; transform: scale(0.7); }
.js .icon-btn.rec.active .icon-a { opacity: 0; transform: scale(0.7); }
.icon-btn.rec.active .icon-b { opacity: 1; transform: none; }

.icon-btn.rec.active,
.icon-btn.rec.active:hover { color: var(--danger-ink); }

.icon-btn.recording { color: var(--danger-ink); }
.icon-btn.recording:hover { color: var(--danger-ink); }
