/* ============================================================
   JARVIS ROBOT — LOOI-style face
   ============================================================ */

:root {
  --bg:            #060609;
  --face-bg:       #0b0f18;
  --face-border:   rgba(0, 200, 230, 0.12);
  --eye-color:     #00dcf0;
  --eye-glow-a:    rgba(0, 220, 240, 0.70);
  --eye-glow-b:    rgba(0, 220, 240, 0.25);
  --lid-color:     #0b0f18;
  --mouth-color:   #00dcf0;
  --accent:        #00dcf0;
  --text-user:     #7dd3fc;
  --text-bot:      #e2e8f0;
  --text-system:   #94a3b8;
  --modal-bg:      #111827;
  --modal-border:  rgba(0,200,230,0.18);
  --input-bg:      #1a2235;
  --transition:    0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: #e2e8f0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
}

/* ============================================================
   USER SELECTOR MODAL
   ============================================================ */
.user-selector-modal {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0a0e1a 0%, #060609 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.user-selector-modal.hidden {
  display: none;
}

.user-selector-container {
  background: rgba(15, 23, 42, 0.9);
  border: 2px solid rgba(0, 220, 240, 0.25);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
}

.user-selector-container h1 {
  color: rgba(0, 220, 240, 0.95);
  margin-bottom: 10px;
  font-size: 32px;
  font-weight: 600;
}

.user-selector-subtitle {
  color: rgba(148, 163, 184, 0.7);
  font-size: 14px;
  margin-bottom: 30px;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px;
}

.user-list::-webkit-scrollbar {
  width: 6px;
}

.user-list::-webkit-scrollbar-track {
  background: rgba(0, 220, 240, 0.05);
  border-radius: 3px;
}

.user-list::-webkit-scrollbar-thumb {
  background: rgba(0, 220, 240, 0.3);
  border-radius: 3px;
}

.user-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 220, 240, 0.5);
}

.user-btn {
  background: rgba(0, 200, 230, 0.08);
  border: 2px solid rgba(0, 200, 230, 0.2);
  color: rgba(0, 220, 240, 0.85);
  padding: 14px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s var(--transition);
  text-align: left;
}

.user-btn:hover {
  background: rgba(0, 200, 230, 0.15);
  border-color: rgba(0, 220, 240, 0.5);
  color: rgba(0, 220, 240, 0.95);
  transform: translateX(4px);
}

.user-btn.active {
  background: rgba(0, 200, 230, 0.25);
  border-color: rgba(0, 220, 240, 0.7);
  color: #00dcf0;
}

.loading {
  color: rgba(148, 163, 184, 0.5);
  font-size: 14px;
  padding: 20px;
}

.user-divider {
  color: rgba(148, 163, 184, 0.4);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  margin: 20px 0;
}

.user-input-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.user-input {
  padding: 14px 16px;
  border: 2px solid rgba(0, 200, 230, 0.2);
  border-radius: 10px;
  background: rgba(26, 34, 53, 0.6);
  color: rgba(0, 220, 240, 0.9);
  font-size: 16px;
  transition: all 0.3s var(--transition);
  font-family: inherit;
}

.user-input:focus {
  outline: none;
  border-color: rgba(0, 220, 240, 0.6);
  background: rgba(26, 34, 53, 0.8);
  box-shadow: 0 0 20px rgba(0, 220, 240, 0.1);
}

.user-input::placeholder {
  color: rgba(148, 163, 184, 0.4);
}

.create-user-btn {
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(0, 220, 240, 0.2), rgba(0, 200, 230, 0.1));
  border: 2px solid rgba(0, 220, 240, 0.4);
  color: rgba(0, 220, 240, 0.95);
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s var(--transition);
  font-family: inherit;
}

.create-user-btn:hover {
  background: linear-gradient(135deg, rgba(0, 220, 240, 0.3), rgba(0, 200, 230, 0.2));
  border-color: rgba(0, 220, 240, 0.7);
  transform: translateY(-2px);
}

.create-user-btn:active {
  transform: translateY(0);
}

.switch-user-btn {
  padding: 10px 16px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: rgba(148, 163, 184, 0.6);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s var(--transition);
}

.switch-user-btn:not(.hidden):hover {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.4);
  color: rgba(148, 163, 184, 0.8);
}

.switch-user-btn.hidden {
  display: none;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  position: relative;
}

#app.app-hidden {
  display: none;
}

/* ---- History, New Chat, and Settings buttons ---- */
.history-btn, .new-chat-btn, .settings-btn {
  position: fixed;
  top: 18px;
  background: rgba(0,200,230,0.08);
  border: 1px solid rgba(0,200,230,0.2);
  border-radius: 10px;
  color: rgba(0,200,230,0.7);
  padding: 8px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  z-index: 50;
  display: flex;
  align-items: center;
}
.history-btn {
  right: 120px;
}
.new-chat-btn {
  right: 70px;
}
.settings-btn {
  right: 20px;
}
.history-btn:hover, .new-chat-btn:hover, .settings-btn:hover {
  background: rgba(0,200,230,0.18);
  color: var(--accent);
}

/* ---- Scene wrapper ---- */
#scene {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ================================================================
   ROBOT FACE
   ================================================================ */
.robot-face {
  width: 380px;
  height: 290px;
  background: var(--face-bg);
  border: 1px solid var(--face-border);
  border-radius: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow:
    0 0 40px rgba(0, 180, 210, 0.08),
    0 0 1px rgba(0,200,230,0.3) inset;
  transition: box-shadow var(--transition);
}

/* top status bar */
.robot-top-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-light {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #334155;
  transition: background var(--transition), box-shadow var(--transition);
}
.status-light.active {
  background: var(--eye-color);
  box-shadow: 0 0 6px var(--eye-color), 0 0 12px var(--eye-glow-a);
}
.status-light.thinking {
  background: #8b5cf6;
  box-shadow: 0 0 6px #8b5cf6;
  animation: pulse-status 0.8s ease-in-out infinite alternate;
}
.status-light.talking {
  background: #22d3ee;
  box-shadow: 0 0 6px #22d3ee;
  animation: pulse-status 0.3s ease-in-out infinite alternate;
}

@keyframes pulse-status {
  from { opacity: 0.6; }
  to   { opacity: 1; }
}

.status-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(148,163,184,0.6);
  font-family: monospace;
  font-weight: 600;
  transition: all var(--transition);
}

.status-label.active {
  color: var(--eye-color);
  font-weight: 700;
  animation: pulse-label 1s ease-in-out infinite;
}

.status-label.thinking {
  color: #8b5cf6;
}

.status-label.talking {
  color: #22d3ee;
}

@keyframes pulse-label {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ================================================================
   EYES ROW
   ================================================================ */
.eyes-row {
  display: flex;
  gap: 56px;
  align-items: center;
  margin-top: 10px;
}

/* Eye pod — holds glow filter */
.eye-pod {
  filter:
    drop-shadow(0 0 8px var(--eye-color))
    drop-shadow(0 0 18px var(--eye-glow-a))
    drop-shadow(0 0 38px var(--eye-glow-b));
  transition:
    filter var(--transition),
    transform var(--transition);
}

/* Eye wrapper — oval clip boundary */
.eye-wrapper {
  width: 88px;
  height: 98px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  transition: width var(--transition), height var(--transition), transform var(--transition);
}

/* Eye background fill */
.eye-bg {
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 40% 38%, #b4f0fb 0%, var(--eye-color) 30%, #008099 80%, #003344 100%);
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Iris */
.iris {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #005577 0%, #002233 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition);
}

/* Pupil */
.pupil {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #000;
  position: relative;
}
.highlight {
  position: absolute;
  top: 3px;
  left: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
}

/* Eyelids */
.eyelid {
  position: absolute;
  left: 0;
  width: 100%;
  background: var(--lid-color);
  z-index: 10;
  transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.eyelid-top    { top: 0;    height: 0; }
.eyelid-bottom { bottom: 0; height: 0; }

/* ================================================================
   EMOTION STATES — applied to #robot-face
   ================================================================ */

/* NEUTRAL (default) — already set by :root vars */

/* HAPPY */
.emotion-happy {
  --eye-color:   #00ff8c;
  --eye-glow-a:  rgba(0,255,140,0.65);
  --eye-glow-b:  rgba(0,255,140,0.20);
  --mouth-color: #00ff8c;
}
.emotion-happy .eyelid-bottom { height: 38%; }

/* ANGRY */
.emotion-angry {
  --eye-color:   #ff3b3b;
  --eye-glow-a:  rgba(255,59,59,0.65);
  --eye-glow-b:  rgba(255,59,59,0.20);
  --mouth-color: #ff3b3b;
}
.emotion-angry .eyelid-top { height: 34%; }
.emotion-angry .eye-pod:first-child .eye-wrapper { transform: rotate(12deg);  }
.emotion-angry .eye-pod:last-child  .eye-wrapper { transform: rotate(-12deg); }

/* CURIOUS */
.emotion-curious {
  --eye-color:   #ffb300;
  --eye-glow-a:  rgba(255,179,0,0.65);
  --eye-glow-b:  rgba(255,179,0,0.20);
  --mouth-color: #ffb300;
}
.emotion-curious .eye-pod:first-child .eye-wrapper { transform: scale(1.14) rotate(-5deg); }
.emotion-curious .eye-pod:last-child  .eye-wrapper { transform: scale(0.88); }
.emotion-curious .iris { animation: look-side 2.8s ease-in-out infinite; }

/* EMBARRASSED */
.emotion-embarrassed {
  --eye-color:   #f472b6;
  --eye-glow-a:  rgba(244,114,182,0.65);
  --eye-glow-b:  rgba(244,114,182,0.20);
  --mouth-color: #f472b6;
}
.emotion-embarrassed .eyelid-top    { height: 22%; }
.emotion-embarrassed .eyelid-bottom { height: 22%; }
.emotion-embarrassed .iris { transform: translateY(10px); }

/* SURPRISED */
.emotion-surprised {
  --eye-color:   #e0f2fe;
  --eye-glow-a:  rgba(255,255,255,0.80);
  --eye-glow-b:  rgba(0,200,255,0.35);
  --mouth-color: #e0f2fe;
}
.emotion-surprised .eye-wrapper { transform: scale(1.18); }

/* THINKING */
.emotion-thinking {
  --eye-color:   #a78bfa;
  --eye-glow-a:  rgba(167,139,250,0.65);
  --eye-glow-b:  rgba(167,139,250,0.20);
  --mouth-color: #a78bfa;
}
.emotion-thinking .iris { animation: think-lr 2.2s ease-in-out infinite; }

/* LISTENING */
.emotion-listening .eye-pod {
  animation: breathe 1.8s ease-in-out infinite;
}

/* TALKING */
.emotion-talking .eye-pod {
  animation: talk-pulse 0.35s ease-in-out infinite alternate;
}

/* SLEEPING */
.emotion-sleeping {
  --eye-color:   #0e3a4a;
  --eye-glow-a:  rgba(0,68,102,0.15);
  --eye-glow-b:  rgba(0,68,102,0.05);
}
.emotion-sleeping .eyelid-top    { height: 52%; }
.emotion-sleeping .eyelid-bottom { height: 52%; }
.emotion-sleeping .eye-pod { filter: drop-shadow(0 0 3px rgba(0,68,102,0.3)); }

/* BLINKING — brief class added by JS */
.blinking .eyelid-top,
.blinking .eyelid-bottom {
  height: 56% !important;
  transition: height 0.08s ease-in !important;
}

/* ================================================================
   KEYFRAMES
   ================================================================ */
@keyframes think-lr {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-14px); }
  75%       { transform: translateX(14px); }
}

@keyframes look-side {
  0%, 100% { transform: translateX(0); }
  40%       { transform: translateX(-8px); }
  80%       { transform: translateX(4px); }
}

@keyframes breathe {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%       { opacity: 0.82; transform: scale(0.96); }
}

@keyframes talk-pulse {
  from { transform: scaleY(1);    }
  to   { transform: scaleY(1.05); }
}

/* ================================================================
   MOUTH SVG
   ================================================================ */
.mouth-area {
  margin-top: 22px;
}
.mouth-svg {
  width: 80px;
  height: 36px;
  overflow: visible;
}
#mouth-path, #fp-mouth-path {
  stroke: var(--mouth-color, var(--eye-color));
  transition: stroke var(--transition);
}

/* ================================================================
   FLOATERS
   ================================================================ */
#floaters {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
}
.floater {
  position: absolute;
  font-size: 2.2rem;
  animation: float-up 2.6s ease-out forwards;
  pointer-events: none;
  line-height: 1;
}
@keyframes float-up {
  0%   { opacity: 1;   transform: translateY(0)     scale(0.7); }
  30%  { opacity: 1;   transform: translateY(-40px) scale(1.1); }
  100% { opacity: 0;   transform: translateY(-140px) scale(0.9); }
}

/* ================================================================
   SUBTITLES
   ================================================================ */
.subtitles {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, 90vw);
  text-align: center;
  pointer-events: none;
}
.subtitle-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.subtitle-line {
  font-size: 15px;
  line-height: 1.5;
  padding: 4px 14px;
  border-radius: 8px;
  animation: sub-in 0.25s ease-out;
  white-space: pre-wrap;
  word-break: break-word;
}
.subtitle-line.user {
  color: var(--text-user);
  background: rgba(125, 211, 252, 0.08);
}
.subtitle-line.bot {
  color: var(--text-bot);
  background: rgba(226, 232, 240, 0.06);
}
.subtitle-line.system {
  color: var(--text-system);
  font-style: italic;
  font-size: 13px;
}
.subtitle-line.interim {
  color: rgba(125,211,252,0.5);
  font-style: italic;
}
@keyframes sub-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   CONTROLS
   ================================================================ */
.controls {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  align-items: center;
}
.mic-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(0,200,230,0.3);
  background: rgba(0,200,230,0.08);
  color: rgba(0,200,230,0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  position: relative;
}
.mic-btn:hover {
  background: rgba(0,200,230,0.16);
  border-color: var(--accent);
  color: var(--accent);
}
.mic-btn.active {
  background: rgba(0,200,230,0.18);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0,200,230,0.12), 0 0 20px rgba(0,200,230,0.2);
  animation: mic-ring 1.8s ease-in-out infinite;
}
.mic-btn.muted {
  color: rgba(148,163,184,0.5);
  border-color: rgba(148,163,184,0.2);
}
@keyframes mic-ring {
  0%, 100% { box-shadow: 0 0 0 4px rgba(0,200,230,0.12); }
  50%       { box-shadow: 0 0 0 8px rgba(0,200,230,0.06); }
}

.camera-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(0,200,230,0.3);
  background: rgba(0,200,230,0.08);
  color: rgba(0,200,230,0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.camera-btn:hover {
  background: rgba(0,200,230,0.16);
  border-color: var(--accent);
  color: var(--accent);
}
.camera-btn.with-image {
  background: rgba(76,175,80,0.18);
  border-color: rgba(76,175,80,0.6);
  color: rgba(76,175,80,0.9);
}

/* ================================================================
   SETTINGS MODAL
   ================================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  border-radius: 20px;
  width: min(480px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.history-modal-content {
  width: min(560px, 92vw);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0,200,230,0.1);
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.close-btn {
  background: none;
  border: none;
  color: rgba(148,163,184,0.7);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}
.close-btn:hover { color: #e2e8f0; }

.modal-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.setting-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148,163,184,0.8);
}
.setting-select, .setting-input {
  background: var(--input-bg);
  border: 1px solid rgba(0,200,230,0.15);
  border-radius: 10px;
  color: #e2e8f0;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.setting-select:focus, .setting-input:focus {
  border-color: rgba(0,200,230,0.45);
}
.setting-select option { background: #111827; }

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #e2e8f0;
  cursor: pointer;
  font-weight: normal !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}
.radio-label input[type="radio"] {
  accent-color: var(--accent);
}

.range-input {
  accent-color: var(--accent);
  width: 100%;
}

.voice-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.voice-row .setting-select {
  flex: 1;
}
.preview-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(0,200,230,0.25);
  background: rgba(0,200,230,0.08);
  color: rgba(0,200,230,0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.preview-btn:hover {
  background: rgba(0,200,230,0.18);
  border-color: var(--accent);
  color: var(--accent);
}
.preview-btn.playing {
  background: rgba(0,200,230,0.22);
  border-color: var(--accent);
  color: var(--accent);
  animation: mic-ring 0.8s ease-in-out infinite;
}

.memory-add-row {
  display: flex;
  gap: 8px;
}
.memory-add-row .setting-input {
  flex: 1;
}
.memory-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}
.memory-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid rgba(0,200,230,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}
.memory-text {
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}
.memory-meta {
  margin-top: 4px;
  color: rgba(148,163,184,0.65);
  font-size: 11px;
}
.memory-actions {
  display: flex;
  gap: 6px;
}
.memory-action-btn {
  border: 1px solid rgba(0,200,230,0.25);
  border-radius: 8px;
  background: rgba(0,200,230,0.08);
  color: rgba(0,220,240,0.9);
  cursor: pointer;
  font-size: 12px;
  padding: 8px 10px;
}
.memory-action-btn:hover {
  background: rgba(0,200,230,0.16);
  border-color: rgba(0,220,240,0.5);
}
.memory-action-btn.danger {
  border-color: rgba(255,107,107,0.35);
  color: #ff8a8a;
  background: rgba(255,107,107,0.08);
}
.memory-empty {
  color: rgba(148,163,184,0.6);
  font-size: 13px;
  padding: 10px;
}

/* ================================================================
   SETTINGS FACE PREVIEW
   ================================================================ */
.face-preview-wrap {
  display: flex;
  justify-content: center;
  height: 128px;       /* 290px * 0.44 */
  overflow: hidden;
  margin-bottom: 10px;
}
.robot-face--mini {
  transform: scale(0.44);
  transform-origin: top center;
  flex-shrink: 0;
  pointer-events: none;
  /* hide top bar and scanline */
}
.robot-face--mini .robot-top-bar { display: none; }
.robot-face--mini::after         { display: none; }

/* ================================================================
   EMOTION PICKER
   ================================================================ */
.emotion-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.emo-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(0,200,230,0.15);
  background: rgba(255,255,255,0.03);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, border-color 0.18s, transform 0.12s;
  line-height: 1;
}
.emo-btn:hover {
  background: rgba(0,200,230,0.12);
  border-color: rgba(0,200,230,0.4);
  transform: scale(1.12);
}
.emo-btn.active {
  background: rgba(0,200,230,0.18);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(0,200,230,0.3);
  transform: scale(1.1);
}

/* ================================================================
   LOONA THEME — SVG morphing cartoon eyes
   ================================================================ */

/* Hide/show the right eye set per theme */
.loona-eyes                { display: none; }
.theme-loona .loona-eyes   { display: flex; gap: 56px; align-items: center; margin-top: 10px; }
.theme-loona #jarvis-eyes,
.theme-loona #jarvis-eyes-p { display: none; }

/* Loona eye SVG sizing — matches Jarvis eye-wrapper */
.loona-eye-svg {
  width: 88px;
  height: 98px;
  overflow: visible;
  filter:
    drop-shadow(0 0 10px rgba(66,165,245,0.55))
    drop-shadow(0 0 28px rgba(66,165,245,0.22));
  transition: filter 0.4s ease;
}

/* SVG path `d` morphing — same number of commands = smooth interpolation */
#lsl-L, #lsl-R, #lol-L, #lol-R,
#lsl-pL, #lsl-pR, #lol-pL, #lol-pR {
  transition: d 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Iris circle transition for gaze */
#lil-L, #lil-R, #lil-pL, #lil-pR {
  transition: cx 0.15s ease, cy 0.15s ease, fill 0.38s ease, r 0.38s ease;
}

/* Pupil radius transition */
#lpl-L, #lpl-R {
  transition: r 0.38s ease;
}

/* Talking bounce on SVG eyes */
.theme-loona .emotion-talking .loona-eye-svg {
  animation: talk-pulse 0.35s ease-in-out infinite alternate;
}

/* Face border / bg tweak for Loona */
.theme-loona .robot-face {
  border-color: rgba(66,165,245,0.14);
  box-shadow: 0 0 40px rgba(66,130,210,0.08), 0 0 1px rgba(66,165,245,0.25) inset;
}

/* ================================================================
   HISTORY LIST
   ================================================================ */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  padding: 12px 14px;
  background: rgba(0,200,230,0.05);
  border: 1px solid rgba(0,200,230,0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.history-item:hover {
  background: rgba(0,200,230,0.12);
  border-color: rgba(0,200,230,0.35);
}
.history-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-date {
  font-size: 11px;
  color: rgba(148,163,184,0.6);
}
.history-item-preview {
  font-size: 12px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.history-action-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid rgba(0,200,230,0.2);
  background: rgba(0,200,230,0.08);
  color: rgba(0,200,230,0.8);
  cursor: pointer;
  transition: all 0.2s;
}
.history-action-btn:hover {
  background: rgba(0,200,230,0.16);
  border-color: var(--accent);
  color: var(--accent);
}
.history-action-btn.delete:hover {
  background: rgba(255,59,59,0.16);
  border-color: #ff3b3b;
  color: #ff3b3b;
}
.history-empty {
  text-align: center;
  padding: 32px 20px;
  color: rgba(148,163,184,0.5);
  font-size: 14px;
}

/* ================================================================
   UTILITIES
   ================================================================ */
.hidden { display: none !important; }

/* Subtle scanline overlay */
.robot-face::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 32px;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.04) 3px,
    rgba(0,0,0,0.04) 4px
  );
  pointer-events: none;
}

/* Debug Console */
.debug-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(0, 200, 230, 0.2);
  border: 1px solid rgba(0, 200, 230, 0.4);
  color: #00dcf0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.debug-toggle:active {
  transform: scale(0.95);
  background: rgba(0, 200, 230, 0.4);
}

.debug-console {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 320px;
  max-height: 400px;
  background: #111827;
  border: 1px solid rgba(0, 200, 230, 0.3);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  z-index: 9998;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.debug-console.hidden {
  display: none;
}

.debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 200, 230, 0.2);
  font-size: 12px;
  font-weight: 600;
  color: #00dcf0;
  background: rgba(0, 200, 230, 0.05);
}
.debug-close {
  background: none;
  border: none;
  color: #00dcf0;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.debug-logs {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #cbd5e1;
}
.debug-logs::-webkit-scrollbar {
  width: 6px;
}
.debug-logs::-webkit-scrollbar-track {
  background: rgba(0, 200, 230, 0.05);
}
.debug-logs::-webkit-scrollbar-thumb {
  background: rgba(0, 200, 230, 0.3);
  border-radius: 3px;
}

.debug-log-entry {
  margin: 2px 0;
  padding: 4px;
  border-left: 2px solid rgba(0, 200, 230, 0.2);
  padding-left: 6px;
}
.debug-log-entry.error {
  color: #ff6b6b;
  border-left-color: #ff6b6b;
}
.debug-log-entry.warn {
  color: #ffa94d;
  border-left-color: #ffa94d;
}
.debug-log-entry.info {
  color: #74c0fc;
  border-left-color: #74c0fc;
}

/* ============================================================
   SEARCHABLE DROPDOWN
============================================================ */
.searchable-select-container {
  position: relative;
  margin-bottom: 12px;
}

.searchable-select-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(0, 200, 230, 0.25);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  font-size: 14px;
  transition: all 0.2s;
}

.searchable-select-input:hover {
  border-color: rgba(0, 200, 230, 0.4);
}

.searchable-select-input:focus {
  outline: none;
  border-color: rgba(0, 200, 230, 0.6);
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 2px rgba(0, 200, 230, 0.1);
}

.searchable-select-input::placeholder {
  color: #64748b;
}

.searchable-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(0, 200, 230, 0.25);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.searchable-select-dropdown.open {
  display: block;
}

.searchable-select-option {
  padding: 10px 12px;
  cursor: pointer;
  color: #cbd5e1;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(0, 200, 230, 0.1);
}

.searchable-select-option:last-child {
  border-bottom: none;
}

.searchable-select-option:hover {
  background: rgba(0, 200, 230, 0.15);
  color: #00dcf0;
}

.searchable-select-option.hidden {
  display: none;
}

.searchable-select-option.selected {
  background: rgba(0, 200, 230, 0.25);
  color: #00dcf0;
  font-weight: 500;
}

.searchable-select-dropdown::-webkit-scrollbar {
  width: 6px;
}

.searchable-select-dropdown::-webkit-scrollbar-track {
  background: rgba(0, 200, 230, 0.05);
}

.searchable-select-dropdown::-webkit-scrollbar-thumb {
  background: rgba(0, 200, 230, 0.3);
  border-radius: 3px;
}

/* ============================================================
   WEBCAM MODAL
   ============================================================ */
.webcam-modal-content {
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.webcam-container {
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin: 15px 0;
  position: relative;
  aspect-ratio: 16 / 9;
}

.webcam-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.webcam-canvas {
  display: none;
}

.webcam-canvas.hidden {
  display: none;
}

.webcam-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 15px;
}

.webcam-btn {
  padding: 10px 20px;
  border: 1px solid var(--accent);
  background: rgba(0, 220, 240, 0.1);
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
  font-size: 14px;
}

.webcam-btn:hover:not(.hidden) {
  background: rgba(0, 220, 240, 0.2);
  box-shadow: 0 0 12px rgba(0, 220, 240, 0.3);
}

.webcam-btn.hidden {
  display: none;
}

.webcam-error {
  padding: 10px;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid #ff6b6b;
  border-radius: 6px;
}
