/* ========================================================================= */
/* 4 DISTINCT ARCHITECTURAL UI THEMES & 4 EXCLUSIVE THEMATIC FONTS           */
/* 1. Candy: 幼圆/圆体 (Cute Rounded)                                        */
/* 2. Forest: 手札/楷体 (Handwritten Picturebook)                             */
/* 3. Galaxy: SF Pro/无衬线 (Cyber Modern HUD)                                */
/* 4. Craft: 宋体/明体 (Folk Classical Serif)                                */
/* ========================================================================= */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ========================================================================= */
/* BASE CORE LAYOUT                                                          */
/* ========================================================================= */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

@media (min-width: 600px) {
  .app-layout {
    height: 94vh;
  }
}

.app-header {
  height: 54px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

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

.clickable-home {
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.clickable-home:hover { transform: scale(1.04); }
.clickable-home:active { transform: scale(0.96); }

.logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-title {
  font-size: 18px;
  font-weight: 900;
}

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

.btn-settings-icon {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, all 0.3s ease;
}

.btn-settings-icon:active { transform: scale(0.92); }

.status-dot-mini {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94A3B8;
}

.status-dot-mini.online { background: #10B981; }

.btn-mini-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, all 0.3s ease;
}

.btn-mini-nav:active { transform: scale(0.94); }
.btn-mini-nav.hidden { display: none !important; }

/* Panels */
.app-main-canvas {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  display: flex;
  flex-direction: column;
}

.step-panel {
  display: none !important;
  min-height: 100% !important;
  width: 100% !important;
  flex-direction: column !important;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.step-panel.active { display: flex !important; }

.age-card, .story-cover-card, .btn-card-go, .btn-read-story {
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

/* ========================================================================= */
/* THEME 1: 🍬 糖果果冻 3D 软萌风 (CANDY 3D JELLY)                              */
/* 专属字体：幼圆体 / 苹方圆体 (Round & Soft)                                   */
/* ========================================================================= */
body.theme-candy {
  background-color: #F7EFE9;
  color: #2D3748;
  font-family: "Yuanti SC", "幼圆", "YouYuan", "Hiragino Maru Gothic ProN", "PingFang SC", sans-serif;
}

body.theme-candy .logo-title,
body.theme-candy .hero-title,
body.theme-candy .age-main-title,
body.theme-candy .glory-title,
body.theme-candy .stage-title-text,
body.theme-candy .story-cover-info h3 {
  font-family: "Yuanti SC", "幼圆", "YouYuan", "Hiragino Maru Gothic ProN", "PingFang SC", sans-serif;
  letter-spacing: 0.6px;
}

body.theme-candy .app-layout {
  background: #FFFDF9;
  border-radius: 32px;
  box-shadow: 0 20px 60px rgba(255, 107, 74, 0.15), 0 0 0 1px #F3E8E2;
}

body.theme-candy .app-header {
  background: #FFFDF9;
  border-bottom: 2px solid #F8ECE4;
}

body.theme-candy .logo-title { color: #FF6B4A; }

body.theme-candy .btn-settings-icon {
  background: #FFF4F0;
  border: 2px solid #FFE4D6;
  border-radius: 16px;
  color: #FF6B4A;
}

body.theme-candy .btn-mini-nav {
  background: linear-gradient(135deg, #FF7B54 0%, #FF5232 100%);
  color: white;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(255, 107, 74, 0.35);
}

body.theme-candy .age-card {
  background: #FFFFFF;
  border: 2.5px solid #FFE2D4;
  border-radius: 26px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(255, 107, 74, 0.08), 0 3px 0 #FFD5C0;
}

body.theme-candy .age-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(255, 107, 74, 0.14), 0 4px 0 #FFBFA0;
}

body.theme-candy .btn-card-go {
  background: #FFEAE4;
  color: #FF5232;
  border-radius: 20px;
  font-weight: 900;
  padding: 6px 14px;
}

body.theme-candy .story-cover-card {
  background: #FFFFFF;
  border: 2.5px solid #FFE8DC;
  border-radius: 24px;
  box-shadow: 0 8px 20px rgba(255, 107, 74, 0.07), 0 3px 0 #FFD5C0;
}

body.theme-candy .story-cover-card:hover {
  transform: translateY(-3px);
  border-color: #FF7B54;
}

body.theme-candy .btn-read-story {
  background: linear-gradient(135deg, #FF7B54, #FF5232);
  color: white;
  border-radius: 18px;
  padding: 6px 12px;
  box-shadow: 0 3px 8px rgba(255, 107, 74, 0.3);
}

body.theme-candy .big-stage-picture-box {
  border-radius: 26px;
  border: 3px solid #FFE2D4;
  box-shadow: 0 10px 30px rgba(255, 107, 74, 0.12), 0 4px 0 #FFD5C0;
}

body.theme-candy .stage-progress-badge {
  background: #FFEAE4;
  color: #FF5232;
  border-radius: 18px;
  border: 1.5px solid #FFD0C0;
}

body.theme-candy .chat-bubble.assistant {
  background: #FFFFFF;
  border: 2px solid #FFE8DC;
  color: #2D3748;
  border-radius: 20px;
  border-bottom-left-radius: 6px;
  box-shadow: 0 6px 18px rgba(255, 107, 74, 0.06);
}

body.theme-candy .chat-bubble.user {
  background: linear-gradient(135deg, #FF7B54, #FF5232);
  color: white;
  border-radius: 20px;
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 20px rgba(255, 107, 74, 0.35);
}

body.theme-candy .chat-input-bar {
  background: #FFFFFF;
  border: 2.5px solid #FFE2D4;
  border-radius: 28px;
  box-shadow: 0 8px 24px rgba(255, 107, 74, 0.1), 0 3px 0 #FFD5C0;
}

body.theme-candy .btn-send-main {
  background: linear-gradient(135deg, #FF7B54, #FF5232);
  color: white;
  border-radius: 22px;
  box-shadow: 0 4px 12px rgba(255, 107, 74, 0.35);
}

body.theme-candy .story-glory-card {
  background: #FFFFFF;
  border: 3px solid #FFE2D4;
  border-radius: 30px;
  box-shadow: 0 16px 40px rgba(255, 107, 74, 0.15), 0 5px 0 #FFD5C0;
}

/* ========================================================================= */
/* THEME 2: 🌲 森林原木绘本风 (FOREST PICTUREBOOK)                              */
/* 专属字体：手札体 / 温润楷体 (Warm Handwritten Script)                          */
/* ========================================================================= */
body.theme-forest {
  background-color: #E2ECE5;
  color: #064E3B;
  font-family: "Hannotate SC", "Kaiti SC", "楷体", "KaiTi", "STKaiti", "PingFang SC", sans-serif;
}

body.theme-forest .logo-title,
body.theme-forest .hero-title,
body.theme-forest .age-main-title,
body.theme-forest .glory-title,
body.theme-forest .stage-title-text,
body.theme-forest .story-cover-info h3 {
  font-family: "Hannotate SC", "Kaiti SC", "楷体", "KaiTi", "STKaiti", "PingFang SC", sans-serif;
  letter-spacing: 0.8px;
}

body.theme-forest .app-layout {
  background: #F4FBF7;
  border-radius: 18px;
  border: 3px solid #A7F3D0;
  box-shadow: 0 16px 45px rgba(6, 78, 59, 0.12);
}

body.theme-forest .app-header {
  background: #ECFDF5;
  border-bottom: 2px solid #A7F3D0;
}

body.theme-forest .logo-title { color: #059669; }

body.theme-forest .btn-settings-icon {
  background: #D1FAE5;
  border: 2px solid #6EE7B7;
  border-radius: 10px;
  color: #065F46;
}

body.theme-forest .btn-mini-nav {
  background: linear-gradient(135deg, #10B981 0%, #047857 100%);
  color: white;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

body.theme-forest .age-card {
  background: #FFFFFF;
  border: 2px solid #86EFAC;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 6px 18px rgba(6, 78, 59, 0.06);
}

body.theme-forest .btn-card-go {
  background: #D1FAE5;
  color: #047857;
  border-radius: 10px;
  font-weight: 800;
  border: 1px solid #A7F3D0;
}

body.theme-forest .story-cover-card {
  background: #FFFFFF;
  border: 2px solid #BBF7D0;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(6, 78, 59, 0.05);
}

body.theme-forest .btn-read-story {
  background: #059669;
  color: white;
  border-radius: 8px;
  padding: 5px 10px;
}

body.theme-forest .big-stage-picture-box {
  border-radius: 16px;
  border: 2.5px solid #86EFAC;
  background: #F0FDF4;
  box-shadow: 0 8px 24px rgba(6, 78, 59, 0.08);
}

body.theme-forest .stage-progress-badge {
  background: #D1FAE5;
  color: #047857;
  border-radius: 8px;
  border: 1px solid #6EE7B7;
}

body.theme-forest .chat-bubble.assistant {
  background: #FFFFFF;
  border: 1.5px solid #86EFAC;
  color: #064E3B;
  border-radius: 14px;
  border-bottom-left-radius: 2px;
  box-shadow: 0 4px 12px rgba(6, 78, 59, 0.04);
}

body.theme-forest .chat-bubble.user {
  background: #059669;
  color: white;
  border-radius: 14px;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

body.theme-forest .chat-input-bar {
  background: #FFFFFF;
  border: 2px solid #86EFAC;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(6, 78, 59, 0.06);
}

body.theme-forest .btn-send-main {
  background: #059669;
  color: white;
  border-radius: 10px;
}

body.theme-forest .story-glory-card {
  background: #FFFFFF;
  border: 2.5px solid #86EFAC;
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(6, 78, 59, 0.1);
}

/* ========================================================================= */
/* THEME 3: 🌌 赛博太空探索风 (CYBER GALAXY HUD)                               */
/* 专属字体：SF Pro / 现代无衬线 (Modern Geometric HUD)                         */
/* ========================================================================= */
body.theme-galaxy {
  background-color: #030712;
  color: #F9FAFB;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body.theme-galaxy .logo-title,
body.theme-galaxy .hero-title,
body.theme-galaxy .age-main-title,
body.theme-galaxy .glory-title,
body.theme-galaxy .stage-title-text,
body.theme-galaxy .story-cover-info h3 {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  letter-spacing: 1px;
}

body.theme-galaxy .app-layout {
  background: #0F172A;
  border-radius: 20px;
  border: 2px solid #0284C7;
  box-shadow: 0 0 40px rgba(2, 132, 199, 0.35);
}

body.theme-galaxy .app-header {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1.5px solid rgba(56, 189, 248, 0.35);
}

body.theme-galaxy .logo-title { color: #38BDF8; }

body.theme-galaxy .btn-settings-icon {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  color: #38BDF8;
}

body.theme-galaxy .btn-mini-nav {
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: #FFFFFF;
  border-radius: 8px;
  border: 1px solid #38BDF8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

body.theme-galaxy .age-card {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body.theme-galaxy .btn-card-go {
  background: rgba(56, 189, 248, 0.15);
  color: #38BDF8;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

body.theme-galaxy .story-cover-card {
  background: rgba(30, 41, 59, 0.8);
  border: 1.5px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
}

body.theme-galaxy .btn-read-story {
  background: #0284C7;
  color: white;
  border-radius: 6px;
  border: 1px solid #38BDF8;
}

body.theme-galaxy .big-stage-picture-box {
  border-radius: 14px;
  border: 2px solid rgba(56, 189, 248, 0.5);
  background: #020617;
  box-shadow: 0 0 30px rgba(2, 132, 199, 0.3);
}

body.theme-galaxy .stage-progress-badge {
  background: rgba(56, 189, 248, 0.18);
  color: #38BDF8;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

body.theme-galaxy .chat-bubble.assistant {
  background: rgba(30, 41, 59, 0.9);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  color: #F1F5F9;
  border-radius: 12px;
  border-left: 4px solid #38BDF8;
}

body.theme-galaxy .chat-bubble.user {
  background: linear-gradient(135deg, #0284C7, #0369A1);
  color: white;
  border-radius: 12px;
  border: 1px solid #38BDF8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
}

body.theme-galaxy .chat-input-bar {
  background: rgba(30, 41, 59, 0.95);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  border-radius: 14px;
  box-shadow: 0 0 20px rgba(2, 132, 199, 0.25);
}

body.theme-galaxy .btn-send-main {
  background: #0284C7;
  color: white;
  border-radius: 8px;
  border: 1px solid #38BDF8;
}

body.theme-galaxy .story-glory-card {
  background: rgba(30, 41, 59, 0.95);
  border: 2px solid #38BDF8;
  border-radius: 16px;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.3);
}

/* ========================================================================= */
/* THEME 4: 🎨 国风剪纸皮影风 (FOLK PAPERCUT CRAFT)                             */
/* 专属字体：古风宋体 / 典雅明体 (Classical Folk Serif)                         */
/* ========================================================================= */
body.theme-craft {
  background-color: #F1E5D8;
  color: #7F1D1D;
  font-family: "Songti SC", "SimSun", "宋体", "STSong", "Hiragino Mincho ProN", serif;
}

body.theme-craft .logo-title,
body.theme-craft .hero-title,
body.theme-craft .age-main-title,
body.theme-craft .glory-title,
body.theme-craft .stage-title-text,
body.theme-craft .story-cover-info h3 {
  font-family: "Songti SC", "SimSun", "宋体", "STSong", "Hiragino Mincho ProN", serif;
  letter-spacing: 1.2px;
}

body.theme-craft .app-layout {
  background: #FDF9F2;
  border-radius: 12px;
  border: 3px double #DC2626;
  box-shadow: 0 14px 40px rgba(127, 29, 29, 0.15);
}

body.theme-craft .app-header {
  background: #FDF8F0;
  border-bottom: 2px solid #FCA5A5;
}

body.theme-craft .logo-title { color: #DC2626; }

body.theme-craft .btn-settings-icon {
  background: #FEE2E2;
  border: 1.5px solid #DC2626;
  border-radius: 6px;
  color: #B91C1C;
}

body.theme-craft .btn-mini-nav {
  background: linear-gradient(135deg, #DC2626, #991B1B);
  color: #FEF3C7;
  border-radius: 6px;
  border: 1px solid #F87171;
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.3);
}

body.theme-craft .age-card {
  background: #FFFDF9;
  border: 2px solid #F87171;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 6px 16px rgba(127, 29, 29, 0.06);
}

body.theme-craft .btn-card-go {
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 6px;
  border: 1px solid #FCA5A5;
}

body.theme-craft .story-cover-card {
  background: #FFFDF9;
  border: 2px solid #FCA5A5;
  border-radius: 10px;
}

body.theme-craft .btn-read-story {
  background: #DC2626;
  color: #FEF3C7;
  border-radius: 6px;
  padding: 5px 12px;
}

body.theme-craft .big-stage-picture-box {
  border-radius: 12px;
  border: 2.5px double #DC2626;
  background: #FEF9F3;
  box-shadow: 0 8px 24px rgba(127, 29, 29, 0.08);
}

body.theme-craft .stage-progress-badge {
  background: #FEE2E2;
  color: #991B1B;
  border-radius: 6px;
  border: 1px solid #FCA5A5;
}

body.theme-craft .chat-bubble.assistant {
  background: #FFFDF9;
  border: 1.5px solid #FCA5A5;
  color: #7F1D1D;
  border-radius: 10px;
  border-left: 3px solid #DC2626;
  box-shadow: 0 4px 12px rgba(127, 29, 29, 0.04);
}

body.theme-craft .chat-bubble.user {
  background: #DC2626;
  color: #FEF3C7;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

body.theme-craft .chat-input-bar {
  background: #FFFDF9;
  border: 2px solid #F87171;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(127, 29, 29, 0.07);
}

body.theme-craft .btn-send-main {
  background: #DC2626;
  color: #FEF3C7;
  border-radius: 6px;
}

body.theme-craft .story-glory-card {
  background: #FFFDF9;
  border: 3px double #DC2626;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(127, 29, 29, 0.12);
}

/* ========================================================================= */
/* COMMON STRUCTURE ELEMENTS                                                 */
/* ========================================================================= */
#stepAge.active {
  padding: 16px 14px;
  overflow-y: auto;
}

.hero-box {
  text-align: center;
  margin: 10px 0 16px 0;
}

.hero-title {
  font-size: 21px;
  font-weight: 900;
}

.age-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.age-card {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.age-badge-icon { flex-shrink: 0; }
.age-card-content { flex: 1; }
.age-main-title { font-size: 18px; font-weight: 900; }

.btn-card-go {
  display: flex;
  align-items: center;
  gap: 4px;
}

#stepStory.active {
  padding: 12px 14px;
  overflow-y: auto;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

.compact-hero {
  margin: 4px 0 12px 0;
  flex-shrink: 0;
}

.btn-shuffle-stories {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.btn-shuffle-stories:hover {
  transform: scale(1.05);
  border-color: var(--primary);
  background: var(--primary-light);
}

.btn-shuffle-stories:active {
  transform: scale(0.95);
}

.hero-desc {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 2px;
}

.story-cover-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-bottom: 24px;
  width: 100%;
}

.story-cover-card {
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  content-visibility: auto;
  contain-intrinsic-size: 0 180px;
  transform: translateZ(0);
  will-change: transform;
}

.story-cover-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: rgba(0, 0, 0, 0.04);
  overflow: hidden;
  position: relative;
}

.story-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.story-cover-card:hover .story-cover-img {
  transform: scale(1.05);
}

.story-cover-footer {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.story-cover-info h3 {
  font-size: 13.5px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 105px;
}

.story-cover-info p {
  font-size: 10.5px;
  opacity: 0.75;
  margin-top: 1px;
}

#stepStage.active {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  overflow: hidden !important;
}

.single-big-picture-stage {
  padding: 8px 14px 4px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stage-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.stage-info-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-title-text {
  font-size: 15.5px;
  font-weight: 900;
}

.stage-info-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-stage-action {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  border-radius: 14px;
  padding: 3px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.btn-stage-action:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-stage-action.btn-voice-active {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-stage-action.playing,
.btn-bubble-voice.playing {
  background: #EF4444;
  color: white;
  border-color: #EF4444;
  animation: pulseVoicePlaying 1s infinite alternate;
}

.btn-bubble-voice.pulse-attention {
  animation: pulseAttention 1.2s infinite ease-in-out;
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

@keyframes pulseAttention {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.5); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(255, 107, 107, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

/* Pure Picture Stage Box (100% Unobstructed Clean High-Def Canvas) */
.pure-picture-stage-box {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 46vh;
  min-height: 220px;
  background: var(--bg-card);
  border-radius: 20px;
  border: 1.5px solid var(--border-color);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-sizing: border-box;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pure-picture-stage-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

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



@keyframes pulseVoicePlaying {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.06); opacity: 1; }
}
.full-agent-chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 4px 14px 10px 14px;
}

.agent-chat-flow {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}

/* Perfect Dialogue Bubble Layout */
.chat-bubble {
  max-width: 90%;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 1.5;
  position: relative;
  animation: bubblePop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  word-break: break-word;
}

.chat-bubble.user.streaming-bubble {
  border: 1.5px dashed var(--primary);
  background: var(--bg-card);
  opacity: 0.95;
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.15);
  animation: pulseStreaming 1.8s infinite ease-in-out;
}

.chat-bubble.user.streaming-bubble .chat-bubble-text::after {
  content: '▋';
  color: var(--primary);
  margin-left: 2px;
  animation: blinkCursor 0.8s infinite;
}

@keyframes pulseStreaming {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.2); }
  50% { box-shadow: 0 0 0 6px rgba(255, 107, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.2); }
}

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

@keyframes bubblePop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.btn-bubble-voice {
  background: rgba(0, 0, 0, 0.06);
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
  transition: transform 0.2s ease;
}

.btn-bubble-voice:active { transform: scale(0.9); }

.btn-bubble-voice.playing {
  animation: pulseVoice 1s infinite;
}

@keyframes pulseVoice {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.agent-input-dock {
  flex-shrink: 0;
  margin-top: 4px;
  padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
  position: relative;
  z-index: 30;
}

.quick-prompt-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 10px 8px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.quick-prompt-chips::-webkit-scrollbar { display: none; }

.prompt-chip {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-color);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 4px;
}

.prompt-chip:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.prompt-chip:active {
  transform: scale(0.95);
}

.live-status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  margin: 0 10px 8px 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 22px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.25s ease;
}

.live-status-bar.speaking {
  border-color: #EA580C;
  background: #FFF7ED;
}

.live-status-bar.listening {
  border-color: #10B981;
  background: #ECFDF5;
  animation: pulseListen 1.5s infinite;
}

.live-status-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.live-status-bar.speaking .live-status-text { color: #EA580C; }
.live-status-bar.listening .live-status-text { color: #059669; }

.live-status-wave {
  display: inline-flex;
  align-items: center;
  gap: 2.5px;
  height: 14px;
}

.live-status-wave span {
  display: block;
  width: 2.5px;
  height: 100%;
  background: #EA580C;
  border-radius: 2px;
  animation: waveAnim 0.8s infinite ease-in-out alternate;
}

.live-status-wave span:nth-child(2) { animation-delay: 0.15s; }
.live-status-wave span:nth-child(3) { animation-delay: 0.3s; }
.live-status-wave span:nth-child(4) { animation-delay: 0.45s; }

.live-status-bar:not(.speaking) .live-status-wave {
  display: none;
}

@keyframes waveAnim {
  0% { height: 3px; }
  100% { height: 14px; }
}

@keyframes pulseListen {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}

.btn-mode-toggle {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
}

.input-mode-container {
  display: none;
  flex: 1;
  align-items: center;
}

.input-mode-container.active { display: flex; }

.child-text-area {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  resize: none;
  padding: 4px 6px;
  color: inherit;
  font-family: inherit;
}

.btn-voice-record {
  flex: 1;
  background: linear-gradient(135deg, #FFF0EB 0%, #FFE5DC 100%);
  border: 2px solid #FF8A65;
  color: #D84315;
  border-radius: 28px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 107, 74, 0.18);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}

.btn-voice-record:hover {
  transform: scale(1.02);
  background: linear-gradient(135deg, #FFE8E0 0%, #FFDCD0 100%);
}

.btn-voice-record:active {
  transform: scale(0.97);
}

.btn-voice-record.recording {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  border-color: #B91C1C;
  color: #FFFFFF;
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.25);
  animation: pulseRecording 1.2s infinite;
}

.btn-voice-record.cancel-state {
  background: linear-gradient(135deg, #9CA3AF 0%, #6B7280 100%) !important;
  border-color: #4B5563 !important;
  color: #FFFFFF !important;
  transform: scale(0.96);
  box-shadow: 0 0 0 6px rgba(156, 163, 175, 0.3) !important;
}

@keyframes pulseRecording {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

#stepPlayback.active {
  padding: 16px 14px;
  overflow-y: auto;
  align-items: center;
}

.story-glory-card {
  width: 100%;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.minimalist-glory-card {
  max-width: 420px;
  margin: 40px auto;
  padding: 36px 24px;
  border-radius: 28px;
  background: var(--bg-card);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
  border: 1.5px solid var(--border-color);
  text-align: center;
}

.minimal-glory-actions {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 12px;
  width: 100%;
  margin-top: 24px;
}

.btn-minimal-action {
  padding: 13px 18px;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-minimal-action.btn-exit {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-color);
  border: 1.5px solid var(--border-color);
}

.btn-minimal-action.btn-exit:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.btn-minimal-action.btn-next-story {
  background: linear-gradient(135deg, var(--primary), #FF5232);
  color: white;
  border: none;
  box-shadow: 0 6px 18px rgba(255, 107, 107, 0.35);
}

.btn-minimal-action.btn-next-story:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(255, 107, 107, 0.45);
}

.btn-minimal-action:active {
  transform: scale(0.96);
}

.glory-ribbon {
  text-align: center;
  margin-bottom: 14px;
}

.glory-title {
  font-size: 21px;
  font-weight: 900;
  margin-top: 8px;
}

.glory-sub {
  font-size: 13px;
  opacity: 0.75;
  margin-top: 3px;
}

.book-readback-container {
  width: 100%;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 16px;
  padding: 15px;
  position: relative;
  margin-bottom: 14px;
}

.story-flowing-text {
  font-size: 15px;
  line-height: 1.75;
}

.playback-audio-ctl {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.btn-audio-listen {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #FF7B54, #FF5232);
  color: white;
  border: none;
  padding: 9px 20px;
  border-radius: 22px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}

.praise-badge-box {
  width: 100%;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.praise-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 800;
  color: #059669;
  margin-bottom: 4px;
}

.praise-body {
  font-size: 12.5px;
  color: #065F46;
  line-height: 1.6;
}

.glory-actions-grid { width: 100%; }

.glory-sub-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-glory-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.05);
  border: 1.5px solid rgba(0, 0, 0, 0.08);
  padding: 11px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}

.btn-glory-sub.btn-again {
  background: #FF6B4A;
  color: white;
  border: none;
}

/* Modals & Settings */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.image-modal.hidden { display: none !important; }

.btn-modal-close-corner {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  color: #FFFFFF;
  font-size: 20px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 120;
}

.modal-img {
  max-width: 96%;
  max-height: 85vh;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

.modal-close-hint {
  position: absolute;
  bottom: 20px;
  color: white;
  font-size: 13px;
  opacity: 0.85;
}

.llm-config-card {
  width: 100%;
  max-width: 460px;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 18px;
  border: 2px solid #E2E8F0;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #1E293B;
}

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

.modal-card-header h3 {
  font-size: 16.5px;
  font-weight: 900;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #64748B;
}

.modal-card-desc {
  font-size: 11.5px;
  color: #64748B;
  margin-top: -6px;
}

.section-label {
  display: block;
  font-size: 12.5px;
  font-weight: 800;
  margin-bottom: 8px;
}

/* Theme Previews Grid inside Settings */
.settings-theme-block {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 16px;
  padding: 12px;
}

.theme-previews-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.theme-preview-card {
  background: #FFFFFF;
  border: 2px solid #E2E8F0;
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-preview-card:hover { transform: translateY(-2px); }

.theme-preview-card.active {
  border-color: #FF6B4A;
  background: #FFF7ED;
  box-shadow: 0 4px 14px rgba(255, 107, 74, 0.15);
}

.preview-mini-banner {
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 6px;
}

.candy-banner { background: linear-gradient(135deg, #FF7B54 0%, #FF5232 100%); }
.forest-banner { background: linear-gradient(135deg, #34D399 0%, #059669 100%); }
.galaxy-banner { background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%); }
.craft-banner { background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%); }

.preview-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid white;
}

.preview-card-info { display: flex; flex-direction: column; }
.preview-theme-title { font-size: 12.5px; font-weight: 800; }
.preview-theme-sub { font-size: 10px; opacity: 0.7; margin-top: 1px; }

.theme-selected-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FF6B4A;
  color: white;
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-preview-card.active .theme-selected-badge {
  opacity: 1;
  transform: scale(1);
}

/* AI Settings */
.settings-ai-block {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 16px;
  padding: 12px;
}

.provider-tabs-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.provider-tab-btn {
  flex: 1;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  padding: 6px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.provider-tab-btn.active {
  background: #FFEAE4;
  color: #FF5232;
  border-color: #FF6B4A;
}

.form-group { margin-bottom: 8px; }

.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: #64748B;
  margin-bottom: 3px;
}

.form-input {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid #CBD5E1;
  border-radius: 10px;
  font-size: 12.5px;
  outline: none;
  background: #FFFFFF;
  font-family: inherit;
}

.modal-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-modal-test {
  flex: 1;
  background: #F1F5F9;
  border: 1.5px solid #CBD5E1;
  padding: 8px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 800;
  color: #334155;
  cursor: pointer;
}

.btn-modal-save {
  flex: 1;
  background: linear-gradient(135deg, #FF7B54, #FF5232);
  color: white;
  border: none;
  padding: 8px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

.settings-logs-section {
  border-top: 1px dashed #E2E8F0;
  padding-top: 8px;
}

.settings-logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: #F1F5F9;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
}

.settings-logs-container {
  margin-top: 8px;
  background: #0F172A;
  border-radius: 8px;
  padding: 8px;
  max-height: 140px;
  display: flex;
  flex-direction: column;
}

.settings-logs-container.hidden { display: none !important; }

.settings-log-stream {
  flex: 1;
  overflow-y: auto;
  font-family: monospace;
  font-size: 10.5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #E2E8F0;
}

/* Toast Micro-animation */
.app-toast-layer {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1.5px solid #CBD5E1;
  color: #1E293B;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 14.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.app-toast-layer.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-toast-layer.success {
  border-color: #10B981;
  color: #065F46;
  background: #F0FDF4;
}

.app-toast-layer.warn {
  border-color: #F59E0B;
  color: #92400E;
  background: #FFFBEB;
}

/* 4 Theme-Consistent Celebration Badges & Geometric Particles */
.celebration-layer {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  pointer-events: none !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}

.celebration-layer.hidden { display: none !important; }

.star-burst {
  position: fixed !important;
  top: 36% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  padding: 14px 26px !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  animation: fixedBurstZoom 2.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
  z-index: 10000 !important;
  white-space: nowrap !important;
}

/* Theme 1 Candy Badge */
.theme-badge-candy {
  background: #FFFDF9 !important;
  border: 3px solid #FF7B54 !important;
  color: #FF5232 !important;
  border-radius: 36px !important;
  box-shadow: 0 16px 45px rgba(255, 107, 74, 0.35), 0 4px 0 #FFBFA0 !important;
}

/* Theme 2 Forest Badge */
.theme-badge-forest {
  background: #ECFDF5 !important;
  border: 3px solid #10B981 !important;
  color: #047857 !important;
  border-radius: 16px !important;
  box-shadow: 0 16px 45px rgba(6, 78, 59, 0.25) !important;
}

/* Theme 3 Galaxy Badge */
.theme-badge-galaxy {
  background: rgba(15, 23, 42, 0.95) !important;
  border: 2px solid #38BDF8 !important;
  color: #38BDF8 !important;
  border-radius: 12px !important;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.5), inset 0 0 15px rgba(56, 189, 248, 0.2) !important;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.6) !important;
}

/* Theme 4 Craft Badge */
.theme-badge-craft {
  background: #FDF8F0 !important;
  border: 3px double #DC2626 !important;
  color: #B91C1C !important;
  border-radius: 10px !important;
  box-shadow: 0 14px 40px rgba(127, 29, 29, 0.3) !important;
}

@keyframes fixedBurstZoom {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(2deg); }
  32% { transform: translate(-50%, -50%) scale(1.0) rotate(0deg); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1.0) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(0.85); }
}

.confetti-particle {
  position: absolute;
  pointer-events: none;
  animation: confettiExplode 2.1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes confettiExplode {
  0% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(0.4); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(1.0); }
}

/* Gentle Nudge Hint Floating Pill (Non-blocking & Theme Consistent) */
.gentle-clue-pill {
  position: fixed !important;
  top: 36% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  padding: 10px 20px !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  animation: gentlePillFloat 1.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
  z-index: 10000 !important;
  white-space: nowrap !important;
  pointer-events: none !important;
}

@keyframes gentlePillFloat {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
  35% { transform: translate(-50%, -50%) scale(1.0); }
  78% { opacity: 1; transform: translate(-50%, -50%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -65%) scale(0.85); }
}

.clue-theme-candy {
  background: #FFFDF9;
  border: 2px solid #FF7B54;
  color: #FF5232;
  border-radius: 26px;
  box-shadow: 0 10px 30px rgba(255, 107, 74, 0.25), 0 3px 0 #FFD5C0;
}

.clue-theme-forest {
  background: #ECFDF5;
  border: 2px solid #10B981;
  color: #047857;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(6, 78, 59, 0.18);
}

.clue-theme-galaxy {
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid #38BDF8;
  color: #38BDF8;
  border-radius: 8px;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.4);
}

.clue-theme-craft {
  background: #FDF8F0;
  border: 2px solid #DC2626;
  color: #991B1B;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(127, 29, 29, 0.2);
}

/* Voice Persona Cards Grid & Audition Controls */
.voice-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
}

.voice-card {
  background: #FFFFFF;
  border: 2px solid #EAEAEA;
  border-radius: 18px;
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.voice-card:hover {
  transform: translateY(-4px);
  border-color: #FF7B54;
  box-shadow: 0 12px 28px rgba(255, 107, 74, 0.18), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.voice-card:active {
  transform: scale(0.97);
}

.voice-card.active {
  border: 2.5px solid #FF5232;
  background: #FFF9F6;
  box-shadow: 0 10px 26px rgba(255, 82, 50, 0.2), 0 0 0 1px #FFD5C8;
}

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

.voice-card-identity {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-card-icon {
  font-size: 22px;
  line-height: 1;
}

.voice-card-name {
  font-size: 15px;
  font-weight: 900;
  color: #1F2937;
  letter-spacing: -0.2px;
}

.voice-card-sub {
  font-size: 12px;
  color: #6B7280;
  line-height: 1.4;
  font-weight: 500;
}

.voice-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1.5px solid #F3F4F6;
}

.btn-voice-sample {
  background: #FFF1EB;
  color: #FF5232;
  border: 1px solid #FFD8CA;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-voice-sample:hover {
  background: #FF5232;
  color: white;
  border-color: #FF5232;
  transform: scale(1.05);
}

.btn-voice-sample.playing {
  background: #EF4444;
  color: white;
  border-color: #EF4444;
  animation: pulseListen 1s infinite alternate;
}

.voice-status-tag {
  font-size: 11px;
  background: #FF5232;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 800;
  display: none;
  box-shadow: 0 2px 6px rgba(255, 82, 50, 0.3);
}

.voice-card.active .voice-status-tag {
  display: inline-flex;
  align-items: center;
}

@media (max-width: 500px) {
  .voice-cards-grid {
    grid-template-columns: 1fr;
  }
}

.api-config-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.api-input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.api-input-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.api-input-field {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-color);
  font-size: 13px;
  outline: none;
}

.api-input-field:focus {
  border-color: var(--primary);
}

.btn-save-api {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-save-api:hover { opacity: 0.9; }

.btn-test-api {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 14px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-test-api:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-api-preset {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-api-preset:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

/* ========================================================================= */
/* GRAND COMPLETION MODAL ANIMATION (NO TEXT SUMMARY, PURE CELEBRATION)       */
/* ========================================================================= */
.completion-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.completion-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.completion-card-pop {
  background: #ffffff;
  border-radius: 32px;
  padding: 36px 28px;
  width: 90%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  transform: scale(0.7) translateY(40px);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.completion-modal-overlay.active .completion-card-pop {
  transform: scale(1) translateY(0);
}

.completion-trophy-icon {
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  background: #FFF7ED;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(255, 183, 3, 0.35);
  animation: bounceTrophy 1.2s infinite alternate ease-in-out;
}

.completion-moral-badge {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 16px;
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 1.5px solid #F59E0B;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.completion-moral-badge span {
  font-size: 13px;
  font-weight: 800;
  color: #B45309;
}

@keyframes bounceTrophy {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.08); }
}

.completion-title {
  font-size: 22px;
  font-weight: 900;
  color: #1F2937;
  margin-bottom: 8px;
}

.completion-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: #6B7280;
  line-height: 1.6;
  margin-bottom: 28px;
}

.completion-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.completion-actions button {
  width: 100%;
  height: 52px;
  border-radius: 26px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.completion-actions .btn-primary-action {
  background: linear-gradient(135deg, #FF7B54 0%, #FF5232 100%);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(255, 82, 50, 0.35);
}

.completion-actions .btn-primary-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(255, 82, 50, 0.45);
}

.completion-actions .btn-secondary-action {
  background: #F3F4F6;
  color: #374151;
}

.completion-actions .btn-secondary-action:hover {
  background: #E5E7EB;
  transform: translateY(-1px);
}

.live-status-bar {
  display: none !important;
}

/* ========================================================================= */
/* LLM AGENT THINKING INTERACTIVE ANIMATION                                  */
/* ========================================================================= */
.chat-bubble.assistant.thinking-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  background: var(--bg-card, #ffffff);
  border: 1.5px solid var(--border-color, #FFE8DC);
  border-radius: 20px;
  border-bottom-left-radius: 6px;
  animation: thinkingFloat 2s infinite ease-in-out;
}

@keyframes thinkingFloat {
  0%, 100% { transform: translateY(0); box-shadow: 0 4px 12px rgba(255, 123, 84, 0.08); }
  50% { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(255, 123, 84, 0.18); }
}

.thinking-teacher-avatar {
  font-size: 17px;
  display: inline-block;
  animation: teacherWink 1.4s infinite alternate ease-in-out;
}

@keyframes teacherWink {
  0% { transform: rotate(-8deg) scale(0.95); }
  100% { transform: rotate(8deg) scale(1.08); }
}

.thinking-dots-box {
  display: flex;
  align-items: center;
  gap: 4.5px;
  margin: 0 2px;
}

.thinking-dots-box .dot {
  width: 6.5px;
  height: 6.5px;
  background: var(--primary, #FF7B54);
  border-radius: 50%;
  animation: bounceDot 1.2s infinite cubic-bezier(0.34, 1.56, 0.64, 1);
}

.thinking-dots-box .dot:nth-child(1) { animation-delay: 0s; }
.thinking-dots-box .dot:nth-child(2) { animation-delay: 0.18s; }
.thinking-dots-box .dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes bounceDot {
  0%, 80%, 100% {
    transform: translateY(0) scale(0.75);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-6px) scale(1.25);
    opacity: 1;
  }
}

.thinking-label-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-color, #4B5563);
  letter-spacing: 0.2px;
}
