:root {
  --bg: #0f1115;
  --fg: #e7e9ee;
  --muted: #98a0b3;
  --card: #171923;
  --accent: #6aa9ff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell;
  background: var(--bg);
  color: var(--fg);
}
.center { min-height: 100dvh; display: grid; place-items: center; }
.card {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  width: min(420px, 92vw);
}
label { display: block; margin-top: 12px; margin-bottom: 6px; color: var(--muted); }
input, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a2f3a;
  background: #0b0d13;
  color: var(--fg);
}
button {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #2a2f3a;
  background: #1a2130;
  color: var(--fg);
  cursor: pointer;
  transition: all 0.2s ease;
}
button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 6px rgba(106, 169, 255, 0.3);
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

.topbar {
  position: sticky;
  top: 0;
  background: #0b0d13;
  border-bottom: 1px solid #222838;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  min-height: calc(100dvh - 52px);
}
.videos {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  padding: 10px;
}
.tile {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile video {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #000;
}
.tile .label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, .5);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}

/* Ava tile */
.ai-tile {
  height: 180px;
  background: linear-gradient(145deg, #121826, #0b0f1f);
  border: 1px solid #2a3550;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.ai-tile.speaking {
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(106, 169, 255, 0.4);
}
.ai-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--accent), #7b68ee, #111);
  filter: drop-shadow(0 0 10px rgba(106, 169, 255, 0.4));
  animation: pulse 2.4s ease-in-out infinite;
  transition: transform 0.2s ease;
}
.ai-tile.speaking .ai-avatar {
  background: url('ai_avatar.gif') center/cover no-repeat;
  animation: none;
  transform: scale(1.05);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.side {
  border-left: 1px solid #222838;
  display: flex;
  flex-direction: column;
}
.tabs {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid #222838;
}
.tab.active {
  outline: 2px solid #2a3550;
}
.panel {
  padding: 10px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.panel.hidden { display: none; }
.log {
  flex: 1;
  overflow: auto;
  background: #0b0d13;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #222838;
}
.row { display: flex; gap: 8px; margin-top: 8px; }
.row.wrap { flex-wrap: wrap; align-items: center; }
.inline { display: flex; align-items: center; gap: 8px; user-select: none; }
.aiOut {
  white-space: pre-wrap;
  background: #0b0d13;
  border: 1px solid #222838;
  padding: 8px;
  border-radius: 8px;
  min-height: 80px;
}
