:root {
  --bg: #0f1419; --panel: #171e26; --panel2: #1f2832; --text: #eef3f8; --muted: #9fb0c0; --line: #2a3542;
  --brand: #ff6a1f; --brand2: #ffa366; --ok: #2ecc71; --warn: #f5b041; --bad: #ff5c5c; --wa: #0b141a; --wa-in: #202c33; --wa-out: #005c4b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Malayalam", sans-serif; }
#app { min-height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; }
.hidden { display: none !important; }
.card { width: 100%; max-width: 720px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; }
.card.center { text-align: center; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 24px; margin: 8px 0 12px; } h3 { font-size: 17px; margin: 18px 0 8px; }
p { margin: 8px 0; } .muted { color: var(--muted); } .small { font-size: 14px; }
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.brand.small { margin: 0; gap: 10px; font-weight: 600; }
.logo { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--brand), #ff3d00); display: grid; place-items: center; font-weight: 800; letter-spacing: 1px; color: #fff; flex: none; }
.brand.small .logo { width: 32px; height: 32px; font-size: 12px; border-radius: 9px; }
.btn { border: 0; border-radius: 12px; padding: 12px 20px; font: inherit; font-weight: 600; cursor: pointer; background: var(--panel2); color: var(--text); transition: transform .08s, opacity .2s; }
.btn:active { transform: scale(.98); } .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; } .btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.big { padding: 16px 28px; font-size: 18px; width: 100%; }
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; } .center-row { justify-content: center; }
.expect ul { padding-left: 20px; margin: 0; } .expect li { margin: 6px 0; color: #d6dee7; }
.status-box { background: var(--panel2); border-radius: 14px; padding: 16px 18px; margin: 14px 0; border-left: 4px solid var(--brand); }
.status-box.ok { border-left-color: var(--ok); } .status-box.warn { border-left-color: var(--warn); } .status-box.bad { border-left-color: var(--bad); }
.slot-day { margin: 14px 0 6px; font-weight: 600; color: var(--brand2); }
.slot-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; font: inherit; font-weight: 600; color: var(--text); }
.slot:hover { border-color: var(--brand); } .slot.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.preview-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 14px; overflow: hidden; margin: 14px 0; }
.preview-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview-wrap.small { margin: 0; border-radius: 12px; }
.meter-row { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.meter { flex: 1; height: 10px; background: var(--panel2); border-radius: 6px; overflow: hidden; }
.meter > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), var(--warn)); transition: width .08s; }
.meter-row.tiny { margin-top: 8px; font-size: 12px; } .meter-row.tiny .meter { height: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-weight: 600; } .check input { width: 20px; height: 20px; margin-top: 3px; }
.spinner { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; margin: 10px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* interview */
#s-interview { flex-direction: column; padding: 0; align-items: stretch; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.progress { flex: 1; height: 6px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--brand); transition: width .6s; }
.timer { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.stage { flex: 1; display: grid; grid-template-columns: 1fr 300px; gap: 20px; padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }
.interviewer { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 20px 12px; }
.avatar { position: relative; width: 120px; height: 120px; border-radius: 50%; background: linear-gradient(135deg, #2f3f52, #1b2531); display: grid; place-items: center; font-size: 46px; font-weight: 700; color: var(--brand2); margin-bottom: 12px; }
.avatar .ring { position: absolute; inset: -8px; border-radius: 50%; border: 3px solid transparent; }
.avatar.speaking .ring { border-color: var(--brand); animation: pulse 1.1s ease-in-out infinite; }
.avatar.listening .ring { border-color: var(--ok); animation: pulse 1.6s ease-in-out infinite; }
.avatar.thinking .ring { border-color: var(--warn); border-style: dashed; animation: spin 2.4s linear infinite; }
.avatar.customer { background: linear-gradient(135deg, #3a2f52, #241b31); color: #d7a3ff; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.08); opacity: .4; } }
.who { color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.pill { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--panel2); font-weight: 700; font-size: 14px; letter-spacing: .3px; margin-bottom: 18px; }
.pill.speaking { background: rgba(255,106,31,.18); color: var(--brand2); } .pill.listening { background: rgba(46,204,113,.18); color: var(--ok); } .pill.thinking { background: rgba(245,176,65,.18); color: var(--warn); }
.caption { font-size: clamp(19px, 2.3vw, 26px); line-height: 1.45; max-width: 760px; min-height: 60px; white-space: pre-line; }
.heard { margin-top: 16px; font-size: 15px; color: var(--muted); background: var(--panel2); border-radius: 10px; padding: 8px 14px; max-width: 700px; }
.answer-timer { margin-top: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.me .hint { margin-top: 12px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.me .save { margin-top: 6px; font-size: 12px; color: var(--muted); min-height: 16px; }
.bigcheck { width: 80px; height: 80px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 44px; display: grid; place-items: center; margin: 10px auto 16px; }

/* chat */
.chat { position: fixed; inset: 64px 0 0 0; max-width: 560px; margin: 0 auto; background: var(--wa); display: flex; flex-direction: column; border-left: 1px solid var(--line); border-right: 1px solid var(--line); z-index: 20; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--wa-in); border-bottom: 1px solid #111b21; }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: #6b4fbb; display: grid; place-items: center; font-weight: 700; }
.chat-name { font-weight: 700; } .chat-sub { font-size: 12px; color: #8696a0; } .chat-count { margin-left: auto; font-size: 12px; color: #8696a0; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='1' fill='%23233138'/%3E%3C/svg%3E"); }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 10px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; position: relative; }
.bubble.in { background: var(--wa-in); align-self: flex-start; border-top-left-radius: 2px; }
.bubble.out { background: var(--wa-out); align-self: flex-end; border-top-right-radius: 2px; }
.bubble .time { display: block; font-size: 11px; color: #8696a0; text-align: right; margin-top: 2px; }
.bubble.typing { color: #8696a0; font-style: italic; }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; background: var(--wa-in); border-top: 1px solid #111b21; }
.chat-input textarea { flex: 1; resize: none; border: 0; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 15px; background: #2a3942; color: var(--text); }
@media (max-width: 860px) {
  .stage { grid-template-columns: 1fr; padding: 16px; align-content: start; gap: 12px; }
  .me { order: -1; display: grid; grid-template-columns: 84px 1fr; grid-template-rows: auto auto auto; column-gap: 12px; align-items: center; }
  .me .preview-wrap.small { aspect-ratio: 3/4; grid-row: 1 / span 3; }
  .me .meter-row.tiny { margin-top: 0; }
  .me .hint { margin-top: 4px; font-size: 12px; }
  .me .save { margin-top: 0; }
  .interviewer { padding: 8px 4px; }
  .avatar { width: 84px; height: 84px; font-size: 34px; margin-bottom: 8px; }
  .pill { margin-bottom: 12px; }
  .caption { font-size: 19px; }
  .chat { inset: 56px 0 0 0; }
  .card { padding: 20px; }
}

body.chat-open .interviewer { visibility: hidden; }
@media (min-width: 861px) { body.chat-open .chat { left: 24px; right: auto; margin: 0; width: calc(100% - 372px); max-width: 640px; } }
