/* ==========================================================================
   영남이공대학교 음성 안내 키오스크 - 화면 디자인 (TDS / 토스 스타일)
   기준: 토스 디자인 시스템(TDS) design.md + 학교 브랜드(영이 캐릭터, 학교 로고) 유지
   수정 범위: 이 CSS 파일만. 클래스명/ID/data-state 는 index.asp, JS 와 연결되어 있어 변경하지 않음.

   구성 원칙 (TDS)
   - 화면 바탕 = greyBackground(grey-100), 그 위 흰 카드(radius 24, 평면, 그림자 없음)
   - 말풍선 꼬리 X → 토스식 카드 + list-row 레이아웃
   - 강조는 토스 블루 1가지, 상태는 시맨틱 색(red/orange/green)만
   - pressed = 검정 26% 오버레이, 모션 120/200/320ms, 바운스 없음

   크기 단위: rem. 큰 키오스크 화면에서는 html font-size 가 커져 전체가 같은 비율로 확대 (맨 아래 @media)
   ========================================================================== */

:root {
  /* Brand */
  --blue-500: #3182f6;
  --blue-600: #1b64da;
  --blue-50: #e8f3ff;

  /* Greyscale (cool-blue neutrals) */
  --grey-900: #191f28;
  --grey-800: #333d4b;
  --grey-700: #4e5968;
  --grey-600: #6b7684;
  --grey-500: #8b95a1;
  --grey-400: #b0b8c1;
  --grey-300: #d1d6db;
  --grey-200: #e5e8eb;
  --grey-100: #f2f4f6;
  --grey-50: #f9fafb;
  --white: #ffffff;

  /* Semantic */
  --red-500: #f04452;
  --red-50: #ffeeee;
  --green-500: #03b26c;
  --green-ink: #028450;
  --green-50: #e5f8ee;
  --orange-500: #fe9800;
  --orange-50: #fff3e0;
  --orange-ink: #c26e00; /* 연한 주황 배경 위 글자용(가독성 보정) */

  /* Alpha */
  --line-subtle: rgba(0, 0, 0, 0.06);
  --bg-overlay: rgba(0, 0, 0, 0.56);
  --press-overlay: rgba(0, 0, 0, 0.12);
  --press-overlay-fill: rgba(0, 0, 0, 0.26);

  /* Radius ladder (rem) */
  --r-xs: 0.25rem;
  --r-s: 0.5rem;
  --r-m: 0.75rem;
  --r-l: 0.875rem;
  --r-xl: 1rem;
  --r-2xl: 1.25rem;
  --r-3xl: 1.5rem;
  --r-full: 999px;

  /* Elevation (떠 있는 면에만 사용) */
  --shadow-3: 0 0.75rem 2rem rgba(8, 18, 40, 0.1), 0 0.125rem 0.375rem rgba(8, 18, 40, 0.06);
  --shadow-sheet: 0 -0.125rem 0.75rem rgba(8, 18, 40, 0.06);

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;

  /* 아이콘 (버튼 글자가 항상 흰색인 상태에서만 사용) */
  --ico-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cpath d='M12 19v3'/%3E%3C/svg%3E");
  --ico-stop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Crect x='6' y='6' width='12' height='12' rx='3'/%3E%3C/svg%3E");
  --ico-sound: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234e5968' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6 9H3v6h3l5 4V5Z'/%3E%3Cpath d='M15.5 8.5a5 5 0 0 1 0 7'/%3E%3Cpath d='M18.5 5.5a9 9 0 0 1 0 13'/%3E%3C/svg%3E");

  /* 기존 변수명 호환 */
  --blue: var(--blue-500);
  --bg: var(--grey-100);
  --ink: var(--grey-900);
  --ink-2: var(--grey-700);
  --muted: var(--grey-600);
  --line: var(--grey-200);
  --listen: var(--red-500);
}

* { box-sizing: border-box; }

html {
  font-size: 16px;
  background: var(--grey-200);
}

html, body {
  margin: 0;
  height: 100%;
}

body {
  width: min(26.875rem, 100%);
  min-height: 100%;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--grey-900);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Noto Sans KR", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line-subtle);
}

@media (orientation: portrait) {
  html { background: var(--bg); }
  body {
    width: 100%;
    box-shadow: none;
  }
}

button { font-family: inherit; }

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   상단 (top-app-bar): 회색(grey-700) 포인트 바
   로고는 어두운 바탕 위라 흰색 단색으로 표시 (이미지 파일은 그대로)
   -------------------------------------------------------------------------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 4rem;
  padding: 0.75rem 1.25rem 0.75rem 1.5rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  background: var(--grey-700);
  color: var(--white);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.logo-link img {
  height: 2rem;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

/* 상태 칩: 어두운 바 위 반투명 pill + 상태 점 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 2.125rem;
  padding: 0 0.75rem;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.14);
  color: var(--white);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
  transition: background var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}

.badge .dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: #64a8ff;
  transition: background var(--dur-base) var(--ease);
}

/* 소리 설정: 아이콘 + 라벨, ghost 버튼 (흰색) */
.voice-open {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 2.125rem;
  padding: 0 0.75rem 0 0.5rem;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.voice-open::before {
  content: "";
  width: 1.125rem;
  height: 1.125rem;
  background: var(--ico-sound) center / contain no-repeat;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

/* 터치 영역 44px 이상 확보 */
.voice-open::after {
  content: "";
  position: absolute;
  inset: -0.375rem -0.25rem;
}

.voice-open:active { background: rgba(255, 255, 255, 0.12); }

/* --------------------------------------------------------------------------
   제목 / 대화 (메신저형: 영이 = 왼쪽, 나 = 오른쪽)
   -------------------------------------------------------------------------- */
.page {
  flex: 1;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.top-copy {
  padding: 0 0.25rem;
}

.top-copy h1 {
  margin: 1.5rem 0 1.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.36;
  letter-spacing: -0.02em;
  color: var(--grey-900);
}

.talk {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* 한 줄 = 아바타 + 말풍선 */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  min-height: 0;
  overflow: hidden;
}

/* 나: 오른쪽 정렬, 내 아바타는 숨김 (메신저 관례) */
.msg.me {
  flex: 0 1 auto;
  max-height: 40%;
  flex-direction: row-reverse;
  padding-left: 2rem;
}

/* 나 아바타: 오른쪽, 영이 프로필과 같은 크기(3.5rem)
   TDS chip brand(blue-50 + blue-500) 방식 → 채운 파란 버튼과 구분 */
.ava {
  flex: 0 0 3.5rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
}

.ava.me {
  background:#84b7ff; 
  color: #fff;
}




/* 영이: 왼쪽, 캐릭터 프로필 */
.msg.ai {
  flex: 0 1 auto;
  padding-right: 1.5rem;
}

.char {
  flex: 0 0 3.5rem;
  align-self: flex-start;
  width: 3.5rem;
  height: 3.5rem;
  padding: 0.25rem;
  border-radius: 50%;
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--line-subtle);
  object-fit: contain;
  display: block;
}

body[data-state="SPEAKING"] .char {
  animation: think-bob 0.9s var(--ease) infinite;
}

/* 말풍선 공통 */
.say {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  padding: 0.875rem 1.125rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--grey-300) transparent;
  transition: background var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}

.say::-webkit-scrollbar { width: 0.25rem; }
.say::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: var(--r-full); }
.say::-webkit-scrollbar-button { display: none; }

/* 나 = 연한 블루(blue-50) 말풍선, 오른쪽 위 꼬리 (말하기 버튼과 구분) */
.msg.me .say {
  background: var(--blue-50);
  color: var(--grey-900);
  border-radius: var(--r-2xl) var(--r-xs) var(--r-2xl) var(--r-2xl);
}

/* 영이 = 흰 말풍선, 왼쪽 위 꼬리 */
.msg.ai .say {
  background: var(--white);
  color: var(--grey-900);
  border-radius: var(--r-xs) var(--r-2xl) var(--r-2xl) var(--r-2xl);
}

/* 이름 라벨 */
.who {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
}

/* 영이 이름: 말풍선 안 상단 작은 라벨 */
.msg.ai .who {
  margin-bottom: 0.25rem;
  color: var(--blue-500);
}

/* 내 말풍선에는 '질문' 라벨 숨기고, 듣는 중 뱃지만 노출 */
.msg.me .who {
  font-size: 0;
  margin: 0;
}

/* 듣는 중 뱃지 */
.who em[hidden] { display: none; }

.who em {
  display: inline-flex;
  align-items: center;
  height: 1.375rem;
  margin-bottom: 0.375rem;
  padding: 0 0.5rem;
  border-radius: 0.375rem;
  background: var(--red-50);
  color: var(--red-500);
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 600;
}

.txt {
  line-height: 1.5;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.msg.me .txt {
  color: #1957c2;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: -0.005em;
}

.msg.ai .txt {
  color: var(--grey-800);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: -0.005em;
}

/* 듣는 중: 내 말풍선 바깥으로 블루 링 */
body[data-state="LISTENING"] .msg.me .say {
  box-shadow: inset 0 0 0 1.5px var(--blue-500);
}

#user-live.is-live::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 3px;
  vertical-align: -0.15em;
  border-radius: 1px;
  background: var(--blue-500);
  animation: blink 0.8s step-end infinite;
}

/* 길 안내 지도 */
.way[hidden] { display: none; }
.way { margin-top: 1rem; }
.way-frame {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--grey-100);
  box-shadow: inset 0 0 0 1px var(--line-subtle);
}
.way-frame img {
  display: block;
  width: 100%;
  height: auto;
}
.way-frame svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.way-frame line {
  stroke: var(--blue-500);
  stroke-width: 1.15;
  stroke-linecap: round;
}
.way-frame polyline {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.way-frame polyline.halo {
  stroke: #fff;
  stroke-width: 3.4;
}
.way-frame polyline.route {
  stroke: var(--blue-500);
  stroke-width: 1.7;
  marker-end: url(#walk-arrow);
}
.way-frame marker path { fill: var(--blue-500); }
.way-frame circle {
  stroke: #fff;
  stroke-width: 0.45;
}
.way-frame circle.from { fill: var(--grey-900); }
.way-frame circle.to { fill: var(--red-500); }
.way p {
  margin: 0.5rem 0 0;
  color: var(--grey-600);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
}

/* --------------------------------------------------------------------------
   생각 중 (dialog)
   -------------------------------------------------------------------------- */
.think-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.think-layer[hidden] { display: none; }

.think-dim {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  animation: fade-in var(--dur-base) var(--ease);
}

.think-pop {
  position: relative;
  width: min(20rem, 100%);
  padding: 2rem 1.5rem 1.75rem;
  border-radius: var(--r-2xl);
  background: var(--white);
  box-shadow: var(--shadow-3);
  text-align: center;
  animation: think-pop-in var(--dur-slow) var(--ease-out);
}

.think-char {
  width: 7.5rem;
  height: 8.5rem;
  object-fit: contain;
  margin: 0 auto 0.75rem;
  display: block;
  animation: think-bob 1.4s var(--ease) infinite;
}

.think-pop strong {
  display: block;
  color: var(--grey-900);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

/* 3-dot 로더 (skeleton shimmer 대신) */
.think-pop strong::after {
  content: "";
  display: inline-block;
  width: 1.4em;
  text-align: left;
  animation: dots 1.2s steps(1, end) infinite;
}

.think-pop p {
  margin: 0.375rem 0 0;
  color: var(--grey-600);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.005em;
  min-height: 1.5rem;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes think-pop-in {
  from { opacity: 0; transform: translateY(0.75rem) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes think-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.25rem); }
}

@keyframes dots {
  0%   { content: "."; }
  34%  { content: ".."; }
  67%  { content: "..."; }
}

/* 버튼 안 로더용: 세로 가운데에 놓이는 점 글자 */
@keyframes dots-mid {
  0%   { content: "•"; }
  34%  { content: "••"; }
  67%  { content: "•••"; }
}

/* --------------------------------------------------------------------------
   하단 (bottom-cta): 볼륨 / 말하기
   위쪽 bg → transparent 보호 그라디언트 (TDS 허용 예외)
   -------------------------------------------------------------------------- */
.bottom {
  position: relative;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0.75rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  background: var(--bg);
}

.bottom::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 1.5rem;
  background: linear-gradient(to top, var(--bg), rgba(242, 244, 246, 0));
  pointer-events: none;
}

.vol-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0.25rem 0.875rem;
}

.vol-bar {
  flex: 1 1 auto;
  height: 0.25rem;
  border-radius: var(--r-full);
  background: var(--grey-200);
  overflow: hidden;
}

.vol-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: var(--r-full);
  background: var(--blue-500);
  transition: width 0.08s linear;
}

body[data-state="LISTENING"] .vol-bar i { background: var(--red-500); }

#vol-text {
  flex: 0 0 auto;
  min-width: 3rem;
  text-align: right;
  font-size: 0.8125rem;
  color: var(--grey-500);
  font-weight: 600;
  letter-spacing: 0;
}

/* XL 버튼: 56px / radius 16 / label 17 Bold → 키오스크라 한 단계 키움 */
.cta {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 3.75rem;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--blue-500);
  color: var(--white);
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease), transform var(--dur-fast) var(--ease);
}

.cta:active { transform: scale(0.98); }

/* 버튼 앞 아이콘: 말하기/답하는 중 = 마이크, 듣는 중 = 정지 */
body[data-state="IDLE"] .cta::before,
body[data-state="SPEAKING"] .cta::before,
body[data-state="LISTENING"] .cta::before {
  content: "";
  flex: 0 0 auto;
  width: 1.375rem;
  height: 1.375rem;
  background: var(--ico-mic) center / contain no-repeat;
}

body[data-state="LISTENING"] .cta::before { background-image: var(--ico-stop); }

/* pressed = 검정 오버레이 (그림자/색 교체가 아님) */
.cta::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--press-overlay);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
  pointer-events: none;
}

.cta:active::after { opacity: 1; }

/* 상태별 칩/버튼: 듣는 중 = danger, 생각 중 = loading, 말하는 중 = dark */
body[data-state="LISTENING"] .badge { background: var(--red-500); color: var(--white); }
body[data-state="LISTENING"] .badge .dot { background: var(--white); animation: blink 1s step-end infinite; }
body[data-state="LISTENING"] .cta { background: var(--red-500); }

body[data-state="PROCESSING"] .badge { background: var(--blue-50); color: var(--blue-500); }
body[data-state="PROCESSING"] .badge .dot { background: var(--blue-500); animation: blink 1s step-end infinite; }
body[data-state="PROCESSING"] .cta { color: transparent; }
body[data-state="PROCESSING"] .cta::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.8em;
  margin-left: -0.9em;
  transform: translateY(-50%);
  color: var(--white);
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: 0.3em;
  text-align: left;
  animation: dots-mid 1.2s steps(1, end) infinite;
}

body[data-state="SPEAKING"] .badge { background: var(--blue-500); color: var(--white); }
body[data-state="SPEAKING"] .badge .dot { background: var(--white); }
body[data-state="SPEAKING"] .cta { background: var(--blue-600); }

.hint {
  margin: 0.625rem 0 0;
  text-align: center;
  color: var(--grey-500);
  font-size: 0.8125rem;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0;
}

.foot {
  padding: 0 1.25rem max(0.875rem, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--grey-500);
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   소리 설정 (bottom-sheet)
   -------------------------------------------------------------------------- */
.voice-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.voice-layer[hidden] { display: none; }

.voice-dim {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  animation: fade-in var(--dur-base) var(--ease);
}

.voice-sheet {
  position: relative;
  display: flow-root;
  width: min(26.875rem, 100%);
  padding: 0.5rem 1.5rem 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  border-radius: var(--r-3xl) var(--r-3xl) 0 0;
  background: var(--white);
  box-shadow: var(--shadow-sheet);
  animation: sheet-in var(--dur-slow) var(--ease-out);
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.voice-handle {
  width: 2.25rem;
  height: 0.25rem;
  margin: 0.25rem auto 1.25rem;
  border-radius: var(--r-full);
  background: var(--grey-200);
}

.voice-sheet strong {
  display: block;
  color: var(--grey-900);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.voice-help {
  margin: 0.25rem 0 1.5rem;
  color: var(--grey-600);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.005em;
}

.voice-field {
  margin-bottom: 1.5rem;
}

.voice-field span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  color: var(--grey-700);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
}

.voice-field em {
  font-style: normal;
  color: var(--blue-500);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 말투 선택 = chip (resting: 흰 배경 + 헤어라인 / active: grey-900 flip) */
.tone-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.tone {
  position: relative;
  overflow: hidden;
  height: 3rem;
  border: 1px solid var(--grey-200);
  border-radius: var(--r-m);
  background: var(--white);
  color: var(--grey-700);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease), color var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}

.tone:active { background: var(--grey-100); }

.tone.is-on {
  border-color: var(--blue-500);
  background: var(--blue-50);
  color: var(--blue-500);
  box-shadow: inset 0 0 0 0.5px var(--blue-500);
}

#voice-select,
#voice-vol {
  width: 100%;
}

/* text-field: 48px / radius 12 / grey-100 / focus 시 흰 배경 + 파란 1.5px */
#voice-select {
  -webkit-appearance: none;
  appearance: none;
  height: 3rem;
  padding: 0 2.5rem 0 1rem;
  border: 1px solid transparent;
  border-radius: var(--r-m);
  background: var(--grey-100) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 0.875rem center / 1.125rem no-repeat;
  color: var(--grey-900);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background-color var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}

#voice-select:focus {
  outline: 0;
  background-color: var(--white);
  border-color: var(--blue-500);
  box-shadow: 0 0 0 0.5px var(--blue-500);
}

/* 음량 슬라이더: 4px 트랙 + 흰 원형 thumb */
#voice-vol {
  -webkit-appearance: none;
  appearance: none;
  height: 1.75rem;
  background: transparent;
  accent-color: var(--blue-500);
  cursor: pointer;
}

#voice-vol::-webkit-slider-runnable-track {
  height: 0.25rem;
  border-radius: var(--r-full);
  background: var(--grey-200);
}

#voice-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: -0.625rem;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 1px var(--line-subtle), 0 2px 6px rgba(8, 18, 40, 0.16);
}

#voice-vol::-moz-range-track {
  height: 0.25rem;
  border-radius: var(--r-full);
  background: var(--grey-200);
}

#voice-vol::-moz-range-progress {
  height: 0.25rem;
  border-radius: var(--r-full);
  background: var(--blue-500);
}

#voice-vol::-moz-range-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 1px var(--line-subtle), 0 2px 6px rgba(8, 18, 40, 0.16);
}

/* 하단 버튼 2개: secondary(미리듣기) + primary(확인), 가로 배치 */
.voice-preview,
.voice-close {
  position: relative;
  overflow: hidden;
  display: inline-block;
  width: calc(50% - 0.25rem);
  height: 3.5rem;
  border: 0;
  border-radius: var(--r-xl);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  vertical-align: top;
  cursor: pointer;
}

.voice-preview::after,
.voice-close::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--press-overlay);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
  pointer-events: none;
}

.voice-preview:active::after,
.voice-close:active::after { opacity: 1; }

.voice-preview {
  float: left;
  background: var(--grey-100);
  color: var(--grey-700);
}

.voice-close {
  float: right;
  background: var(--blue-500);
  color: var(--white);
}

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

/* 낮은 화면(짧은 폰/창) */
@media (max-height: 740px) {
  .say { padding: 0.75rem 1rem; }
  .msg.me .txt { font-size: 1rem; }
  .msg.ai .txt { font-size: 1rem; }
  .cta { height: 3.5rem; font-size: 1.0625rem; }
  .top-copy h1 { font-size: 1.5rem; margin: 0.75rem 0 1rem; }
  .char,
  .ava { flex-basis: 3rem; width: 3rem; height: 3rem; }
}

/* 큰 키오스크 화면: rem 기준을 키워 화면 전체를 같은 비율로 확대 (모바일 폭 약 430px 설계 기준) */
@media (orientation: portrait) and (min-width: 700px) {
  html { font-size: 3.7vw; }
}

@media (orientation: landscape) and (min-height: 700px) {
  html { font-size: max(16px, 2.1vh); }
}

@media (prefers-reduced-motion: reduce) {
  .char,
  .think-char,
  .think-pop,
  .think-dim,
  .voice-dim,
  .voice-sheet,
  .cta { animation: none; transition: none; }
}
