html,
body {
  margin: 0;
  padding: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
  background: #0b1020;
  color: #e8eefc;
}

/* Mobile call UI */
.call-shell {
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background:
    radial-gradient(
      1200px 600px at 70% 20%,
      rgba(23, 189, 146, 0.14),
      transparent 60%
    ),
    radial-gradient(
      900px 500px at 10% 20%,
      rgba(79, 140, 255, 0.18),
      transparent 55%
    ),
    #050816;
}

.call-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 8, 22, 0.72);
  backdrop-filter: blur(10px);
}

.call-title {
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.call-subtitle {
  font-size: 11px;
  opacity: 0.72;
  margin-top: 2px;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.call-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.call-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.95;
  user-select: none;
}

.call-select {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  max-width: 140px;
}

.call-stage {
  position: relative;
  padding: 10px 10px 0 10px;
  min-height: 0;
}

.call-remote {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-content: start;
}

.call-remote.has-0 {
  place-items: center;
}

.call-remote.has-1 {
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
}

.call-remote.has-2 {
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
}

.call-remote.has-3,
.call-remote.has-4plus {
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
}

.call-remote.has-4plus {
  overflow: auto;
  padding-bottom: 6px;
}

.call-remote.has-1 .remote-tile,
.call-remote.has-2 .remote-tile,
.call-remote.has-3 .remote-tile,
.call-remote.has-4plus .remote-tile {
  min-height: 0;
}

.call-remote.has-1 .remote-tile video {
  height: calc(100svh - 210px);
  min-height: 260px;
}

.call-remote.has-2 .remote-tile video {
  height: calc((100svh - 210px) / 2);
  min-height: 180px;
}

.call-remote .remote-tile video,
.call-remote video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  aspect-ratio: auto;
}

.call-local-pip {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 118px;
  height: 158px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}

.call-local-pip video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  aspect-ratio: auto;
}

.call-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 12px 10px 12px;
}

.call-btn {
  min-width: 72px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #e8eefc;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.call-btn:disabled {
  opacity: 0.55;
}

.call-btn-primary {
  background: rgba(23, 189, 146, 0.92);
  border-color: rgba(23, 189, 146, 0.35);
  color: #04101d;
}

.call-btn-danger {
  background: rgba(255, 76, 76, 0.92);
  border-color: rgba(255, 76, 76, 0.35);
  color: #04101d;
}

.call-captions {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 8, 22, 0.7);
  backdrop-filter: blur(10px);
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom)) 10px;
}

.call-captions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.call-caption-panel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  overflow: hidden;
}

.call-caption-title {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.9;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.call-shell .transcript {
  height: 18svh;
  min-height: 120px;
  max-height: 180px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

@media (min-width: 920px) {
  .call-shell {
    grid-template-rows: auto 1fr auto auto;
  }
  .call-stage {
    padding: 16px 16px 0 16px;
  }
  .call-local-pip {
    width: 160px;
    height: 214px;
  }
  .call-shell .transcript {
    height: 220px;
    max-height: 260px;
  }
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.header h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 650;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

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

@media (min-width: 920px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
}

.panel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
}

.panel h3 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 650;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.label {
  display: block;
  min-width: 64px;
  opacity: 0.9;
}

.input {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e8eefc;
  padding: 10px 10px;
  border-radius: 10px;
  outline: none;
}

.input:focus {
  border-color: rgba(124, 195, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 195, 255, 0.18);
}

.btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #e8eefc;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    rgba(88, 155, 255, 0.95),
    rgba(88, 255, 204, 0.75)
  );
  border-color: rgba(88, 155, 255, 0.3);
  color: #04101d;
  font-weight: 700;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: rgba(255, 76, 76, 0.15);
  border-color: rgba(255, 76, 76, 0.25);
}

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
}

.badge.ok {
  background: rgba(88, 255, 204, 0.16);
  border-color: rgba(88, 255, 204, 0.32);
}

.badge.warn {
  background: rgba(255, 205, 88, 0.16);
  border-color: rgba(255, 205, 88, 0.32);
}

.badge.bad {
  background: rgba(255, 76, 76, 0.16);
  border-color: rgba(255, 76, 76, 0.32);
}

video {
  width: 100%;
  background: #050816;
  border-radius: 12px;
  aspect-ratio: 16 / 9;
}

.remote-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 920px) {
  .remote-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.remote-tile {
  position: relative;
}

.remote-label {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(6px);
}

.transcript {
  height: 220px;
  overflow: auto;
  padding: 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.line {
  margin-bottom: 10px;
}

.orig {
  font-size: 13px;
  opacity: 0.95;
}

.tran {
  font-size: 13px;
  color: rgba(88, 255, 204, 0.92);
  margin-top: 4px;
}

.hint {
  margin-top: 10px;
  opacity: 0.75;
  font-size: 12px;
  line-height: 1.4;
}

.table-wrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
}

.created {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(88, 155, 255, 0.12);
  border: 1px solid rgba(88, 155, 255, 0.22);
}

a {
  color: rgba(124, 195, 255, 1);
}

.error {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 76, 76, 0.12);
  border: 1px solid rgba(255, 76, 76, 0.22);
}
