/* ============ UnivMeet — dark modern UI ============ */
:root {
  --bg: #0b0f19;
  --bg-2: #111827;
  --card: #151b2b;
  --card-2: #1b2233;
  --line: #262e42;
  --txt: #e8ecf6;
  --muted: #97a3b8;
  --brand: #6366f1;
  --brand-2: #8b5cf6;
  --ok: #22c55e;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }
.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ---------- shared bits ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .9);
}
.brand .logo svg { width: 22px; height: 22px; }
.brand-name { font-size: 18px; }
.brand.small .logo { width: 28px; height: 28px; border-radius: 8px; }
.brand.small .logo svg { width: 18px; height: 18px; }
.brand.small .brand-name { font-size: 15px; }

.btn {
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--txt);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  transition: .18s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { border-color: #3a4560; transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 12px 30px -14px rgba(99, 102, 241, 1);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

/* ============ LANDING ============ */
.view { min-height: 100dvh; }

#landing { position: relative; display: flex; flex-direction: column; }

.bg-glow {
  position: fixed; inset: -20% -10% auto -10%; height: 70vh; z-index: 0; pointer-events: none;
  background:
    radial-gradient(45% 55% at 25% 30%, rgba(99, 102, 241, .30), transparent 70%),
    radial-gradient(40% 50% at 75% 20%, rgba(139, 92, 246, .24), transparent 70%),
    radial-gradient(35% 45% at 55% 65%, rgba(34, 197, 94, .12), transparent 70%);
  filter: blur(10px);
}

.land-top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(18px, 5vw, 60px);
}
.top-link { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.top-link:hover { color: var(--txt); }

.land-main { position: relative; z-index: 2; flex: 1; display: grid; place-items: center; padding: 10px clamp(18px, 5vw, 60px) 40px; }

.hero { width: 100%; max-width: 620px; text-align: center; }
.hero h1 {
  font-size: clamp(30px, 6vw, 52px); line-height: 1.06; letter-spacing: -.03em;
  margin: 0 0 14px; font-weight: 800;
}
.grad {
  background: linear-gradient(120deg, #a5b4fc, #8b5cf6 55%, #22d3ee);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .sub { color: #aab6cc; font-size: clamp(14px, 2vw, 17px); margin: 0 auto 26px; max-width: 480px; line-height: 1.55; }

.card {
  background: linear-gradient(180deg, rgba(30, 37, 55, .92), rgba(17, 22, 35, .95));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  text-align: left;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.field .opt { font-weight: 400; opacity: .75; }
.field input {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  background: #0d1220; border: 1px solid var(--line); color: var(--txt);
  font-size: 15px; outline: none; transition: .16s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
.field input::placeholder { color: #55617a; }

.actions { display: flex; gap: 10px; margin-top: 4px; }
.actions .btn { flex: 1; }
@media (max-width: 420px) { .actions { flex-direction: column; } }

.hint { min-height: 18px; margin-top: 12px; font-size: 13px; color: #fbbf24; }
.hint.err { color: #f87171; }

.feat { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 22px 0 0; padding: 0; }
.feat li {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted); font-weight: 600;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 999px;
}

.how {
  position: relative; z-index: 2;
  max-width: 720px; margin: 0 auto; padding: 30px clamp(18px, 5vw, 60px) 10px;
}
.how h2 { font-size: 16px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; text-align: center; }
.how ol { margin: 0 0 10px; padding-left: 20px; color: #c3ccdd; line-height: 1.9; font-size: 14.5px; max-width: 520px; margin-inline: auto; }
.how b { color: var(--txt); }
.how .note { color: var(--muted); font-size: 13px; }

.land-foot { position: relative; z-index: 2; text-align: center; color: #5b667c; font-size: 12.5px; padding: 26px 0 22px; }

/* ============ ROOM ============ */
#room { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

.room-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 25, .92); backdrop-filter: blur(10px); z-index: 5;
  flex: 0 0 auto;
}
.room-mid { display: flex; align-items: center; gap: 8px; min-width: 0; }
.code-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); color: var(--txt);
  padding: 7px 12px; border-radius: 10px; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; max-width: 46vw; overflow: hidden;
}
.code-pill:hover { border-color: var(--brand); }
.code-pill .ico { width: 15px; height: 15px; flex: 0 0 auto; }
#room-code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(34, 197, 94, .14); }
.dot-live.off { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, .14); }
.room-right { display: flex; align-items: center; gap: 10px; }
.people { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
@media (max-width: 640px) {
  .room-top .brand-name { display: none; }
  .people { display: none; }
  .code-pill { max-width: 40vw; }
}

.stage { position: relative; flex: 1 1 auto; min-height: 0; padding: 12px; }

.grid {
  display: grid; gap: 10px; height: 100%;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  grid-auto-rows: 1fr;
  align-content: center;
}
.grid[data-count="1"] { grid-template-columns: 1fr; }
.grid[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 700px) {
  .grid[data-count="2"] { grid-template-columns: 1fr; }
}

.tile {
  position: relative; background: #0d1220; border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; min-height: 140px;
  display: grid; place-items: center;
}
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #0a0e18; }
.tile.mirror video { transform: scaleX(-1); }
.tile.screen video { object-fit: contain; background: #05080f; }
.tile .avatar {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  position: absolute; inset: 0; margin: auto;
}
.tile .tag {
  position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px;
  background: rgba(6, 10, 18, .72); border: 1px solid rgba(255, 255, 255, .08);
  padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  max-width: calc(100% - 16px);
}
.tile .tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .tag .mini { width: 13px; height: 13px; opacity: .9; display: inline-flex; align-items: center; }
.tile .tag .mini svg { width: 13px; height: 13px; display: block; }
.tile .tag .mini.off { color: #f87171; }
.tile .tag .mini.cam { color: #f87171; }
.tile .badge-host {
  position: absolute; right: 8px; top: 8px; font-size: 11px; font-weight: 700;
  background: rgba(99, 102, 241, .9); padding: 3px 8px; border-radius: 999px;
}
.tile .badge-screen {
  position: absolute; right: 8px; top: 8px; font-size: 11px; font-weight: 700;
  background: rgba(34, 197, 94, .9); padding: 3px 8px; border-radius: 999px;
}
.tile .badge-host + .badge-screen { top: 34px; }
.tile.connecting::after {
  content: ''; position: absolute; inset: 0; background:
    linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .05) 40%, transparent 60%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-60%); } to { transform: translateX(60%); } }

.grid-empty {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center;
  color: var(--muted); font-size: 14px;
}

/* side panel */
.side {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 88vw); z-index: 20;
  background: #0e1422; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; box-shadow: -20px 0 50px -30px #000;
  animation: slideIn .18s ease;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: .4; } to { transform: none; opacity: 1; } }
.side-tabs { display: flex; align-items: center; gap: 4px; padding: 10px 10px 0; border-bottom: 1px solid var(--line); }
.tab {
  background: none; border: none; color: var(--muted); font-weight: 700; font-size: 14px;
  padding: 10px 12px; border-radius: 10px 10px 0 0; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--txt); border-bottom-color: var(--brand); }
.side-close { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 15px; padding: 8px; }
.side-close:hover { color: var(--txt); }
.side-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.msg { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 11px; font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.msg .who { display: block; font-size: 11.5px; font-weight: 700; color: #a5b4fc; margin-bottom: 3px; }
.msg.mine { background: #1b2440; border-color: #33406a; }
.msg.sys { background: none; border: none; color: #6b768c; font-size: 12px; text-align: center; padding: 2px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; padding: 11px 13px; border-radius: 11px; background: #0a0f1b; border: 1px solid var(--line); color: var(--txt); font-size: 14px; outline: none; }
.chat-form input:focus { border-color: var(--brand); }

.people-list { list-style: none; margin: 0; padding: 12px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.people-list li { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; font-size: 13.5px; }
.people-list .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: linear-gradient(135deg, var(--brand), var(--brand-2)); flex: 0 0 auto; }
.people-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-list .fl { font-size: 11px; color: var(--muted); }
.people-list .kick { background: none; border: 1px solid var(--line); color: #f87171; border-radius: 8px; font-size: 11px; padding: 4px 8px; }

/* controls */
.controls {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: rgba(11, 15, 25, .96);
  backdrop-filter: blur(10px); z-index: 6;
}
.ctl {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 66px; padding: 9px 8px; border-radius: 13px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--txt);
  font-size: 11px; font-weight: 600; transition: .16s;
}
.ctl:hover { border-color: #3a4560; transform: translateY(-1px); }
.ctl .ico { width: 22px; height: 22px; }
.ctl.off { background: #2a1520; border-color: #5b2333; color: #f87171; }
.ctl.na { opacity: .55; }
.ctl.na::after {
  content: ''; position: absolute; top: 8px; right: 10px;
  width: 6px; height: 6px; border-radius: 50%; background: #f59e0b;
}
.ctl.active { background: #1b2440; border-color: var(--brand); color: #c7d2fe; }
.ctl.danger { background: var(--danger); border-color: transparent; color: #fff; }
.ctl.danger:hover { filter: brightness(1.08); }
.ctl .badge {
  position: absolute; top: 4px; right: 8px; background: var(--danger); color: #fff;
  font-size: 10px; font-style: normal; font-weight: 800; min-width: 16px; height: 16px;
  border-radius: 999px; display: grid; place-items: center; padding: 0 4px;
}
@media (max-width: 480px) {
  .ctl { min-width: 56px; font-size: 10px; padding: 8px 5px; }
  .ctl .ico { width: 20px; height: 20px; }
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: #1b2440; border: 1px solid #33406a; color: var(--txt);
  padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  z-index: 40; box-shadow: 0 16px 40px -20px #000;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* kicked */
.kick { position: fixed; inset: 0; z-index: 60; background: rgba(5, 8, 14, .92); display: grid; place-items: center; padding: 20px; }
.kick-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px; text-align: center; max-width: 380px; }
.kick-card h2 { margin: 0 0 8px; font-size: 19px; }
.kick-card p { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

/* ===== modal diagnosa share layar ===== */
.sf-overlay {
  position: fixed; inset: 0; z-index: 70; background: rgba(5, 8, 14, .88);
  display: grid; place-items: center; padding: 18px; overflow: auto;
}
.sf-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; width: min(560px, 100%); max-height: 88vh; overflow: auto;
  box-shadow: var(--shadow); text-align: left;
}
.sf-card h3 { margin: 0 0 6px; font-size: 18px; }
.sf-sub { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.sf-reasons { margin: 0 0 14px; padding-left: 18px; color: #f0c9a8; font-size: 13.5px; line-height: 1.6; }
.sf-steps { background: #0d1220; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.sf-steps-title { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.sf-steps ol { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.75; color: #c9d3e6; }
.sf-steps code { background: #1b2233; padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.sf-detail { margin-bottom: 12px; }
.sf-detail summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.sf-detail pre { background: #0a0f1b; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 11.5px; overflow: auto; max-height: 180px; color: #9fb0c9; }
.sf-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ===== audio: banner unlock + panel volume ===== */
.audio-unlock {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 12px;
  background: #3a2a12; border-bottom: 1px solid #6b4a1c; color: #fbd38d;
  padding: 9px 14px; font-size: 13px; font-weight: 600; z-index: 6;
}
.vol-panel {
  position: fixed; right: 14px; top: 58px; z-index: 30; width: min(280px, 86vw);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow);
}
.vol-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; }
.vol-row input[type="range"] { flex: 1; accent-color: var(--brand); }
.vol-tip { margin-top: 8px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* indikator bicara */
.tile.speaking { box-shadow: inset 0 0 0 2px rgba(34, 197, 94, .85); }
.tile.speaking .tag { background: rgba(22, 101, 52, .85); }

/* tile share layar: lebar penuh supaya teks kebaca */
.tile.screen-tile {
  grid-column: 1 / -1;
  min-height: 220px;
  background: #05080f;
  border-color: #2f6b4a;
}
.tile.screen-tile video { object-fit: contain; }
.tile.screen-tile .badge-screen { top: 8px; right: 8px; }
