/* ============================================================
   Portfolio Chat Widget — widget.css
   All rules scoped under #pcw-root to prevent bleed into portfolio.
   Cyberpunk theme matching ray-tran-portfolio.html:
     Cyan:    #00c8ff
     Mint:    #0af5b4
     Pink:    #ff4d6d
     BG:      #080b0f
     Surface: #0d1117 / #131c26
   ============================================================ */

#pcw-root {
  --pcw-accent:   #00c8ff;
  --pcw-accent2:  #0af5b4;
  --pcw-pink:     #ff4d6d;
  --pcw-bg:       #080b0f;
  --pcw-surface:  #0d1117;
  --pcw-surface2: #131c26;
  --pcw-border:   rgba(0, 200, 255, 0.15);
  --pcw-border2:  rgba(10, 245, 180, 0.12);
  --pcw-text:     #e2e8f0;
  --pcw-text-dim: rgba(226, 232, 240, 0.5);
  --pcw-radius:   4px;
  --pcw-shadow:   0 0 32px rgba(0, 200, 255, 0.18), 0 8px 32px rgba(0,0,0,0.6);

  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  color: var(--pcw-text);
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 1000;
  pointer-events: none;
}

/* ── FAB (Floating Action Button) ──────────────────────────── */

#pcw-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(0, 200, 255, 0.3);
  background: var(--pcw-surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  transition: opacity 0.4s ease, box-shadow 0.4s ease, transform 0.2s ease, border-color 0.4s ease;
  /* Ghost/unassuming state while loading */
  opacity: 0.3;
  box-shadow: none;
  z-index: 1001;
}

/* Progress ring — sits behind all content */
#pcw-fab-ring {
  position: absolute;
  inset: 0;
  width: 56px;
  height: 56px;
  transform: rotate(-90deg); /* start arc at 12 o'clock */
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.pcw-ring-track {
  fill: none;
  stroke: rgba(0, 200, 255, 0.1);
  stroke-width: 2.5;
}

#pcw-ring-fill {
  fill: none;
  stroke: var(--pcw-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 150.796;
  stroke-dashoffset: 150.796; /* starts fully hidden */
  transition: stroke-dashoffset 0.5s ease;
}

/* Mic icon inside FAB */
#pcw-fab .pcw-fab-mic {
  width: 20px;
  height: 20px;
  stroke: rgba(226, 232, 240, 0.4);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.4s ease;
  flex-shrink: 0;
}

/* Progress percentage text inside FAB */
#pcw-fab-pct {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--pcw-accent);
  line-height: 1;
  margin-top: 2px;
  transition: opacity 0.3s;
}

/* Hide percentage once ready */
#pcw-fab.pcw-ready #pcw-fab-pct {
  display: none;
}

/* Hide ring once ready */
#pcw-fab.pcw-ready #pcw-fab-ring {
  opacity: 0;
}

#pcw-fab-label {
  display: none; /* hidden until ready */
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: var(--pcw-surface2);
  border: 1px solid var(--pcw-border);
  color: var(--pcw-accent);
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: var(--pcw-radius);
  white-space: nowrap;
  pointer-events: none;
}

/* In-progress state — activated once downloading begins */
#pcw-fab.pcw-progress {
  opacity: 0.6;
  border-color: rgba(0, 200, 255, 0.35);
}

/* Ready state — activated by widget.js adding .pcw-ready */
#pcw-fab.pcw-ready {
  opacity: 1;
  border-color: rgba(0, 200, 255, 0.5);
  box-shadow: 0 0 16px rgba(0, 200, 255, 0.25), 0 0 4px rgba(0, 200, 255, 0.15);
  animation: pcw-fab-pulse 3s ease-in-out infinite;
}

#pcw-fab.pcw-ready .pcw-fab-mic {
  stroke: var(--pcw-accent);
}

#pcw-fab.pcw-ready #pcw-fab-label {
  display: block;
  animation: pcw-fade-in 0.5s ease forwards;
}

#pcw-fab:hover {
  transform: scale(1.06);
}

#pcw-fab:active {
  transform: scale(0.96);
}

@keyframes pcw-fab-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(0,200,255,0.25), 0 0 4px rgba(0,200,255,0.15); }
  50%       { box-shadow: 0 0 24px rgba(0,200,255,0.4),  0 0 8px rgba(0,200,255,0.25); }
}

/* ── Toast notification ────────────────────────────────────── */

#pcw-toast {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  background: var(--pcw-surface2);
  border: 1px solid var(--pcw-border);
  border-left: 3px solid var(--pcw-accent2);
  color: var(--pcw-accent2);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-radius: var(--pcw-radius);
  white-space: nowrap;
  pointer-events: all;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 1002;
  animation: pcw-toast-in 0.35s ease forwards;
}

#pcw-toast.pcw-toast-out {
  animation: pcw-toast-out 0.4s ease forwards;
}

@keyframes pcw-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pcw-toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

/* ── Chat Panel ────────────────────────────────────────────── */

#pcw-panel {
  position: fixed;
  bottom: 5.5rem;
  right: 2rem;
  width: 380px;
  height: 520px;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--pcw-border);
  border-radius: var(--pcw-radius);
  box-shadow: var(--pcw-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: all;
  z-index: 1001;

  /* Hidden by default */
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#pcw-panel.pcw-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Panel header ───────────────────────────────────────────── */

#pcw-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(10, 245, 180, 0.04);
  border-bottom: 1px solid var(--pcw-border);
  flex-shrink: 0;
}

#pcw-panel-title {
  font-family: 'Syne', 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pcw-accent2);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

#pcw-panel-title .pcw-glyph {
  color: var(--pcw-accent);
  font-size: 16px;
}

#pcw-model-badges {
  display: flex;
  gap: 4px;
}

.pcw-badge {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 2px;
  border: 1px solid rgba(226,232,240,0.15);
  color: rgba(226,232,240,0.4);
  background: transparent;
  transition: all 0.3s ease;
}

.pcw-badge[data-s="loading"] {
  color: rgba(226,232,240,0.35);
  border-color: rgba(226,232,240,0.12);
}

.pcw-badge[data-s="ready"] {
  color: var(--pcw-accent2);
  border-color: rgba(10,245,180,0.4);
  background: rgba(10,245,180,0.06);
}

.pcw-badge[data-s="error"] {
  color: var(--pcw-pink);
  border-color: rgba(255,77,109,0.4);
  background: rgba(255,77,109,0.06);
}

#pcw-close {
  background: none;
  border: none;
  color: var(--pcw-text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  border-radius: 2px;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}

#pcw-close:hover {
  color: var(--pcw-pink);
}


/* ── Loading section ───────────────────────────────────────── */

#pcw-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 24px 20px;
  overflow: hidden;
}

#pcw-loading.pcw-hidden {
  display: none;
}

.pcw-load-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pcw-load-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pcw-load-name {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pcw-text-dim);
}

.pcw-load-pct {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--pcw-accent);
  transition: color 0.3s;
}

.pcw-load-row.done .pcw-load-pct {
  color: var(--pcw-accent2);
}

.pcw-load-track {
  height: 3px;
  background: rgba(226,232,240,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.pcw-load-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pcw-accent), var(--pcw-accent2));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.pcw-load-row.done .pcw-load-fill {
  background: var(--pcw-accent2);
}

.pcw-load-msg {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--pcw-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#pcw-load-error {
  font-size: 12px;
  color: var(--pcw-pink);
  margin-top: 8px;
  text-align: center;
}

/* ── Chat area ──────────────────────────────────────────────── */

#pcw-chat-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#pcw-chat-area::-webkit-scrollbar { width: 4px; }
#pcw-chat-area::-webkit-scrollbar-track { background: transparent; }
#pcw-chat-area::-webkit-scrollbar-thumb { background: rgba(0,200,255,0.2); border-radius: 2px; }

#pcw-empty-state {
  margin: auto;
  text-align: center;
  color: var(--pcw-text-dim);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  padding: 20px;
}

#pcw-empty-state .pcw-empty-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 10px;
}

/* ── Message rows ───────────────────────────────────────────── */

.pcw-msg-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 88%;
}

.pcw-msg-row.user {
  align-self: flex-end;
  align-items: flex-end;
}

.pcw-msg-row.ai {
  align-self: flex-start;
  align-items: flex-start;
}

.pcw-msg-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pcw-msg-row.user .pcw-msg-label { color: var(--pcw-accent); }
.pcw-msg-row.ai  .pcw-msg-label { color: var(--pcw-accent2); }

.pcw-msg-bubble {
  padding: 9px 12px;
  border-radius: var(--pcw-radius);
  font-size: 13px;
  line-height: 1.55;
  font-family: 'DM Sans', sans-serif;
}

.pcw-msg-row.user .pcw-msg-bubble {
  background: rgba(0, 200, 255, 0.1);
  border-left: 2px solid var(--pcw-accent);
  color: var(--pcw-text);
}

.pcw-msg-row.ai .pcw-msg-bubble {
  background: rgba(10, 245, 180, 0.07);
  border-left: 2px solid var(--pcw-accent2);
  color: var(--pcw-text);
}

.pcw-msg-bubble.streaming::after {
  content: "▌";
  animation: pcw-blink 0.7s steps(1) infinite;
  color: var(--pcw-accent2);
  margin-left: 1px;
}

.pcw-msg-time {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--pcw-text-dim);
}

/* ── Typing indicator ────────────────────────────────────────── */

.pcw-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(10,245,180,0.07);
  border-left: 2px solid var(--pcw-accent2);
  border-radius: var(--pcw-radius);
  align-self: flex-start;
}

.pcw-typing-dot {
  width: 5px;
  height: 5px;
  background: var(--pcw-accent2);
  border-radius: 50%;
  animation: pcw-typing-bounce 1.2s ease infinite;
}

.pcw-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.pcw-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pcw-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* ── Audio player ───────────────────────────────────────────── */

.pcw-msg-audio {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.pcw-audio-play-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--pcw-border2);
  background: rgba(10,245,180,0.08);
  color: var(--pcw-accent2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}

.pcw-audio-play-btn:hover { background: rgba(10,245,180,0.15); }
.pcw-audio-play-btn svg { width: 12px; height: 12px; fill: currentColor; }
.pcw-audio-play-btn .pcw-pause-icon { display: none; }
.pcw-audio-play-btn[data-playing="true"] .pcw-play-icon  { display: none; }
.pcw-audio-play-btn[data-playing="true"] .pcw-pause-icon { display: block; }

.pcw-audio-duration {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--pcw-text-dim);
}

/* ── Controls bar ────────────────────────────────────────────── */

#pcw-controls {
  flex-shrink: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--pcw-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(13,17,23,0.6);
}

/* Status pill */
#pcw-status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
}

#pcw-status-text {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pcw-text-dim);
}

#pcw-status-pill.active #pcw-status-text { color: var(--pcw-accent); }
#pcw-status-pill.error  #pcw-status-text { color: var(--pcw-pink); }

#pcw-mute {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  padding: 0 0 0 6px;
  line-height: 1;
  opacity: 0.55;
  transition: opacity 0.2s;
}

#pcw-mute:hover { opacity: 1; }

#pcw-mute[data-speaking="true"] {
  display: inline-block;
  animation: pcw-mute-flash 0.8s ease-in-out infinite;
}

#pcw-mute[data-speaking="true"][data-muted="true"] {
  animation-name: pcw-mute-flash-dim;
}

@keyframes pcw-mute-flash {
  0%, 100% { opacity: 0.45; }
  50%       { opacity: 1; }
}

@keyframes pcw-mute-flash-dim {
  0%, 100% { opacity: 0.2; }
  50%       { opacity: 0.55; }
}

/* Voice + waveform row */
#pcw-voice-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Record button */
#pcw-record-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

#pcw-rings {
  position: absolute;
  inset: -6px;
  pointer-events: none;
}

#pcw-rings span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--pcw-pink);
  opacity: 0;
  transform: scale(0.85);
}

#pcw-rings.active span:nth-child(1) { animation: pcw-ring 1.5s ease-out infinite 0s; }
#pcw-rings.active span:nth-child(2) { animation: pcw-ring 1.5s ease-out infinite 0.5s; }
#pcw-rings.active span:nth-child(3) { animation: pcw-ring 1.5s ease-out infinite 1s; }

@keyframes pcw-ring {
  0%   { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.6);  opacity: 0; }
}

#pcw-record-btn {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255,77,109,0.5);
  background: rgba(255,77,109,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#pcw-record-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#pcw-record-btn:not(:disabled):hover {
  background: rgba(255,77,109,0.2);
  border-color: rgba(255,77,109,0.7);
}

#pcw-record-btn.recording {
  background: rgba(255,77,109,0.3);
  border-color: var(--pcw-pink);
  box-shadow: 0 0 12px rgba(255,77,109,0.3);
}

#pcw-record-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--pcw-pink);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

#pcw-record-btn .pcw-stop-icon { display: none; }
#pcw-record-btn.recording .pcw-mic-icon  { display: none; }
#pcw-record-btn.recording .pcw-stop-icon { display: block; }

/* Waveform canvas */
#pcw-waveform {
  flex: 1;
  height: 36px;
  border-radius: var(--pcw-radius);
  background: rgba(0,200,255,0.03);
  border: 1px solid var(--pcw-border);
  opacity: 0.5;
  transition: opacity 0.3s;
}

#pcw-waveform.active {
  opacity: 1;
}

/* Mic hint */
#pcw-mic-hint {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--pcw-text-dim);
  text-align: center;
  letter-spacing: 0.04em;
}

/* Text input row */
#pcw-text-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

#pcw-text-input {
  flex: 1;
  background: rgba(0,200,255,0.04);
  border: 1px solid var(--pcw-border);
  border-radius: var(--pcw-radius);
  color: var(--pcw-text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}

#pcw-text-input::placeholder {
  color: var(--pcw-text-dim);
}

#pcw-text-input:focus {
  border-color: rgba(0,200,255,0.45);
}

#pcw-text-input:disabled {
  opacity: 0.4;
}

#pcw-send-btn {
  background: rgba(0,200,255,0.12);
  border: 1px solid rgba(0,200,255,0.3);
  border-radius: var(--pcw-radius);
  color: var(--pcw-accent);
  cursor: pointer;
  padding: 7px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

#pcw-send-btn:hover:not(:disabled) {
  background: rgba(0,200,255,0.2);
  border-color: var(--pcw-accent);
}

#pcw-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* iOS tap-to-play */
.pcw-ios-play-btn {
  margin-top: 6px;
}

/* ── RAG Sources panel ───────────────────────────────────────────── */

.pcw-rag-sources {
  margin-top: 6px;
  border-left: 2px solid rgba(10,245,180,0.25);
  padding-left: 8px;
  font-size: 12px;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
}

.pcw-rag-sources-toggle {
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(10,245,180,0.6);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  user-select: none;
}

.pcw-rag-sources-toggle::-webkit-details-marker { display: none; }

.pcw-rag-sources-toggle::before {
  content: "▸";
  font-size: 9px;
  transition: transform 0.15s;
}

.pcw-rag-sources[open] > .pcw-rag-sources-toggle::before {
  transform: rotate(90deg);
}

.pcw-rag-sources-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.pcw-rag-source-item {
  border: 1px solid var(--pcw-border2);
  border-radius: 2px;
  background: rgba(10,245,180,0.03);
  overflow: hidden;
}

.pcw-rag-source-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  gap: 8px;
  list-style: none;
  user-select: none;
}

.pcw-rag-source-header::-webkit-details-marker { display: none; }

.pcw-rag-source-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--pcw-text-dim);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pcw-rag-source-score {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--pcw-accent2);
  flex-shrink: 0;
}

.pcw-rag-source-body {
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pcw-rag-source-question {
  font-size: 11px;
  color: var(--pcw-text-dim);
  font-family: 'DM Sans', sans-serif;
  font-style: italic;
  margin: 0;
}

.pcw-rag-source-answer {
  font-size: 11px;
  color: rgba(226,232,240,0.7);
  font-family: 'DM Sans', sans-serif;
  margin: 0;
  line-height: 1.5;
}

/* ── Utility animations ──────────────────────────────────────── */

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

@keyframes pcw-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Mobile ──────────────────────────────────────────────────── */

@media (max-width: 480px) {
  #pcw-fab {
    bottom: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
  }

  #pcw-panel {
    bottom: 4.5rem;
    right: 1rem;
    width: calc(100vw - 2rem);
    height: 75vh;
  }

  #pcw-toast {
    bottom: 5.5rem;
    right: 1rem;
    font-size: 11px;
  }
}

/* ── Large mobile (added via JS when window.innerWidth ≥ 390) ── */
/* Applied by ios-faq.js: root.classList.add("pcw-large-mobile")  */

#pcw-root.pcw-large-mobile {
  font-size: 18px;
}

#pcw-root.pcw-large-mobile #pcw-panel {
  height: 82vh;
}

#pcw-root.pcw-large-mobile #pcw-panel-title {
  font-size: 16px;
}

#pcw-root.pcw-large-mobile .pcw-badge {
  font-size: 12px;
  padding: 3px 7px;
}

#pcw-root.pcw-large-mobile .pcw-msg-bubble {
  font-size: 16px;
  padding: 12px 15px;
}

#pcw-root.pcw-large-mobile .pcw-msg-label {
  font-size: 11px;
}

#pcw-root.pcw-large-mobile .pcw-msg-time {
  font-size: 12px;
}

#pcw-root.pcw-large-mobile #pcw-text-input {
  font-size: 16px; /* ≥16 px prevents iOS auto-zoom on focus */
  padding: 10px 12px;
}

#pcw-root.pcw-large-mobile #pcw-send-btn {
  font-size: 14px;
  padding: 10px 15px;
}

#pcw-root.pcw-large-mobile #pcw-record-wrap {
  width: 54px;
  height: 54px;
}

#pcw-root.pcw-large-mobile .pcw-load-name,
#pcw-root.pcw-large-mobile .pcw-load-pct {
  font-size: 14px;
}

#pcw-root.pcw-large-mobile .pcw-load-msg {
  font-size: 13px;
}

#pcw-root.pcw-large-mobile #pcw-status-text {
  font-size: 13px;
}

#pcw-root.pcw-large-mobile .pcw-faq-play-btn,
#pcw-root.pcw-large-mobile .pcw-faq-stop-btn {
  font-size: 13px;
  padding: 7px 14px;
}

#pcw-root.pcw-large-mobile .pcw-faq-matched-q {
  font-size: 13px;
}

#pcw-root.pcw-large-mobile .pcw-faq-other-card {
  padding: 9px 12px;
  font-size: 15px;
}

#pcw-root.pcw-large-mobile #pcw-empty-state {
  font-size: 16px;
}

/* ── iOS FAQ TTS controls ─────────────────────────────────── */
#pcw-root .pcw-faq-tts-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

#pcw-root .pcw-faq-play-btn,
#pcw-root .pcw-faq-stop-btn {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid rgba(10,245,180,0.3);
  background: rgba(10,245,180,0.06);
  color: var(--pcw-accent2);
  cursor: pointer;
  transition: background 0.15s;
}

#pcw-root .pcw-faq-play-btn:hover,
#pcw-root .pcw-faq-stop-btn:hover {
  background: rgba(10,245,180,0.14);
}

/* ── Other questions panel ────────────────────────────────── */
#pcw-root .pcw-faq-other {
  margin-top: 6px;
  width: 100%;
  box-sizing: border-box;
}

#pcw-root .pcw-faq-other-card {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--pcw-border2);
  border-radius: 2px;
  background: rgba(10,245,180,0.03);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  font-family: inherit;
  color: inherit;
}

#pcw-root .pcw-faq-other-card:hover {
  background: rgba(10,245,180,0.08);
}

/* ── iOS FAQ matched-question header ─────────────────────── */
#pcw-root .pcw-faq-matched-q {
  font-size: 10px;
  opacity: 0.55;
  margin-bottom: 6px;
  font-style: italic;
  border-bottom: 1px solid rgba(10,245,180,0.15);
  padding-bottom: 4px;
}
