* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #000000;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  user-select: none;
  color: #e0e0e0;
}

/* TTS activation overlay */
#tts-activate {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  cursor: pointer;
}

#tts-activate-inner {
  color: #c59b5f;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1rem 2rem;
  border: 1px solid rgba(197,155,95,0.4);
  border-radius: 8px;
  background: rgba(197,155,95,0.08);
}

/* Questbook campaign badge */
#questbook-badge {
  position: fixed;
  top: 32px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: rgba(197,155,95,0.1);
  border: 1px solid rgba(197,155,95,0.3);
  border-radius: 12px;
  color: #c59b5f;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 100;
  letter-spacing: 0.02em;
}

#questbook-badge.hidden { display: none; }

/* ── Notification Terminal ── */
#notif-panel {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-height: 220px;
  background: rgba(8, 12, 24, 0.92);
  border: 1px solid rgba(80, 140, 255, 0.35);
  border-radius: 8px;
  z-index: 200;
  overflow: hidden;
  font-family: 'Consolas', 'Courier New', monospace;
  box-shadow: 0 0 20px rgba(60, 120, 255, 0.15), inset 0 0 30px rgba(0, 0, 0, 0.4);
  animation: notif-slide-in 0.3s ease-out;
}

@keyframes notif-slide-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

#notif-panel.hiding {
  animation: notif-slide-out 0.3s ease-in forwards;
}

@keyframes notif-slide-out {
  to { transform: translateY(20px); opacity: 0; }
}

#notif-panel.hidden { display: none; }

#notif-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(60, 120, 255, 0.08);
  border-bottom: 1px solid rgba(80, 140, 255, 0.2);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: rgba(140, 180, 255, 0.7);
  text-transform: uppercase;
}

#notif-icon {
  color: #508cff;
  font-size: 8px;
  animation: notif-blink 1.5s ease-in-out infinite;
}

@keyframes notif-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#notif-count {
  margin-left: auto;
  font-size: 9px;
  color: rgba(140, 180, 255, 0.4);
}

#notif-close {
  background: none;
  border: none;
  color: rgba(140, 180, 255, 0.5);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

#notif-close:hover {
  color: #fff;
}

#notif-log {
  max-height: 180px;
  overflow-y: auto;
  padding: 6px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(80, 140, 255, 0.2) transparent;
}

.notif-entry {
  display: flex;
  gap: 8px;
  padding: 3px 0;
  font-size: 11px;
  line-height: 1.4;
  animation: notif-type 0.4s ease-out;
}

@keyframes notif-type {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.notif-time {
  color: rgba(80, 140, 255, 0.4);
  flex-shrink: 0;
  font-size: 9px;
  min-width: 45px;
}

.notif-source {
  color: #508cff;
  font-weight: 600;
  flex-shrink: 0;
  font-size: 10px;
  min-width: 60px;
}

.notif-source.claude { color: #c59b5f; }
.notif-source.discord { color: #5865f2; }
.notif-source.plexseek { color: #e5a00d; }
.notif-source.spotify { color: #1ed760; }
.notif-source.questbook { color: #c59b5f; }
.notif-source.timer { color: #4caf50; }
.notif-source.system { color: #78909c; }

.notif-text {
  color: rgba(220, 230, 255, 0.85);
  word-break: break-word;
}

/* ── Notification Badges (right side) ── */
#notif-badges {
  position: fixed;
  top: 140px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 150;
}

.notif-badge {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(8, 12, 24, 0.85);
  border: 1.5px solid rgba(80, 140, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  animation: badge-pop 0.3s ease-out;
}

@keyframes badge-pop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.notif-badge:hover {
  border-color: rgba(80, 140, 255, 0.7);
  transform: scale(1.1);
}

.notif-badge img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.notif-badge svg {
  width: 30px;
  height: 30px;
}

.notif-badge .badge-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 22px;
  height: 22px;
  background: #e53935;
  color: #fff;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  box-shadow: 0 0 6px rgba(229, 57, 53, 0.5);
}

.notif-badge.claude { border-color: rgba(197, 155, 95, 0.4); }
.notif-badge.claude svg { color: #c59b5f; }
.notif-badge.discord { border-color: rgba(88, 101, 242, 0.4); }
.notif-badge.discord svg { color: #5865f2; }
.notif-badge.plexseek { border-color: rgba(229, 160, 13, 0.4); }
.notif-badge.plexseek svg { color: #e5a00d; }
.notif-badge.spotify { border-color: rgba(30, 215, 96, 0.4); }
.notif-badge.spotify svg { color: #1ed760; }
.notif-badge.questbook { border-color: rgba(197, 155, 95, 0.4); }
.notif-badge.questbook svg { color: #c59b5f; }
.notif-badge.timer { border-color: rgba(76, 175, 80, 0.4); }
.notif-badge.timer svg { color: #4caf50; }
.notif-badge.system { border-color: rgba(80, 140, 255, 0.4); }
.notif-badge.system svg { color: #508cff; }

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

/* ── Titlebar ── */
#titlebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  z-index: 100;
  background: rgba(0, 0, 0, 0.3);
}

#status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #555;
  transition: background 0.3s;
}

#status-indicator.listening {
  background: #4caf50;
  box-shadow: 0 0 6px #4caf50;
}

#status-indicator.thinking {
  background: #ff9800;
  box-shadow: 0 0 6px #ff9800;
}

#status-indicator.speaking {
  background: #2196f3;
  box-shadow: 0 0 6px #2196f3;
}

#status-text {
  font-size: 11px;
  opacity: 0.5;
}

#devices-panel {
  position: fixed;
  top: 38px;
  left: 12px;
  display: flex;
  gap: 6px;
  z-index: 100;
}

.device-dot {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(80, 120, 255, 0.1);
  border: 1px solid rgba(80, 120, 255, 0.2);
  border-radius: 12px;
  font-size: 12px;
  color: rgba(180, 200, 255, 0.7);
}

.device-dot .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf50;
}

#connection-status {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.4;
}

/* ── Jobs panel ── */
#jobs-panel {
  position: fixed;
  top: 70px;
  left: 12px;
  max-width: 320px;
  background: rgba(10, 15, 30, 0.85);
  border: 1px solid rgba(80, 120, 255, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
  backdrop-filter: blur(8px);
  z-index: 100;
  font-size: 11px;
}

#jobs-panel.hidden { display: none; }

#jobs-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(140, 170, 255, 0.6);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#jobs-clear {
  font-size: 9px;
  color: rgba(140, 170, 255, 0.4);
  cursor: pointer;
  background: none;
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#jobs-clear:hover {
  color: rgba(200, 220, 255, 0.7);
}

.job-card {
  padding: 6px 0;
  border-top: 1px solid rgba(80, 120, 255, 0.1);
}

.job-card:first-child { border-top: none; padding-top: 0; }

.job-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.job-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.job-status-dot.running { background: #ff9800; animation: pulse 1.5s ease-in-out infinite; }
.job-status-dot.completed { background: #4caf50; }
.job-status-dot.failed { background: #e74c3c; }
.job-status-dot.cancelled { background: #888; }

.job-pc { color: rgba(140, 170, 255, 0.7); font-weight: 600; font-size: 12px; }

.job-prompt {
  color: rgba(200, 210, 230, 0.8);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.job-status-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 6px;
}

.job-status-label.running {
  color: #ff9800;
  background: rgba(255, 152, 0, 0.1);
}

.job-status-label.completed {
  color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}

.job-status-label.failed {
  color: #ff4444;
  background: rgba(255, 68, 68, 0.15);
  font-size: 12px;
}

.job-status-label.cancelled {
  color: #888;
  background: rgba(136, 136, 136, 0.1);
}

.job-update {
  color: rgba(160, 180, 210, 0.5);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ── Avatar ── */
#avatar-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#avatar-glow {
  display: none;
}

#avatar-wrapper {
  position: relative;
  transition: transform 0.15s ease-out, width 0.2s ease, height 0.2s ease;
  /* Keep aspect ratio square so the blob doesn't stretch */
  width: 95vmin;
  height: 95vmin;
}

#avatar-face {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Soften hard pixel edges with a slight blur glow */
  filter: drop-shadow(0 0 6px rgba(160, 190, 230, 0.25))
          drop-shadow(0 0 1px rgba(160, 190, 230, 0.4));
  /* Feather the very edge of the image */
  image-rendering: auto;
  transition: filter 0.3s;
}

#avatar-face.speaking {
  filter: drop-shadow(0 0 12px rgba(80, 180, 255, 0.35))
          drop-shadow(0 0 2px rgba(160, 200, 240, 0.4));
}

#face-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── Speech bubble ── */
#speech-bubble {
  position: absolute;
  bottom: 80px;
  max-width: 70%;
  background: rgba(20, 30, 60, 0.9);
  border: 1px solid rgba(80, 120, 255, 0.3);
  border-radius: 16px;
  padding: 14px 20px;
  backdrop-filter: blur(10px);
  transition: opacity 0.3s, transform 0.3s, bottom 0.3s ease;
  z-index: 10;
}

#speech-bubble.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

#speech-text {
  font-size: 14px;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
}

/* ── Transcript ── */
#transcript {
  position: absolute;
  top: 50px;
  background: rgba(0,0,0,0.4);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0.7;
  transition: opacity 0.3s;
}

#transcript.hidden {
  opacity: 0;
}

/* ── Listening indicator ── */
#listening-indicator {
  position: absolute;
  bottom: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  opacity: 0.6;
  transition: opacity 0.3s;
}

#listening-indicator.hidden {
  opacity: 0;
}

.pulse-ring {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4caf50;
  animation: pulse 1.5s ease-in-out infinite;
}

.pulse-ring.delay {
  animation-delay: 0.3s;
}


/* ── Animations ── */
@keyframes glow-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.4); opacity: 1; }
}

/* ── Timers Panel (left side, below jobs) ── */
#timers-panel {
  position: fixed;
  bottom: 16px;
  left: 16px;
  max-width: 280px;
  background: rgba(10, 15, 30, 0.88);
  border: 1px solid rgba(76, 175, 80, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
  backdrop-filter: blur(8px);
  z-index: 100;
  font-size: 11px;
}

#timers-panel.hidden { display: none; }

#timers-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(76, 175, 80, 0.6);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#timers-header svg {
  width: 12px;
  height: 12px;
  color: #4caf50;
}

.timer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px solid rgba(76, 175, 80, 0.1);
}

.timer-item:first-child { border-top: none; }

.timer-type-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.timer-type-icon.timer { color: #4caf50; }
.timer-type-icon.alarm { color: #ff9800; }
.timer-type-icon.reminder { color: #42a5f5; }
.timer-type-icon.countdown { color: #e040fb; }

.timer-label {
  flex: 1;
  color: rgba(220, 230, 255, 0.8);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer-remaining {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #4caf50;
  flex-shrink: 0;
}

.timer-remaining.urgent {
  color: #ff5252;
  animation: pulse 1s ease-in-out infinite;
}

.timer-cancel {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.2);
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.timer-cancel:hover { color: #ff5252; }

/* ── Todo Overlay (fullscreen) ── */
#todo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: todo-fade-in 0.3s ease-out;
}

#todo-overlay.hidden { display: none; }

@keyframes todo-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

#todo-container {
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

#todo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

#todo-title {
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 0.05em;
  color: rgba(220, 230, 255, 0.9);
}

#todo-close {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#todo-close:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); }

#todo-summary {
  font-size: 12px;
  color: rgba(140, 170, 210, 0.5);
  margin-bottom: 16px;
}

#todo-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(20, 30, 60, 0.6);
  border: 1px solid rgba(80, 120, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.todo-item:hover {
  background: rgba(30, 45, 80, 0.7);
  border-color: rgba(80, 120, 255, 0.3);
}

.todo-item.completed {
  opacity: 0.4;
}

.todo-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(80, 140, 255, 0.4);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.todo-item.completed .todo-checkbox {
  background: #4caf50;
  border-color: #4caf50;
}

.todo-item.completed .todo-checkbox::after {
  content: '\2713';
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.todo-text {
  flex: 1;
  font-size: 15px;
  color: rgba(220, 230, 255, 0.9);
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: rgba(220, 230, 255, 0.4);
}

.todo-delete {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.15);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s;
}

.todo-item:hover .todo-delete { opacity: 1; }
.todo-delete:hover { color: #ff5252; }

#todo-empty {
  text-align: center;
  padding: 40px;
  color: rgba(140, 170, 210, 0.3);
  font-size: 14px;
}

#todo-input-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

#todo-input {
  flex: 1;
  padding: 10px 16px;
  background: rgba(20, 30, 60, 0.6);
  border: 1px solid rgba(80, 120, 255, 0.2);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
}

#todo-input:focus { border-color: rgba(80, 140, 255, 0.5); }

#todo-add-btn {
  padding: 10px 20px;
  background: rgba(80, 140, 255, 0.15);
  border: 1px solid rgba(80, 140, 255, 0.3);
  border-radius: 8px;
  color: #508cff;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}

#todo-add-btn:hover { background: rgba(80, 140, 255, 0.25); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(80, 120, 255, 0.3); border-radius: 2px; }
