:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #101827;
  --muted: #667085;
  --border: #e6e9f0;
  --primary: #111827;
  --primary-soft: #eef2ff;
  --danger: #dc2626;
  --warning: #b45309;
  --success: #16a34a;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  --radius: 24px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.14), transparent 32%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.10), transparent 28%),
    var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

.page { min-height: 100vh; padding: 28px; }
.shell { max-width: 1180px; margin: 0 auto; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -0.03em; }
.brand-mark { width: 40px; height: 40px; border-radius: 14px; background: linear-gradient(135deg, #111827, #4f46e5); box-shadow: 0 12px 30px rgba(79, 70, 229, 0.28); }
.topbar-pill { padding: 9px 14px; border: 1px solid var(--border); border-radius: 999px; background: rgba(255,255,255,.74); color: var(--muted); font-size: 13px; backdrop-filter: blur(10px); }

.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 28px; align-items: stretch; }
.hero-card, .setup-card, .interview-card, .feedback-card, .proctoring-card, .camera-card {
  background: rgba(255,255,255,.9); border: 1px solid rgba(230,233,240,.9); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.hero-card { padding: 42px; position: relative; overflow: hidden; }
.hero-card::after { content: ""; position: absolute; width: 220px; height: 220px; right: -80px; bottom: -80px; border-radius: 999px; background: radial-gradient(circle, rgba(79,70,229,.18), transparent 68%); pointer-events: none; }
.eyebrow, .section-label { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border-radius: 999px; background: var(--primary-soft); color: #4338ca; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
h1 { margin: 20px 0 14px; font-size: clamp(38px, 5vw, 64px); line-height: .95; letter-spacing: -.06em; }
.hero-copy { max-width: 680px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.feature-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 30px; }
.feature { padding: 16px; border-radius: 18px; background: #f8fafc; border: 1px solid #eef2f7; }
.feature strong { display: block; font-size: 14px; margin-bottom: 6px; }
.feature span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.setup-card { padding: 28px; }
.setup-card h2, .interview-card h2, .feedback-card h2, .proctoring-card h3 { margin: 14px 0 8px; letter-spacing: -.03em; }
.muted { color: var(--muted); line-height: 1.55; }
.form-grid { display: grid; gap: 14px; margin-top: 22px; }
label { display: block; margin-bottom: 7px; color: #344054; font-size: 13px; font-weight: 700; }
input { width: 100%; border: 1px solid var(--border); border-radius: 15px; padding: 14px 15px; font-size: 15px; outline: none; background: #fff; transition: border .18s ease, box-shadow .18s ease; }
input:focus { border-color: #6366f1; box-shadow: 0 0 0 4px rgba(99,102,241,.12); }
.button-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
button { border: 0; border-radius: 999px; padding: 13px 18px; cursor: pointer; font-weight: 800; font-size: 14px; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.primary { background: var(--primary); color: #fff; box-shadow: 0 14px 28px rgba(17,24,39,.16); }
.primary:hover { background: #374151; }
.secondary { background: #eef2f7; color: #111827; }
.danger { background: #fee2e2; color: #991b1b; }
.danger:hover { background: #fecaca; }
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.check-card { padding: 14px; border-radius: 18px; background: #f8fafc; border: 1px solid #eef2f7; }
.check-card strong { display: block; margin-bottom: 6px; }
.check-card span { color: var(--muted); font-size: 13px; }
.interview-layout { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; align-items: stretch; }
.interview-card { padding: 26px; }
.interview-stage { min-height: 560px; border-radius: 28px; background: linear-gradient(145deg, rgba(17,24,39,.94), rgba(31,41,55,.92)), radial-gradient(circle at top, rgba(99,102,241,.28), transparent 40%); color: white; padding: 24px; display: grid; grid-template-rows: auto 1fr auto; position: relative; overflow: hidden; }
.stage-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: relative; z-index: 2; }
.stage-top-left, .stage-top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stage-top-right { justify-content: flex-end; text-align: right; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; background: rgba(255,255,255,.10); padding: 8px 12px; font-size: 13px; color: rgba(255,255,255,.86); }
.live-dot { width: 8px; height: 8px; border-radius: 999px; background: #22c55e; box-shadow: 0 0 0 6px rgba(34,197,94,.14); }
.timer-pill { display: inline-flex; align-items: center; justify-content: center; padding: 8px 13px; border-radius: 999px; background: rgba(238,242,255,.16); color: rgba(255,255,255,.94); font-size: 13px; font-weight: 800; border: 1px solid rgba(199,210,254,.26); white-space: nowrap; }
.timer-pill.warning { background: rgba(251,146,60,.18); color: #fed7aa; border-color: rgba(253,186,116,.38); }
.timer-pill.ended { background: rgba(239,68,68,.18); color: #fecaca; border-color: rgba(252,165,165,.38); }
.status-main { font-size: 13px; font-weight: 800; color: rgba(255,255,255,.9); }
.status-sub { display: none; }
.interviewer-area { display: flex; align-items: center; justify-content: center; position: relative; z-index: 2; min-height: 340px; }
.avatar-wrap { width: 210px; height: 240px; position: relative; filter: drop-shadow(0 24px 46px rgba(0,0,0,.28)); transform-origin: center; }
.avatar-wrap::before { content: ""; position: absolute; inset: -24px; border-radius: 999px; background: radial-gradient(circle, rgba(99,102,241,.30), transparent 68%); opacity: .8; z-index: 0; }
.avatar-svg { position: relative; z-index: 2; width: 100%; height: 100%; }
.avatar-mouth { transform-origin: center; }
.avatar-wrap.speaking .avatar-mouth { animation: mouthTalk .34s infinite alternate ease-in-out; }
.avatar-wrap.speaking { animation: avatarPulse 1.2s infinite ease-in-out; }
.avatar-wrap.listening { animation: avatarListen 1.4s infinite ease-in-out; }
.avatar-wrap.thinking { animation: avatarThink 1.8s infinite ease-in-out; }
@keyframes mouthTalk { 0%{transform:scaleY(.55)} 100%{transform:scaleY(1.35)} }
@keyframes avatarPulse { 0%{transform:scale(1)} 50%{transform:scale(1.035)} 100%{transform:scale(1)} }
@keyframes avatarListen { 0%{transform:scale(1);opacity:.94} 50%{transform:scale(1.018);opacity:1} 100%{transform:scale(1);opacity:.94} }
@keyframes avatarThink { 0%{transform:translateY(0)} 50%{transform:translateY(-5px)} 100%{transform:translateY(0)} }
.stage-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; position: relative; z-index: 2; }
.attention-indicator { margin-top: 14px; padding: 16px 18px; border-radius: 16px; font-weight: 900; font-size: 16px; text-align: center; border: 2px solid #e6e9f0; background: #f8fafc; color: var(--muted); transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06); letter-spacing: -0.01em; }
.attention-indicator[data-state="looking_at_screen"] { background: #ecfdf5; border-color: #34d399; color: #047857; }
.attention-indicator[data-state="looking_side_right"], .attention-indicator[data-state="looking_side_left"], .attention-indicator[data-state="looking_up"], .attention-indicator[data-state="looking_down"], .attention-indicator[data-state="head_tilted_right"], .attention-indicator[data-state="head_tilted_left"] { background: #fffbeb; border-color: #f59e0b; color: #92400e; animation: attentionAlert 0.9s infinite ease-in-out; }
.attention-indicator[data-state="no_face"], .attention-indicator[data-state="multiple_faces"] { background: #fef2f2; border-color: #dc2626; color: #991b1b; animation: attentionAlert 0.7s infinite ease-in-out; }
@keyframes attentionAlert { 0%, 100% { transform: scale(1); box-shadow: 0 4px 14px rgba(220, 38, 38, 0.15); } 50% { transform: scale(1.03); box-shadow: 0 6px 22px rgba(220, 38, 38, 0.35); } }
.mic-status { display: inline-flex; align-items: center; gap: 10px; margin: 0 auto 14px; padding: 10px 18px; border-radius: 999px; background: #f8fafc; border: 1px solid #e6e9f0; color: var(--muted); font-weight: 800; font-size: 13.5px; position: relative; z-index: 2; }
.mic-status::before { content: ""; width: 10px; height: 10px; border-radius: 999px; background: #94a3b8; }
.mic-status[data-state="listening"] { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.mic-status[data-state="listening"]::before { background: #10b981; animation: micPulse 1.4s infinite ease-in-out; }
.mic-status[data-state="recording"] { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.mic-status[data-state="recording"]::before { background: #dc2626; animation: micPulse 0.9s infinite ease-in-out; }
.mic-status[data-state="ai_speaking"] { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.mic-status[data-state="ai_speaking"]::before { background: #4f46e5; animation: micPulse 1.2s infinite ease-in-out; }
.mic-status[data-state="thinking"] { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.mic-status[data-state="thinking"]::before { background: #f59e0b; animation: micPulse 0.7s infinite ease-in-out; }
@keyframes micPulse { 0%, 100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.4); opacity: 1; } }
.side-panel { display: grid; gap: 20px; }
.camera-card, .proctoring-card { padding: 20px; }
.camera-frame { margin-top: 14px; border-radius: 20px; overflow: hidden; background: #0f172a; aspect-ratio: 4/3; border: 1px solid rgba(255,255,255,.08); }
#cameraPreview, #systemCameraPreview { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.proctoring-warning { margin-bottom: 14px; padding: 13px 15px; border-radius: 16px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-weight: 800; line-height: 1.45; }
.proctoring-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 16px 0; }
.proctoring-metrics > div { padding: 12px; border-radius: 16px; background: #f8fafc; border: 1px solid #eef2f7; text-align: center; }
.proctoring-metrics strong { display: block; font-size: 22px; margin-bottom: 3px; }
.proctoring-metrics span { font-size: 12px; color: var(--muted); }
.proctoring-event-list { display: grid; gap: 10px; max-height: 230px; overflow: auto; padding-right: 4px; }
.proctoring-event { padding: 11px; border-radius: 14px; border: 1px solid #eef2f7; background: #f8fafc; }
.proctoring-event.warning { background: #fff7ed; border-color: #fed7aa; }
.proctoring-event.error { background: #fef2f2; border-color: #fecaca; }
.proctoring-event-title { font-weight: 800; font-size: 12px; margin-bottom: 5px; }
.proctoring-event-message, .proctoring-event-time, .proctoring-empty { color: var(--muted); font-size: 12px; line-height: 1.45; }
.feedback-card { margin-top: 22px; padding: 26px; }
#finalFeedback { margin: 18px 0 0; white-space: pre-wrap; background: #f8fafc; border: 1px solid #eef2f7; border-radius: 18px; padding: 18px; line-height: 1.65; max-height: 620px; overflow: auto; font-size: 14px; }
#events { display: none; }
@media (max-width: 980px) { .hero, .interview-layout { grid-template-columns: 1fr; } .feature-row, .check-grid { grid-template-columns: 1fr; } .page { padding: 18px; } .hero-card { padding: 28px; } .stage-top { align-items:flex-start; flex-direction:column; } .stage-top-right { justify-content:flex-start; text-align:left; } }
