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

:root {
  /* Flutter AppColors.dark() */
  --bg:             #11171A;
  --bg-bottom:      #000000;
  --dock-bg:        rgba(33,48,48,0.82);
  --border:         rgba(255,255,255,0.11);
  --border-sheet:   rgba(255,255,255,0.20);
  --input-bg:       rgba(255,255,255,0.15);
  --input-border:   rgba(255,255,255,0.25);
  --text-primary:   rgba(255,255,255,0.80);
  --text-secondary: rgba(255,255,255,0.50);
  --accent-live:    #4CAF50;
  --accent-green:   #17B762;
  --accent-cyan:    #00BCFF;
  --user-bubble:    #103D3B;
  --asst-bubble:    rgba(25,66,77,0.60);
  --end-btn:        #FF4B4B;
  --error:          #FF4B4B;
  --btn-bg:         rgba(255,255,255,0.09);
  --header-menu-bg: rgba(255,255,255,0.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(to bottom, var(--bg) 0%, var(--bg-bottom) 100%);
  color: var(--text-primary);
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── Resume button (shown below status label on session end) ── */
#resume-btn {
  display: none;
  margin-top: 20px;
  padding: 12px 32px;
  font-size: 0.9rem;
}
#resume-btn.visible { display: block; }

/* ── Session Screen ── */
#session-screen {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
}

#session-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 15%, rgba(23,183,98,0.12) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 15% 85%, rgba(0,188,255,0.08) 0%, transparent 60%),
    linear-gradient(to bottom, #11171A 0%, #000000 100%);
  z-index: 0;
}

/* ── Avatar ── */
#avatar-wrap {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
  transition:
    top       0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#avatar {
  width: 200px;
  height: auto;
  border-radius: 0;
  object-fit: contain;
}

#status-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--accent-live);
  min-height: 20px;
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-live);
  flex-shrink: 0;
  animation: blink 1.4s ease-in-out infinite;
  display: none;
}

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

/* ── Bottom Dock ── */
#dock {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  border-radius: 32px 32px 0 0;
  background: var(--dock-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-sheet);
  overflow: hidden;
}

/* Transcript area */
#transcript-area {
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    opacity    0.35s ease;
  opacity: 0;
}
#transcript-area.open { max-height: 280px; opacity: 1; }

#transcript-scroll {
  height: 240px;
  overflow-y: auto;
  padding: 16px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#transcript-scroll::-webkit-scrollbar       { width: 4px; }
#transcript-scroll::-webkit-scrollbar-track { background: transparent; }
#transcript-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.875rem;
  line-height: 1.45;
  animation: bubble-in 0.2s ease;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bubble.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border: 1px solid rgba(23,183,98,0.25);
  color: rgba(255,255,255,0.90);
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--asst-bubble);
  border: 1px solid rgba(255,255,255,0.11);
  color: rgba(255,255,255,0.80);
}
.bubble.interim { opacity: 0.6; font-style: italic; }

#transcript-status {
  text-align: center;
  font-size: 0.75rem;
  color: var(--accent-live);
  padding: 8px 0 0;
  font-weight: 500;
}

/* Controls row */
#controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 16px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

/* Text input bar */
#text-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 50px;
  padding: 0 4px 0 16px;
  transition: border-color 0.2s;
}
#text-input-wrap:focus-within { border-color: var(--accent-green); }

#text-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 10px 0;
}
#text-input::placeholder { color: var(--text-secondary); }

#send-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-green);
  border: none;
  color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
#send-btn:hover { opacity: 0.85; }
#send-btn svg  { width: 16px; height: 16px; }

/* Control buttons */
.ctrl-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.14); }
.ctrl-btn.active-btn {
  background: rgba(76,175,80,0.18);
  border-color: var(--accent-live);
  color: var(--accent-live);
}
.ctrl-btn.end-btn {
  background: rgba(255,75,75,0.15);
  border-color: rgba(255,75,75,0.45);
  color: var(--end-btn);
}
.ctrl-btn.end-btn:hover { background: rgba(255,75,75,0.28); }
.ctrl-btn svg { width: 20px; height: 20px; }

/* ── Error / Info banner ── */
#banner {
  position: absolute;
  top: 24px; left: 16px; right: 16px;
  z-index: 20;
  background: rgba(255,75,75,0.15);
  border: 1px solid rgba(255,75,75,0.40);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--end-btn);
  display: none;
  align-items: center;
  gap: 10px;
}
#banner.info {
  background: rgba(23,183,98,0.12);
  border-color: rgba(23,183,98,0.35);
  color: var(--accent-live);
}
#banner-msg    { flex: 1; }
#banner-close  { cursor: pointer; opacity: 0.7; font-size: 1rem; background: none; border: none; color: inherit; }

/* ── Summary overlay ── */
#summary-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(13,13,20,0.92);
  backdrop-filter: blur(12px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 20px;
  text-align: center;
}
#summary-overlay h2 { font-size: 1.25rem; font-weight: 600; color: var(--accent-live); }
#summary-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 400px;
  max-height: 40vh;
  overflow-y: auto;
  text-align: left;
}

/* ── Dock disabled state (no active session) ── */
#dock.inactive {
  pointer-events: none;
  opacity: 0.45;
}

/* ── Primary button ── */
.btn-primary {
  background: linear-gradient(135deg, #7c5cfc 0%, #5b8dee 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 16px 48px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: 0.02em;
}
.btn-primary:hover  { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
