:root {
  --bg: #0e1116;
  --panel: #171c24;
  --panel-2: #1f2630;
  --border: #2a323d;
  --text: #e6edf3;
  --muted: #8b97a7;
  --accent: #4f9dff;
  --accent-2: #2ec27e;
  --danger: #ff5d5d;
  --warn: #ffb454;
  --radius: 12px;
  --maxw: 1100px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100%;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 650; }
.topbar nav a { margin-left: 16px; text-decoration: none; color: var(--muted); font-size: 14px; }
.topbar nav a:hover { color: var(--text); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 20px; }

.status-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 6px;
  vertical-align: middle;
}
.status-dot.live { background: var(--danger); box-shadow: 0 0 8px var(--danger); animation: pulse 1.5s infinite; }
.status-dot.connected { background: var(--accent-2); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #08111f; font-weight: 650; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #2a0808; font-weight: 650; }

label { font-size: 14px; color: var(--muted); }
input[type="text"], select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

/* --- Captions (listener + big screen) --- */
.captions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0;
}
.caption {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 14px 18px;
  animation: fadein .3s ease;
}
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.caption .en { font-size: clamp(20px, 3.2vw, 34px); line-height: 1.35; }
.caption .fa {
  margin-top: 8px;
  font-size: clamp(15px, 2vw, 22px);
  color: var(--muted);
  direction: rtl;
  text-align: right;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
}
.caption .meta { margin-top: 6px; font-size: 12px; color: var(--muted); }
.caption.partial { border-left-color: var(--warn); opacity: .85; }

.bignote { color: var(--muted); font-size: 14px; }

.pill {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
}

/* --- Sessions table --- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
td a { margin-right: 10px; }

.log {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.log .error { color: var(--danger); }
.log .warn { color: var(--warn); }

.meter {
  height: 8px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex: 1;
  min-width: 120px;
}
.meter > div { height: 100%; width: 0%; background: var(--accent-2); transition: width .08s linear; }

/* Fullscreen / big-screen mode for the listener captions */
body.bigscreen .topbar,
body.bigscreen .controls { display: none; }
body.bigscreen .caption .en { font-size: clamp(28px, 5vw, 56px); }
body.bigscreen .caption .fa { font-size: clamp(20px, 3vw, 32px); }
