/* Video-call UI.

   Pehle ye poori dark thi. Wajah wajib thi - camera feed ke aas-paas light
   chrome aankh mein chubhta hai. Par asli istemaal mein poora screen kaala
   pad jaata tha aur labels, buttons, timer sab padhna mushkil ho gaya.

   Ab beech ka raasta: chrome (panel, button, text) light hai taaki sab saaf
   dikhe, aur camera ke tile abhi bhi dark hain - wahan video ke chaaron taraf
   safed border achha nahi lagta. Tile ka background neeche hardcoded hai
   (#0e1013), isliye palette light hone par bhi wo dark hi rehte hain.

   Dhyan rahe: jin jagah background hardcoded dark hai, wahan text ka rang bhi
   fix karna padta hai - warna light palette ka gehra text kaale par gayab ho
   jaata hai. */

:root {
  --c-bg: #f4f6f5;
  --c-surface: #ffffff;
  --c-surface-2: #eaeeec;
  --c-line: #ccd4d1;
  --c-text: #101917;
  --c-text-dim: #5e6a67;
  --c-accent: #0d6156;
  --c-accent-soft: #e2efec;
  --c-danger: #b3261e;
  --c-danger-hover: #8c1d18;

  /* Sirf un jagahon ke liye jahan background pakka dark hai (camera tile). */
  --on-dark: #e8eaed;
  --on-dark-dim: #9aa0a6;
  --on-dark-accent: #5fbfae;
}

/* ================= GREEN ROOM ================= */

.greenroom {
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-text);
  padding: 1.5rem clamp(1rem, 5vw, 3rem) 3rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.gr-brand {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--c-text);
}
.gr-brand span { color: var(--c-accent); }

.gr-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(19rem, 0.85fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  /* Pehle 74rem - bade screen par dono taraf khaali patti. */
  max-width: 96rem;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 56rem) {
  .gr-grid { grid-template-columns: 1fr; align-items: start; }
}

.gr-preview { display: flex; flex-direction: column; gap: 1rem; }

.gr-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: center;
}
.gr-hint { color: var(--c-text-dim); font-size: 0.83rem; margin-left: 0.5rem; }

.gr-form { display: flex; flex-direction: column; gap: 0.85rem; }
.gr-fields { display: flex; flex-direction: column; }
.gr-form h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  margin: 0;
  color: var(--c-text);
  letter-spacing: -0.015em;
}
.gr-sub { color: var(--c-text-dim); font-size: 0.93rem; margin: 0; }

.gr-form label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--c-text-dim);
  margin: 0.35rem 0 0.25rem;
  display: block;
}
.gr-form select,
.gr-form input[type='text'] {
  width: 100%;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  color: var(--c-text);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  font-family: inherit;
  font-size: 0.94rem;
}
.gr-form select:focus,
.gr-form input:focus { outline: 2px solid var(--c-accent); outline-offset: 1px; }

.gr-notice {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-accent);
  border-radius: 10px;
  padding: 0.8rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.87rem;
  color: var(--c-text-dim);
}
.gr-notice b { color: var(--c-text); font-weight: 600; }

.gr-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.9rem;
  color: var(--c-text);
  cursor: pointer;
  margin: 0.2rem 0;
}
.gr-check input { width: auto; margin-top: 0.15rem; accent-color: var(--c-accent); }

.join-btn {
  background: var(--c-accent);
  color: #0b1c19;
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.6rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  align-self: flex-start;
}
.join-btn:hover:not(:disabled) { background: #4fb9a3; }
.join-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.join-btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; }

.gr-status { color: #8a5a12; font-size: 0.85rem; min-height: 1.2em; }
.gr-meta { color: var(--c-text-dim); font-size: 0.83rem; }
.gr-link { color: var(--c-accent); font-size: 0.85rem; text-decoration: none; align-self: flex-start; }
.gr-link:hover { text-decoration: underline; }

/* ================= TILES ================= */

.tile {
  position: relative;
  background: #0e1013;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--c-line);
}
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);          /* mirror - log khud ko aaine jaisa dekhna chahte hain */
}

.tile-off {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: #0e1013;
  color: var(--on-dark-dim);          /* background pakka dark hai */
  font-size: 0.85rem;
}
.tile.cam-off .tile-off { display: flex; }
.tile.cam-off video { visibility: hidden; }

.avatar {
  border-radius: 50%;
  background: var(--c-surface-2);
  color: var(--c-text);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-family: var(--display);
}
.avatar.lg { width: 5.5rem; height: 5.5rem; font-size: 2rem; }

.tile-name {
  position: absolute;
  left: 0.7rem;
  bottom: 0.6rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 10px;
  backdrop-filter: blur(4px);
}
.tile-badges { position: absolute; right: 0.7rem; bottom: 0.6rem; display: flex; gap: 0.35rem; }
.mic-mute {
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
}
.mic-mute svg { width: 0.95rem; height: 0.95rem; fill: #f07575; }

/* ================= CALL LAYOUT ================= */

.call {
  position: fixed;
  inset: 0;
  height: 100dvh;
  background: var(--c-bg);
  color: var(--c-text);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.call-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(0.75rem, 3vw, 1.5rem);
}
.call-top-left, .call-top-right { display: flex; align-items: center; gap: 0.7rem; }
.call-title { font-size: 0.92rem; color: var(--c-text); font-weight: 500; }

.rec-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  /* Light background par gehra laal - pehle ka #f07575 usme ghul jaata tha. */
  color: #b3261e;
  background: rgba(217, 59, 59, 0.1);
  border: 1px solid rgba(179, 38, 30, 0.35);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.rec-chip i { width: 7px; height: 7px; border-radius: 50%; background: #e05a5a; display: block; }
@media (prefers-reduced-motion: no-preference) {
  .rec-chip i { animation: recpulse 1.8s ease-in-out infinite; }
}
@keyframes recpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

.pill-dark {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--c-accent);
  background: var(--c-accent-soft);
  border: 1px solid rgba(62, 163, 143, 0.3);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.call .timer {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
}

/* stage */
.stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.6rem, 1.5vw, 1rem);
  padding: 0 clamp(0.75rem, 3vw, 1.5rem);
  align-content: center;
  min-height: 0;
  transition: padding-right 0.25s ease;
}
.stage .tile { aspect-ratio: auto; height: min(62vh, 34rem); }

.call.panel-open .stage { padding-right: calc(clamp(0.75rem, 3vw, 1.5rem) + 21rem); }
@media (max-width: 60rem) {
  .call.panel-open .stage { padding-right: clamp(0.75rem, 3vw, 1.5rem); }
}

/* examiner tile */
.tile.examiner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  background: radial-gradient(circle at 50% 45%, #1b2b28 0%, #12161a 62%);
  border-color: var(--c-line);
}
.tile.examiner.speaking { border-color: rgba(62, 163, 143, 0.65); }

.agent-visual { position: relative; display: grid; place-items: center; }

.agent-orb {
  position: relative;
  width: clamp(5rem, 11vw, 7.5rem);
  height: clamp(5rem, 11vw, 7.5rem);
  display: grid;
  place-items: center;
}
.agent-orb .core {
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 24px rgba(62, 163, 143, 0.5);
  transition: transform 0.18s ease;
}
.agent-orb .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(62, 163, 143, 0.35);
  opacity: 0;
}
.agent-orb.speaking .core { transform: scale(1.18); }

/* ---- AI ka chehra ----
   Orb ke andar ek saada chehra - jab admin ne na photo lagayi ho na video.
   Asli insaan ki video (neeche .agent-video) par "AI" ka badge rehta hai,
   taaki candidate ko saaf rahe ki saamne AI hai.

   Muh sirf `.speaking` par hilta hai - wahi class pehle se orb par lagti hai
   jab agent bolta hai, isliye JS mein kuch nahi badla. */
.agent-orb .face { position: absolute; inset: 12%; width: 76%; height: 76%; z-index: 2; }

/* Admin ki lagayi hui photo. Gol daayre mein, kate bina - isliye object-fit
   cover, aur admin portal beech ka chauk-kaat pehle hi kar deta hai. */
.agent-orb .face-photo {
  position: absolute; inset: 8%; width: 84%; height: 84%;
  border-radius: 50%; object-fit: cover; z-index: 2;
}
.agent-orb .face-bg { fill: var(--c-accent); }
.agent-orb .eye { fill: #fff; transform-origin: center; }
.agent-orb .mouth { fill: #fff; transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: no-preference) {
  /* Palak jhapakna - dhyan kheenche bina, bas jaan daalne ke liye. */
  .agent-orb .eye { animation: blink 5.5s infinite; }
  .agent-orb .eye:nth-of-type(3) { animation-delay: 0.06s; }
  .agent-orb.speaking .mouth { animation: talk 0.26s ease-in-out infinite alternate; }
}

@keyframes blink {
  0%, 94%, 100% { transform: scaleY(1); }
  97%           { transform: scaleY(0.1); }
}

@keyframes talk {
  from { transform: scaleY(0.45); }
  to   { transform: scaleY(1.5); }
}
@media (prefers-reduced-motion: no-preference) {
  .agent-orb.speaking .ring { animation: pulsering 1.8s ease-out infinite; }
  .agent-orb.speaking .ring.r2 { animation-delay: 0.9s; }
}
@keyframes pulsering {
  0% { transform: scale(0.55); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 0; }
}

.tile.examiner .tile-name { position: static; background: none; padding: 0; font-size: 0.95rem; color: var(--c-text); }
.tile-state { font-size: 0.85rem; color: var(--c-text-dim); text-align: center; padding: 0 1rem; }

/* ---- Asli insaan ki clips (admin portal se record ki hui) ----
   Poora tile video se bhara. Do clips ek ke upar: bolte waqt "talk" dikhti
   hai, warna "idle". Opacity se badalte hain taaki dono chalti rahein aur
   jhatka na lage. */
.tile.examiner.has-video { justify-content: flex-end; gap: 0.3rem; padding-bottom: 0.9rem; overflow: hidden; }
.tile.examiner.has-video .agent-visual { display: none; }
.agent-video { position: absolute; inset: 0; z-index: 0; background: #12161a; }
.agent-video video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transition: opacity 0.18s ease;
  transform: none; /* .tile video apna camera aaine jaisa ulta dikhata hai - ye nahi */
}
.agent-video video.talk { opacity: 0; }
.tile.examiner.speaking .agent-video video.talk { opacity: 1; }
/* Neeche halka andhera - taaki naam aur "Speaking…" padhne mein aayein. */
.agent-video::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 38%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
}
.agent-video .ai-badge {
  position: absolute; top: 0.7rem; left: 0.7rem; z-index: 1;
  background: rgba(0, 0, 0, 0.55); color: #fff;
  font-size: 0.72rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px;
}
.tile.examiner.has-video .tile-name,
.tile.examiner.has-video .tile-state { position: relative; z-index: 1; color: #fff; }
.tile.examiner.has-video.speaking { box-shadow: 0 0 0 2px rgba(62, 163, 143, 0.8); }

/* captions */
.captions {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 6.4rem;
  width: min(52rem, calc(100% - 3rem));
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}
.cap-line {
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  line-height: 1.45;
  padding: 0.6rem 1.1rem;
  border-radius: 12px;
  max-width: 100%;
  text-align: center;
}
.cap-line:empty { display: none; }
.cap-line b { color: var(--c-accent); font-weight: 600; margin-right: 0.4rem; }

/* transcript panel */
.panel {
  position: absolute;
  top: 3.2rem;
  right: clamp(0.75rem, 3vw, 1.5rem);
  bottom: 5.6rem;
  width: 20rem;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 6;
}
@media (max-width: 60rem) {
  .panel { left: clamp(0.75rem, 3vw, 1.5rem); width: auto; }
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--c-line);
}
.panel-head h3 { margin: 0; font-size: 0.92rem; font-weight: 600; margin-right: auto; }
.panel-body { flex: 1; overflow-y: auto; padding: 0.9rem; display: flex; flex-direction: column; gap: 0.85rem; }
.panel-empty { color: var(--c-text-dim); font-size: 0.85rem; text-align: center; margin: 2rem 0; }

.msg { display: flex; flex-direction: column; gap: 0.2rem; }
.msg .who { font-size: 0.78rem; font-weight: 600; }
.msg.agent .who { color: var(--c-accent); }
.msg.staff .who { color: var(--c-text-dim); }
.msg .txt { font-size: 0.88rem; line-height: 1.5; color: var(--c-text); }
.msg.agent .txt { color: #c9cfd4; }

/* bottom bar */
.call-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem clamp(0.75rem, 3vw, 1.5rem) 1.1rem;
}
.bar-center { display: flex; align-items: center; gap: 0.6rem; justify-content: center; }
.bar-left { min-width: 0; }
.bar-right { display: flex; justify-content: flex-end; }
.agent-hint, .bar-meta { color: var(--c-text-dim); font-size: 0.8rem; }

/* control buttons */
.ctrl {
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  color: var(--c-text);
  border-radius: 50%;
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}
.ctrl svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }
.ctrl:hover { background: #343940; }
.ctrl:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.ctrl.round { width: 3.1rem; height: 3.1rem; }
.ctrl.round svg { width: 1.35rem; height: 1.35rem; }
.ctrl.sm { width: 2.2rem; height: 2.2rem; }
.ctrl.sm svg { width: 1.05rem; height: 1.05rem; }
.ctrl.ghost-dark { background: transparent; border-color: transparent; color: var(--c-text-dim); }
.ctrl.ghost-dark:hover { background: var(--c-surface-2); color: var(--c-text); }

/* on/off state: red-filled when the device is OFF, like every call app */
.ctrl .i-off { display: none; }
.ctrl[data-on='false'] {
  background: var(--c-danger);
  border-color: var(--c-danger);
  color: #fff;
}
.ctrl[data-on='false']:hover { background: var(--c-danger-hover); }
.ctrl[data-on='false'] .i-on { display: none; }
.ctrl[data-on='false'] .i-off { display: block; }

.ctrl.active { background: var(--c-accent-soft); border-color: rgba(62, 163, 143, 0.45); color: var(--c-accent); }

.ctrl.end {
  background: var(--c-danger);
  border-color: var(--c-danger);
  color: #fff;
  width: 4.4rem;
  border-radius: 999px;
}
.ctrl.end:hover { background: var(--c-danger-hover); }
.ctrl.end svg { transform: rotate(135deg); width: 1.5rem; height: 1.5rem; }

/* ================= DONE ================= */

.done {
  min-height: 100dvh;
  background: var(--c-bg);
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}
.done-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 14px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  max-width: 32rem;
  width: 100%;
  color: var(--c-text);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  text-align: center;
}
.done-tick {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  background: var(--c-accent-soft);
  display: grid;
  place-items: center;
  margin: 0 auto;
}
.done-tick svg { width: 1.6rem; height: 1.6rem; fill: var(--c-accent); }
.done h1 { font-family: var(--display); font-weight: 500; font-size: 1.65rem; margin: 0; }
.done-sub { color: var(--c-text-dim); font-size: 0.93rem; margin: 0; }

.done-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--c-line);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  overflow: hidden;
}
.done-stats > div {
  background: var(--c-surface);
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.done-stats span { font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.done-stats .mono-sm { font-family: var(--mono); font-size: 0.7rem; word-break: break-all; }
.done-stats small {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--c-text-dim);
}

.done-next {
  background: var(--c-accent-soft);
  border: 1px solid rgba(62, 163, 143, 0.25);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.87rem;
  color: #b8c4c1;
}
.done-next b { color: var(--c-text); }

.done-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.done .btn {
  background: var(--c-accent);
  color: #0b1c19;
  border: 0;
  border-radius: 999px;
  padding: 0.6rem 1.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.done .btn:hover { background: #4fb9a3; }
.done .btn.ghost { background: transparent; color: var(--c-text-dim); border: 1px solid var(--c-line); }
.done .btn.ghost:hover { background: var(--c-surface-2); color: var(--c-text); }

.done #doneScore .callout {
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-accent);
  color: var(--c-text);
  text-align: left;
}

/* toast on dark ground - call mein control bar ke upar */
body:has(.call:not([hidden])) .toast,
body:has(.greenroom:not([hidden])) .toast,
body:has(.done:not([hidden])) .toast {
  background: var(--c-surface-2);
  color: var(--c-text);
  border: 1px solid var(--c-line);
}
body.in-call .toast { bottom: 6.2rem; }

/* long device hint should not crowd the controls */
.bar-left { display: flex; align-items: center; }
.agent-hint {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 26rem;
  line-height: 1.4;
}


/* =====================================================================
   MOBILE
   Phone par ye ek call app jaisa lagna chahiye, chhota kiya hua desktop
   nahi: examiner poori screen leta hai, apni video kone mein PiP ban
   jaati hai, aur controls angoothe ki reach mein rehte hain.
   ===================================================================== */

@media (max-width: 46rem) {
  /* ---- green room ---- */
  .greenroom {
    padding-top: 1rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    gap: 1.25rem;
  }
  .gr-grid { gap: 1.25rem; }

  /* Preview poori screen kha jaata tha aur form neeche chhup jaata tha. */
  .gr-preview .tile { aspect-ratio: 5 / 4; max-height: 34vh; margin: 0 auto; width: 100%; }
  .gr-form h1 { font-size: 1.5rem; }
  .gr-form select,
  .gr-form input[type='text'] {
    font-size: 16px;              /* 16px se kam par iOS focus par zoom kar deta hai */
    padding: 0.7rem 0.75rem;
  }
  .join-btn { align-self: stretch; text-align: center; justify-content: center; padding: 0.85rem 1.5rem; }
  .gr-link { align-self: center; padding: 0.5rem; }
  .gr-controls { gap: 0.75rem; flex-wrap: wrap; }
  .gr-hint { margin-left: 0; flex-basis: 100%; text-align: center; }

  /* ---- in call ---- */
  .call-top { padding: 0.55rem 0.75rem; padding-top: calc(0.55rem + env(safe-area-inset-top)); }
  .call-title { font-size: 0.85rem; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #fsBtn { display: none; }       /* mobile browser khud fullscreen jaisa hai */

  /* Examiner poori jagah leta hai - centered tile ke aas-paas ki khaali
     space phone par sirf barbaad lagti hai. */
  .stage {
    position: relative;
    grid-template-columns: 1fr;
    align-content: stretch;
    padding: 0 0.6rem 0.6rem;
  }
  .stage .tile.examiner { height: 100%; justify-content: center; }

  /* apni video = kone ka chhota PiP, bilkul phone call apps jaisa */
  .stage .tile.self {
    position: absolute;
    top: 0.5rem;
    right: 1.1rem;
    width: 6.2rem;
    height: 8.4rem;
    border-radius: 10px;
    z-index: 4;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  }
  .stage .tile.self .tile-name {
    left: 0.3rem; bottom: 0.3rem; font-size: 0.6rem; padding: 0.1rem 0.35rem;
    max-width: calc(100% - 0.6rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .stage .tile.self .tile-badges { right: 0.3rem; bottom: 0.3rem; }
  .stage .tile.self .mic-mute { width: 1.3rem; height: 1.3rem; }
  .stage .tile.self .avatar.lg { width: 2.8rem; height: 2.8rem; font-size: 1.1rem; }

  .agent-orb { width: 4.5rem; height: 4.5rem; }
  .tile-state { font-size: 0.8rem; }

  /* ---- captions ---- */
  .captions { bottom: 5.6rem; width: calc(100% - 1.5rem); }
  .cap-line { font-size: 0.95rem; padding: 0.5rem 0.8rem; }

  /* ---- transcript = bottom sheet ---- */
  /* Sheet control bar ke UPAR rukta hai - end-call button chhupna nahi chahiye. */
  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: calc(4.4rem + env(safe-area-inset-bottom));
    width: auto;
    height: 52dvh;
    border-radius: 14px 14px 0 0;
    border-bottom: 0;
  }
  .panel-body { font-size: 0.95rem; }

  /* ---- control bar ---- */
  .call-bar {
    grid-template-columns: 1fr;
    padding: 0.6rem 0.5rem;
    padding-bottom: calc(0.7rem + env(safe-area-inset-bottom));
  }
  .bar-left, .bar-right { display: none; }
  .bar-center { gap: 0.4rem; }
  .ctrl.round { width: 2.9rem; height: 2.9rem; }
  .ctrl.round svg { width: 1.25rem; height: 1.25rem; }
  .ctrl.end { width: 4rem; }

  /* ---- done ---- */
  .done { padding: 1.5rem 1rem calc(2rem + env(safe-area-inset-bottom)); }
  .done h1 { font-size: 1.4rem; }
  .done-stats { grid-template-columns: repeat(2, 1fr); }
  .done-stats > div:last-child { grid-column: 1 / -1; }
  .done-actions { flex-direction: column; }
  .done .btn { justify-content: center; padding: 0.75rem 1.3rem; }

  body.in-call .toast { bottom: 5.4rem; }
}

/* Very small phones - 5 controls ek line mein hi rehne chahiye. */
@media (max-width: 20.5rem) {
  .bar-center { gap: 0.3rem; }
  .ctrl.round { width: 2.65rem; height: 2.65rem; }
  .ctrl.end { width: 3.6rem; }
}

/* Landscape phone: height hi asli constraint hai. */
@media (max-height: 30rem) and (orientation: landscape) {
  .stage .tile.examiner { height: min(52dvh, 14rem); }
  .stage .tile.self { width: 5rem; height: 3.6rem; }
  .agent-orb { width: 3.2rem; height: 3.2rem; }
  .tile.examiner { gap: 0.5rem; }
  .captions { bottom: 4.6rem; }
  .call-bar { padding-top: 0.4rem; padding-bottom: calc(0.4rem + env(safe-area-inset-bottom)); }
  .ctrl.round { width: 2.5rem; height: 2.5rem; }
}

/* Touch par hover state chipak jaata hai - usse rok do. */
@media (hover: none) {
  .ctrl:hover { background: var(--c-surface-2); }
  .ctrl[data-on='false']:hover { background: var(--c-danger); }
  .join-btn:hover:not(:disabled) { background: var(--c-accent); }
}

/* =====================================================================
   PROCTORING
   ===================================================================== */

/* ---- green room: camera chooser ---- */
.gr-camselect {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.gr-camselect label {
  font-size: 0.8rem;
  color: var(--c-text-dim);
  margin: 0;
  flex: none;
}
.gr-camselect select {
  flex: 1 1 12rem;
  min-width: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  color: var(--c-text);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  font-family: inherit;
  font-size: 0.88rem;
}
.gr-camselect .gr-hint { margin: 0; }

/* ---- 360 camera: poora frame dikhna chahiye, crop nahi ----
   Panorama ko mirror karna bhi galat hai - wo kamre ka view hai, aaina nahi. */
.tile.cam-360 { aspect-ratio: 2 / 1; }
.tile.cam-360 video {
  object-fit: contain;
  transform: none;
  background: #0e1013;
}
.stage .tile.cam-360 { aspect-ratio: auto; }

/* ---- face box overlay ---- */
.face-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.tile.cam-off .face-overlay { display: none; }

/* ---- "monitoring" chip on the self tile ---- */
.watch-chip {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-dark-accent);       /* background pakka dark hai */
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(95, 191, 174, 0.45);
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.watch-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-accent);
  display: block;
}
.watch-chip.bad {
  color: #f07575;
  border-color: rgba(217, 59, 59, 0.45);
}
.watch-chip.bad i { background: #e05a5a; }
@media (prefers-reduced-motion: no-preference) {
  .watch-chip i { animation: recpulse 2.4s ease-in-out infinite; }
}

/* ---- alert strip ----
   Screen ke upar, tiles ke UPAR. Ye chhota nahi hona chahiye - candidate ko
   turant dikhna chahiye ki kuch pakda gaya hai, warna wo sochta hai sab theek
   chal raha hai aur baad mein flag dekhkar hairaan hota hai. */
.proctor-alert {
  position: absolute;
  top: 3.4rem;
  /* left:50% + translateX(-50%) yahan kaam nahi karta - absolute box ki
     available width sirf 50% reh jaati hai aur text bekaar mein 4 line ka ho
     jaata hai. left/right 0 + auto margin poori chaudai deta hai. */
  left: 0;
  right: 0;
  margin: 0 auto;
  width: fit-content;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: min(34rem, calc(100% - 2rem));
  /*
   * Rang light theme ke hisaab se.
   *
   * Pehle yahan halka gulaabi text (#ffd9d9) tha - wo dark call screen par
   * theek dikhta tha. Screen light hone ke baad wo apne hi halke gulaabi
   * background mein ghul gaya aur warning padhi hi nahi ja rahi thi. Ek
   * warning jo dikhe hi nahi, us ka na hona aur hona barabar hai - isliye ab
   * background halka aur text gehra hai, aur dono ke beech achha antar hai.
   *
   * backdrop-filter bhi hata diya: solid background par uska koi kaam nahi
   * tha, bas text ko halka dhundhla kar raha tha.
   */
  background: #fdecea;
  border: 1px solid #e3a9a3;
  color: #8c1d18;
  font-weight: 500;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}
.proctor-alert svg { width: 1.2rem; height: 1.2rem; fill: #b3261e; flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .proctor-alert { animation: alertin 0.25s ease-out; }
}
@keyframes alertin {
  from { opacity: 0; transform: translateY(-0.4rem); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 46rem) {
  .proctor-alert {
    top: auto;
    bottom: 5.4rem;
    max-width: calc(100% - 1.5rem);
    font-size: 0.85rem;
  }
  .watch-chip { top: 0.35rem; left: 0.35rem; font-size: 0.55rem; padding: 0.15rem 0.35rem; }
  /* PiP mein "other person" label padhne laayak nahi hota - box hi kaafi hai. */
  .stage .tile.cam-360 { aspect-ratio: auto; }
}

/* =====================================================================
   SIGN IN
   ===================================================================== */

.login-screen { justify-content: flex-start; }
.login-box {
  margin: auto;
  width: 100%;
  max-width: 24rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 14px;
  padding: clamp(1.5rem, 5vw, 2.25rem);
  text-align: center;
}
.login-box h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.5rem;
  margin: 0;
  color: var(--c-text);
}
.login-box .gr-sub { text-align: center; }
.login-box .gr-meta { text-align: center; }

/* Google ka apna button spec: safed background, apna wordmark, apna icon. */
.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}
.google-btn:hover { background: #f5f5f5; }
.google-btn svg { width: 1.15rem; height: 1.15rem; }
.google-btn.disabled { opacity: 0.45; pointer-events: none; }

.login-note {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-align: left;
  font-size: 0.85rem;
  color: var(--c-text-dim);
  background: rgba(217, 59, 59, 0.12);
  border: 1px solid rgba(217, 59, 59, 0.4);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}
.login-note b { color: #8c1d18; }

/* ---- signed-in identity ---- */

.gr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.gr-account {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--c-text-dim);
  min-width: 0;
}
.gr-account img { width: 1.6rem; height: 1.6rem; border-radius: 50%; flex: none; }
.gr-account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-account .gr-link { flex: none; }

.gr-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
}
.gr-identity img { width: 2.4rem; height: 2.4rem; border-radius: 50%; flex: none; }
.gr-identity > div { display: flex; flex-direction: column; min-width: 0; }
.gr-identity b { color: var(--c-text); font-size: 0.95rem; }
.gr-identity .faint {
  color: var(--c-text-dim);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 46rem) {
  .gr-account { font-size: 0.78rem; width: 100%; }
}

/* Sign-in note ke do roop: rukavat (bad) aur intezaar (warn). */
.login-note.warn {
  background: rgba(230, 161, 92, 0.12);
  border-color: rgba(230, 161, 92, 0.4);
}
.login-note.warn b { color: #8a5a12; }
.google-btn:disabled { opacity: 0.5; cursor: default; }
