/* ========================================
   Ask Mirror Talk Widget — Premium UX
   ======================================== */

/* Container */
.ask-mirror-talk {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 28px;
  border: 1px solid #e6e2dc;
  background: linear-gradient(180deg, #faf8f4 0%, #f5f2ed 100%);
  font-family: "Source Serif 4", Georgia, serif;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;     /* prevent iOS text inflation */
  text-size-adjust: 100%;
}

/* Subtle top accent bar */
.ask-mirror-talk::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #2e2a24, #8b7355, #2e2a24);
}

/* Title */
.ask-mirror-talk h2 {
  margin-top: 0;
  margin-bottom: 4px;
  color: #2e2a24;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.ask-mirror-talk h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  color: #2e2a24;
  font-size: 18px;
  font-weight: 600;
}

/* Label */
.ask-mirror-talk label {
  display: block;
  font-size: 15px;
  color: #6b665d;
  margin-bottom: 4px;
  font-style: italic;
}

/* ========================================
   Form Input
   ======================================== */
#ask-mirror-talk-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.6;
  margin: 8px 0 12px;
  border: 2px solid #d4cec6;
  border-radius: 10px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
  box-sizing: border-box;
  resize: vertical;
}

#ask-mirror-talk-input:focus {
  outline: none;
  border-color: #2e2a24;
  box-shadow: 0 0 0 4px rgba(46, 42, 36, 0.08), 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

#ask-mirror-talk-input::placeholder {
  color: #b5afa5;
  font-style: italic;
}

#ask-mirror-talk-input:disabled {
  background: #f0ede8;
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

/* ========================================
   Submit Button
   ======================================== */
.ask-mirror-talk button[type="submit"] {
  background: linear-gradient(135deg, #2e2a24, #3d3731);
  color: #fff;
  border: none;
  padding: 13px 32px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(46, 42, 36, 0.2);
}

.ask-mirror-talk button[type="submit"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ask-mirror-talk button[type="submit"]:hover:not(:disabled) {
  background: linear-gradient(135deg, #3d3731, #524b42);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(46, 42, 36, 0.3);
}

.ask-mirror-talk button[type="submit"]:hover:not(:disabled)::after {
  opacity: 1;
}

.ask-mirror-talk button[type="submit"]:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(46, 42, 36, 0.2);
}

.ask-mirror-talk button[type="submit"]:disabled {
  background: #8b8378;
  cursor: not-allowed;
  opacity: 0.7;
  box-shadow: none;
  transform: none;
}

/* ========================================
   Response Section
   ======================================== */
.ask-mirror-talk-response {
  margin-top: 24px;
  padding: 24px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e6e2dc;
  min-height: 0;
  line-height: 1.8;
  color: #2e2a24;
  font-size: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  transition: opacity 0.3s ease, border-color 0.3s ease;
  contain: layout style; /* CSS containment — prevents child reflows from pushing page layout */
  overflow-anchor: auto;
}

/* While streaming, lock to a min-height so the container doesn't collapse/expand wildly */
.ask-mirror-talk-response.amt-streaming {
  min-height: 180px;
}

/* Hide response section when empty */
.ask-mirror-talk-response:has(#ask-mirror-talk-output:empty) {
  display: none;
}

/* Response content — no animation during streaming to prevent layout bounce */
#ask-mirror-talk-output {
  overflow-anchor: none; /* prevent scroll anchoring thrash */
  overflow-wrap: break-word;
  word-wrap: break-word;
}

#ask-mirror-talk-output p {
  margin: 0 0 16px 0;
}

#ask-mirror-talk-output p:last-child {
  margin-bottom: 0;
}

/* Streaming cursor — visible while streaming text */
.ask-mirror-talk-response.amt-streaming #ask-mirror-talk-output::after {
  content: '▍';
  display: inline;
  animation: blink 0.7s step-end infinite;
  color: #8b7355;
  font-weight: 300;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* Only animate paragraphs AFTER streaming is complete (class added by JS) */
#ask-mirror-talk-output.amt-complete p {
  animation: fadeInUp 0.4s ease-out both;
}

/* Stagger paragraph animations — only when complete */
#ask-mirror-talk-output.amt-complete p:nth-child(1) { animation-delay: 0.05s; }
#ask-mirror-talk-output.amt-complete p:nth-child(2) { animation-delay: 0.1s; }
#ask-mirror-talk-output.amt-complete p:nth-child(3) { animation-delay: 0.15s; }
#ask-mirror-talk-output.amt-complete p:nth-child(4) { animation-delay: 0.2s; }
#ask-mirror-talk-output.amt-complete p:nth-child(5) { animation-delay: 0.25s; }
#ask-mirror-talk-output.amt-complete p:nth-child(6) { animation-delay: 0.3s; }
#ask-mirror-talk-output.amt-complete p:nth-child(7) { animation-delay: 0.35s; }
#ask-mirror-talk-output.amt-complete p:nth-child(8) { animation-delay: 0.4s; }

/* Better spacing after headings in paragraphs */
.ask-mirror-talk-response p strong:only-child {
  display: block;
  margin-bottom: 8px;
}

/* Error state */
.ask-mirror-talk-response.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
  animation: shake 0.4s ease-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ========================================
   Loading Animation — Elegant Pulse
   ======================================== */
.amt-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  animation: fadeIn 0.3s ease-out;
}

.amt-loading-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.amt-loading-dots span {
  width: 10px;
  height: 10px;
  background: #2e2a24;
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}

.amt-loading-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.amt-loading-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.amt-loading-text {
  font-size: 15px;
  color: #8b8378;
  font-style: italic;
  text-align: center;
  animation: pulse 2s ease-in-out infinite;
}

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

/* ========================================
   Citations Section
   ======================================== */
.ask-mirror-talk-citations {
  margin-top: 28px;
  display: none;
  animation: fadeInUp 0.5s ease-out;
}

.ask-mirror-talk-citations h3 {
  margin-top: 0;
  margin-bottom: 14px;
  color: #6b665d;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
}

#ask-mirror-talk-citations {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Citation Items */
.citation-item {
  background: #fff;
  border: 1px solid #e6e2dc;
  border-radius: 10px;
  margin-bottom: 8px;
  padding: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideInRight 0.4s ease-out both;
  overflow: hidden;
}

/* Stagger citation animations */
.citation-item:nth-child(1) { animation-delay: 0.05s; }
.citation-item:nth-child(2) { animation-delay: 0.12s; }
.citation-item:nth-child(3) { animation-delay: 0.19s; }
.citation-item:nth-child(4) { animation-delay: 0.26s; }
.citation-item:nth-child(5) { animation-delay: 0.33s; }

.citation-item:hover {
  border-color: #2e2a24;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.citation-link {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  gap: 12px;
  cursor: pointer;
  padding: 14px 18px;
  transition: background 0.2s ease;
}

.citation-link:hover {
  text-decoration: none;
  background: #faf8f4;
}

/* Citation info column (title + quote) */
.citation-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.citation-title {
  font-weight: 600;
  color: #2e2a24;
  font-size: 15px;
  line-height: 1.4;
  transition: color 0.2s ease;
}

/* Quote snippet under each citation */
.citation-quote {
  display: block;
  font-size: 13px;
  line-height: 1.55;
  color: #6b665d;
  font-style: italic;
  border-left: 3px solid #d4cec6;
  padding: 4px 0 4px 10px;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  transition: color 0.2s ease;
}

.citation-link:hover .citation-quote {
  color: #4a453d;
  border-left-color: #8b7355;
}

.citation-time {
  font-size: 13px;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
  background: #2e2a24;
  padding: 5px 12px;
  border-radius: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
  cursor: pointer;
}

.citation-link:hover .citation-title {
  color: #1a1815;
}

.citation-link:hover .citation-time {
  background: #8b7355;
  color: #fff;
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(139, 115, 85, 0.3);
}

/* "Explore this episode" button */
.citation-explore {
  display: block;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #2e2a24;
  text-decoration: none;
  text-align: center;
  border-top: 1px solid #f0ede8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
  background: #faf8f4;
}

.citation-explore:hover {
  color: #fff;
  background: #2e2a24;
  text-decoration: none;
}

/* ========================================
   Response Content Formatting
   ======================================== */
.ask-mirror-talk-response strong {
  font-weight: 700;
  color: #1a1815;
}

.ask-mirror-talk-response em {
  font-style: italic;
  color: #4a453d;
}

.ask-mirror-talk-response ol,
.ask-mirror-talk-response ul {
  margin: 16px 0;
  padding-left: 28px;
}

.ask-mirror-talk-response ol {
  list-style-type: decimal;
}

.ask-mirror-talk-response ul {
  list-style-type: disc;
}

.ask-mirror-talk-response li {
  margin: 8px 0;
  line-height: 1.7;
  padding-left: 4px;
}

.ask-mirror-talk-response li strong {
  color: #1a1815;
}

.ask-mirror-talk-response p + ol,
.ask-mirror-talk-response p + ul {
  margin-top: 12px;
}

/* ========================================
   Feedback Section (from analytics addon)
   ======================================== */
.amt-feedback-section {
  margin-top: 24px !important;
  padding: 20px !important;
  background: linear-gradient(135deg, #faf8f4, #f5f2ed) !important;
  border-radius: 10px !important;
  border: 1px solid #e6e2dc !important;
  animation: fadeInUp 0.5s ease-out;
}

.amt-feedback-question {
  font-size: 15px !important;
  font-weight: 600 !important;
  color: #2e2a24 !important;
  margin-bottom: 14px !important;
  text-align: center;
}

.amt-feedback-buttons {
  display: flex;
  gap: 10px;
}

.amt-feedback-btn {
  flex: 1;
  padding: 12px 20px !important;
  border: 2px solid transparent !important;
  border-radius: 8px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.amt-feedback-positive {
  background: #ecfdf5 !important;
  color: #065f46 !important;
  border-color: #a7f3d0 !important;
}

.amt-feedback-positive:hover {
  background: #10b981 !important;
  color: #fff !important;
  border-color: #10b981 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.amt-feedback-negative {
  background: #fef2f2 !important;
  color: #991b1b !important;
  border-color: #fecaca !important;
}

.amt-feedback-negative:hover {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.amt-feedback-thanks {
  display: none;
  padding: 14px !important;
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: white !important;
  border-radius: 8px !important;
  text-align: center !important;
  font-weight: 600 !important;
  font-size: 15px !important;
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@keyframes scaleIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ========================================
   Share Button
   ======================================== */
.amt-share-section {
  text-align: center;
  margin-top: 16px;
}

.amt-share-btn {
  display: inline-block;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  color: #8b7355;
  background: transparent;
  border: 2px solid #d4cec6;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.amt-share-btn:hover {
  color: #2e2a24;
  border-color: #2e2a24;
  background: #faf8f4;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========================================
   Inline Audio Player
   ======================================== */

/* Citation active state */
.citation-item.citation-playing {
  border-color: #2e2a24;
  box-shadow: 0 4px 20px rgba(46, 42, 36, 0.12);
}

.citation-item.citation-playing .citation-link {
  background: #faf8f4;
}

.citation-item.citation-playing .citation-time {
  background: #2e2a24;
  color: #fff;
}

/* Player container */
.amt-inline-player {
  padding: 16px 18px;
  border-top: 1px solid #e6e2dc;
  background: linear-gradient(180deg, #faf8f4 0%, #f5f2ed 100%);
  animation: playerSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.amt-inline-player.amt-player-closing {
  animation: playerSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes playerSlideIn {
  from {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    max-height: 300px;
    opacity: 1;
    padding-top: 16px;
    padding-bottom: 16px;
  }
}

@keyframes playerSlideOut {
  from {
    max-height: 300px;
    opacity: 1;
    padding-top: 16px;
    padding-bottom: 16px;
  }
  to {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
}

/* Player header */
.amt-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.amt-player-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8b7355;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.amt-player-close {
  background: none;
  border: 1px solid #d4cec6;
  color: #6b665d;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.amt-player-close:hover {
  background: #2e2a24;
  border-color: #2e2a24;
  color: #fff;
  transform: scale(1.1);
}

/* Episode title in player */
.amt-player-episode {
  font-size: 14px;
  font-weight: 600;
  color: #2e2a24;
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Audio element */
.amt-inline-player .amt-audio {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  outline: none;
  margin-bottom: 10px;
}

/* Custom audio styling for webkit browsers */
.amt-inline-player .amt-audio::-webkit-media-controls-panel {
  background: #fff;
  border-radius: 8px;
}

/* Player action buttons */
.amt-player-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.amt-player-skip-back,
.amt-player-skip-fwd {
  background: #fff;
  border: 1px solid #d4cec6;
  color: #2e2a24;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.amt-player-skip-back:hover,
.amt-player-skip-fwd:hover {
  background: #2e2a24;
  color: #fff;
  border-color: #2e2a24;
  transform: translateY(-1px);
}

.amt-player-external {
  margin-left: auto;
  font-size: 12px;
  color: #8b7355;
  text-decoration: none;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid #d4cec6;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.amt-player-external:hover {
  background: #f5f2ed;
  color: #2e2a24;
  border-color: #2e2a24;
  text-decoration: none;
}

/* ========================================
   Keyframe Animations
   ======================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========================================
   Responsive Design — Tablet
   ======================================== */
@media (max-width: 768px) {
  .ask-mirror-talk {
    padding: 24px 16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .ask-mirror-talk h2 {
    font-size: 24px;
  }

  .citation-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .citation-time {
    align-self: flex-start;
  }

  .citation-explore {
    text-align: center;
  }

  .amt-topics-list {
    gap: 6px;
  }

  .amt-topic-btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  .amt-feedback-buttons {
    flex-direction: column;
  }

  .amt-player-actions {
    flex-wrap: wrap;
  }

  .amt-player-external {
    margin-left: 0;
    flex: 1;
    text-align: center;
  }

  .amt-qotd-text {
    font-size: 16px;
  }

  .amt-qotd-inner {
    padding: 16px 18px;
  }
}

/* ========================================
   Responsive Design — Mobile (≤ 480px)
   ======================================== */
@media (max-width: 480px) {

  /* ── Container ──────────────────────── */
  .ask-mirror-talk {
    padding: 16px 12px;
    margin: 0 -12px;            /* bleed to screen edges inside WP padding */
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }

  .ask-mirror-talk::before {
    height: 2px;
  }

  /* ── Typography ─────────────────────── */
  .ask-mirror-talk h2 {
    font-size: 22px;
    text-align: center;
    margin-bottom: 2px;
  }

  .ask-mirror-talk h3 {
    font-size: 16px;
    margin-top: 18px;
    margin-bottom: 8px;
  }

  .ask-mirror-talk label {
    font-size: 14px;
    text-align: center;
  }

  /* ── Form Input ─────────────────────── */
  #ask-mirror-talk-input {
    font-size: 16px;            /* prevents iOS zoom on focus */
    padding: 12px 14px;
    margin: 6px 0 10px;
    border-radius: 10px;
    min-height: 72px;           /* compact on mobile */
  }

  /* ── Submit Button — full-width tap target ── */
  .ask-mirror-talk button[type="submit"] {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
  }

  .ask-mirror-talk button[type="submit"]:hover:not(:disabled) {
    transform: none;            /* no hover lift on touch */
  }

  .ask-mirror-talk button[type="submit"]:active:not(:disabled) {
    transform: scale(0.97);
    box-shadow: 0 1px 3px rgba(46, 42, 36, 0.15);
  }

  /* ── Question of the Day ────────────── */
  .amt-qotd-inner {
    padding: 14px 14px 16px;
    border-radius: 12px;
  }

  .amt-qotd-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 8px;
  }

  .amt-qotd-badge {
    font-size: 11px;
  }

  .amt-qotd-theme {
    font-size: 10px;
    padding: 2px 8px;
  }

  .amt-qotd-text {
    font-size: 16px;
    line-height: 1.45;
    margin-bottom: 12px;
  }

  .amt-qotd-ask {
    width: 100%;
    text-align: center;
    padding: 12px 20px;
    font-size: 15px;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
  }

  .amt-qotd-ask:hover {
    transform: none;
  }

  .amt-qotd-ask:active {
    transform: scale(0.97);
  }

  /* ── Browse by Topic ────────────────── */
  .amt-topics {
    margin-bottom: 14px;
  }

  .amt-topics-label {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .amt-topics-list {
    gap: 6px;
    /* Horizontally scrollable on narrow screens */
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 4px;
    margin: 0 -12px;           /* bleed to screen edges */
    padding-left: 12px;
    padding-right: 12px;
    scrollbar-width: none;     /* Firefox */
  }

  .amt-topics-list::-webkit-scrollbar {
    display: none;             /* Chrome, Safari */
  }

  .amt-topic-btn {
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 20px;
    -webkit-tap-highlight-color: transparent;
  }

  .amt-topic-btn:hover {
    transform: none;
  }

  .amt-topic-btn:active {
    transform: scale(0.95);
    box-shadow: none;
  }

  .amt-topic-icon {
    font-size: 14px;
  }

  /* ── Suggested Questions ────────────── */
  .amt-suggestions {
    margin-bottom: 12px;
  }

  .amt-suggestions-label,
  .amt-followups-label {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .amt-suggestions-list,
  .amt-followups-list {
    gap: 6px;
  }

  .amt-suggestion-btn,
  .amt-followup-btn {
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 18px;
    -webkit-tap-highlight-color: transparent;
    /* full-width on very narrow screens for easy tapping */
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    text-align: center;
  }

  .amt-suggestion-btn:hover,
  .amt-followup-btn:hover {
    transform: none;
  }

  .amt-suggestion-btn:active,
  .amt-followup-btn:active {
    transform: scale(0.96);
  }

  /* ── Response Section ───────────────── */
  .ask-mirror-talk-response {
    margin-top: 16px;
    padding: 16px 14px;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.75;
  }

  #ask-mirror-talk-output p {
    margin: 0 0 12px 0;
  }

  .ask-mirror-talk-response ol,
  .ask-mirror-talk-response ul {
    padding-left: 20px;
    margin: 12px 0;
  }

  .ask-mirror-talk-response li {
    margin: 6px 0;
    line-height: 1.65;
  }

  /* ── Loading ────────────────────────── */
  .amt-loading {
    padding: 28px 12px;
  }

  .amt-loading-text {
    font-size: 14px;
  }

  /* ── Citations ──────────────────────── */
  .ask-mirror-talk-citations {
    margin-top: 18px;
  }

  .ask-mirror-talk-citations h3 {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .citation-item {
    margin-bottom: 6px;
    border-radius: 10px;
  }

  /* Remove hover lift on touch */
  .citation-item:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }

  .citation-link {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 14px;
    -webkit-tap-highlight-color: transparent;
  }

  .citation-title {
    font-size: 14px;
    line-height: 1.4;
  }

  .citation-quote {
    font-size: 12.5px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    padding: 3px 0 3px 8px;
  }

  .citation-time {
    font-size: 12px;
    padding: 4px 10px;
    align-self: flex-start;
  }

  .citation-link:hover .citation-time {
    transform: none;            /* no hover scale on touch */
  }

  /* Explore button — full-width CTA on mobile */
  .citation-explore {
    text-align: center;
    padding: 10px 14px;
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
  }

  .citation-explore:hover {
    background: transparent;
  }

  .citation-explore:active {
    background: #faf8f4;
  }

  /* ── Inline Audio Player ────────────── */
  .amt-inline-player {
    padding: 12px 14px;
  }

  .amt-player-episode {
    font-size: 13px;
    margin-bottom: 10px;
  }

  .amt-inline-player .amt-audio {
    height: 36px;
    margin-bottom: 8px;
  }

  .amt-player-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .amt-player-skip-back,
  .amt-player-skip-fwd {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    font-size: 12px;
    -webkit-tap-highlight-color: transparent;
  }

  .amt-player-skip-back:hover,
  .amt-player-skip-fwd:hover {
    transform: none;
  }

  .amt-player-external {
    margin-left: 0;
    flex: 1 1 100%;
    text-align: center;
    padding: 8px 10px;
    font-size: 12px;
    -webkit-tap-highlight-color: transparent;
  }

  .amt-player-external:hover {
    transform: none;
  }

  /* ── Feedback Section ───────────────── */
  .amt-feedback-section {
    margin-top: 16px !important;
    padding: 14px !important;
    border-radius: 10px !important;
  }

  .amt-feedback-question {
    font-size: 14px !important;
    margin-bottom: 10px !important;
  }

  .amt-feedback-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .amt-feedback-btn {
    padding: 12px 16px !important;
    font-size: 14px !important;
    border-radius: 10px !important;
    -webkit-tap-highlight-color: transparent;
  }

  .amt-feedback-positive:hover,
  .amt-feedback-negative:hover {
    transform: none;
    box-shadow: none;
  }

  .amt-feedback-positive:active {
    background: #10b981 !important;
    color: #fff !important;
    transform: scale(0.97);
  }

  .amt-feedback-negative:active {
    background: #ef4444 !important;
    color: #fff !important;
    transform: scale(0.97);
  }

  .amt-feedback-thanks {
    font-size: 14px !important;
    padding: 12px !important;
  }

  /* ── Follow-ups ─────────────────────── */
  .amt-followups {
    margin-top: 14px;
    padding-top: 12px;
  }
}

/* ========================================
   Accessibility
   ======================================== */
.ask-mirror-talk button:focus-visible,
#ask-mirror-talk-input:focus-visible {
  outline: 2px solid #2e2a24;
  outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   Session Resume Hint
   ======================================== */
.amt-resume-hint {
  margin-bottom: 12px;
}

.amt-resume-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  color: #6b665d;
  background: #faf8f4;
  border: 1px dashed #d4cec6;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.amt-resume-btn:hover {
  color: #2e2a24;
  border-color: #2e2a24;
  border-style: solid;
  background: #f5f2ed;
}

/* ========================================
   Question of the Day
   ======================================== */
.amt-qotd {
  margin-bottom: 20px;
  animation: fadeInUp 0.6s ease-out;
}

.amt-qotd-inner {
  background: linear-gradient(135deg, #fdfbf6 0%, #f5f0e6 100%);
  border: 1.5px solid #e0d5c3;
  border-radius: 14px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}

/* Warm shimmer accent along the top */
.amt-qotd-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #d4a857, #8b7355, #d4a857);
}

.amt-qotd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}

.amt-qotd-badge {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #8b7355;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.amt-qotd-theme {
  font-size: 11px;
  font-weight: 600;
  color: #a09380;
  background: rgba(139, 115, 85, 0.1);
  padding: 3px 10px;
  border-radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.3px;
}

.amt-qotd-text {
  font-size: 18px;
  line-height: 1.5;
  color: #2e2a24;
  font-style: italic;
  font-weight: 500;
  margin: 0 0 14px 0;
}

.amt-qotd-ask {
  display: inline-block;
  background: linear-gradient(135deg, #2e2a24, #3d3731);
  color: #fff;
  border: none;
  padding: 9px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.3px;
}

.amt-qotd-ask:hover {
  background: linear-gradient(135deg, #3d3731, #524b42);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(46, 42, 36, 0.25);
}

.amt-qotd-ask:active {
  transform: translateY(0);
}

/* QOTD tablet adjustments handled in responsive section above */

/* ========================================
   Browse by Topic
   ======================================== */
.amt-topics {
  margin-bottom: 20px;
  animation: fadeInUp 0.5s ease-out;
}

.amt-topics-label {
  font-size: 14px;
  color: #6b665d;
  margin: 0 0 10px 0;
  font-style: italic;
}

.amt-topics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.amt-topic-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fff, #faf8f4);
  border: 1.5px solid #e6e2dc;
  border-radius: 24px;
  padding: 8px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #2e2a24;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1.4;
}

.amt-topic-icon {
  font-size: 15px;
  line-height: 1;
}

.amt-topic-name {
  font-size: 13px;
}

.amt-topic-btn:hover {
  background: linear-gradient(135deg, #2e2a24, #3d3731);
  color: #fff;
  border-color: #2e2a24;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(46, 42, 36, 0.2);
}

.amt-topic-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(46, 42, 36, 0.15);
}

/* ========================================
   Suggested Questions
   ======================================== */
.amt-suggestions {
  margin-bottom: 16px;
}

.amt-suggestions-label,
.amt-followups-label {
  font-size: 14px;
  color: #6b665d;
  margin: 0 0 8px 0;
  font-style: italic;
}

.amt-suggestions-list,
.amt-followups-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.amt-suggestion-btn,
.amt-followup-btn {
  background: #fff;
  border: 1.5px solid #d4cec6;
  border-radius: 20px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  color: #2e2a24;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.amt-suggestion-btn:hover,
.amt-followup-btn:hover {
  background: #2e2a24;
  color: #fff;
  border-color: #2e2a24;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(46, 42, 36, 0.15);
}

.amt-suggestion-btn:active,
.amt-followup-btn:active {
  transform: translateY(0);
}

/* ========================================
   Follow-up Questions — The Addictive Loop
   ======================================== */
.amt-followups {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e6e2dc;
  animation: fadeInUp 0.4s ease;
}

.amt-followups-label {
  position: relative;
}

/* Subtle glow on follow-up buttons to draw attention */
.amt-followup-btn {
  animation: followUpAppear 0.5s ease-out both;
}

.amt-followup-btn:nth-child(1) { animation-delay: 0.1s; }
.amt-followup-btn:nth-child(2) { animation-delay: 0.25s; }
.amt-followup-btn:nth-child(3) { animation-delay: 0.4s; }

@keyframes followUpAppear {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Depth indicator — shows episode count searched */
.amt-depth-indicator {
  display: inline-block;
  font-size: 12px;
  color: #8b7355;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-top: 8px;
  opacity: 0;
  animation: fadeIn 0.5s ease-out 0.3s forwards;
}

.amt-depth-indicator::before {
  content: '📚 ';
}

/* ========================================
   PWA Install Banner — "Add to Home Screen"
   ======================================== */
.amt-install-banner {
  margin: -8px -8px 16px -8px;
  animation: fadeInUp 0.4s ease-out;
}

.amt-install-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #2e2a24, #3d3731);
  border-radius: 10px;
  color: #fff;
}

.amt-install-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.amt-install-text strong {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.amt-install-text span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.3;
}

.amt-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.amt-install-btn {
  background: #fff;
  color: #2e2a24;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.amt-install-btn:hover {
  background: #f5f2ed;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.amt-install-btn:active {
  transform: scale(0.96);
}

.amt-install-dismiss {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.amt-install-dismiss:hover {
  color: #fff;
}

.amt-install-banner.amt-install-hiding {
  animation: fadeOutUp 0.3s ease-in forwards;
}

@keyframes fadeOutUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

/* Mobile: stack install banner vertically */
@media (max-width: 480px) {
  .amt-install-banner {
    margin: -4px -4px 12px -4px;
  }

  .amt-install-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
    text-align: center;
  }

  .amt-install-actions {
    justify-content: center;
    gap: 10px;
  }

  .amt-install-btn {
    flex: 1;
    padding: 10px 16px;
  }
}

/* Hide install banner in standalone mode (already installed) */
@media (display-mode: standalone) {
  .amt-install-banner {
    display: none !important;
  }
}

/* ========================================
   Push Notification Opt-In Banner
   ======================================== */
.amt-notif-optin {
  margin: 16px 0;
  animation: amtSlideDown 0.3s ease-out;
}

.amt-notif-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #f0ede8 0%, #e8e4dd 100%);
  border: 1px solid #d4cfc5;
  border-radius: 12px;
  padding: 16px 20px;
}

.amt-notif-success {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border-color: #a5d6a7;
  justify-content: center;
}

.amt-notif-error {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
  border-color: #ffcc80;
  justify-content: center;
}

.amt-notif-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.amt-notif-text strong {
  font-size: 15px;
  color: #2e2a24;
}

.amt-notif-text span {
  font-size: 13px;
  color: #6b665d;
}

.amt-notif-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.amt-notif-enable {
  background: #2e2a24;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.amt-notif-enable:hover {
  background: #3d3731;
}

.amt-notif-enable:active {
  transform: scale(0.97);
}

.amt-notif-dismiss {
  background: transparent;
  border: 1px solid #c4bfb5;
  color: #6b665d;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.amt-notif-dismiss:hover {
  background: rgba(0,0,0,0.04);
  border-color: #a09a8f;
}

/* Preferences checkboxes */
.amt-notif-prefs {
  background: #faf8f4;
  border: 1px solid #d4cfc5;
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: amtSlideDown 0.2s ease-out;
}

.amt-notif-pref {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #2e2a24;
  cursor: pointer;
}

.amt-notif-pref input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #2e2a24;
  cursor: pointer;
}

.amt-notif-save {
  align-self: flex-start;
  background: #2e2a24;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: 4px;
  transition: background 0.2s;
}

.amt-notif-save:hover {
  background: #3d3731;
}

.amt-notif-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.amt-notif-optin.amt-notif-hiding {
  animation: amtSlideUp 0.3s ease-in forwards;
}

@keyframes amtSlideDown {
  from { opacity: 0; max-height: 0; transform: translateY(-8px); }
  to { opacity: 1; max-height: 200px; transform: translateY(0); }
}

@keyframes amtSlideUp {
  from { opacity: 1; max-height: 200px; }
  to { opacity: 0; max-height: 0; margin: 0; padding: 0; overflow: hidden; }
}

/* Mobile: stack notification banner vertically */
@media (max-width: 600px) {
  .amt-notif-inner {
    flex-direction: column;
    text-align: center;
    padding: 14px 16px;
  }

  .amt-notif-actions {
    width: 100%;
    justify-content: center;
  }

  .amt-notif-enable {
    flex: 1;
    padding: 10px 16px;
  }

  .amt-notif-prefs {
    align-items: center;
  }

  .amt-notif-save {
    align-self: center;
    width: 100%;
  }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
  .ask-mirror-talk button,
  #ask-mirror-talk-input,
  .ask-mirror-talk form,
  .amt-feedback-section,
  .amt-inline-player,
  .amt-suggestions,
  .amt-followups,
  .amt-install-banner {
    display: none;
  }

  .ask-mirror-talk {
    box-shadow: none;
    border: none;
  }
}
