/* ═══════════════════════════════════════════════════════
   LEARNING SCREEN v3 — 2-Zone Flex Layout
   Image Zone (62%) + Input Zone (38%)
   Subtitle = Transparent Overlay on Image
   Mode Toggle = Floating on Image Area
   ═══════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS (Light Default) ── */
/* 홈 colors.css 와 동일한 팔레트 — blue 액센트 */
:root {
  /* ── MAIN LAYOUT RATIO (Image Zone : Input Zone) ── */
  --iz-ratio: 62;
  --iz2-ratio: 38;

  --lrn-bg: #f4f6f9;
  --lrn-s1: #ffffff;
  --lrn-s2: #f0f2f5;
  --lrn-s3: #e4e6ea;
  --lrn-bd: rgba(0, 0, 0, 0.08);
  --lrn-acc: #3b82f6;
  --lrn-acc2: #2563eb;
  --lrn-teal: #0d9488;
  --lrn-rose: #e11d48;
  --lrn-vio: #7c3aed;
  --lrn-blue: #3b82f6;
  --lrn-rose-pale: rgba(225, 29, 72, 0.55);
  --lrn-blue-pale: rgba(59, 130, 246, 0.55);
  --lrn-vio-pale: rgba(124, 58, 237, 0.55);
  --lrn-text: #0f0f0f;
  --lrn-text2: #606060;
  --lrn-fh: var(--font);
  --lrn-fb: var(--font);
  --lrn-fm: 'JetBrains Mono', monospace;
  --lrn-key-fs: 0.9rem;
  --lrn-key-r: 6px;
  /* Semi-transparent layers */
  --lrn-float-bg: rgba(255, 255, 255, 0.88);
  --lrn-float-c: rgba(15, 15, 15, 0.55);
  --lrn-float-brd: rgba(0, 0, 0, 0.10);
  --lrn-tab-bg: rgba(255, 255, 255, 0.80);
  --lrn-tab-on-bg: rgba(59, 130, 246, 0.10);
  --lrn-tab-on-brd: rgba(59, 130, 246, 0.35);
  --lrn-chip-bg: rgba(255, 255, 255, 0.80);
  --lrn-chip-brd: rgba(59, 130, 246, 0.20);
  --lrn-ov-mid: rgba(244, 246, 249, 0.45);
  --lrn-ov-end: rgba(244, 246, 249, 0.94);
  --lrn-sub-c: #0f0f0f;
  --lrn-sub-sh: 0 1px 6px rgba(0, 0, 0, 0.12);
  --lrn-kb-bg: rgba(240, 242, 245, 0.98);
  --lrn-key-brd: rgba(0, 0, 0, 0.07);
  --lrn-key-sh: rgba(0, 0, 0, 0.06);
  --lrn-iz-bg: #dde1e7;
  --lrn-pen-bg: rgba(0, 0, 0, 0.02);
  --lrn-pop-sh: rgba(0, 0, 0, 0.10);
}

/* ── DARK MODE (Netflix Theme) — red 액센트 */
.t-nf {
  --lrn-bg: #0e0e0e;
  --lrn-s1: #181818;
  --lrn-s2: #242424;
  --lrn-s3: #2a2a2a;
  --lrn-bd: rgba(255, 255, 255, 0.08);
  --lrn-acc: #e50914;
  --lrn-acc2: #b20710;
  --lrn-teal: #3dd6c8;
  --lrn-rose: #ff5f6d;
  --lrn-vio: #a78bfa;
  --lrn-blue: #60a5fa;
  --lrn-rose-pale: rgba(255, 95, 109, 0.65);
  --lrn-blue-pale: rgba(96, 165, 250, 0.65);
  --lrn-vio-pale: rgba(167, 139, 250, 0.65);
  --lrn-text: #e5e5e5;
  --lrn-text2: #999999;
  --lrn-float-bg: rgba(24, 24, 24, 0.85);
  --lrn-float-c: rgba(255, 255, 255, 0.55);
  --lrn-float-brd: rgba(255, 255, 255, 0.12);
  --lrn-tab-bg: rgba(24, 24, 24, 0.80);
  --lrn-tab-on-bg: rgba(229, 9, 20, 0.12);
  --lrn-tab-on-brd: rgba(229, 9, 20, 0.45);
  --lrn-chip-bg: rgba(24, 24, 24, 0.85);
  --lrn-chip-brd: rgba(229, 9, 20, 0.25);
  --lrn-ov-mid: rgba(14, 14, 14, 0.45);
  --lrn-ov-end: rgba(14, 14, 14, 0.94);
  --lrn-sub-c: #ffffff;
  --lrn-sub-sh: 0 1px 10px rgba(0, 0, 0, 0.9);
  --lrn-kb-bg: rgba(14, 14, 14, 0.98);
  --lrn-key-brd: rgba(255, 255, 255, 0.08);
  --lrn-key-sh: rgba(0, 0, 0, 0.5);
  --lrn-iz-bg: #0a0a0a;
  --lrn-pen-bg: rgba(255, 255, 255, 0.015);
  --lrn-pop-sh: rgba(0, 0, 0, 0.6);
}

/* ── LEARN SCREEN SHELL ── */
.learn-screen {
  position: fixed;
  inset: 0;
  z-index: 3500;
  background: var(--lrn-bg);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.learn-screen.open {
  display: flex;
}

#learn-app {
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* [hidden] 속성 우선순위 강화 (ID 선택자와 조합하여 !important 없이 처리) */
#learn-app [hidden],
.learn-screen [hidden],
#hw-toolbar [hidden],
.hw-sound-btn[hidden],
.hw-divider[hidden] {
  display: none;
}

/* ── PROGRESS STRIP ── */
#learn-prog-strip {
  flex-shrink: 0;
  height: 2px;
  background: var(--lrn-s2);
}

#learn-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--lrn-acc2), var(--lrn-acc));
  box-shadow: 0 0 8px var(--lrn-acc2);
  width: 0%;
  transition: width 0.3s;
}

/* ── MAIN 2-ZONE ── */
#learn-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* ═══════════════ IMAGE ZONE ═══════════════ */
#learn-iz {
  flex: var(--iz-ratio);
  position: relative;
  overflow: hidden;
  background: var(--lrn-iz-bg);
  min-height: 0;
}

#learn-iz::before {
  content: '🖼️';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: 0.12;
  z-index: 1;
  pointer-events: none;
}

/* Main image + 3-slot buffer */
#learn-scene-img,
.learn-img-slot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: brightness(0.80) saturate(1.1);
  transition: opacity 0.5s;
}

.learn-img-slot {
  opacity: 0;
  z-index: 10;
}

.learn-img-slot.slot-curr {
  opacity: 1;
}

/* ── FLOATING UI (on image area) ── */
.learn-float-btn {
  font-family: var(--lrn-fm);
  font-size: 0.5rem;
  color: var(--lrn-float-c);
  border: 1px solid var(--lrn-float-brd);
  background: var(--lrn-float-bg);
  border-radius: 99px;
  padding: 4px 10px;
  cursor: pointer;
  z-index: 20;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.learn-float-btn:hover {
  color: var(--lrn-acc);
  border-color: var(--lrn-acc);
}

/* Left Controls Area (Vertical Layout) */
.learn-left-controls {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.learn-control-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--lrn-bd);
  background: var(--lrn-float-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--lrn-fm);
  font-size: 0.72rem;
  color: var(--lrn-text2);
  padding: 0;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.learn-control-btn:hover {
  color: var(--lrn-acc);
  border-color: var(--lrn-acc);
}

/* MODE 및 ZOOM/FULL 버튼 내부 텍스트 폰트 크기 미세화 */
#learn-auto-btn.learn-control-btn,
#learn-img-ratio-btn.learn-control-btn {
  font-size: 0.44rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Back button */
.learn-float-tl {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--lrn-bd);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--lrn-text2);
  padding: 0;
}

/* Hero chip */
.learn-float-tl2 {
  position: absolute;
  top: 8px;
  left: 46px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--lrn-chip-bg);
  border: 1px solid var(--lrn-chip-brd);
  border-radius: 99px;
  padding: 3px 10px 3px 3px;
  backdrop-filter: blur(8px);
  z-index: 20;
}

.learn-hero-av {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lrn-acc), var(--lrn-acc2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  overflow: hidden;
}

.learn-hero-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.learn-hero-nm {
  font-family: var(--lrn-fm);
  font-size: 0.58rem;
  color: var(--lrn-acc);
}

/* Mode toggle (top-right) */
.learn-float-tr {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 2px;
  z-index: 20;
}

.learn-mode-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--lrn-tab-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  transition: all 0.16s;
  gap: 1px;
  -webkit-tap-highlight-color: transparent;
}

.learn-mode-ic {
  font-size: 0.78rem;
  line-height: 1;
}

.learn-mode-lb {
  font-family: var(--lrn-fm);
  font-size: 0.4rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--lrn-text2);
}

.learn-mode-tab.on {
  border-color: var(--lrn-tab-on-brd);
  background: var(--lrn-tab-on-bg);
}

.learn-mode-tab.on .learn-mode-lb {
  color: var(--lrn-acc);
}

.learn-mode-tab:active {
  background: var(--lrn-tab-on-bg);
}

/* Sub-controls row (Auto & Ratio) */
.learn-float-tr2-row {
  position: absolute;
  top: 46px;
  right: 8px;
  display: flex;
  gap: 2px;
  z-index: 20;
}

/* IPA toggle (bottom-left) */
.learn-float-bl {
  position: absolute;
  bottom: 56px;
  left: 10px;
  z-index: 20;
}

.learn-float-bl.on {
  color: var(--lrn-acc);
  border-color: var(--lrn-tab-on-brd);
  background: var(--lrn-tab-on-bg);
}

/* Sentence counter (bottom-right) */
.learn-float-br {
  position: absolute;
  bottom: 58px;
  right: 10px;
  font-family: var(--lrn-fm);
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.55);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 20;
  cursor: pointer;
  user-select: none;
}

/* ── SYLLABLE OVERLAY ── */
.learn-syllable-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  gap: 15px;
  pointer-events: none;
}

.learn-syllable-btn {
  padding: 10px 20px;
  font-size: 1.5rem;
  font-weight: 800;
  border: 3px solid currentColor;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: transform 0.2s;
  text-transform: uppercase;
  color: #fff;
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

/* ── SUBTITLE OVERLAY ── */
#learn-sub-ov {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 42px 14px 12px;
  background: linear-gradient(to bottom, transparent 0%, var(--lrn-ov-mid) 30%, var(--lrn-ov-end) 100%);
  z-index: 15;
}

.learn-sub-txt {
  font-family: var(--lrn-fb);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--lrn-sub-c);
  text-shadow: var(--lrn-sub-sh);
}

/* Clickable words */
.learn-w {
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 3px;
  padding: 0 1px;
  display: inline;
}

.learn-w:hover {
  background: var(--lrn-tab-on-bg);
}

.learn-w.hi-gold {
  color: var(--lrn-acc);
}

.learn-w.hi-teal {
  color: var(--lrn-teal);
}

.learn-w.word-correct {
  color: var(--lrn-teal);
}

/* 정답 시 자막 전체 녹색 (테마 무관) */
.learn-sub-txt.word-correct,
.learn-sub-txt.word-correct .learn-w {
  color: #22c55e;
}

.learn-w.word-active,
.learn-w .word-active {
  color: #3b82f6;
  font-weight: 800;
}

/* SPK 모드: 텍스트 투명 처리 (DOM 구조 보존) */
.learn-w.spk-hidden,
.learn-w.spk-hidden .learn-cf-word {
  color: transparent;
}

/* SPK 모드: 버튼 텍스트 블러 유령 효과 */
.learn-sw.spk-hidden,
.learn-sw.spk-hidden .learn-cf-word {
  color: transparent;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
}

.t-nf .learn-sw.spk-hidden,
.t-nf .learn-sw.spk-hidden .learn-cf-word {
  color: transparent;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.18);
}

/* SPK 버튼 굵기 통일: 크기로 정보 누출 방지 */
.learn-sw.spk-hidden.learn-prom-button {
  font-weight: 500;
}

/* SPK 퍼즐: 드롭존 */
.learn-drop-zone {
  display: none;
  gap: 0;
  padding: 8px 12px;
  justify-content: center;
  flex-wrap: wrap;
  align-items: center;
}

.learn-drop-slot {
  min-width: 0;
  margin: 0 3px;
  padding: 6px 12px;
  border: 1px dashed var(--lrn-bd);
  border-radius: 99px;
  font-family: var(--lrn-fb);
  font-size: 0.72rem;
  color: transparent;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
}

.learn-drop-slot.active {
  border-color: var(--lrn-teal);
  background: rgba(13, 148, 136, 0.05);
}

.learn-drop-slot.filled {
  border-style: solid;
  border-color: var(--lrn-teal);
  color: var(--lrn-teal);
  background: rgba(13, 148, 136, 0.08);
}

/* 채워진 슬롯 연결: 인접한 filled 슬롯끼리 합쳐지는 효과 */
.learn-drop-slot.filled+.learn-drop-slot.filled {
  margin-left: 0;
  border-left: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding-left: 2px;
}

.learn-drop-slot.filled:has(+ .learn-drop-slot.filled) {
  margin-right: 0;
  border-right: none;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 2px;
}

/* 워드 모드: 음절 완전 밀착 */
.learn-drop-zone.word-mode .learn-drop-slot.filled+.learn-drop-slot.filled {
  padding-left: 0;
}

.learn-drop-zone.word-mode .learn-drop-slot.filled:has(+ .learn-drop-slot.filled) {
  padding-right: 0;
}

/* SPK 퍼즐: 선택된 버튼 */
.learn-sw.selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* SPK 퍼즐: 드래그 복제 요소 */
.learn-drag-clone {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.9;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* SPK 퍼즐: 드래그 대상 슬롯 */
.learn-drop-slot.drag-hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  transform: scale(1.05);
}

.learn-w.word-wrong,
.learn-w .word-wrong {
  color: #ff4a4a;
  text-decoration: underline;
  text-decoration-color: #ff4a4a;
}

.learn-prom-subtitle.learn-prom-stress-primary,
.learn-prom-subtitle.learn-prom-content,
.learn-prom-subtitle.learn-prom-name {
  font-weight: 800;
}

.learn-prom-subtitle.learn-prom-stress-secondary {
  font-weight: 700;
}

.learn-prom-subtitle.learn-prom-stress-weak,
.learn-prom-subtitle.learn-prom-function {
  font-weight: 500;
  opacity: 0.72;
}

/* Per-word CF sub-spans (multi-word chunks) */
.learn-cf-word {
  display: inline;
}

.learn-cf-word.learn-prom-content,
.learn-cf-word.learn-prom-name {
  font-weight: 800;
  opacity: 1;
}

.learn-cf-word.learn-prom-function {
  font-weight: 500;
  opacity: 0.72;
}

/* IPA display */
.learn-sub-ipa {
  font-family: var(--lrn-fb);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.6;
  color: var(--lrn-sub-c);
  text-shadow: var(--lrn-sub-sh);
  margin-top: 3px;
  display: none;
}

.learn-sub-ipa.on {
  display: block;
}

/* Chunk pills */
.learn-chunk-bar {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.learn-cpill {
  font-family: var(--lrn-fm);
  font-size: 0.54rem;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--lrn-bd);
  color: var(--lrn-text2);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.learn-cpill:hover,
.learn-cpill.on {
  border-color: var(--lrn-acc);
  color: var(--lrn-acc);
  background: var(--lrn-tab-on-bg);
}

/* ── LEARNING IMAGE ZONE SKELETON ── */
.lrn-sk-img {
  flex: 1;
  width: 100%;
  min-height: 0;
  border-radius: 0;
  background-color: var(--lrn-iz-bg);
}

.lrn-sk-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 42px 14px 14px;
  /* #learn-sub-ov 와 동일한 패딩 */
  background: linear-gradient(to bottom, transparent 0%, var(--lrn-ov-mid) 35%, var(--lrn-ov-end) 100%);
  pointer-events: none;
}

.lrn-sk-line {
  height: 12px;
  border-radius: 4px;
  background-color: var(--lrn-bd);
}

/* #learn-dots 와 동일: absolute, bottom:10px, center */
.lrn-sk-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  align-items: center;
  z-index: 13;
}

.lrn-sk-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--lrn-bd);
}

.lrn-sk-dot--active {
  width: 14px;
  border-radius: 3px;
}

/* Nav dots */
.learn-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  /* JS가 이미지 2장 이상일 때 flex로 전환 */
  gap: 5px;
  z-index: 20;
  align-items: center;
}

.learn-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.learn-dot.on {
  background: var(--lrn-acc);
  width: 14px;
  border-radius: 3px;
  box-shadow: 0 0 6px var(--lrn-acc);
}

/* ═══════════════ INPUT ZONE ═══════════════ */
#learn-iz2 {
  flex: var(--iz2-ratio);
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--lrn-s1);
  border-top: 1px solid var(--lrn-bd);
  min-height: 0;
  overflow: hidden;
}

/* Panels container */
#learn-panels {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.learn-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.learn-panel.on {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* ── BTN: Scatter Panel ── */
#learn-panel-btn {
  justify-content: flex-start;
  padding-top: 10px;
}

.learn-scatter-area {
  width: 100%;
  flex: 1;
  position: relative;
  min-height: 0;
}

.learn-sw {
  position: absolute;
  font-family: var(--lrn-fb);
  font-size: 0.72rem;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--lrn-bd);
  background: var(--lrn-s2);
  color: var(--lrn-text);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.learn-prom-button.learn-prom-stress-primary,
.learn-prom-button.learn-prom-content,
.learn-prom-button.learn-prom-name {
  font-weight: 900;
}

.learn-prom-button.learn-prom-stress-secondary {
  font-weight: 750;
}

.learn-prom-button.learn-prom-stress-weak,
.learn-prom-button.learn-prom-function {
  font-weight: 500;
  opacity: 0.78;
}

/* Per-word CF in buttons (multi-word chunks) */
.learn-sw .learn-cf-word.learn-prom-content,
.learn-sw .learn-cf-word.learn-prom-name {
  font-weight: 900;
}

.learn-sw .learn-cf-word.learn-prom-function {
  font-weight: 500;
  opacity: 0.72;
}

.learn-sw:active {
  transform: scale(0.94);
}

.learn-sw.ok {
  border-color: var(--lrn-teal);
  color: var(--lrn-teal);
  background: rgba(13, 148, 136, 0.10);
  pointer-events: none;
}

.learn-sw.no {
  border-color: var(--lrn-rose);
  color: var(--lrn-rose);
  background: rgba(225, 29, 72, 0.10);
  pointer-events: none;
  text-decoration: line-through;
}

.learn-sw.dim {
  opacity: 0.35;
  pointer-events: none;
}

.learn-scatter-prompt {
  font-family: var(--lrn-fb);
  font-size: 0.68rem;
  color: var(--lrn-text2);
  text-align: center;
  flex-shrink: 0;
  line-height: 1.4;
}

.learn-scatter-prompt em {
  color: var(--lrn-acc);
  font-style: normal;
}

.learn-btn-fb {
  font-family: var(--lrn-fm);
  font-size: 0.6rem;
  min-height: 16px;
  text-align: center;
  flex-shrink: 0;
}

.learn-next-btn {
  font-family: var(--lrn-fm);
  font-size: 0.58rem;
  color: var(--lrn-acc);
  border: 1px solid var(--lrn-tab-on-brd);
  background: var(--lrn-tab-on-bg);
  border-radius: 99px;
  padding: 4px 14px;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.learn-next-btn.show {
  display: flex;
}

.learn-next-btn:active {
  filter: brightness(1.1);
}

/* ── TYPE PANEL ── */
#learn-panel-type {
  justify-content: flex-start;
  padding: 8px 12px;
  gap: 7px;
}

.learn-type-prompt {
  display: none;
}

.learn-type-display {
  width: 100%;
  flex-shrink: 0;
  background: var(--lrn-s2);
  border: 1px solid var(--lrn-bd);
  border-radius: 8px;
  padding: 2px 12px;
  display: flex;
  align-items: center;
  font-family: var(--lrn-fb);
  font-size: 0.78rem;
  color: var(--lrn-text);
  min-height: 32px;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  position: relative;
}

#learn-type-text-wrap {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow-x: hidden;
}


.learn-type-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.learn-type-act-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--lrn-bd);
  background: var(--lrn-s3);
  color: var(--lrn-text2);
  font-size: 0.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  line-height: 1;
}

.learn-type-act-btn:active {
  transform: scale(0.9);
}

.learn-type-clear {
  display: none;
}

.learn-type-act-btn.kb-off {
  opacity: 0.35;
}

.learn-tcaret {
  display: inline-block;
  width: 2px;
  height: 13px;
  background: var(--lrn-acc);
  vertical-align: middle;
  margin-left: 1px;
  animation: lrn-blink 0.88s step-end infinite;
}

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

.learn-type-fb {
  display: none;
}

.learn-type-fb-next {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding-bottom: 4px;
}

.learn-type-fb-next.show {
  display: flex;
}

.learn-custom-kb {
  flex: 1;
  min-height: 0;
  width: 100%;
  background: var(--lrn-kb-bg);
  border: 1px solid var(--lrn-bd);
  border-radius: 10px;
  padding: 3px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}

.learn-kb-row {
  flex: 1;
  display: flex;
  gap: 3px;
  min-height: 0;
}

.learn-key {
  flex: 1;
  height: 100%;
  min-width: 0;
  background: var(--lrn-s3);
  border: 1px solid var(--lrn-key-brd);
  border-radius: var(--lrn-key-r, 6px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--lrn-fb);
  font-size: var(--lrn-key-fs, 0.82rem);
  color: var(--lrn-text);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 0 var(--lrn-key-sh);
  transition: background 0.08s, transform 0.06s;
  overflow: hidden;
  white-space: nowrap;
}

.learn-key:active {
  background: var(--lrn-s2);
  transform: translateY(1px);
  box-shadow: none;
}

.learn-key.special {
  background: var(--lrn-s2);
  color: var(--lrn-text2);
  font-family: var(--lrn-fm);
  font-size: calc(var(--lrn-key-fs, 0.82rem) * 0.66);
  letter-spacing: 0.04em;
  flex: 1.5;
}

.learn-key.punct {
  background: var(--lrn-tab-on-bg);
  border-color: var(--lrn-tab-on-brd);
  color: var(--lrn-acc);
  flex: 0.82;
}

.learn-key.space {
  flex: 3;
  font-family: var(--lrn-fm);
  font-size: calc(var(--lrn-key-fs, 0.82rem) * 0.55);
  color: var(--lrn-text2);
  letter-spacing: 0.07em;
}

.learn-key.enter {
  background: var(--lrn-tab-on-bg);
  border-color: var(--lrn-tab-on-brd);
  color: var(--lrn-acc);
  flex: 1.7;
}

.learn-key.del {
  flex: 1.4;
}

.learn-key.caps {
  flex: 1.5;
}

.learn-key.nums {
  flex: 1.5;
}

/* ── PEN PANEL ── */
#learn-panel-pen {
  padding: 8px 12px;
}

.learn-pen-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  flex-shrink: 0;
}

.learn-dc {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.13s;
  -webkit-tap-highlight-color: transparent;
}

.learn-dc:active {
  transform: scale(0.85);
}

.learn-dc.sel {
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 2px var(--lrn-acc);
}

/* 무지개 스펙트럼 바 + 툴바 (백업 복원) */
.hw-toolbar-container {
  padding: 2px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--lrn-s2);
  border: 1px solid var(--lrn-bd);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  min-height: 32px;
  width: 100%;
}

.hw-brush-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--lrn-text2);
}

.hw-brush-controls input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  height: 3px;
  background: var(--lrn-bd);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.hw-brush-controls input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--thumb-size, 8px);
  height: var(--thumb-size, 8px);
  border-radius: 50%;
  background: var(--lrn-acc);
  cursor: pointer;
  transition: width 0.15s, height 0.15s;
}

.hw-brush-controls input[type=range]::-moz-range-thumb {
  width: var(--thumb-size, 8px);
  height: var(--thumb-size, 8px);
  border-radius: 50%;
  background: var(--lrn-acc);
  border: none;
  cursor: pointer;
}

.hw-divider {
  width: 1px;
  height: 12px;
  background-color: var(--lrn-bd);
  margin: 0 4px;
  flex-shrink: 0;
}

.hw-divider--sub {
  background-color: transparent;
}

.hw-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.hw-swatch.active {
  border-color: var(--lrn-acc);
  transform: scale(1.15);
}

.spectrum-btn {
  background: conic-gradient(from 180deg,
      #ff7675, #fab1a0, #ffeaa7, #55efc4, #81ecec, #74b9ff, #a29bfe, #fd79a8, #ff7675);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.5),
    0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.spectrum-btn:hover {
  transform: scale(1.05);
}

.hw-sound-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lrn-bd);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  font-family: var(--lrn-fm);
}

.hw-sound-btn:hover {
  /* 호버 효과 제거 */
}

.hw-sound-btn svg.viz-svg-icon {
  width: 10px;
  height: 10px;
  color: var(--lrn-text2);
}

.hw-sound-btn .viz-svg-icon.hidden {
  display: none;
}

.hw-font-alphabet {
  font-size: 8.5px;
  font-weight: 900;
  color: var(--lrn-text2);
  line-height: 1;
  pointer-events: none;
  transform: translateY(0.5px);
}

.hw-spectrum-bar {
  position: absolute;
  top: 100%;
  left: 0;
  display: flex;
  align-items: center;
  padding: 3px;
  background: var(--lrn-s2);
  border: 1px solid var(--lrn-bd);
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  z-index: 30;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 200px;
  height: 16px;
}

.hw-spectrum-bar.hidden {
  opacity: 0;
  transform: translateY(-10px) scale(0.9);
  pointer-events: none;
}

.hw-spectrum-gradient {
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(to right,
      #000000 0%, #ff0000 15%, #ffff00 30%, #00ff00 45%,
      #00ffff 60%, #0000ff 75%, #ff00ff 85%, #ffffff 100%);
  cursor: crosshair;
  border: 1px solid var(--lrn-bd);
  position: relative;
}

.hw-spectrum-indicator {
  position: absolute;
  top: -10px;
  left: 0;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid var(--lrn-s2);
  pointer-events: none;
  z-index: 35;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
  display: none;
}

.hw-spectrum-indicator::after {
  content: '';
  position: absolute;
  top: -11px;
  left: -7px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 11px solid #000;
  z-index: -1;
}

.hw-spectrum-bar:not(.hidden) .hw-spectrum-indicator {
  display: block;
}

.learn-pen-sz {
  width: 44px;
  accent-color: var(--lrn-acc);
}

.learn-pen-clr {
  margin-left: auto;
  font-family: var(--lrn-fm);
  font-size: 0.54rem;
  color: var(--lrn-text2);
  padding: 3px 9px;
  border: 1px solid var(--lrn-bd);
  border-radius: 99px;
  cursor: pointer;
  transition: all 0.14s;
}

.learn-pen-clr:active {
  color: var(--lrn-rose);
  border-color: var(--lrn-rose);
}

.learn-pen-wrap {
  flex: 1;
  width: 100%;
  min-height: 0;
  position: relative;
  border: 1px solid var(--lrn-bd);
  border-radius: 10px;
  overflow: hidden;
  background: var(--lrn-pen-bg);
}

.learn-pen-cv {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  display: block;
}

.learn-pen-ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--lrn-fh);
  font-size: 2.2rem;
  letter-spacing: 0.1em;
  color: var(--lrn-text);
  pointer-events: none;
  user-select: none;
}

.learn-pen-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  justify-content: center;
  padding-top: 6px;
}

/* ── MIC PANEL (Aligned with Pen/Type) ── */
#learn-panel-mic {
  padding: 8px 12px;
}

.learn-mic-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-shrink: 0;
  background: var(--lrn-s2);
  border: 1px solid var(--lrn-bd);
  border-radius: 8px;
  padding: 2px 10px;
  min-height: 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}


.learn-mic-display {
  flex: 1;
  font-family: var(--lrn-fm);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--lrn-acc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  height: 100%;
  margin-left: 5px;
}

/* ── MIC TYPING INDICATOR ── */
.mic-typing-dots {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 100%;
}

.mic-typing-dot {
  width: 4px;
  height: 4px;
  background-color: var(--lrn-acc);
  border-radius: 50%;
  animation: mic-typing-bounce 1.2s infinite ease-in-out both;
}

.mic-typing-dot:nth-child(1) {
  animation-delay: -0.3s;
}

.mic-typing-dot:nth-child(2) {
  animation-delay: -0.15s;
}

@keyframes mic-typing-bounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.learn-btext {
  /* Inherits from display */
}

.learn-bcaret {
  display: inline-block;
  width: 2px;
  height: 14px;
  background: var(--lrn-acc);
  margin-left: 2px;
  margin-left: 4px;
  animation: lrn-blink 0.8s infinite;
  vertical-align: middle;
}

.learn-mic-content-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 120px;
  background: var(--lrn-s2);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.learn-wave-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  transition: opacity 0.4s ease;
}

/* ── Idle Center Mic Button ── */
.learn-mic-idle-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--lrn-s1);
  border: 1px solid var(--lrn-bd);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  color: var(--lrn-text2);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .learn-mic-idle-center:hover {
    transform: scale(1.04);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.12);
    color: var(--lrn-acc);
  }
}


.learn-mic-idle-center:active {
  transform: scale(0.95);
  transition: all 0.1s;
}

.idle-mic-icon svg {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

@keyframes lrn-mic-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--lrn-acc);
    opacity: 0.2;
  }

  70% {
    box-shadow: 0 0 0 18px var(--lrn-acc);
    opacity: 0;
  }

  100% {
    box-shadow: 0 0 0 0 var(--lrn-acc);
    opacity: 0;
  }
}

/* 마이크 활성화 시(rec) 중앙 버튼 처리 */
/* 파동(wave)이나 말풍선(bubble) 모드일 때 녹음 중이면 숨김 */
#learn-panel-mic.is-recording:not(.mode-classic) .learn-mic-idle-center {
  opacity: 0;
  transform: scale(0.6);
  filter: blur(8px);
  pointer-events: none;
}

/* 클래식 모드(classic)에서 활성화 중일 때 버튼 스타일 (MicDictation.js에서 scale 제어) */
#learn-panel-mic.is-recording.mode-classic .learn-mic-idle-center {
  background: var(--lrn-acc);
  /* Theme-dependent accent */
  color: #fff;
  border-color: var(--lrn-acc);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
  animation: none;
  /* JS에서 직접 scale 제어하므로 기본 pulse 중단 */
}

/* 클래식 모드 활성화 시 리플(Ripple) 효과 추가 */
#learn-panel-mic.is-recording.mode-classic .learn-mic-idle-center::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--lrn-acc);
  border-radius: 50%;
  z-index: -1;
  animation: lrn-mic-ripple 1.8s infinite;
}


@keyframes lrn-mic-ripple {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }

  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

/* 마이크 모드 전환 버튼 가시성 제어: 마이크가 켜졌을 때(rec)만 표시 */
.learn-mic-side-btn#learn-mic-mode-sw {
  opacity: 0;
  pointer-events: none;
  transform: translateX(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#learn-panel-mic:has(.learn-mic-btn.rec) .learn-mic-side-btn#learn-mic-mode-sw {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}




.learn-wave-cv {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.6;
  cursor: pointer;
}

.learn-mic-center-ui {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.learn-mic-btns,
.learn-mic-btns-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.learn-mic-btn,
.learn-listen-btn,
.learn-mic-side-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lrn-bd);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  flex-shrink: 0;
}

.learn-mic-btn {
  width: auto;
  min-width: 34px;
  height: 16px;
  border-radius: 4px;
  padding: 0 5px;
}

.rec-text {
  font-family: var(--lrn-fb);
  font-size: 0.54rem;
  font-weight: 900;
  color: var(--lrn-text2);
  letter-spacing: -0.02em;
}

.learn-mic-btn svg.viz-svg-icon,
.learn-listen-btn svg.viz-svg-icon,
.learn-mic-side-btn svg.viz-svg-icon {
  width: 10px;
  height: 10px;
  color: var(--lrn-text2);
  transition: all 0.2s;
}

.learn-mic-side-btn svg.hidden {
  display: none;
}

.learn-mic-btn:hover,
.learn-mic-side-btn:hover {
  background: var(--lrn-s3);
  transform: scale(1.05);
}

/* 명시도 강화를 위해 .learn-mic-btn.rec 에 #learn-panel-mic 부모 추가 */
#learn-panel-mic .learn-mic-btn.rec {
  background: #ef4444;
  /* Red for recording */
  border-color: transparent;
}

#learn-panel-mic .learn-mic-btn.rec .rec-text {
  color: #ffffff;
}


.learn-mic-footer {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  padding-top: 4px;
}

/* ── WORD POPUP ── */
#learn-wpop {
  position: fixed;
  z-index: 5500;
  background: var(--lrn-s3);
  border: 1px solid var(--lrn-tab-on-brd);
  border-radius: 12px;
  padding: 11px 15px;
  max-width: 200px;
  box-shadow: 0 8px 32px var(--lrn-pop-sh);
  display: none;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

#learn-wpop.on {
  display: flex;
}

.learn-wp-pos {
  font-family: var(--lrn-fm);
  font-size: 0.5rem;
  color: var(--lrn-text2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.learn-wp-word {
  font-family: var(--lrn-fh);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--lrn-acc);
}

.learn-wp-ipa {
  font-family: var(--lrn-fb);
  font-size: 0.7rem;
  color: var(--lrn-text2);
}

.learn-wp-ko {
  font-family: var(--lrn-fb);
  font-size: 0.7rem;
  color: var(--lrn-text);
}

/* ── TYPING PANEL ── */
.typing-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.typing-input {
  width: 100%;
  max-width: 600px;
  min-height: 50px;
  padding: 12px 16px;
  font-family: var(--lrn-fb);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--lrn-text);
  background: var(--lrn-s2);
  border: 1px solid var(--lrn-bd);
  border-radius: 12px;
  outline: none;
  resize: none;
  text-align: center;
  transition: all 0.2s;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.typing-input:focus {
  border-color: var(--lrn-acc);
  background: var(--lrn-s1);
  box-shadow: 0 0 0 3px var(--lrn-tab-on-bg);
}

/* Specificity reinforcement to avoid !important */
.typing-wrapper textarea.typing-input.typing-correct {
  border-color: var(--lrn-teal);
  background: rgba(13, 148, 136, 0.05);
  color: var(--lrn-teal);
}

.typing-wrapper textarea.typing-input.typing-wrong {
  border-color: var(--lrn-rose);
  background: rgba(225, 29, 72, 0.05);
  color: var(--lrn-rose);
}

.typing-result {
  font-family: var(--lrn-fm);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--lrn-text2);
  min-height: 1.2rem;
  transition: all 0.2s;
}

.typing-result.correct {
  color: var(--lrn-teal);
  transform: scale(1.1);
}

@keyframes shake-error {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-5px);
  }

  40%,
  80% {
    transform: translateX(5px);
  }
}

.shake-error {
  animation: shake-error 0.4s ease-in-out;
}

/* ── ANIMATIONS ── */
@keyframes lrn-fadeUp {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.learn-fade-up {
  animation: lrn-fadeUp 0.3s ease forwards;
}

/* ── TOOLTIP ── */
.lt-tooltip {
  position: fixed;
  z-index: 5500;
  pointer-events: none;
  background: var(--lrn-text);
  color: var(--lrn-bg);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
}

.lt-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}



/* ═══════════════════════════════════════════════════════
   PEN MODE (Handwriting Dictation) CSS 복구
   ═══════════════════════════════════════════════════════ */

/* 캔버스가 패널 전체를 덮도록 절대 좌표 부여 */
.hw-canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 5;
  /* 클릭 이벤트 가로채기 */
}

#hw-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  /* 브라우저 스크롤 방지 */
  cursor: none;
}

/* 고스트 가이드 (정답 연하게 따라쓰기) */
.hw-ghost-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  color: var(--lrn-text);
  white-space: pre-wrap;
  width: 90%;
  word-break: break-word;
  user-select: none;
}

/* 필기 소리 시각화 파티클 */
.hw-chatter-particle {
  position: absolute;
  pointer-events: none;
  user-select: none;
  font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', Arial, sans-serif;
  text-shadow: 1px 1px 0 white, -1px -1px 0 white, 1px -1px 0 white, -1px 1px 0 white;
  animation: hw-particle-fade 0.8s ease-out forwards;
  z-index: 20;
}

@keyframes hw-particle-fade {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }

  20% {
    opacity: 1;
    transform: translateY(-10px) scale(1.2);
  }

  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.8);
  }
}



/* ── 커스텀 키보드 가이드 하이라이트 ── */
.learn-key.guide-strong {
  background: var(--lrn-acc) !important;
  color: #ffffff !important;
  border-color: var(--lrn-acc2) !important;
  box-shadow: 0 2px 0 var(--lrn-acc2) !important;
}

.learn-key.guide-weak {
  background: var(--lrn-tab-on-bg) !important;
  border-color: var(--lrn-tab-on-brd) !important;
  color: var(--lrn-acc) !important;
}

/* ── 미니게임 모드 전용 스타일 ── */
.learn-sw.bubble-pop {
  border-radius: 9999px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.1) 60%, rgba(0, 0, 0, 0.05) 100%);
  border: 1.5px solid currentColor;
  box-shadow: 0 4px 10px var(--lrn-key-sh), inset 0 2px 4px rgba(255, 255, 255, 0.7);
  font-weight: 600;
  transition: transform 0.18s, opacity 0.18s, background-color 0.18s;
}

.t-nf .learn-sw.bubble-pop {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.02) 60%, rgba(255, 255, 255, 0.05) 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

.learn-sw.block-catch {
  border-radius: 6px;
  background: var(--lrn-s1);
  border: 1px solid currentColor;
  box-shadow: 0 2px 5px var(--lrn-key-sh);
  font-weight: 700;
  transition: transform 0.18s, opacity 0.18s, background-color 0.18s;
}

.t-nf .learn-sw.block-catch {
  box-shadow: 0 2px 5px var(--lrn-key-sh);
}

/* ── IPA(bubble-pop) 및 ENG(block-catch) 모드 전용 강세 색상 부여 (SPK/정답/오답 제외) ── */
/* IPA 모드 (선명한 색) */
.learn-sw.bubble-pop:not(.ok):not(.no).learn-prom-stress-primary,
.learn-sw.bubble-pop:not(.ok):not(.no).learn-prom-content,
.learn-sw.bubble-pop:not(.ok):not(.no) .learn-cf-word.learn-prom-content {
  color: var(--lrn-rose);
}

.learn-sw.bubble-pop:not(.ok):not(.no).learn-prom-stress-secondary {
  color: var(--lrn-blue);
}

.learn-sw.bubble-pop:not(.ok):not(.no).learn-prom-name,
.learn-sw.bubble-pop:not(.ok):not(.no) .learn-cf-word.learn-prom-name {
  color: var(--lrn-vio);
}

/* ENG 모드 (옅은 색) */
.learn-sw.block-catch:not(.ok):not(.no).learn-prom-stress-primary,
.learn-sw.block-catch:not(.ok):not(.no).learn-prom-content,
.learn-sw.block-catch:not(.ok):not(.no) .learn-cf-word.learn-prom-content {
  color: var(--lrn-rose-pale);
}

.learn-sw.block-catch:not(.ok):not(.no).learn-prom-stress-secondary {
  color: var(--lrn-blue-pale);
}

.learn-sw.block-catch:not(.ok):not(.no).learn-prom-name,
.learn-sw.block-catch:not(.ok):not(.no) .learn-cf-word.learn-prom-name {
  color: var(--lrn-vio-pale);
}

/* ── 다크모드(.t-nf) 환경 오버라이드 ── */
/* IPA 모드 (선명한 색) */
.t-nf .learn-sw.bubble-pop:not(.ok):not(.no).learn-prom-stress-primary,
.t-nf .learn-sw.bubble-pop:not(.ok):not(.no).learn-prom-content,
.t-nf .learn-sw.bubble-pop:not(.ok):not(.no) .learn-cf-word.learn-prom-content {
  color: var(--lrn-rose);
}

.t-nf .learn-sw.bubble-pop:not(.ok):not(.no).learn-prom-stress-secondary {
  color: var(--lrn-blue);
}

.t-nf .learn-sw.bubble-pop:not(.ok):not(.no).learn-prom-name,
.t-nf .learn-sw.bubble-pop:not(.ok):not(.no) .learn-cf-word.learn-prom-name {
  color: var(--lrn-vio);
}

/* ENG 모드 (옅은 색) */
.t-nf .learn-sw.block-catch:not(.ok):not(.no).learn-prom-stress-primary,
.t-nf .learn-sw.block-catch:not(.ok):not(.no).learn-prom-content,
.t-nf .learn-sw.block-catch:not(.ok):not(.no) .learn-cf-word.learn-prom-content {
  color: var(--lrn-rose-pale);
}

.t-nf .learn-sw.block-catch:not(.ok):not(.no).learn-prom-stress-secondary {
  color: var(--lrn-blue-pale);
}

.t-nf .learn-sw.block-catch:not(.ok):not(.no).learn-prom-name,
.t-nf .learn-sw.block-catch:not(.ok):not(.no) .learn-cf-word.learn-prom-name {
  color: var(--lrn-vio-pale);
}