/* 경기도서관 창의 아고라 - 소크라테스 인터랙션 웹 스타일 */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --bg-dark: #0f172a;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sub: #475569;
  --border-color: #e2e8f0;
  --accent-call: #10b981;
  --accent-end: #ef4444;
  --accent-gold: #f59e0b;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-card: 0 20px 45px -10px rgba(15, 23, 42, 0.12), 0 10px 20px -5px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  background-color: #f1f5f9;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

/* 배경 글로우 장식 */
.ambient-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}
.glow-top {
  top: -100px;
  left: 10%;
  background: radial-gradient(circle, #38bdf8, #818cf8);
}
.glow-bottom {
  bottom: -100px;
  right: 10%;
  background: radial-gradient(circle, #f43f5e, #fb923c);
}

/* 피그마 원본 iPad 규격 (834 x 1194) 컨테이너 */
.kiosk-container {
  width: min(834px, 100vw);
  aspect-ratio: 834 / 1194;
  height: auto;
  max-height: 98vh;
  background: #1e1b18;
  border-radius: clamp(16px, 3vw, 40px);
  box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.6), 0 10px 30px -5px rgba(0, 0, 0, 0.3);
  margin: auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* 상단 상태 바 */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(30, 26, 22, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  z-index: 10;
}

.brand-tag {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-tag .dot {
  width: 9px;
  height: 9px;
  background-color: var(--accent-call);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}
.brand-tag .lib-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.2px;
}

.zone-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-api-key {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-api-key:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* API 설정 모달 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden {
  display: none;
}
.modal-box {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
.modal-box h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.modal-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}
.modal-box input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  font-size: 0.95rem;
  margin-bottom: 16px;
  outline: none;
}
.modal-box input:focus {
  border-color: var(--primary);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.btn-save {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
}
.btn-clear {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  color: var(--text-sub);
  border: none;
  font-weight: 600;
  cursor: pointer;
}
.btn-close {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  cursor: pointer;
}

/* 화면 전환 */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 30px 32px;
  animation: fadeIn 0.35s ease-out forwards;
}
.screen.active {
  display: flex;
}

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

/* 1. 수신 대기 화면 (Figma 디자인 반영) */
#incoming-screen.figma-incoming {
  position: relative;
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  background-image: url('../assets/figma/bg_ca031.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: clamp(36px, 5vh, 64px) clamp(20px, 4vw, 36px) clamp(40px, 5.5vh, 68px);
  overflow: hidden;
  color: #ffffff;
}

#incoming-screen.figma-incoming.active {
  display: flex;
}

.figma-bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg, 
    rgba(40, 36, 30, 0.45) 0%, 
    rgba(35, 32, 28, 0.6) 50%,
    rgba(25, 22, 18, 0.8) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.figma-incoming-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

/* 1. 대형 타이틀: 소크라테스 (피그마 160px 비례) */
.figma-caller-title {
  font-size: clamp(4.2rem, 11vw, 7.5rem);
  font-weight: 900;
  color: #f5f5f5;
  letter-spacing: -3px;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.65), 0 2px 4px rgba(0, 0, 0, 0.8);
  margin-top: clamp(6px, 1.5vh, 20px);
  line-height: 1.05;
  user-select: none;
}

/* 2. 중앙 아바타 & 파동 링 (피그마 지름 404px 비례) */
.figma-avatar-container {
  position: relative;
  width: clamp(260px, 38vw, 360px);
  height: clamp(260px, 38vw, 360px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto auto;
}

.figma-avatar-circle {
  width: clamp(210px, 31vw, 290px);
  height: clamp(210px, 31vw, 290px);
  border-radius: 50%;
  overflow: hidden;
  background: #ffffff;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), inset 0 2px 8px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 3;
}

.figma-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* 파동 링 애니메이션 */
.figma-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  pointer-events: none;
  z-index: 2;
  transition: all 0.3s ease;
}

.figma-ring.ring-1 {
  width: clamp(230px, 34vw, 320px);
  height: clamp(230px, 34vw, 320px);
  animation: ringPulseFigma 3s ease-in-out infinite;
}

.figma-ring.ring-2 {
  width: clamp(260px, 38vw, 360px);
  height: clamp(260px, 38vw, 360px);
  animation: ringPulseFigma 3s ease-in-out infinite 0.5s;
}

.figma-ring.ring-3 {
  width: clamp(290px, 42vw, 400px);
  height: clamp(290px, 42vw, 400px);
  animation: ringPulseFigma 3s ease-in-out infinite 1s;
}

@keyframes ringPulseFigma {
  0% {
    transform: scale(0.96);
    opacity: 0.25;
    border-color: rgba(255, 255, 255, 0.25);
  }
  50% {
    transform: scale(1.05);
    opacity: 0.75;
    border-color: rgba(255, 255, 255, 0.65);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
  }
  100% {
    transform: scale(0.96);
    opacity: 0.25;
    border-color: rgba(255, 255, 255, 0.25);
  }
}

/* 3. 안내 문구 (피그마 32px / 26px 비례) */
.figma-message-group {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.5vh, 18px);
  margin-bottom: clamp(16px, 2.5vh, 28px);
}

.figma-msg-call {
  font-size: clamp(1.75rem, 3.8vw, 2.35rem);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.4px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.figma-msg-sub {
  font-size: clamp(1.25rem, 2.9vw, 1.7rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.2px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* 4. 전화 받기 버튼 (피그마 492px x 134px 비례) */
.figma-btn-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: clamp(10px, 2vh, 24px);
}

.figma-btn-answer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: clamp(340px, 58vw, 480px);
  height: clamp(84px, 10vh, 120px);
  padding: 0 clamp(24px, 4vw, 44px);
  border-radius: 60px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background-color: #f7f3ed;
  background-image: url('../assets/figma/btn_bg_1fe90.png');
  background-size: cover;
  background-position: center;
  box-shadow: 
    0 16px 36px rgba(0, 0, 0, 0.4),
    0 4px 10px rgba(0, 0, 0, 0.2),
    inset 0 2px 4px rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: figmaBtnFloat 2.6s ease-in-out infinite;
}

.figma-btn-answer:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 
    0 20px 42px rgba(0, 0, 0, 0.45),
    inset 0 2px 6px rgba(255, 255, 255, 0.9);
}

.figma-btn-answer:active {
  transform: translateY(1px) scale(0.98);
}

.figma-btn-icon {
  width: clamp(42px, 5.5vw, 56px);
  height: clamp(42px, 5.5vw, 56px);
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.15));
}

.figma-btn-text {
  font-size: clamp(1.8rem, 4.2vw, 2.5rem);
  font-weight: 800;
  color: #1a1a1a;
  letter-spacing: -0.5px;
}

@keyframes figmaBtnFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

/* 레거시 클래스 호환 */
.avatar-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-circle {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  border: 4px solid #ffffff;
  z-index: 2;
}

.avatar-icon {
  font-size: 52px;
}

.avatar-ring {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid rgba(37, 99, 235, 0.4);
  animation: ringPulse 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

@keyframes ringPulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.35); opacity: 0.3; }
  100% { transform: scale(1.7); opacity: 0; }
}

.caller-info .caller-sub {
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 600;
  display: block;
  margin-bottom: 8px;
}
.caller-info .caller-name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}
.caller-info .call-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 380px;
  margin: 0 auto 36px;
  line-height: 1.5;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 40px;
  border-radius: 50px;
  border: none;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.btn-accept {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  animation: pulseScale 1.8s infinite;
}
.btn-accept:active {
  transform: scale(0.97);
}

@keyframes pulseScale {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35); }
  50% { transform: scale(1.04); box-shadow: 0 12px 32px rgba(16, 185, 129, 0.55); }
}

.whisper-hint {
  margin-top: 40px;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 10px 20px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

/* 2. 통화 중 화면 (Figma '2. 인사' 디자인 반영) */
#call-screen.figma-incall {
  position: relative;
  flex: 1;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  background-image: url('../assets/figma/bg_incall_622ee.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: clamp(30px, 4.5vh, 54px) clamp(24px, 4vw, 42px) clamp(24px, 3.8vh, 44px);
  overflow: hidden;
  color: #ffffff;
}

#call-screen.figma-incall.active {
  display: flex;
}

.figma-bg-overlay.incall-overlay {
  background: linear-gradient(
    180deg, 
    rgba(0, 0, 0, 0.45) 0%, 
    rgba(0, 0, 0, 0.1) 35%,
    rgba(0, 0, 0, 0.35) 100%
  );
}

/* 상단 상태 및 종료 버튼 (피그마 원본: 중앙 상태 타이머 + 우측 상단 종료 버튼) */
.figma-incall-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: clamp(68px, 9.5vw, 84px);
}

.figma-call-status {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  white-space: nowrap;
  pointer-events: none;
}

.figma-status-dot {
  width: clamp(14px, 2vw, 18px);
  height: clamp(14px, 2vw, 18px);
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.85);
  animation: blink 1.5s infinite;
}

.figma-status-label {
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  letter-spacing: -0.3px;
}

.figma-call-timer {
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

.figma-btn-hangup {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  width: clamp(68px, 9.5vw, 84px);
  height: clamp(68px, 9.5vw, 84px);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
}

.figma-btn-hangup:hover {
  transform: scale(1.08) rotate(-4deg);
}

.figma-btn-hangup:active {
  transform: scale(0.94);
}

.hangup-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* 중앙 캐릭터 영역 (피그마 원본: 바닥에 안정적으로 위치, 공중 부양 애니메이션 제거) */
.figma-character-container {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto auto;
}

.socrates-character-wrap {
  width: 100%;
  max-width: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.socrates-full-img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  display: block;
  animation: none !important;
  filter: none !important;
  transition: opacity 0.25s ease;
  position: relative;
  user-select: none;
  -webkit-user-drag: none;
}

/* 하단 대화창 (피그마 원본 위치) */
.figma-dialog-section {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 676px;
  margin: 0 auto clamp(20px, 4vh, 44px);
}

/* 이름표 뱃지 (피그마 원본: 너비 168px, 높이 62px, 말풍선 상단과 38px 푹 겹침) */
.figma-name-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  background-image: url('../assets/figma/name_tag_1335b.svg');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  color: #1a1a1a;
  font-size: 1.65rem;
  font-weight: 800;
  width: 168px;
  height: 62px;
  padding: 0 0 6px 0;
  border-radius: 0;
  margin-left: 14px;
  margin-bottom: -38px;
  position: relative;
  z-index: 10;
  box-shadow: none;
  letter-spacing: -0.5px;
  pointer-events: none;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
}

/* 말풍선 본체 (피그마 순수 SVG 형태 - 676px x 195px 비율) */
.figma-speech-bubble {
  background-color: transparent;
  background-image: url('../assets/figma/dialog_box_5dfd1.svg');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border-radius: 0;
  padding: 42px 48px 36px 48px;
  box-shadow: none;
  min-height: 195px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.figma-speech-text {
  font-size: 1.95rem;
  font-weight: 700;
  line-height: 1.48;
  color: #4f321c;
  word-break: keep-all;
  letter-spacing: -0.5px;
  flex: 1;
  text-align: left;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', sans-serif;
}

.figma-bubble-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.figma-replay-btn {
  background: rgba(79, 50, 28, 0.08);
  border: 1px solid rgba(79, 50, 28, 0.15);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.figma-replay-btn:hover {
  background: rgba(79, 50, 28, 0.18);
  transform: scale(1.08);
}

.figma-next-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  border-radius: 20px;
  color: #ffffff;
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.figma-next-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
}

.figma-next-btn:active {
  transform: translateY(1px) scale(0.97);
}

/* 캐릭터 포즈 교체 시 부드러운 페이드 */
.socrates-full-img {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.socrates-full-img.fade-out {
  opacity: 0;
  transform: scale(0.96);
}

/* 사용자 말할 때 초록 이름표 */
/* 사용자 말할 때 초록 이름표 (구버전 사각 배경 완전 제거) */
.figma-name-badge.user-speaker {
  background-color: transparent !important;
  background-image: url('../assets/figma/name_tag_me_b2a32.svg') !important;
  color: #ffffff !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

/* 사용자 음성 인터랙션 바 */
.figma-user-interaction {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.user-mic-status-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(25, 22, 18, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  padding: 6px 20px 6px 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  max-width: 95%;
}

.figma-mic-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  border-radius: 50px;
  color: white;
  padding: 8px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.figma-mic-btn:hover {
  transform: scale(1.04);
}

.figma-mic-btn.recording {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  animation: pulseScale 1.2s infinite;
}

.figma-transcript-text {
  font-size: 1.05rem;
  color: #f1f5f9;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 380px;
}

.figma-mic-hint {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* 2. 레거시 통화 중 화면 스타일 (호환 유지) */
.call-active-card {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.call-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.call-target {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-indicator.live {
  width: 10px;
  height: 10px;
  background: var(--accent-call);
  border-radius: 50%;
  animation: blink 1.2s infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.target-name {
  font-size: 1.05rem;
  font-weight: 700;
}
.call-timer {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* 소크라테스 비주얼 및 음파 */
.socrates-visual {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f8fafc;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}
.socrates-avatar-small {
  width: 50px;
  height: 50px;
  background: #1e293b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.waveform-container {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  flex: 1;
}
.wave-bar {
  width: 4px;
  height: 8px;
  background: #cbd5e1;
  border-radius: 4px;
  transition: height 0.15s ease;
}
.waveform-container.talking .wave-bar {
  background: var(--primary);
  animation: waveAnim 0.8s ease-in-out infinite alternate;
}
.waveform-container.talking .wave-bar:nth-child(1) { animation-delay: 0.1s; height: 16px; }
.waveform-container.talking .wave-bar:nth-child(2) { animation-delay: 0.3s; height: 28px; }
.waveform-container.talking .wave-bar:nth-child(3) { animation-delay: 0.2s; height: 34px; }
.waveform-container.talking .wave-bar:nth-child(4) { animation-delay: 0.4s; height: 22px; }
.waveform-container.talking .wave-bar:nth-child(5) { animation-delay: 0.15s; height: 32px; }
.waveform-container.talking .wave-bar:nth-child(6) { animation-delay: 0.35s; height: 26px; }
.waveform-container.talking .wave-bar:nth-child(7) { animation-delay: 0.25s; height: 14px; }

@keyframes waveAnim {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.3); }
}

.call-status-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 6px 14px;
  border-radius: 20px;
}

/* 자막 카드 */
.subtitle-card {
  background: linear-gradient(180deg, #f0f7ff, #ffffff);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 24px 26px;
  margin-bottom: 18px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.05);
}
.subtitle-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}
.tts-replay-btn {
  background: none;
  border: none;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.tts-replay-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}
.subtitle-text {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.6;
  color: #1e293b;
  letter-spacing: -0.3px;
  min-height: 70px;
}

/* 사용자 응답 박스 */
.user-response-box {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 22px;
  border: 1px dashed var(--border-color);
}
.user-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}
.transcript-placeholder {
  font-size: 1.05rem;
  color: var(--text-sub);
  font-style: italic;
  min-height: 28px;
}

/* 마이크 버튼 컨트롤 */
.call-controls {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mic-control-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.mic-main-btn {
  width: 100%;
  max-width: 380px;
  padding: 20px 24px;
  border-radius: 50px;
  border: none;
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}
.mic-main-btn:active {
  transform: scale(0.98);
}
.mic-main-btn.recording {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.45);
  animation: pulseScale 1.2s infinite;
}
.mic-main-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.mic-sub-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* 유틸리티 바 (텍스트 모드 & 종료) */
.utility-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.util-btn {
  flex: 1;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-sub);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.util-btn:hover {
  background: #f8fafc;
}
.util-btn.btn-hangup {
  color: var(--accent-end);
  border-color: #fecaca;
  background: #fef2f2;
}

/* 텍스트 입력창 */
.text-input-panel {
  margin-top: 6px;
  transition: all 0.2s ease;
}
.text-input-panel.hidden {
  display: none;
}
.input-row {
  display: flex;
  gap: 10px;
}
.input-row input {
  flex: 1;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-color);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}
.input-row input:focus {
  border-color: var(--primary);
}
.btn-send-text {
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

/* 에티켓 배너 */
.etiquette-banner {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

/* 3. 종료 화면 */
#end-screen .end-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.end-icon {
  font-size: 56px;
  margin-bottom: 16px;
}
.end-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.end-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.recap-card {
  width: 100%;
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  text-align: left;
}
.recap-tag {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
  margin-bottom: 6px;
}
.recap-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.5;
}
.recap-divider {
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

.booth-nudge-box {
  width: 100%;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin-bottom: 30px;
  border: 1px solid #fcd34d;
  text-align: left;
}
.nudge-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  color: #92400e;
  background: #ffffff;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.booth-nudge-box h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #78350f;
  margin-bottom: 8px;
}
.nudge-desc {
  font-size: 0.98rem;
  color: #92400e;
  line-height: 1.5;
}

.btn-restart {
  background: var(--bg-dark);
  color: white;
}

/* 아이패드 및 태블릿 대응 미디어 쿼리 */
@media (max-width: 600px) {
  .kiosk-container {
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
    border: none;
  }
  .screen {
    padding: 24px 20px;
  }
  .subtitle-text {
    font-size: 1.18rem;
  }
}

/* =============================================================
   캐릭터 위치/크기 조절기 (Tuner Widget)
   ============================================================= */
.tuner-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: linear-gradient(135deg, #ff8c00, #e65100);
  color: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(230, 81, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tuner-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(230, 81, 0, 0.6);
}

.tuner-panel {
  display: none;
  position: fixed;
  bottom: 74px;
  right: 24px;
  width: 330px;
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(24, 24, 28, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 18px 20px;
  color: #f1f5f9;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, 'Pretendard', sans-serif;
  animation: tunerFadeIn 0.2s ease;
}

.tuner-panel.active {
  display: block;
}

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

.tuner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tuner-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ff9800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tuner-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
}

.tuner-close-btn:hover {
  color: #fff;
}

.tuner-row {
  margin-bottom: 14px;
}

.tuner-label-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.tuner-val-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #38bdf8;
}

.tuner-ctrl-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tuner-slider {
  flex: 1;
  accent-color: #ff9800;
  cursor: pointer;
}

.tuner-mini-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.tuner-mini-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.tuner-select {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

.tuner-select option {
  background: #1e1e24;
  color: #fff;
}

.tuner-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tuner-btn-copy {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s;
}

.tuner-btn-copy:hover {
  background: #1d4ed8;
}

.tuner-btn-reset {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}

.tuner-btn-reset:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.tuner-output-box {
  width: 100%;
  height: 90px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #38bdf8;
  font-family: monospace;
  font-size: 0.75rem;
  padding: 8px;
  resize: vertical;
  margin-top: 8px;
  box-sizing: border-box;
}

.tuner-drag-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: center;
  margin-top: 6px;
}

.socrates-full-img.draggable-active {
  cursor: grab;
}
.socrates-full-img.draggable-active:active {
  cursor: grabbing;
}

/* =============================================================
   6번 화면 전용 스타일 (첫번째 사용자 질문 듣기)
   ============================================================= */

/* 초록색 '나' 이름표 뱃지 */
.figma-name-badge.user-speaker {
  background-color: transparent !important;
  background-image: url('../assets/figma/name_tag_me_b2a32.svg') !important;
  box-shadow: none !important;
  color: #ffffff !important;
  font-size: 1.85rem !important;
  font-weight: 800 !important;
  padding: 0 0 6px 0 !important;
}

/* 말풍선 내부 듣기 UI (음파 + 안내) */
.figma-listening-ui {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  padding: 10px 0;
}

/* 8개의 음파 파형 바 */
.soundwave-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
}

.soundwave-bars .bar {
  display: inline-block;
  width: 5.5px;
  background-color: #725648;
  border-radius: 13px;
  animation: wavePulse 1.2s ease-in-out infinite;
}

.soundwave-bars .bar-1 { height: 17px; animation-delay: 0.1s; }
.soundwave-bars .bar-2 { height: 24px; animation-delay: 0.3s; }
.soundwave-bars .bar-3 { height: 41px; animation-delay: 0.5s; }
.soundwave-bars .bar-4 { height: 17px; animation-delay: 0.2s; }
.soundwave-bars .bar-5 { height: 41px; animation-delay: 0.4s; }
.soundwave-bars .bar-6 { height: 24px; animation-delay: 0.6s; }
.soundwave-bars .bar-7 { height: 17px; animation-delay: 0.25s; }
.soundwave-bars .bar-8 { height: 24px; animation-delay: 0.45s; }

@keyframes wavePulse {
  0%, 100% {
    transform: scaleY(0.5);
    opacity: 0.65;
  }
  50% {
    transform: scaleY(1.15);
    opacity: 1;
  }
}

.listening-guidance-text {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.4;
  color: #4f321c;
  text-align: center;
  word-break: keep-all;
  letter-spacing: -0.4px;
  margin: 0;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: all 0.2s ease;
}

.listening-guidance-text.speaking-active {
  color: #1e3a8a;
  font-size: 1.85rem;
}

/* 우측 하단 '다 말했어요!' 버튼 */
.done-speaking-wrap {
  position: absolute;
  right: 0;
  bottom: -72px;
  z-index: 20;
}

.btn-done-speaking {
  background: transparent url('../assets/figma/btn_done_speaking_b1122.svg') no-repeat center / 100% 100%;
  width: 196px;
  height: 64px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 0 4px 6px;
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  box-shadow: 0 8px 20px rgba(224, 112, 0, 0.35);
  border-radius: 50px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-done-speaking:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 26px rgba(224, 112, 0, 0.5);
}

.btn-done-speaking:active {
  transform: translateY(1px) scale(0.98);
}

.btn-done-speaking .chevron-icon {
  width: 10px;
  height: 18px;
  object-fit: contain;
  margin-top: 1px;
}

/* =============================================================
   16번 화면 전용 스타일 (전화 종료)
   ============================================================= */
.figma-end-screen {
  background: url('../assets/figma/bg_ca031.png') no-repeat center center;
  background-size: cover;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.figma-end-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(54, 51, 44, 0.75) 0%, rgba(54, 51, 44, 0.94) 100%);
  z-index: 1;
}

.figma-end-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(140px, 20vh, 200px) 24px clamp(70px, 9vh, 100px);
  text-align: center;
  box-sizing: border-box;
}

.figma-end-title {
  font-size: 2.6rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 16px 0;
  letter-spacing: -0.6px;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.figma-end-duration {
  font-size: 2rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  margin: 0;
  letter-spacing: -0.4px;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
}

.figma-end-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.figma-end-countdown {
  font-size: 1.65rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  letter-spacing: -0.3px;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
}

.figma-btn-restart {
  background: transparent url('../assets/figma/btn_restart_1fe90.png') no-repeat center / 100% 100%;
  width: min(492px, 86%);
  height: 124px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1a1a1a;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.6px;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  border-radius: 60px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.figma-btn-restart:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.figma-btn-restart:active {
  transform: translateY(2px) scale(0.98);
}
