/* 
  🎨 Designer-Delta's Ultra-Cute, Jelly-Bouncy Pastel Theme for Kids
  Focus: Tactile 3D buttons, soft glassmorphism, enchanting animations, and clear typography.
*/

:root {
  /* Ultra-Soft & Warm Pastel Palette */
  --bg-cream: #FFFDF5;
  --text-main: #6B5B5B;
  --text-muted: #9C8E8E;
  --white: #FFFFFF;
  
  /* Gummy Colors with Deep Shadows for 3D Toy Effect */
  --brand-blue: #A1E3F9;
  --brand-blue-shadow: #73C2DF;
  
  --brand-pink: #FFC4D9;
  --brand-pink-shadow: #ECA3BD;
  
  --brand-accent: #FF9AA2;
  --brand-accent-shadow: #E87A83;
  
  --brand-mint: #B5EAD7;
  --brand-mint-shadow: #94D1BA;
  
  --brand-yellow: #FFF1C5;
  --brand-yellow-shadow: #E6D099;

  /* Highlights and Materials */
  --highlight-inner: rgba(255, 255, 255, 0.6);
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.95);
  
  /* Bouncy Animation Curve */
  --jelly-curve: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Jua', sans-serif;
  background-color: var(--bg-cream);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 3rem 1.5rem 5rem 1.5rem;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  /* Soft background radial glow */
  background-image: radial-gradient(circle at 50% 0%, #FFFFFF 0%, transparent 60%);
}

/* -------------------------------------------
   Background Decorations (Magical Sky)
------------------------------------------- */
.background-decorations {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.cloud {
  position: absolute;
  opacity: 0.9;
  filter: drop-shadow(0 20px 20px rgba(0,0,0,0.03));
  animation: floatCloud ease-in-out infinite alternate;
  will-change: transform;
}
.cloud-1 { top: 5%; left: 2%; font-size: 6rem; animation-duration: 16s; }
.cloud-2 { top: 25%; right: 5%; font-size: 5rem; animation-duration: 20s; animation-delay: -5s; }
.cloud-3 { bottom: 8%; left: 10%; font-size: 7rem; animation-duration: 18s; animation-delay: -2s; transform-origin: center; }

.star {
  position: absolute;
  animation: twinkleStar ease-in-out infinite alternate;
  will-change: transform, opacity, filter;
}
.star-1 { top: 15%; right: 20%; font-size: 3rem; animation-duration: 2.5s; }
.star-2 { bottom: 30%; right: 10%; font-size: 4rem; animation-duration: 3s; animation-delay: -1s; }

@keyframes floatCloud {
  0% { transform: translate(0, 0) scale(1) rotate(-2deg); }
  100% { transform: translate(40px, -25px) scale(1.08) rotate(2deg); }
}

@keyframes twinkleStar {
  0% { 
    opacity: 0.5; 
    transform: scale(0.8) rotate(0deg); 
    filter: drop-shadow(0 0 10px rgba(255,241,197,0.4)); 
  }
  100% { 
    opacity: 1; 
    transform: scale(1.25) rotate(35deg); 
    filter: drop-shadow(0 0 25px rgba(255,241,197,1)); 
  }
}

/* -------------------------------------------
   Layout & Entrances
------------------------------------------- */
.app-container {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  align-items: center;
  z-index: 1;
}

header {
  text-align: center;
  animation: popIn 1s var(--jelly-curve) forwards;
  position: relative;
}

.workspace-section {
  animation: popIn 1.2s var(--jelly-curve) forwards;
  opacity: 0; /* Handled by forward fill */
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.4) translateY(40px); }
  60% { opacity: 1; transform: scale(1.05) translateY(-10px); }
  80% { transform: scale(0.98) translateY(5px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* -------------------------------------------
   Header Typography
------------------------------------------- */
.app-title {
  font-size: 4.8rem;
  color: var(--white);
  /* Pop-up book 3D text effect */
  -webkit-text-stroke: 2px var(--brand-accent-shadow);
  text-shadow: 
    4px 4px 0 var(--brand-accent), 
    8px 8px 0 var(--brand-accent-shadow), 
    12px 12px 25px rgba(232, 122, 131, 0.4);
  margin-bottom: 1.2rem;
  letter-spacing: 3px;
  line-height: 1.1;
  transform: rotate(-3deg);
  display: inline-block;
  transition: transform 0.3s ease;
}

.app-title:hover {
  transform: rotate(0deg) scale(1.05);
}

.app-subtitle {
  font-size: 1.6rem;
  color: var(--brand-accent-shadow);
  background: var(--white);
  display: inline-block;
  padding: 0.8rem 2.5rem;
  border-radius: 50px;
  border: 4px solid var(--brand-yellow);
  box-shadow: 0 8px 0 var(--brand-yellow-shadow), 0 15px 20px rgba(0,0,0,0.06);
  transform: rotate(1deg);
}

/* -------------------------------------------
   Mic Section (The Magic Toy Button)
------------------------------------------- */
.mic-section {
  display: flex;
  flex-direction: column-reverse; /* 상태 텍스트를 마이크 위로 올려 겹침 및 가림 방지 */
  align-items: center;
  gap: 0.5rem; /* 말풍선을 마이크 버튼에 더 가깝게 아래로 붙임 */
  margin-top: 0;
}

.mic-btn {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), #8BD5EF);
  border: 8px solid var(--white);
  /* 3D Toy Plastic Effect */
  box-shadow: 
    0 16px 0 var(--brand-blue-shadow), 
    0 25px 35px rgba(0,0,0,0.15),
    inset 0 10px 0 var(--highlight-inner),
    inset 0 -5px 15px rgba(0,0,0,0.1);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  outline: none;
}

.mic-icon {
  font-size: 5rem;
  filter: drop-shadow(0 6px 4px rgba(0,0,0,0.2));
  transform: translateY(-2px); /* Optically center with bottom shadow */
  transition: transform 0.2s ease;
}

.mic-btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 18px 0 var(--brand-blue-shadow), 
    0 30px 40px rgba(0,0,0,0.18),
    inset 0 10px 0 var(--highlight-inner);
}

.mic-btn:active {
  transform: translateY(16px);
  box-shadow: 
    0 0px 0 var(--brand-blue-shadow), 
    0 5px 10px rgba(0,0,0,0.1),
    inset 0 6px 0 var(--highlight-inner);
}

.mic-btn:active .mic-icon {
  transform: translateY(2px);
}

/* Disabled State */
.mic-btn:disabled {
  background: #E0E0E0;
  border-color: #F5F5F5;
  box-shadow: 0 16px 0 #BDBDBD, inset 0 10px 0 rgba(255,255,255,0.8);
  cursor: not-allowed;
  transform: none !important;
}

/* Recording State - Magical Pulse */
.mic-btn.recording {
  background: linear-gradient(135deg, var(--brand-accent), #FF858F);
  box-shadow: 
    0 16px 0 var(--brand-accent-shadow), 
    inset 0 10px 0 var(--highlight-inner);
  animation: magicPulse 2s infinite;
}

.mic-btn.recording:active {
  transform: translateY(16px);
  box-shadow: 0 0px 0 var(--brand-accent-shadow), inset 0 6px 0 var(--highlight-inner);
}

@keyframes magicPulse {
  0% { 
    box-shadow: 0 0 0 0 rgba(255, 154, 162, 0.7), 0 0 0 0 rgba(255, 154, 162, 0.4), 0 16px 0 var(--brand-accent-shadow), inset 0 10px 0 var(--highlight-inner); 
  }
  50% { 
    box-shadow: 0 0 0 25px rgba(255, 154, 162, 0.4), 0 0 0 50px rgba(255, 154, 162, 0.1), 0 16px 0 var(--brand-accent-shadow), inset 0 10px 0 var(--highlight-inner); 
  }
  100% { 
    box-shadow: 0 0 0 50px rgba(255, 154, 162, 0), 0 0 0 70px rgba(255, 154, 162, 0), 0 16px 0 var(--brand-accent-shadow), inset 0 10px 0 var(--highlight-inner); 
  }
}

.status-text {
  font-size: 1.6rem;
  color: #D96A74; /* Deeper accent for readability */
  background: var(--white);
  padding: 1rem 2.5rem;
  border-radius: 30px;
  border: 4px dashed var(--brand-pink);
  animation: gentleHover 3s ease-in-out infinite alternate;
  box-shadow: 0 10px 20px rgba(0,0,0,0.05);
  white-space: nowrap; /* 무조건 한 줄로 표시 */
}

@keyframes gentleHover {
  0% { transform: translateY(0) rotate(-1deg); }
  100% { transform: translateY(-10px) rotate(1deg); }
}

/* -------------------------------------------
   Workspace Section (Glassmorphism Toybox)
------------------------------------------- */
.workspace-section {
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 6px solid var(--glass-border);
  border-radius: 50px;
  padding: 4rem 3rem;
  box-shadow: 
    0 30px 60px rgba(0,0,0,0.08), 
    inset 0 0 30px rgba(255,255,255,0.8),
    inset 0 -10px 20px rgba(0,0,0,0.02);
  display: flex;
  flex-direction: column;
  gap: 4.5rem;
}

/* -------------------------------------------
   Sidebar (AI Text List)
------------------------------------------- */
.sidebar {
  position: absolute;
  top: 100px; /* 헤더 아래 */
  left: 0;
  bottom: 120px;
  width: calc(100% - 60px);
  max-width: 600px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 6px solid var(--glass-border);
  border-left: none;
  border-radius: 0 40px 40px 0;
  box-shadow: 0 30px 60px rgba(0,0,0,0.08);
  z-index: 20;
  transform: translateX(-100%);
  transition: transform 0.4s var(--jelly-curve);
  display: flex;
  flex-direction: column;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -58px; /* 밖으로 튀어나옴 */
  transform: translateY(-50%);
  background: var(--brand-yellow);
  color: #8C7132;
  border: 4px solid var(--white);
  border-left: none;
  border-radius: 0 20px 20px 0;
  width: 60px;
  height: 120px;
  font-family: 'Jua', sans-serif;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 8px 0 15px rgba(0,0,0,0.1);
  pointer-events: auto;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.sidebar-content {
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100%;
  pointer-events: auto;
}

.ai-text-list {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-right: 10px;
}

.ai-text-list::-webkit-scrollbar { width: 8px; }
.ai-text-list::-webkit-scrollbar-track { background: transparent; }
.ai-text-list::-webkit-scrollbar-thumb { background: var(--brand-mint); border-radius: 10px; }

.ai-text-item {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 900;
  font-size: 3rem;
  line-height: 1.3;
  color: #383838;
  background: #FFFFFF;
  border-radius: 20px;
  border: 3px dashed var(--brand-blue-shadow);
  padding: 1.5rem 1.5rem 3.5rem 1.5rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
  word-break: keep-all;
  position: relative;
}

.write-guide-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-family: 'Jua', sans-serif;
  font-size: 1.2rem;
  background: var(--brand-blue);
  color: #386B56;
  border: 3px solid var(--white);
  border-radius: 20px;
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--brand-blue-shadow);
  transition: all 0.15s ease;
  z-index: 5;
}

.write-guide-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 6px 0 var(--brand-blue-shadow);
}

.write-guide-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--brand-blue-shadow);
}

.ai-text-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.ai-text-item.active {
  background: var(--brand-mint);
  border-color: var(--white);
  color: #1a4a35;
  box-shadow: inset 0 0 10px rgba(255,255,255,0.8);
}

.tag-label {
  font-size: 1.5rem;
  padding: 0.8rem 2.5rem;
  border-radius: 40px;
  border: 5px solid var(--white);
  display: inline-block;
  letter-spacing: 1.5px;
  transition: transform 0.3s var(--jelly-curve);
  cursor: default;
  text-align: center;
}

.tag-label:hover {
  transform: scale(1.1) rotate(0deg) !important;
}

.sidebar-content .tag-label {
  background: var(--brand-yellow);
  color: #8C7132;
  box-shadow: 0 10px 0 var(--brand-yellow-shadow), 0 15px 20px rgba(0,0,0,0.08);
  transform: rotate(-2deg);
}

.canvas-container .tag-label {
  background: var(--brand-mint);
  color: #386B56;
  box-shadow: 0 10px 0 var(--brand-mint-shadow), 0 15px 20px rgba(0,0,0,0.08);
  transform: rotate(3deg);
  display: none; /* 배경으로 쓰이므로 캔버스 안의 라벨은 숨김 처리 */
}

/* -------------------------------------------
   Canvas Area (Practice Notebook Full Background)
------------------------------------------- */
.canvas-container {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
}

.canvas-wrapper {
  width: 100%;
  height: 100%;
  background-color: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  position: relative;
  /* 공책 배경을 브라우저 꽉 차게 렌더링 */
  background-image: 
    linear-gradient(rgba(181, 234, 215, 0.4) 3px, transparent 3px),
    linear-gradient(90deg, rgba(181, 234, 215, 0.4) 3px, transparent 3px);
  background-size: 80px 80px;
  background-position: center center;
}

#drawing-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="%23FF9AA2"><path d="M7.127 22.562l-7.127 1.438 1.438-7.128 5.689 5.69zm1.414-1.414l11.228-11.225-5.69-5.692-11.227 11.227 5.689 5.69zm9.768-21.148l-2.816 2.817 5.691 5.691 2.816-2.819-5.691-5.689z"/></svg>') 0 32, crosshair;
}

/* -------------------------------------------
   Bottom Controls (Gummy Buttons)
------------------------------------------- */
.canvas-controls {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.control-btn {
  font-family: 'Jua', sans-serif;
  font-size: 1.8rem;
  padding: 1.2rem 3rem;
  border: 6px solid var(--white);
  border-radius: 50px;
  cursor: pointer;
  color: #5C4D4D;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  outline: none;
}

.control-btn:hover {
  transform: translateY(-3px);
  filter: brightness(1.05);
}

.eraser-btn {
  background: linear-gradient(135deg, var(--brand-pink), #FFDBE6);
  box-shadow: 
    0 12px 0 var(--brand-pink-shadow), 
    0 20px 25px rgba(0,0,0,0.1),
    inset 0 6px 0 var(--highlight-inner);
}

.eraser-btn:active {
  transform: translateY(12px);
  box-shadow: 0 0px 0 var(--brand-pink-shadow), 0 5px 10px rgba(0,0,0,0.08), inset 0 4px 0 var(--highlight-inner);
}

.done-btn {
  background: linear-gradient(135deg, var(--brand-mint), #CFF3E6);
  box-shadow: 
    0 12px 0 var(--brand-mint-shadow), 
    0 20px 25px rgba(0,0,0,0.1),
    inset 0 6px 0 var(--highlight-inner);
}

.done-btn:active {
  transform: translateY(12px);
  box-shadow: 0 0px 0 var(--brand-mint-shadow), 0 5px 10px rgba(0,0,0,0.08), inset 0 4px 0 var(--highlight-inner);
}

.btn-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,0.15));
}

/* -------------------------------------------
   Global Layout Override (Full Screen Canvas)
------------------------------------------- */
body {
  padding: 0 !important;
  margin: 0;
  display: block;
  height: 100vh;
  overflow: hidden;
}

.top-header {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  z-index: 20;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

.app-title { margin-bottom: 0 !important; }

.app-container {
  width: 100vw;
  height: 100vh;
  max-width: none;
  padding: 0;
  margin: 0;
  display: block;
  position: relative;
}

.workspace-section {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* 하단 컨트롤 (마이크, 버튼들) */
.bottom-panel {
  position: absolute;
  bottom: 45px; /* 전체적으로 버튼을 위로 올려 하단 여유 공간 확보 */
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center; /* 양옆 버튼 세로 가운데 정렬 */
  padding: 0 40px;
  z-index: 20;
  pointer-events: none;
}

.mic-section {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -15px; /* 마이크 중앙을 양옆 버튼 높이에 맞춤 */
  pointer-events: none;
}

.mic-btn {
  pointer-events: auto;
}

.status-text {
  pointer-events: none;
}

.canvas-controls {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.control-btn {
  pointer-events: auto;
}

@media (min-width: 1024px) {
  .top-header { gap: 2.5rem; }
}

@media (max-width: 600px) {
  .top-header { flex-direction: column; top: 10px; gap: 0.5rem; }
  .bottom-panel { bottom: 30px; padding: 0 15px; } /* 모바일 하단 공간 넉넉히 확보 */
  .canvas-controls { gap: 0.5rem; flex-wrap: nowrap; justify-content: space-between; align-items: center; }
  .control-btn { font-size: 1rem; padding: 0.8rem 1.2rem; z-index: 30; white-space: nowrap; }
  .sidebar { width: calc(100% - 60px); max-width: 320px; bottom: 170px; } /* 넓게 열리고 버튼이 화면에 유지됨 */
  .mic-section { bottom: -10px; z-index: 25; gap: 0.3rem; }
  .mic-btn { width: 80px; height: 80px; }
  .mic-icon { font-size: 2.5rem; }
  .status-text { font-size: 1rem; padding: 0.5rem 1rem; margin-bottom: 0; max-width: 90vw; overflow: hidden; text-overflow: ellipsis; }
}

/* 가로 모드 (Landscape) 스마트폰 최적화: 세로 폭이 좁을 때 공간 확보 */
@media (max-height: 500px) and (orientation: landscape) {
  .top-header { flex-direction: row; top: -5px; gap: 1.5rem; transform: scale(0.5); transform-origin: top center; }
  .sidebar { top: 40px; bottom: 85px; width: calc(100% - 50px); max-width: 480px; }
  .sidebar-content { padding: 1rem; gap: 0.8rem; }
  .ai-text-item { font-size: 2rem; padding: 1rem 1rem 3rem 1rem; border-width: 2px; }
  .write-guide-btn { font-size: 1rem; padding: 0.4rem 1rem; bottom: 8px; right: 8px; }
  .tag-label { font-size: 1rem; padding: 0.5rem 1.2rem; }
  .sidebar-toggle { width: 50px; height: 90px; right: -48px; font-size: 1rem; }
  
  .bottom-panel { bottom: 35px; padding: 0 40px; }
  .mic-section { flex-direction: row; gap: 1rem; bottom: 0; }
  .status-text { font-size: 0.9rem; padding: 0.5rem 1rem; animation: none; }
  .mic-btn { width: 60px; height: 60px; border-width: 4px; box-shadow: 0 6px 0 var(--brand-blue-shadow), inset 0 4px 0 var(--highlight-inner); }
  .mic-icon { font-size: 2rem; }
  .control-btn { padding: 0.5rem 1rem; font-size: 0.9rem; border-width: 3px; }
}

/* -------------------------------------------
   Write Guide Modal (쓰기 가이드 모달)
------------------------------------------- */
.guide-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 253, 245, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.3s var(--jelly-curve);
}

.guide-modal.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.05);
}

.guide-modal-content {
  background: var(--white);
  border: 8px solid var(--brand-blue);
  border-radius: 40px;
  padding: 3rem;
  max-width: 90vw;
  width: 800px;
  position: relative;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.15), inset 0 0 20px rgba(161, 227, 249, 0.3);
}

.close-guide-btn {
  position: absolute;
  top: -25px;
  right: -25px;
  background: var(--brand-pink);
  border: 6px solid var(--white);
  border-radius: 50%;
  width: 70px; height: 70px;
  font-family: 'Jua', sans-serif;
  font-size: 2rem;
  cursor: pointer;
  box-shadow: 0 10px 0 var(--brand-pink-shadow), 0 15px 20px rgba(0,0,0,0.1);
  color: var(--white);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  justify-content: center;
  align-items: center;
}

.close-guide-btn:active {
  transform: translateY(10px);
  box-shadow: 0 0px 0 var(--brand-pink-shadow), 0 5px 10px rgba(0,0,0,0.1);
}

.guide-title {
  font-size: 3rem;
  color: var(--brand-blue-shadow);
  margin-bottom: 2.5rem;
  text-shadow: 2px 2px 0 var(--brand-yellow);
}

.guide-text-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  min-height: 150px;
}

.guide-char {
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 900;
  font-size: 7rem;
  line-height: 1.2;
  /* 마스크 애니메이션으로 글씨가 써지는 효과 */
  background: linear-gradient(135deg, var(--text-main) 50%, #E0DADA 50%);
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0; /* 처음엔 투명 */
  position: relative;
  padding: 10px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 1.2em; /* 조립되는 동안 십자선 공책 칸 크기가 변하지 않도록 고정 */
  height: 1.2em;
}

.guide-char.writing-anim {
  animation: writeChar 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* 획순 가이드를 위한 십자선 (한자 공책 느낌) */
.guide-char::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 3px dashed rgba(161, 227, 249, 0.6);
  background: 
    linear-gradient(90deg, transparent 49%, rgba(161, 227, 249, 0.4) 50%, transparent 51%),
    linear-gradient(180deg, transparent 49%, rgba(161, 227, 249, 0.4) 50%, transparent 51%);
  z-index: -1;
  border-radius: 15px;
}

@keyframes writeChar {
  0% { background-position: 100% 0; opacity: 1; transform: scale(0.9); }
  100% { background-position: 0% 0; opacity: 1; transform: scale(1); }
}

@media (max-width: 600px) {
  .guide-modal-content { padding: 2rem 1rem; border-width: 5px; }
  .guide-title { font-size: 2rem; margin-bottom: 1.5rem; }
  .guide-char { font-size: 4.5rem; }
  .close-guide-btn { width: 50px; height: 50px; font-size: 1.5rem; top: -15px; right: -15px; border-width: 4px; box-shadow: 0 6px 0 var(--brand-pink-shadow); }
  .close-guide-btn:active { transform: translateY(6px); box-shadow: 0 0px 0 var(--brand-pink-shadow); }
}

/* -------------------------------------------
   Media Queries (Responsive & Kid-Friendly on Mobile)
------------------------------------------- */
@media (max-width: 850px) {
  body { padding: 2rem 1rem 3rem 1rem; }
  .app-title { font-size: 4rem; }
  .ai-text { font-size: 5rem; padding: 1.5rem 2rem; }
  .workspace-section { padding: 3rem 2rem; border-radius: 40px; }
  .canvas-wrapper { background-size: 50px 50px; }
}

@media (max-width: 600px) {
  .app-title { 
    font-size: 3.2rem; 
    -webkit-text-stroke: 1.5px var(--brand-accent-shadow);
    text-shadow: 3px 3px 0 var(--brand-accent), 6px 6px 0 var(--brand-accent-shadow);
  }
  
  .app-subtitle { font-size: 1.3rem; padding: 0.6rem 1.8rem; border-width: 3px; }
  
  .mic-btn { width: 120px; height: 120px; border-width: 6px; box-shadow: 0 12px 0 var(--brand-blue-shadow), inset 0 8px 0 var(--highlight-inner); }
  .mic-btn:hover { box-shadow: 0 14px 0 var(--brand-blue-shadow), inset 0 8px 0 var(--highlight-inner); }
  .mic-btn:active, .mic-btn.recording:active { transform: translateY(12px); box-shadow: 0 0px 0 var(--brand-blue-shadow), inset 0 4px 0 var(--highlight-inner); }
  .mic-btn.recording { box-shadow: 0 12px 0 var(--brand-accent-shadow), inset 0 8px 0 var(--highlight-inner); }
  .mic-icon { font-size: 4rem; }
  
  .workspace-section { padding: 2rem 1.5rem; border-radius: 35px; border-width: 4px; gap: 3rem; }
  
  .ai-text { font-size: 3.5rem; padding: 1.5rem 1rem; border-radius: 20px; border-width: 3px; }
  .ai-text-item { padding-bottom: 3.5rem; }
  .write-guide-btn { font-size: 1rem; padding: 0.4rem 1rem; bottom: 8px; right: 8px; }
  
  .carousel-btn { width: 45px; height: 45px; font-size: 1.5rem; border-width: 3px; }
  .carousel-container { gap: 0.8rem; }
  
  .tag-label { font-size: 1.2rem; padding: 0.6rem 1.8rem; border-width: 4px; }
  
  .canvas-wrapper { border-width: 5px; border-radius: 25px; background-size: 40px 40px; }
  
  .control-btn { font-size: 1rem; padding: 0.8rem 1.2rem; border-width: 4px; box-shadow: 0 8px 0 var(--brand-pink-shadow), inset 0 4px 0 var(--highlight-inner); }
  .control-btn:active { transform: translateY(8px); }
  .done-btn { box-shadow: 0 8px 0 var(--brand-mint-shadow), inset 0 4px 0 var(--highlight-inner); }
  .btn-icon { font-size: 1.3rem; }
}

@media (max-width: 400px) {
  .app-title { font-size: 2.8rem; }
  .app-subtitle { font-size: 1.1rem; }
  .status-text { font-size: 1.2rem; padding: 0.8rem 1.5rem; }
  .ai-text { font-size: 3rem; }
  .cloud { font-size: 4rem !important; }
  .star { font-size: 2.5rem !important; }
}
```