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

body {
  font-family: "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(160deg, #7f1d1d 0%, #991b1b 40%, #b45309 100%);
  min-height: 100vh;
  color: #fff;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  background: rgba(0, 0, 0, 0.25);
}
header .badge {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fde047, #ca8a04);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
header h1 { font-size: 20px; }
header p { font-size: 13px; opacity: .85; }

main {
  flex: 1;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

#summary-btn {
  border: none;
  background: transparent;
  color: #fff;
  opacity: 0.85;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}
#summary-btn:hover { background: rgba(255, 255, 255, 0.15); }

#summary-panel {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
}
#summary-panel h3 { font-size: 15px; margin-bottom: 8px; }
#summary-panel pre {
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 1.5;
  max-height: 40vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
}
.summary-actions { display: flex; gap: 8px; margin-top: 10px; }
.summary-actions button {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: #fbbf24;
  color: #78350f;
  font-weight: 600;
  cursor: pointer;
}
.summary-actions #summary-close { background: rgba(255, 255, 255, 0.25); color: #fff; }

#mode-toggle {
  display: flex;
  gap: 6px;
  background: rgba(0,0,0,.3);
  border-radius: 999px;
  padding: 5px;
}
.mode-btn {
  border: none;
  background: transparent;
  color: #fff;
  opacity: .65;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
.mode-btn.active {
  background: #fbbf24;
  color: #78350f;
  font-weight: 700;
  opacity: 1;
}

#orb-wrap { text-align: center; }
#orb {
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.5);
  background: radial-gradient(circle at 35% 30%, #fca5a5, #dc2626);
  font-size: 44px;
  cursor: pointer;
  transition: transform .15s, box-shadow .3s;
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
}
#orb:hover { transform: scale(1.05); }
#orb.listening {
  animation: pulse 1.6s infinite;
  background: radial-gradient(circle at 35% 30%, #86efac, #16a34a);
}
#orb.thinking {
  animation: spinPulse 1.2s infinite;
  background: radial-gradient(circle at 35% 30%, #fde68a, #d97706);
}
#orb.speaking {
  animation: pulse 1s infinite;
  background: radial-gradient(circle at 35% 30%, #93c5fd, #2563eb);
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,.45); }
  70% { box-shadow: 0 0 0 26px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
@keyframes spinPulse {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(6deg) scale(1.04); }
  100% { transform: rotate(0deg) scale(1); }
}

#status {
  margin-top: 12px;
  font-size: 15px;
  min-height: 22px;
  opacity: .95;
}

#conversation {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 44vh;
  overflow-y: auto;
  padding: 4px;
}
.msg {
  padding: 12px 16px;
  border-radius: 14px;
  max-width: 85%;
  line-height: 1.5;
  font-size: 15px;
  white-space: pre-wrap;
}
.msg.user {
  align-self: flex-end;
  background: rgba(255,255,255,.92);
  color: #7f1d1d;
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  align-self: flex-start;
  background: rgba(0,0,0,.35);
  border-bottom-left-radius: 4px;
}
.msg.interim { opacity: .6; font-style: italic; }

#sources, #validity {
  width: 100%;
  background: rgba(0,0,0,.28);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
}
#sources h3, #validity h3 { font-size: 14px; margin-bottom: 6px; }
#sources a { color: #fde68a; }
#sources li, #validity li { margin-left: 18px; margin-bottom: 4px; }
#validity li.expired { color: #fca5a5; font-weight: 700; }
#validity li.valid { color: #86efac; }
#validity li.partial { color: #fde68a; }
#validity li.unknown { opacity: .75; }

#text-fallback {
  width: 100%;
  display: flex;
  gap: 8px;
}
#text-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
}
#text-send {
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  background: #fbbf24;
  color: #78350f;
  font-weight: 700;
  cursor: pointer;
}

footer {
  text-align: center;
  font-size: 12px;
  opacity: .8;
  padding: 14px;
  background: rgba(0,0,0,.25);
}
