/* Yaps — ABS Hive light theme
   Tokens mirror hive.amvelt.com: canvas #f7f6f3 · honey accent #d8c79a · Syne + DM Sans */

:root {
  --canvas: #f7f6f3;
  --panel: #ffffff;
  --raised: #ffffff;
  --sunken: #efefed;
  --ink: #0c0c0b;
  --ink-mute: #4a4a47;
  --ink-faint: #6d6d6a;
  --line: #e8e8e6;
  --line-strong: #d6d6d2;
  --accent: #d8c79a;
  --accent-ink: #0c0c0b;
  --accent-soft: #efe4cd;
  --danger: #b3261e;
  --danger-ink: #ffffff;
  --ok: #3f7d3f;
  --scrim: rgba(12, 12, 11, 0.55);
  --shadow: 0 18px 44px rgba(12, 12, 11, 0.08);
  --radius: 16px;
}

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

html, body { height: 100%; }

body {
  font-family: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, .brand, .hero h1 {
  font-family: "Syne", "DM Sans", "Segoe UI", system-ui, sans-serif;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; color: inherit; }
.hidden { display: none !important; }

::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- landing ---------- */

.landing {
  min-height: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: clamp(20px, 5vw, 40px) 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: 0.2px; }
.brand.mini span { font-size: 16px; }

.hero h1 { font-size: clamp(34px, 7vw, 46px); line-height: 1.06; letter-spacing: -1.5px; margin-top: 8px; font-weight: 800; }
.grad { color: var(--ink-mute); }
.grad::after { content: ""; display: inline-block; width: 0.5em; height: 0.5em; margin-left: 0.15em; border-radius: 50%; background: var(--accent); }
.eyebrow { color: var(--ink-faint); text-transform: uppercase; letter-spacing: 2px; font-size: 11px; font-weight: 600; }
.sub { color: var(--ink-mute); line-height: 1.55; margin-top: 12px; font-size: 15px; }
.sub.left { text-align: left; margin: 10px 0 18px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lbl { font-size: 12px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 1px; }

input[type="text"], input:not([type]) {
  width: 100%;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  outline: none;
  caret-color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder { color: var(--ink-faint); }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--raised); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 600;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s;
}
.btn:hover { border-color: var(--ink-mute); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.primary:hover { filter: brightness(1.04); }
.btn.big { padding: 14px 18px; font-size: 15.5px; }
.btn.ghost { background: transparent; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-faint); font-size: 12px; margin: 4px 0; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.joinRow { display: flex; gap: 10px; }
.joinRow input { flex: 1; }

.foot { text-align: center; color: var(--ink-faint); font-size: 12.5px; margin-top: auto; }

/* ---------- room ---------- */

.room-body { overflow: hidden; display: flex; flex-direction: column; height: 100dvh; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: blur(10px);
  z-index: 20;
}
.spacer { flex: 1; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  color: var(--ink-mute);
  font-size: 13px;
  transition: border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.code { font-weight: 600; letter-spacing: 0.5px; color: var(--ink); }

.count {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  color: var(--ink-mute);
  font-weight: 600;
}
.count:hover { border-color: var(--line-strong); color: var(--ink); }

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-auto-rows: 1fr;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

.tile {
  position: relative;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 160px;
}
.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--sunken);
}
.tile.mirrored video { transform: scaleX(-1); }
.tile .avatar {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Syne", "DM Sans", sans-serif;
  font-size: 42px;
  font-weight: 800;
  color: var(--ink);
  background: radial-gradient(circle at 30% 25%, var(--accent-soft), transparent 70%), var(--sunken);
}
.tile.live .avatar { display: none; }

/* screen shares show the whole frame, not a cropped one */
.tile.sharing video,
.tile.rsharing video,
.spotlight .tile video {
  object-fit: contain;
  background: #10100f;
}

/* pinned participant / active share takes the stage, everyone else in a filmstrip */
.grid.has-stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 84px;
}
.spotlight { flex: 1; min-height: 0; }
.spotlight .tile { width: 100%; height: 100%; min-height: 0; }
.strip {
  flex: none;
  height: 136px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}
.strip .tile {
  flex: 0 0 auto;
  width: min(240px, 44vw);
  height: 100%;
  min-height: 0;
}
.strip::-webkit-scrollbar { height: 6px; }
.strip::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }

/* per-tile hover actions (pin) */
.t-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 3;
}
.tile:hover .t-actions, .t-actions:focus-within { opacity: 1; }
@media (hover: none) {
  .t-actions { opacity: 1; }
}
.pin-btn {
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.pin-btn:hover { border-color: var(--ink-mute); }
.pin-btn.pinned { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* waiting room — unmistakable, friendly, obvious */
.lobby-card { max-width: 420px; }
.lobby-pulse {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 52px;
  margin: 6px 0 10px;
}
.lobby-pulse span {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.2s ease-in-out infinite;
}
.lobby-pulse span:nth-child(2) { animation-delay: 0.18s; }
.lobby-pulse span:nth-child(3) { animation-delay: 0.36s; }
@keyframes pulse-dot {
  0%, 100% { transform: scale(0.72); opacity: 0.45; }
  50% { transform: scale(1.15); opacity: 1; }
}
.lobby-btns { display: flex; gap: 10px; }
.lobby-btns .btn { flex: 1; }

.spin-ring {
  width: 46px;
  height: 46px;
  margin: 4px auto 10px;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* connection status chip */
.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--raised);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-mute);
  white-space: nowrap;
}
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.conn.ok .dot { background: #3f8f4a; box-shadow: 0 0 0 3px rgba(63, 143, 74, 0.18); }
.conn.wait .dot { background: #d97706; animation: blink 1.1s ease-in-out infinite; }
.conn.err .dot { background: var(--danger); }
@keyframes blink { 50% { opacity: 0.35; } }

/* join screen camera preview */
.preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--sunken);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-wrap video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.preview-wrap .avatar.xl { position: relative; z-index: 1; margin: 0; }
.preview-tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  background: var(--canvas);
  border: 1px solid var(--line);
  color: var(--ink-mute);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
}

.meta {
  position: absolute;
  left: 10px;
  bottom: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--canvas);
  background: color-mix(in srgb, var(--canvas) 72%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill svg { flex: none; }
.tag {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.controls {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  padding: 9px;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  z-index: 30;
}
.ctl {
  position: relative;
  min-width: 62px;
  height: 56px;
  padding: 0 12px;
  border-radius: 16px;
  background: var(--raised);
  border: 1px solid var(--line);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.ctl .lb {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.ctl:hover { border-color: var(--line-strong); }
.ctl:active { transform: scale(0.94); }
.ctl .off { display: none; }
.ctl.offed { background: var(--danger); border-color: transparent; color: var(--danger-ink); }
.ctl.offed .on { display: none; }
.ctl.offed .off { display: block; }
.ctl.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ctl.danger { background: var(--danger); border-color: transparent; color: var(--danger-ink); min-width: 74px; }
.badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 100vw;
  background: var(--panel);
  border-left: 1px solid var(--line);
  transform: translateX(105%);
  transition: transform 0.22s ease;
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.panel.open { transform: translateX(0); }

.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.tab {
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--ink-mute);
  font-weight: 600;
  font-size: 13.5px;
}
.tab.active { background: var(--sunken); color: var(--ink); }
.mini-count { font-size: 11.5px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.icon-btn { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-mute); }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }

.view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.view.active { display: flex; }

.messages { list-style: none; overflow-y: auto; flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; }
.msg .who { font-size: 11.5px; color: var(--ink-faint); font-weight: 600; margin-bottom: 3px; }
.msg .bubble {
  background: var(--sunken);
  border: 1px solid var(--line);
  padding: 9px 12px;
  border-radius: 12px;
  border-top-left-radius: 4px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.msg.mine { align-self: flex-end; }
.msg.mine .bubble { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); border-radius: 12px; border-top-right-radius: 4px; }
.sysmsg { align-self: center; color: var(--ink-faint); font-size: 12px; background: var(--sunken); border-radius: 999px; padding: 4px 12px; }

.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.composer input { flex: 1; }
.send { width: 44px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; transition: filter 0.15s; }
.send:hover { filter: brightness(1.05); }

.people { list-style: none; padding: 10px; overflow-y: auto; }
.ask-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.ask-section.hidden { display: none; }
.ask-title {
  padding: 12px 12px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-faint);
}
#askList { max-height: 40vh; }
.ask-head { display: flex; justify-content: center; padding: 6px 10px 0; }
.person.ask .p-name { font-weight: 600; }
.ask-actions { display: flex; gap: 6px; }
.ask-actions .btn { padding: 7px 13px; font-size: 12.5px; border-radius: 999px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; }
.person:hover { background: var(--sunken); }
.person .p-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--sunken);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Syne", "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}
.person .p-name { flex: 1; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .p-tag { color: var(--ink-faint); font-size: 12px; }
.p-state { display: inline-flex; gap: 6px; color: var(--ink-mute); }
.p-state .dim { opacity: 0.35; }

.overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}
.join-card { width: 380px; max-width: 100%; text-align: center; align-items: stretch; }
.join-card h2 { margin: 4px 0 8px; letter-spacing: -0.5px; }
.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Syne", "DM Sans", sans-serif;
  font-weight: 800;
  font-size: 26px;
}
.avatar.xl { width: 84px; height: 84px; font-size: 32px; margin: 0 auto; }
.avatar.err { background: var(--danger); color: var(--danger-ink); }

.toggles { display: flex; gap: 10px; justify-content: center; }
.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--raised);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-mute);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.toggle-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.toggle-chip:not(.on) { color: var(--ink-faint); text-decoration: line-through; }

.backlink { color: var(--ink-faint); text-align: center; font-size: 13px; text-decoration: none; padding: 6px; }
.backlink:hover { color: var(--ink); }

#toasts {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; grid-auto-rows: minmax(200px, 1fr); padding: 8px; gap: 8px; }
  .strip { height: 100px; }
  .strip .tile { width: min(180px, 46vw); }
  .panel { width: 100%; border-left: none; }
  .chip .code { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .conn { display: none; }
  .controls { gap: 6px; padding: 7px; bottom: 10px; max-width: calc(100vw - 16px); }
  .ctl { min-width: 48px; height: 50px; padding: 0 8px; border-radius: 14px; }
}
