/* ==========================================================================
   ?暑隞餃?銵刻ˊ雿?- Design System & Stylesheet
   ========================================================================== */

/* Fallback / Alias for open 蝎? (jf-openhuninn by justfont) */
@font-face {
  font-family: 'jf-openhuninn';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('jf-openhuninn'), local('jf open 蝎?'), local('open 蝎?'), local('Huninn'),
       url('https://fonts.gstatic.com/s/huninn/v9/OpNNnoINg9bQ4xkpjg.ttf') format('truetype');
}

:root {
  /* Color Palette - Common & Neutral */
  --bg-primary: #f6f8fd;
  --bg-card: #ffffff;
  --text-main: #2d3748;
  --text-muted: #718096;
  --border-color: #e2e8f0;
  
  /* Primary Themes (Switched dynamically via body class) */
  --theme-primary: #3b82f6;
  --theme-primary-hover: #2563eb;
  --theme-primary-light: #eff6ff;
  --theme-secondary: #f59e0b;
  --theme-accent: #10b981;
  --theme-card-glow: rgba(59, 130, 246, 0.25);
  --theme-border-selected: #3b82f6;
  
  /* Paper Sheet Canvas Colors (Warm Kid's Poster Look from reference) */
  --paper-bg: #fffdf9;
  --sheet-border: #f8c291;
  --sheet-border-inner: #fcd9bc;
  --sheet-line-border: #eecda3;
  --row-hover-bg: #fffbf2;

  /* Typography - Google Fonts: open 蝎? (Huninn by justfont) */
  --font-family-chart: 'Huninn', 'jf-openhuninn', 'jf open 蝎?', 'open 蝎?', 'Noto Sans TC', sans-serif;
  --font-family-kids: 'Huninn', 'jf-openhuninn', 'jf open 蝎?', 'open 蝎?', 'Noto Sans TC', sans-serif;
  --font-family-base: 'Huninn', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Spacings & Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 30px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --shadow-paper: 0 20px 50px rgba(70, 50, 20, 0.12), 0 2px 10px rgba(0, 0, 0, 0.04);
}

/* Boy Theme */
body.theme-boy {
  --theme-primary: #2563eb;
  --theme-primary-hover: #1d4ed8;
  --theme-primary-light: #eff6ff;
  --theme-primary-border: #93c5fd;
  --theme-card-glow: rgba(37, 99, 235, 0.25);
  --header-bg-gradient: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 50%, #ede9fe 100%);
}

/* Girl Theme */
body.theme-girl {
  --theme-primary: #ec4899;
  --theme-primary-hover: #db2777;
  --theme-primary-light: #fdf2f8;
  --theme-primary-border: #f9a8d4;
  --theme-card-glow: rgba(236, 72, 153, 0.25);
  --header-bg-gradient: linear-gradient(135deg, #fce7f3 0%, #fae8ff 50%, #fef3c7 100%);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-family-base);
  font-weight: 500;
  color: var(--text-main);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(#e0e7ff 1.2px, transparent 1.2px), 
    radial-gradient(#fce7f3 1.2px, #f8fafc 1.2px);
  background-size: 40px 40px;
  background-position: 0 0, 20px 20px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Global Font Weight 500 for all site text (preserves Font Awesome icons) */
button, input, select, textarea, h1, h2, h3, h4, h5, h6, p, label, strong, b, a, span:not([class*="fa-"]) {
  font-weight: 500;
}

/* Main App Wrapper */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   BUTTONS & COMMON UI
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-family-base);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-primary-hover) 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--theme-card-glow);
}

.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--theme-card-glow);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.btn-preview {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28);
}

.btn-preview:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}

.btn-large {
  padding: 16px 42px;
  font-size: 20px;
  border-radius: var(--radius-xl);
  font-family: var(--font-family-kids);
  font-weight: 500;
}

.btn-bounce {
  animation: pulse-soft 2.5s infinite;
}

@keyframes pulse-soft {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.btn-back {
  background: rgba(255, 255, 255, 0.9);
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 8px 14px;
  font-size: 14px;
}

.btn-back:hover {
  background: #ffffff;
  color: var(--theme-primary);
  border-color: var(--theme-primary);
}

.btn-close {
  background: #f1f5f9;
  border: none;
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
}

.btn-close:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* ==========================================================================
   PAGE 1: Character Selection (蝚砌????
   ========================================================================== */

/* ==========================================================================
   PAGE 1: Character Selection (HopiDay ?暑隞餃?銵刻?擛?)
   ========================================================================== */

.page {
  display: none !important;
  width: 100%;
}

.page.active {
  display: flex !important;
  flex-direction: column;
  animation: fadeIn 0.4s ease-out;
}

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

.page-select {
  min-height: 100vh;
  width: 100%;
  position: relative;
  background-color: #FBF9F4;
  background-image: url('assets/19_background_base.png');
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 70px;
  overflow: hidden;
  box-sizing: border-box;
}

/* Floating Clouds (Desktop Ambiance) */
.deco-cloud {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  user-select: none;
}

.deco-cloud img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(101, 124, 196, 0.08));
}

.deco-cloud-top-left {
  top: 40px;
  left: 6%;
  width: 150px;
  animation: floatCloud 7s ease-in-out infinite alternate;
}

.deco-cloud-top-right {
  top: 70px;
  right: 6%;
  width: 210px;
  animation: floatCloud 9s ease-in-out infinite alternate-reverse;
}

.deco-cloud-left-mid {
  top: 38%;
  left: 3%;
  width: 120px;
  animation: floatCloud 8s ease-in-out infinite alternate;
}

.deco-cloud-right-mid {
  top: 46%;
  right: 4%;
  width: 135px;
  animation: floatCloud 10s ease-in-out infinite alternate-reverse;
}

/* Main Content Wrapper */
.select-main-content {
  position: relative;
  max-width: 1180px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  margin: auto 0;
}

/* Hopi Bunny Mascot Container (Left side) */
.hopi-bunny-wrapper {
  position: absolute;
  left: 15px;
  bottom: -20px;
  width: 260px;
  z-index: 6;
  pointer-events: auto;
  animation: hopiFloat 3.8s ease-in-out infinite alternate;
  user-select: none;
}

.hopi-bunny-mascot {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 14px 30px rgba(30, 45, 90, 0.12));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hopi-bunny-wrapper:hover .hopi-bunny-mascot {
  transform: scale(1.06) rotate(-3deg);
}

.bunny-rays-deco {
  position: absolute;
  top: -10px;
  right: 18px;
  width: 44px;
  z-index: 7;
  animation: raysGlow 2.5s ease-in-out infinite alternate;
}

.rays-bunny-img {
  width: 100%;
  height: auto;
  display: block;
}

/* Center Content Column */
.select-center-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 760px;
  width: 100%;
  z-index: 5;
}

/* Title & Subtitle */
.select-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 22px;
  position: relative;
  z-index: 5;
}

/* HopiDay Brand Logo (Title Top) */
.hopiday-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 2px;
  user-select: none;
}

.hopiday-brand-logo {
  height: 96px;
  width: auto;
  max-width: 320px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(101, 124, 196, 0.12));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hopiday-brand-logo:hover {
  transform: scale(1.04);
}

.hero-title-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.main-title {
  font-family: var(--font-family-kids);
  font-size: 52px;
  font-weight: 800;
  letter-spacing: 1.5px;
  line-height: 1.25;
  background: linear-gradient(135deg, #1A69F0 0%, #3B57DE 38%, #764AD3 76%, #8D3DDD 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
  text-shadow: none;
}

.title-deco-group {
  position: absolute;
  top: -16px;
  right: -72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  user-select: none;
}

.title-rays-img {
  width: 36px;
  height: auto;
  animation: raysTwinkle 2.8s ease-in-out infinite;
}

.title-cloud-img {
  width: 52px;
  height: auto;
  margin-top: 4px;
  filter: drop-shadow(0 4px 10px rgba(101, 124, 196, 0.12));
}

.main-subtitle {
  font-family: var(--font-family-kids);
  font-size: 19px;
  font-weight: 500;
  color: #42527B;
  letter-spacing: 0.5px;
  line-height: 1.5;
  margin: 0;
}

/* Steps Progress Indicator (1 ?貉???/ 2 ?遙??/ 3 摰?銝?) */
.steps-progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 22px 0 32px;
  user-select: none;
}

.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-family-kids);
  background: #E4ECF8;
  color: #657CC4;
  transition: all 0.3s ease;
}

.step-node.active .step-num {
  background: #657CC4;
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(101, 124, 196, 0.36);
}

.step-title {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-family-kids);
  color: #68799A;
  transition: color 0.3s ease;
}

.step-node.active .step-title {
  color: #657CC4;
  font-weight: 700;
}

.step-connector {
  width: 76px;
  height: 2px;
  background: #C8D6EC;
  margin: 0 14px 23px 14px;
}

/* Character Selection Cards (?瑞? / 憟喟?) */
.character-cards-container {
  display: flex;
  gap: 28px;
  justify-content: center;
  align-items: stretch;
  margin-bottom: 32px;
  width: 100%;
}

.character-card {
  width: 220px;
  height: 254px;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 18px 16px 16px;
  border: 2.5px solid transparent;
  box-shadow: 0 10px 30px rgba(101, 124, 196, 0.12), 0 2px 8px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  user-select: none;
  box-sizing: border-box;
}

.character-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 36px rgba(101, 124, 196, 0.2);
}

.character-card.selected {
  border-color: #657CC4 !important;
  background: #FFFFFF !important;
  box-shadow: 0 14px 38px rgba(101, 124, 196, 0.22) !important;
  transform: translateY(-4px);
}

#card-boy.selected,
#card-girl.selected {
  border-color: #657CC4 !important;
  box-shadow: 0 14px 38px rgba(101, 124, 196, 0.22) !important;
}

/* Selection Checkmark Badge (07_selected_check_icon.png) */
.card-selection-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  z-index: 10;
  display: none;
}

.character-card.selected .card-selection-check {
  display: block;
  animation: popCheck 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.check-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 102, 255, 0.25));
}

.card-avatar-circle {
  width: 165px;
  height: 165px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
}

.character-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.character-card:hover .character-avatar-img {
  transform: scale(1.05);
}

.character-name {
  font-family: var(--font-family-kids);
  font-size: 24px;
  font-weight: 800;
  color: #102358;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* CTA Action & Supplementary Text */
.select-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
}

.btn-cta-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 56px;
  font-family: var(--font-family-kids);
  font-size: 20px;
  font-weight: 700;
  color: #FFFFFF;
  background: linear-gradient(135deg, #0070F3 0%, #0054D6 100%);
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 102, 255, 0.36);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  user-select: none;
}

.btn-cta-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0, 102, 255, 0.46);
  filter: brightness(1.04);
}

.btn-cta-start:active {
  transform: translateY(1px);
  box-shadow: 0 6px 18px rgba(0, 102, 255, 0.3);
}

.btn-cta-start .btn-arrow {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.btn-cta-start:hover .btn-arrow {
  transform: translateX(4px);
}

.select-supplement-text {
  font-family: var(--font-family-kids);
  font-size: 15px;
  font-weight: 500;
  color: #556B9E;
  letter-spacing: 0.5px;
  margin-top: 14px;
  user-select: none;
}

/* Keyframe Animations */
@keyframes hopiFloat {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-14px) rotate(2deg); }
}

@keyframes floatCloud {
  0% { transform: translate(0, 0); }
  100% { transform: translate(12px, -8px); }
}

@keyframes raysGlow {
  0% { opacity: 0.7; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1.08); }
}

@keyframes raysTwinkle {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.15) rotate(5deg); opacity: 1; }
}

@keyframes popCheck {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 1080px) {
  .hopi-bunny-wrapper {
    width: 190px;
    left: 10px;
    bottom: 0;
  }
}

@media (max-width: 920px) {
  .hopi-bunny-wrapper {
    display: block !important;
    width: 150px;
    left: 10px;
    bottom: -15px;
  }
  .deco-cloud {
    display: none !important;
  }
  .main-title {
    font-size: 42px;
  }
  .main-subtitle {
    font-size: 17px;
  }
}

@media (max-width: 580px) {
  .page-select {
    padding: 24px 12px 40px;
    overflow-x: hidden;
  }
  .hopi-bunny-wrapper {
    display: block !important;
    position: absolute;
    left: 2px;
    bottom: -8px;
    width: clamp(95px, 26vw, 120px);
    z-index: 6;
  }
  .select-main-content {
    max-width: 100%;
    padding: 0 4px;
    box-sizing: border-box;
  }
  .select-hero {
    margin-bottom: 16px;
    width: 100%;
  }
  .hero-title-container {
    max-width: 90%;
  }
  .main-title {
    font-size: clamp(26px, 7.2vw, 32px);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
  }
  .title-deco-group {
    right: -28px;
    top: -10px;
  }
  .title-rays-img {
    width: 20px;
  }
  .title-cloud-img {
    width: 28px;
  }
  .main-subtitle {
    font-size: clamp(12.5px, 3.4vw, 14px);
    letter-spacing: 0;
    line-height: 1.45;
    padding: 0 8px;
    word-break: break-word;
  }
  .steps-progress-bar {
    margin: 14px 0 20px;
    gap: 0;
  }
  .step-num {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .step-title {
    font-size: 13px;
  }
  .step-connector {
    width: clamp(22px, 7vw, 36px);
    margin: 0 6px 19px 6px;
  }
  .character-cards-container {
    gap: 12px;
    margin-bottom: 24px;
    width: 100%;
    justify-content: center;
  }
  .character-card {
    width: clamp(140px, 43vw, 165px);
    height: 190px;
    padding: 12px 8px 5px;
    border-radius: 18px;
  }
  .card-avatar-circle {
    width: 110px;
    height: 110px;
  }
  .character-name {
    font-size: 19px;
  }
  .card-selection-check {
    width: 26px;
    height: 26px;
    top: 6px;
    right: 6px;
  }
  .btn-cta-start {
    padding: 12px 36px;
    font-size: 17px;
    width: 100%;
    max-width: 280px;
  }
  .btn-cta-start .btn-arrow {
    font-size: 18px;
  }
  .select-supplement-text {
    font-size: 12.5px;
    margin-top: 10px;
  }
}

/* ==========================================================================
   PAGE 2: Studio / Editor (蝚砌????
   ========================================================================== */

.page-editor {
  height: 100vh;
  max-height: 100vh;
  flex-direction: column;
  background-color: #f1f5f9;
  overflow: hidden;
}

.page-editor.active {
  display: flex !important;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

/* Top Header */
.editor-header {
  height: 72px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.active-character-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 4px 14px 4px 6px;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
}

.active-character-badge:hover {
  background: var(--theme-primary-light);
  border-color: var(--theme-primary-border);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--theme-card-glow);
}

.badge-switch-hint {
  font-size: 11px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.06);
  padding: 3px 8px;
  border-radius: 12px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.active-character-badge:hover .badge-switch-hint {
  background: var(--theme-primary);
  color: #ffffff;
}

.header-avatar-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.badge-texts {
  display: flex;
  flex-direction: column;
}

.badge-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.1;
}

.badge-main {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 500;
}

.header-center {
  display: flex;
  align-items: center;
}

.header-chart-title {
  font-family: var(--font-family-kids);
  font-size: 20px;
  font-weight: 500;
  color: #1e293b;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Desktop Template Dropdown Menu (隞餃?銵函??砌????- ?楛?脣?釭?? */
.template-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.template-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.template-dropdown-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.template-dropdown-btn .dropdown-arrow {
  font-size: 11px;
  color: #64748b;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.template-dropdown-wrapper.open .template-dropdown-btn .dropdown-arrow {
  transform: rotate(180deg);
}

.template-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 330px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
  padding: 8px;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.97);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
  pointer-events: none;
}

.template-dropdown-wrapper.open .template-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.template-menu-header {
  padding: 6px 12px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 6px;
}

.template-menu-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.template-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  background: #ffffff;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  font-family: inherit;
  color: #1e293b;
}

.template-menu-item:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.template-menu-item:hover .template-item-desc {
  color: #475569;
}

.template-menu-item:hover .template-tag {
  background: #e2e8f0;
  color: #1e293b;
}

.template-menu-item.active {
  background: #f0f6ff;
  border: 1.5px solid #60a5fa;
}

.template-menu-item.active:hover {
  background: #e0edff;
}

.template-item-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: #f8fafc;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.template-menu-item:hover .template-item-icon {
  transform: scale(1.06);
}

.template-item-icon.icon-blue {
  background: #eff6ff;
  color: #2563eb;
}

.template-item-icon.icon-purple {
  background: #faf5ff;
  color: #9333ea;
}

.template-item-icon.icon-teal {
  background: #f0fdfa;
  color: #0d9488;
}

.template-item-icon.icon-gray {
  background: #fef2f2;
  color: #ef4444;
  font-size: 16px;
}

.template-item-text {
  flex: 1;
  min-width: 0;
}

.template-item-title {
  color: #1e293b;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.template-tag,
.template-item-desc {
  display: none !important;
}

.template-menu-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 4px 4px;
}

.template-menu-item.item-danger .template-item-title {
  color: #dc2626;
}

.template-menu-item.item-danger:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.template-menu-item.item-danger:hover .template-item-desc {
  color: #b91c1c;
}


/* 2-Column Workspace Layout */
.editor-workspace {
  flex: 1;
  display: flex;
  height: calc(100vh - 72px);
  max-height: calc(100vh - 72px);
  overflow: hidden;
}

/* ---------------------------------------------------------
   LEFT COLUMN: 隞餃?? (???嚗?銝撠??迂嚗蝡頠?
   --------------------------------------------------------- */
.left-panel-tasks {
  width: 340px;
  min-width: 340px;
  height: 100%;
  max-height: 100%;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
}

.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.panel-icon {
  font-size: 20px;
}

.panel-title {
  font-family: var(--font-family-kids);
  font-size: 18px;
  font-weight: 500;
  color: #1e293b;
}

.task-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.task-filter-pills.hidden {
  display: none !important;
}

.desktop-search-trigger-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.desktop-search-trigger-btn:hover {
  background: var(--theme-primary-light);
  color: var(--theme-primary);
  border-color: var(--theme-primary-border);
}

.desktop-search-trigger-btn:active {
  transform: scale(0.94);
}

.desktop-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.desktop-search-bar.hidden {
  display: none !important;
}

.desktop-search-bar .picker-search-input-box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 10px;
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid #cbd5e1;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.desktop-search-bar .picker-search-input-box:focus-within {
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 3px var(--theme-card-glow);
}

.desktop-search-bar .picker-search-icon {
  color: #94a3b8;
  font-size: 13px;
  margin-right: 8px;
  flex-shrink: 0;
}

.desktop-search-bar .picker-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: #1e293b;
  font-family: inherit;
  min-width: 0;
}

.desktop-search-bar .picker-search-clear-btn {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 14px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.desktop-search-bar .picker-search-clear-btn:hover {
  color: #64748b;
}

.desktop-search-bar .picker-search-cancel-btn {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 4px 6px;
  font-family: inherit;
  transition: color 0.15s ease;
}

.desktop-search-bar .picker-search-cancel-btn:hover {
  color: var(--theme-primary);
}

/* Desktop & Shared Search Empty Results + Wish Pool Card + Wish Pool Modal */
.picker-empty-results {
  text-align: center;
  padding: 24px 16px 12px;
  color: #6B7280;
}

.picker-empty-results .empty-icon {
  font-size: 28px;
  color: #D1D5DB;
  margin-bottom: 8px;
}

.picker-empty-results .empty-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 6px;
}

.picker-empty-results .empty-desc {
  font-size: 13px;
  color: #8C8FA7;
  margin: 0;
}

.wish-pool-banner-card {
  background: #F8FAFC;
  border: 1.5px dashed #CBD5E1;
  border-radius: 16px;
  padding: 18px 16px 20px;
  margin: 8px 0 6px;
  text-align: center;
  color: #334155;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.wish-pool-mascot-wrap {
  width: 100%;
  max-width: 180px;
  margin: 0 auto 8px;
  display: flex;
  justify-content: center;
}

.wish-pool-mascot-img {
  width: 100%;
  height: auto;
  max-height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.06));
}

.wish-pool-desc {
  font-size: 13px;
  line-height: 1.55;
  color: #475569;
  margin: 0 auto 14px;
  font-weight: 500;
}

.btn-wish-pool-action {
  border: none;
  background: #4F67B5;
  color: #FFFFFF;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 24px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(79, 103, 181, 0.35);
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-wish-pool-action:hover {
  background: #43599E;
  transform: translateY(-1px);
}

.btn-wish-pool-action:active {
  background: #3F5496;
  transform: scale(0.96);
}

.mobile-wish-pool-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1060;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  cursor: pointer;
}

.mobile-wish-pool-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-wish-pool-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1070;
  padding: 20px;
  box-sizing: border-box;
}

.mobile-wish-pool-modal.hidden {
  display: none !important;
}

.wish-pool-dialog {
  background: #FFFFFF;
  border-radius: 20px;
  width: 100%;
  max-width: 380px;
  padding: 20px 20px 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}

.wish-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.wish-dialog-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wish-sparkle-icon {
  font-size: 18px;
}

.wish-dialog-title {
  font-size: 17px;
  font-weight: 800;
  color: #18254A;
  margin: 0;
}

.sheet-close-x {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #F4F6FB;
  color: #747792;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sheet-close-x:hover {
  background: #E2E8F0;
  color: #1E293B;
}

.wish-hint-text {
  font-size: 13.5px;
  color: #6B7280;
  line-height: 1.5;
  margin: 0 0 16px;
}

.wish-input-group {
  margin-bottom: 14px;
  text-align: left;
}

.wish-input-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 6px;
}

.wish-text-input {
  width: 100%;
  height: 42px;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
  padding: 0 12px;
  font-size: 14px;
  color: #1F2937;
  background: #F9FAFB;
  box-sizing: border-box;
  outline: none;
  font-family: inherit;
}

.wish-text-input:focus {
  border-color: #3B99FC;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.15);
}

.wish-dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.btn-submit-wish {
  flex: 1;
  background: #3B99FC !important;
  border-color: #3B99FC !important;
  color: #FFFFFF !important;
  font-weight: 700;
  border-radius: 8px;
  height: 42px;
}

.pill {
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.pill:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.pill.active {
  background: var(--theme-primary);
  color: #ffffff;
  border-color: var(--theme-primary);
}

/* Vertical List of Task Cards (?函???瑁遘) */
.task-cards-vertical-list {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #f1f5f9;
}

/* ?函???瑁遘蝢?璅?? */
.task-cards-vertical-list::-webkit-scrollbar {
  width: 8px;
}

.task-cards-vertical-list::-webkit-scrollbar-track {
  background: #f8fafc;
  border-left: 1px solid #f1f5f9;
}

.task-cards-vertical-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.task-cards-vertical-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Library Card: 撌血???渡隞餃??迂 (璈怠???) */
.library-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  position: relative;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px;
}

.library-card:hover {
  transform: translateX(4px);
  border-color: var(--theme-primary);
  background: #fbfdff;
  box-shadow: 0 4px 14px var(--theme-card-glow);
}

.library-card:active {
  transform: scale(0.98);
}

/* 撌血撠? (撌血??? */
.library-card-thumb {
  width: 58px;
  height: 58px;
  min-width: 58px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.library-card:hover .library-card-thumb-img {
  transform: scale(1.08);
}

.library-card-thumb-emoji {
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-card-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(37, 99, 235, 0.9);
  color: #ffffff;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 6px;
  pointer-events: none;
  line-height: 1.2;
}

/* ?喳隞餃??迂 (蝝葉??銝＊蝷箄?? */
.library-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.library-card-title {
  font-family: var(--font-family-kids);
  font-size: 15px;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.4;
  letter-spacing: 0.5px;
}

/* ?喳??? */
.library-card-add-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--theme-primary-light);
  color: var(--theme-primary);
  border: 1.5px solid var(--theme-primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 15px;
  transition: all 0.2s ease;
}

.library-card:hover .library-card-add-btn {
  background: var(--theme-primary);
  color: #ffffff;
  transform: scale(1.1);
}

/* ---------------------------------------------------------
   RIGHT COLUMN: 隞餃??” (A4 ?怠?)
   --------------------------------------------------------- */
.right-panel-chart {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
}

.chart-canvas-toolbar {
  height: 48px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}

.canvas-info-pills {
  display: flex;
  align-items: center;
  gap: 16px;
}

.info-pill {
  font-size: 13px;
  color: #475569;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
}

.canvas-quick-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.canvas-history-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.canvas-history-group .icon-tool-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.canvas-history-group .icon-tool-btn:hover:not(:disabled) {
  background: #e2e8f0;
  color: #0f172a;
}

.canvas-history-group .icon-tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tool-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.tool-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Paper Viewport & Scroll Area */
.paper-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 30px;
  display: flex;
  justify-content: center;
  background: #cbd5e1;
}

.a4-sheet {
  width: 794px;
  min-height: 1123px;
  height: 1123px; /* Exact A4 aspect ratio @ 96 DPI */
  background-color: #ffffff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  padding: 24px 28px 18px 28px;
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  color: #2b2b2b;
  transform-origin: top center;
  transition: transform 0.2s ease;
  user-select: text;
  font-family: var(--font-family-chart);
  overflow: hidden;
}

/* Chart Typography defaults */
.a4-sheet,
.a4-sheet input,
.a4-sheet button,
.sheet-title-input,
.task-table-header,
.col-head,
.task-row,
.col-task-name,
.task-name-main,
.reward-input,
.footer-slogan-input,
#cloned-preview-sheet,
#cloned-preview-sheet input,
#cloned-preview-sheet .sheet-title-input,
#cloned-preview-sheet .task-name-main,
#cloned-preview-sheet .reward-input,
#cloned-preview-sheet .footer-slogan-input {
  font-family: var(--font-family-chart) !important;
}

/* Outer Border Frame (Inner container inside A4) */
.sheet-frame {
  width: 100%;
  height: 100%;
  flex: 1;
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: transparent;
  box-shadow: none;
}

/* Header: Decorative Assets + Center Cloud Title Banner */
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 6px 4px;
  position: relative;
  height: 98px;
  box-sizing: border-box;
}

.header-deco-left {
  display: flex;
  align-items: center;
  position: relative;
  width: 160px;
  height: 100%;
}

.deco-sun-face {
  width: 68px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(245, 158, 11, 0.2));
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
}

.deco-cloud-left {
  width: 62px;
  height: auto;
  object-fit: contain;
  position: absolute;
  left: 56px;
  top: 12px;
  z-index: 1;
}

.deco-sprout-left {
  width: 38px;
  height: auto;
  object-fit: contain;
  position: absolute;
  left: 78px;
  bottom: 8px;
  z-index: 2;
}

.title-wrapper {
  text-align: center;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3;
}

.sheet-title-banner-box {
  background: #ffffff;
  border: 3px dashed #f6ad55;
  border-radius: 50px;
  padding: 4px 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(246, 173, 85, 0.18);
  max-width: 380px;
  width: 90%;
  transition: all 0.2s ease;
}

.sheet-title-banner-box:hover {
  border-color: #ea580c;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.25);
}

.sheet-title-input {
  font-family: var(--font-family-chart) !important;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #dc2626;
  text-align: center;
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  cursor: text;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.sheet-title-input:focus {
  outline: none;
}

.header-deco-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  width: 160px;
  height: 100%;
}

.deco-rainbow-cloud {
  width: 106px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));
  position: absolute;
  right: 0;
  top: 2px;
}

/* ---------------------------------------------------------
   TASK LIST: 3 COLUMNS (任務圖卡 / 任務名稱 / 完成打卡)
   --------------------------------------------------------- */
.sheet-table-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 2px;
}

.task-table-header {
  display: grid;
  grid-template-columns: 190px 1fr 130px;
  background: #fde8cd;
  border: 2px solid #f6ad55;
  border-bottom: 2px solid #f6ad55;
  border-radius: 14px 14px 0 0;
  padding: 0;
  height: 38px;
  box-shadow: none;
}

.col-head {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-chart) !important;
  font-size: 17px;
  font-weight: 800;
  color: #7b341e;
  letter-spacing: 2px;
}

.col-head:not(:last-child) {
  border-right: 1.5px solid #f6ad55;
}

.task-rows-container {
  display: flex;
  flex-direction: column;
  border: 2px solid #f6ad55;
  border-top: none;
  border-radius: 0 0 14px 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  min-height: 672px;
}

/* Individual Task Row (3 Columns with warm divider lines) */
.task-row {
  display: grid;
  grid-template-columns: 190px 1fr 130px;
  align-items: center;
  border-bottom: 1.5px solid #fbd38d;
  padding: 0;
  position: relative;
  transition: background-color 0.15s ease;
  height: 84px;
  box-sizing: border-box;
  cursor: all-scroll;
}

.task-row:last-child {
  border-bottom: none;
}

.task-row:hover {
  background-color: #fffbf2;
}

/* Drag and Drop styling for task rows */
.task-row.is-dragging {
  opacity: 0.35;
  background-color: #f8fafc;
  outline: 2px dashed #3b82f6;
  outline-offset: -2px;
}

.task-row.drop-target-top::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #2563eb;
  border-radius: 2px;
  z-index: 10;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.6);
}

.task-row.drop-target-bottom::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #2563eb;
  border-radius: 2px;
  z-index: 10;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.6);
}

/* Row Action Buttons (Delete, Move Up, Move Down, Drag Handle) */
.row-actions-floating {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.task-row:hover .row-actions-floating {
  opacity: 1;
  pointer-events: auto;
}

.row-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.15s;
}

.row-action-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #ef4444;
}

.btn-move:hover {
  background: #eff6ff;
  border-color: #60a5fa;
  color: #2563eb;
}

.btn-drag {
  cursor: grab;
  color: #64748b;
}

.btn-drag:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

.btn-drag:active {
  cursor: grabbing;
}

/* Column 1: 任務圖卡 */
.col-card-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-right: 1.5px solid #fbd38d;
  height: 100%;
  box-sizing: border-box;
}

.task-thumb-frame {
  width: 170px;
  height: 76px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.task-thumb-emoji {
  font-size: 40px;
}

/* Column 2: 任務名稱 */
.col-task-name {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-right: 1.5px solid #fbd38d;
  height: 100%;
  box-sizing: border-box;
}

.task-name-pill-box {
  width: 92%;
  max-width: 320px;
  background: #ffffff;
  border: 2px dashed #e5e5e5;
  border-radius: 12px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.task-name-pill-box:hover {
  border-color: #cbd5e1;
  background: #fafafa;
}

.task-name-pill-box:focus-within {
  border-color: #94a3b8;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.15);
}

.task-name-main {
  font-family: var(--font-family-chart) !important;
  font-size: 22px;
  font-weight: 800;
  color: #2c1810;
  letter-spacing: 2px;
  text-align: center;
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  cursor: text !important;
  padding: 0;
}

/* Column 3: 完成打卡圈 */
.col-task-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 100%;
  box-sizing: border-box;
}

.stamp-ring-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.stamp-ring-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 4.5px solid var(--ring-color, #FF6473);
  background: #ffffff;
  box-sizing: border-box;
  transition: transform 0.18s ease;
}

.stamp-ring-circle:hover {
  transform: scale(1.05);
}

/* ---------------------------------------------------------
   BOTTOM INDEPENDENT ROW: 完成任務獎勵
   --------------------------------------------------------- */
.sheet-reward-section {
  margin-top: 8px;
  margin-bottom: 4px;
}

.reward-box-card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: #fae9b4;
  border: none;
  border-radius: 14px;
  padding: 4px 14px 4px 10px;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(246, 173, 85, 0.12);
  height: 68px;
  box-sizing: border-box;
}

.reward-gift-btn-wrap {
  height: 56px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.reward-gift-btn-img {
  height: 54px;
  width: auto;
  object-fit: contain;
}

.reward-input-wrap {
  flex: 1 1 0;
  min-width: 0;
  background: #ffffff;
  border: 2px dashed #fbd38d;
  border-radius: 12px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.reward-input-wrap:hover {
  border-color: #f6ad55;
  background: #fffdfa;
}

.reward-input-wrap:focus-within {
  border-color: #ea580c;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.reward-input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  background: transparent;
  font-family: var(--font-family-chart) !important;
  font-size: 20px;
  font-weight: 800;
  color: #2c1810;
  letter-spacing: 1.5px;
  text-align: left;
  outline: none;
  cursor: text !important;
  padding: 0;
}

/* ---------------------------------------------------------
   FOOTER: 加油！每一天！
   --------------------------------------------------------- */
.sheet-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0 2px 0;
  border-top: none;
}

.footer-cheer-decorations {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.footer-deco-leaf {
  height: 22px;
  width: auto;
  object-fit: contain;
}

.footer-deco-star {
  height: 20px;
  width: auto;
  object-fit: contain;
}

.footer-cheer-pill {
  background: #fff5f5;
  border: 2px dashed #fca5a5;
  border-radius: 24px;
  padding: 4px 28px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.08);
  transition: all 0.2s ease;
}

.footer-cheer-pill:hover {
  border-color: #ef4444;
}

.footer-cheer-pill:focus-within {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.footer-slogan-input {
  font-family: var(--font-family-chart) !important;
  font-size: 19px;
  font-weight: 900;
  color: #dc2626;
  letter-spacing: 3px;
  text-align: center;
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  max-width: 220px;
  cursor: text !important;
  padding: 0;
}

.footer-slogan-input:hover {
  border-color: #f59e0b;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.15);
}

.footer-slogan-input:focus {
  border: 2px solid var(--theme-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Copyright Footers (畫面底部 © HopiDay 2026) */
.screen-footer-copyright,
.mobile-step-footer-copyright,
.sheet-bottom-copyright {
  color: #bbbbbb !important;
  font-size: 12px !important;
  text-align: center !important;
  letter-spacing: 1px;
  user-select: none;
}

.sheet-bottom-copyright {
  font-family: var(--font-family-chart);
  margin-top: 14px;
  margin-bottom: 6px;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.screen-footer-copyright {
  font-family: var(--font-family-base);
  margin-top: 20px;
  padding-bottom: 8px;
}

.mobile-step-footer-copyright {
  font-family: var(--font-family-base);
  margin-top: 16px;
  padding-bottom: 12px;
}

/* ---------------------------------------------------------
   FLOATING REWARD PRESETS BAR
   --------------------------------------------------------- */
.reward-presets-bar {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid #cbd5e1;
  padding: 8px 18px;
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 50;
  max-width: 90vw;
  overflow-x: auto;
}

.reward-presets-label {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

.tag-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tag-pill:hover {
  background: #fef3c7;
  border-color: #fde68a;
  color: #b45309;
  transform: translateY(-1px);
}

/* ==========================================================================
   MODALS (Preview Modal & Custom Task Modal)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.modal-backdrop.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 94vh;
  animation: modalScaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-preview-dialog {
  width: 900px;
  max-width: 96vw;
  height: 94vh;
}

/* Confirm Clear Modal (皜征隞餃?銵函Ⅱ隤?蝒? */
.modal-confirm-dialog {
  width: 440px;
  max-width: 90vw;
  background: #ffffff;
  border-radius: 20px;
  padding: 32px 28px 24px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #fee2e2;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.confirm-title {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 10px;
  font-family: inherit;
}

.confirm-desc {
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 24px;
  font-weight: 500;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-cancel-confirm {
  flex: 1;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn-confirm-action {
  flex: 1;
  padding: 10px 18px;
  border-radius: 10px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-confirm-action:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon {
  font-size: 22px;
}

.modal-title {
  font-family: var(--font-family-kids);
  font-size: 19px;
  font-weight: 500;
  color: #0f172a;
}

.modal-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 電腦版預覽視窗：移除「下載 PDF」按鈕右邊的 X 關閉按鈕，手機版保留 */
.modal-actions-group #btn-modal-close {
  display: none !important;
}

@media (max-width: 768px) {
  .modal-actions-group #btn-modal-close {
    display: inline-flex !important;
  }
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.preview-scroll-body {
  background: #475569;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 30px;
  overflow-y: auto;
}

.preview-stage {
  display: flex;
  justify-content: center;
  transform-origin: top center;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-tips {
  font-size: 12px;
  color: #64748b;
}

/* Toast Message */
.toast-popup {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #657CC4 !important;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-popup.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

/* ==========================================================================
   PREVIEW MODE LOCKED (預覽任務表畫面專用樣式：不可編輯、移除虛線框與操作功能)
   ========================================================================== */
.a4-sheet.preview-mode-locked {
  pointer-events: none !important;
  user-select: none !important;
}

.a4-sheet.preview-mode-locked input,
.a4-sheet.preview-mode-locked textarea {
  pointer-events: none !important;
  user-select: none !important;
  cursor: default !important;
  border: none !important;
  border-color: transparent !important;
  box-shadow: none !important;
  background: transparent !important;
  outline: none !important;
}

/* 預覽畫面：.sheet-title-banner-box 移除 border 與 box-shadow */
.a4-sheet.preview-mode-locked .sheet-title-banner-box {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.a4-sheet.preview-mode-locked .task-name-pill-box {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* 預覽畫面：.footer-cheer-pill 移除 border 與 box-shadow */
.a4-sheet.preview-mode-locked .footer-cheer-pill {
  border: none !important;
  box-shadow: none !important;
}

/* 預覽畫面：.reward-input-wrap 移除 border 與 box-shadow */
.a4-sheet.preview-mode-locked .reward-input-wrap {
  border: none !important;
  box-shadow: none !important;
}

.a4-sheet.preview-mode-locked .row-actions-floating,
.a4-sheet.preview-mode-locked .mobile-canvas-badge,
.a4-sheet.preview-mode-locked .row-action-btn,
.a4-sheet.preview-mode-locked .task-row-drag-handle {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.a4-sheet.preview-mode-locked .task-row.is-selected {
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* ==========================================================================
   PRINT STYLESHEET (璅? A4 摰??)
   ========================================================================== */

@page {
  size: A4 portrait;
  margin: 8mm 6mm 8mm 6mm;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    overflow: visible !important;
  }

  .editor-header,
  .left-panel-tasks,
  .chart-canvas-toolbar,
  .row-actions-floating,
  .reward-presets-bar,
  .modal-backdrop,
  .toast-popup,
  .page-select {
    display: none !important;
  }

  .page-editor {
    display: block !important;
    min-height: auto !important;
    height: auto !important;
    background: transparent !important;
  }

  .editor-workspace {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .right-panel-chart {
    display: block !important;
    height: auto !important;
    background: transparent !important;
    overflow: visible !important;
  }

  .paper-viewport {
    padding: 0 !important;
    background: transparent !important;
    display: block !important;
    overflow: visible !important;
  }

  .a4-sheet {
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    padding: 0 !important;
    margin: 0 auto !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    transform: none !important;
  }

  .sheet-frame {
    box-shadow: none !important;
    border-width: 3px !important;
  }

  .sheet-title-input,
  .inline-input,
  .task-name-main,
  .task-name-sub,
  .reward-input,
  .footer-slogan-input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .stamp-circle {
    box-shadow: none !important;
  }
}

/* Clean poster appearance for Preview Modal & PDF Generation */
#cloned-preview-sheet .sheet-title-input,
#cloned-preview-sheet .task-name-main,
#cloned-preview-sheet .task-name-sub,
#cloned-preview-sheet .reward-input,
#cloned-preview-sheet .footer-slogan-input,
.a4-sheet.print-clean .sheet-title-input,
.a4-sheet.print-clean .task-name-main,
.a4-sheet.print-clean .task-name-sub,
.a4-sheet.print-clean .reward-input,
.a4-sheet.print-clean .footer-slogan-input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

#cloned-preview-sheet .row-actions-floating,
.a4-sheet.print-clean .row-actions-floating {
  display: none !important;
}

#cloned-preview-sheet .sheet-title-banner-box,
.a4-sheet.print-clean .sheet-title-banner-box,
#cloned-preview-sheet .task-name-pill-box,
.a4-sheet.print-clean .task-name-pill-box,
#cloned-preview-sheet .reward-input-wrap,
.a4-sheet.print-clean .reward-input-wrap,
#cloned-preview-sheet .footer-cheer-pill,
.a4-sheet.print-clean .footer-cheer-pill {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* ==========================================================================
   MOBILE HOPIDAY V1 APP STYLES & RESPONSIVE LAYOUT (<= 768px)
   ========================================================================== */

/* Hidden on desktop (> 768px) by default */
.hidden {
  display: none !important;
}

/* Hidden on desktop (> 768px) by default */
@media (min-width: 769px) {
  .mobile-page-step,
  .mobile-download-backdrop,
  .mobile-download-sheet,
  .mobile-task-picker-sheet,
  .mobile-edit-task-sheet,
  #mobile-edit-task-modal,
  .mobile-edit-task-modal,
  .mobile-template-sheet,
  .mobile-3tab-nav,
  .mobile-bottom-nav,
  .mobile-bottom-drawer,
  .mobile-export-sheet,
  .mobile-drawer-backdrop,
  .mobile-canvas-badge,
  .mobile-only-btn {
    display: none !important;
  }
}

.desktop-only-btn {
  display: inline-flex !important;
}

/* Header history buttons on desktop */
.header-history-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-tool-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.icon-tool-btn:hover:not(:disabled) {
  background: #e2e8f0;
  color: #0f172a;
}

.icon-tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ==========================================================================
   MOBILE SCREEN RULES (@media max-width: 768px) - HopiDay V1 Design System
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --primary: #657CC4;
    --accent: #F6B544;
    --background: #FBF9F4;
    --card: #FFFFFF;
    --text: #18254A;
    --secondary: #747792;
    --muted: #AAAABD;
    --border: #E7E6EF;
  }

  /* Prevent horizontal overflow on entire mobile viewport (except during canvas export) */
  html:not(.exporting-canvas), body:not(.exporting-canvas), #app, .app-container {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    position: relative;
    background-color: #FBF9F4 !important;
    background-image: none !important;
    color: #18254A !important;
    font-family: var(--font-family-base);
  }

  html.exporting-canvas,
  body.exporting-canvas {
    width: 794px !important;
    min-width: 794px !important;
    max-width: 794px !important;
    height: 1123px !important;
    min-height: 1123px !important;
    max-height: 1123px !important;
    overflow: visible !important;
    overflow-x: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #ffffff !important;
  }

  body.exporting-canvas .a4-sheet {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    -webkit-transform: none !important;
    transform-origin: 0 0 !important;
    width: 794px !important;
    min-width: 794px !important;
    max-width: 794px !important;
    height: 1123px !important;
    min-height: 1123px !important;
    max-height: 1123px !important;
    margin: 0 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    box-sizing: border-box !important;
  }

  /* Hide desktop specific elements */
  .left-panel-tasks,
  .chart-canvas-toolbar,
  .reward-presets-bar,
  .desktop-only-btn,
  #page-editor {
    display: none !important;
  }

  .mobile-only-btn {
    display: inline-flex !important;
  }

  /* Mobile Toast: ~50px above mobile-bottom-action-wrapper */
  .toast-popup {
    top: auto !important;
    bottom: 150px !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(0) !important;
    z-index: 3500 !important;
    background: #657CC4 !important;
    backdrop-filter: blur(10px) !important;
    color: #FFFFFF !important;
    border-radius: 24px !important;
    padding: 10px 20px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease !important;
  }

  .toast-popup.hidden {
    transform: translateX(-50%) translateY(16px) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* ==========================================================================
     STEP 1/4: Landing / 選角色
     ========================================================================== */
  body.mobile-step1-lock {
    overflow: hidden !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    width: 100vw !important;
    position: fixed !important;
    inset: 0 !important;
  }

  .page-select {
    display: none !important;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    padding: 24px 20px 36px;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    background-color: #FBF9F4 !important;
    background-image: url('assets/19_background_base.png') !important;
    background-position: center bottom !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    position: relative;
    overflow: hidden !important;
  }

  .page-select.active {
    display: flex !important;
    flex-direction: column;
  }

  .select-main-content {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    z-index: 10;
  }

  .select-center-column {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
  }

  /* HopiDay Logo & Title */
  .select-hero {
    margin-bottom: 8px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hopiday-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 2px;
    user-select: none;
  }

  .hopiday-brand-logo {
    height: 74px;
    width: auto;
    max-width: 230px;
    object-fit: contain;
    display: block;
    margin: -8px 0 -6px;
    filter: drop-shadow(0 3px 8px rgba(101, 124, 196, 0.1));
  }

  .hero-title-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
  }

  .main-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #1A69F0 0%, #3B57DE 38%, #764AD3 76%, #8D3DDD 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    line-height: 1.25;
  }

  .title-deco-group {
    position: absolute;
    right: -24px;
    top: -8px;
  }

  .title-rays-img {
    width: 20px;
  }

  .title-cloud-img {
    display: none;
  }

  .main-subtitle {
    font-size: 13.5px;
    color: #747792;
    line-height: 1.45;
    padding: 0 8px;
    margin-top: 4px;
    text-align: center;
  }

  /* 4-Step Progress Indicator */
  .steps-progress-bar {
    width: 100%;
    max-width: 340px;
    margin: 16px auto 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    box-sizing: border-box;
  }

  .step-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #E8E7F0;
    color: #8C8FA7;
    font-size: 12.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }

  .step-node.active .step-num {
    background: #657CC4 !important;
    color: #FFFFFF !important;
  }

  .step-title {
    font-size: 11px;
    font-weight: 600;
    color: #8C8FA7;
    white-space: nowrap;
  }

  .step-node.active .step-title {
    color: #657CC4 !important;
    font-weight: 700;
  }

  .step-connector {
    flex: 1;
    height: 1.5px;
    background: #E8E7F0;
    margin: 0 4px 16px;
    min-width: 10px;
    max-width: 32px;
  }

  /* Role Selection Cards */
  .character-cards-container {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
    max-width: 340px;
    margin: 0 auto 20px;
    justify-content: center;
    box-sizing: border-box;
  }

  .character-card {
    flex: 1;
    height: 188px;
    background: #FFFFFF;
    border: 2px solid #E7E6EF;
    border-radius: 8px;
    padding: 14px 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(24, 37, 74, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
  }

  .character-card.selected {
    border: 2px solid #657CC4 !important;
    box-shadow: 0 6px 18px rgba(101, 124, 196, 0.16) !important;
  }

  .card-selection-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #657CC4;
    display: none;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 11px;
    box-shadow: 0 2px 6px rgba(101, 124, 196, 0.3);
  }

  .character-card.selected .card-selection-check {
    display: flex;
  }

  .check-icon-img {
    width: 100%;
    height: 100%;
  }

  .card-avatar-circle {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #F0F4FC;
    overflow: hidden;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .character-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .character-name {
    font-size: 17px;
    font-weight: 700;
    color: #18254A;
  }

  /* CTA Button & Subtext */
  .select-actions {
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 4px;
  }

  .btn-cta-start, .mobile-primary-cta {
    background: #657CC4 !important;
    color: #FFFFFF !important;
    height: 60px !important;
    min-height: 60px !important;
    border-radius: 16px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    width: 100% !important;
    border: none !important;
    box-shadow: 0 6px 18px rgba(101, 124, 196, 0.28) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, background-color 0.15s ease !important;
    touch-action: manipulation;
  }

  .btn-cta-start:active, .mobile-primary-cta:active {
    transform: scale(0.98);
    background: #546BB3 !important;
  }

  .select-supplement-text {
    font-size: 12.5px;
    color: #747792;
    margin-top: 10px;
    text-align: center;
    font-weight: 500;
  }

  /* Hopi Bunny Brand Mascot (Left-bottom companion, non-interactive) */
  .hopi-bunny-wrapper {
    display: block !important;
    position: fixed !important;
    left: 4px !important;
    bottom: 0 !important;
    width: 110px !important;
    z-index: 5 !important;
    pointer-events: none !important;
    user-select: none !important;
  }

  .hopi-bunny-mascot {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 18px rgba(30, 45, 90, 0.1));
  }

  /* Clouds on Mobile Step 1 */
  .deco-cloud {
    display: block;
    position: absolute;
    pointer-events: none;
    z-index: 1;
    opacity: 0.75;
  }

  .deco-cloud-top-left {
    top: 20px;
    left: -20px;
    width: 90px;
  }

  .deco-cloud-top-right {
    top: 30px;
    right: -25px;
    width: 110px;
  }

  .deco-cloud-left-mid {
    top: 48%;
    left: -30px;
    width: 80px;
  }

  .deco-cloud-right-mid {
    top: 55%;
    right: -30px;
    width: 90px;
  }

  /* ==========================================================================
     MOBILE STEP PAGES COMMON CONTAINER
     ========================================================================== */
  .mobile-page-step {
    display: none !important;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: #FBF9F4;
    box-sizing: border-box;
    position: relative;
    flex-direction: column;
  }

  .mobile-page-step.active {
    display: flex !important;
    animation: fadeIn 0.25s ease-out;
  }

  /* Mobile Header (Height 56px, left arrow, center title, right text) */
  .mobile-step-header {
    height: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    background: #FBF9F4;
    z-index: 100;
    border-bottom: 1px solid rgba(231, 230, 239, 0.4);
  }

  .mobile-header-back-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #18254A;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    touch-action: manipulation;
  }

  .mobile-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .mobile-step-badge {
    font-size: 11.5px;
    color: #747792;
    font-weight: 500;
    line-height: 1.1;
  }

  .mobile-step-title {
    font-size: 18px;
    font-weight: 800;
    color: #18254A;
    line-height: 1.25;
    margin: 0;
  }

  .mobile-header-text-btn {
    min-width: 44px;
    height: 44px;
    padding: 0 8px;
    border: none;
    background: transparent;
    color: #657CC4;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    cursor: pointer;
    touch-action: manipulation;
  }

  .mobile-header-placeholder {
    width: 44px;
    height: 44px;
  }

  /* Mobile Body Layout */
  .mobile-step-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 20px calc(140px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
    width: 100%;
    box-sizing: border-box;
  }

  /* Fixed CTA Area at Bottom (Above 3-Tab Bottom Nav) */
  .mobile-bottom-action-wrapper {
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    padding: 8px 20px 10px;
    background: linear-gradient(180deg, rgba(251, 249, 244, 0) 0%, rgba(251, 249, 244, 0.95) 26%, #FBF9F4 100%);
    z-index: 90;
    box-sizing: border-box;
  }

  .mobile-preview-cta-wrap {
    bottom: 0 !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 1000 !important;
    pointer-events: auto !important;
  }

  .mobile-preview-cta-wrap button,
  #btn-mobile-open-download-sheet {
    pointer-events: auto !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    position: relative !important;
    z-index: 1001 !important;
  }

  .mobile-reward-cta-wrap {
    bottom: 0 !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 1000 !important;
    pointer-events: auto !important;
  }

  .mobile-reward-body {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* 3-Tab Bottom Bar (??, 隞餃?, 閫) */
  .mobile-3tab-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #FFFFFF;
    border-top: 1px solid #E7E6EF;
    display: flex !important;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    box-sizing: border-box;
  }

  .mobile-tab-item {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #747792;
    cursor: pointer;
    position: relative;
    padding-top: 4px;
    touch-action: manipulation;
  }

  .mobile-tab-item i {
    font-size: 19px;
  }

  .mobile-tab-item span {
    font-size: 11px;
    font-weight: 600;
  }

  .mobile-tab-item.active {
    color: #657CC4 !important;
  }

  .tab-active-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #657CC4;
    position: absolute;
    bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  }

  /* ==========================================================================
     STEP 2/4: 摰?隞餃? (Task Cards List & Add Button)
     ========================================================================== */
  .tasks-drag-hint {
    font-size: 10px;
    color: #94A3B8;
    text-align: center;
    margin: 0 0 10px 0;
    font-weight: 500;
    letter-spacing: 0.3px;
    user-select: none !important;
    -webkit-user-select: none !important;
  }

  .mobile-task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    touch-action: pan-y;
  }

  /* 開啟 Bottom Sheet 時暫停背景卡片操作與捲動 */
  body.mobile-sheet-open .mobile-tasks-body {
    overflow: hidden !important;
    touch-action: none !important;
  }

  body.mobile-sheet-open .mobile-task-list,
  body.mobile-sheet-open .mobile-task-card,
  body.mobile-sheet-open .mobile-btn-add-task {
    pointer-events: none !important;
  }

  .mobile-task-card {
    background: #FFFFFF;
    border-radius: 10px;
    border: 1.5px solid #f9f9f9;
    box-shadow: 0 2px 10px rgba(24, 37, 74, 0.08);
    position: relative;
    overflow: hidden;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
    transition: transform 0.18s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.18s cubic-bezier(0.2, 0, 0, 1), border-color 0.18s ease;
    touch-action: pan-y;
  }

  .mobile-task-card.is-drag-active {
    transform: scale(1.03) !important;
    box-shadow: 0 14px 32px rgba(24, 37, 74, 0.18), 0 4px 12px rgba(101, 124, 196, 0.15) !important;
    border-color: #657CC4 !important;
    z-index: 60 !important;
    cursor: grabbing !important;
  }

  .task-card-inner {
    display: flex;
    align-items: center;
    padding: 10px 10px 10px 14px;
    gap: 14px;
    background: #FFFFFF;
    border-radius: 10px;
    position: relative;
    z-index: 2;
    transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1);
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
    touch-action: pan-y;
  }

  /* Task Card Thumbnail - Enlarged Width (Requirement 11) */
  .task-card-thumb {
    width: 68px;
    height: 54px;
    border-radius: 10px;
    background: #F4F7FE;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    touch-action: pan-y;
  }

  .task-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
  }

  .task-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #18254A;
    flex: 1;
    min-width: 0;
    padding: 12px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    user-select: none !important;
    -webkit-user-select: none !important;
    touch-action: pan-y;
  }

  .task-drag-handle {
    width: 36px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #B8BCCB;
    font-size: 18px;
    cursor: grab;
    flex-shrink: 0;
    border-radius: 8px;
    touch-action: none;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
    transition: color 0.15s ease, background-color 0.15s ease;
  }

  .task-drag-handle:active,
  .mobile-task-card.is-drag-active .task-drag-handle {
    color: #657CC4;
    background-color: #F4F7FE;
    cursor: grabbing;
  }

  /* Add Task Button */
  .mobile-btn-add-task {
    width: 100%;
    height: 56px;
    background: #F4F7FE;
    border: 1.5px dashed #B8C7ED;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    touch-action: manipulation;
  }

  .mobile-btn-add-task:active {
    background: #E8EEFB;
  }

  .add-task-icon-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #657CC4;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
  }

  .add-task-text {
    font-size: 15.5px;
    font-weight: 700;
    color: #657CC4;
  }

  /* ==========================================================================
     STEP 3/4: 設定獎勵 (Title & Reward Inputs)
     ========================================================================== */
  .mobile-card {
    background: #FFFFFF;
    border-radius: 8px;
    border: 1px solid #E7E6EF;
    padding: 16px 16px 18px;
    box-shadow: 0 2px 10px rgba(24, 37, 74, 0.08);
    margin-bottom: 14px;
    box-sizing: border-box;
  }

  .mobile-card-title {
    font-size: 16px;
    font-weight: 800;
    color: #18254A;
    margin-bottom: 8px;
  }

  .mobile-helper-text {
    font-size: 12.5px;
    color: #747792;
    margin-top: 6px;
    line-height: 1.4;
  }

  .mobile-helper-text.helper-top {
    margin-top: 0;
    margin-bottom: 10px;
  }

  .mobile-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
  }

  .mobile-setting-input {
    width: 100%;
    height: 48px;
    border: 1px solid #E7E6EF;
    border-radius: 8px;
    padding: 0 54px 0 14px;
    font-size: 15px;
    font-weight: 600;
    color: #18254A;
    background: #FAFAFC;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
    transition: border 0.15s ease, background 0.15s ease;
  }

  .mobile-setting-input:focus {
    border-color: #657CC4;
    background: #FFFFFF;
  }

  .mobile-input-counter {
    position: absolute;
    right: 14px;
    font-size: 12px;
    color: #AAAABD;
    font-weight: 600;
    pointer-events: none;
  }

  /* Single-row Horizontal Scroll for Quick Tag Pills */
  .mobile-chips-scroll-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    white-space: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding: 10px 2px 2px;
    margin-top: 4px;
  }

  .mobile-chips-scroll-row::-webkit-scrollbar {
    display: none;
  }

  .mobile-tag-pill {
    flex-shrink: 0;
    background: #EEF2FB;
    color: #506DBE;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    touch-action: manipulation;
  }

  .mobile-tag-pill:active {
    background: #657CC4;
    color: #FFFFFF;
    transform: scale(0.96);
  }

  .mobile-step-footer-copyright {
    text-align: center;
    font-size: 12.5px;
    color: #94A3B8;
    margin: 16px 0 6px;
    font-weight: 500;
    user-select: none;
  }

  /* ==========================================================================
     STEP 4/4: 預覽任務表 (Pure Preview, Scaled Full Sheet)
     ========================================================================== */
  .mobile-preview-container {
    flex: 1;
    overflow-x: hidden !important;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 16px calc(96px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 100vw !important;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-preview-paper-stage {
    display: block !important;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(24, 37, 74, 0.08);
    background: #FFFFFF;
    margin: auto !important;
    max-width: calc(100% - 8px) !important;
    box-sizing: border-box;
  }

  .mobile-preview-paper-stage .a4-sheet {
    flex-shrink: 0 !important;
    width: 794px !important;
    min-width: 794px !important;
    max-width: 794px !important;
    height: 1123px !important;
    min-height: 1123px !important;
    max-height: 1123px !important;
    transform-origin: top left !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  /* Step 4/4 預覽任務表畫面不提供任務與標題等編輯功能 (鎖定純檢視) */
  .mobile-preview-paper-stage,
  .mobile-preview-paper-stage * {
    user-select: none !important;
  }

  .mobile-preview-paper-stage {
    pointer-events: none !important;
    cursor: default !important;
  }

  .mobile-preview-paper-stage,
  .mobile-preview-paper-stage .a4-sheet,
  .a4-sheet.preview-mode-locked {
    pointer-events: none !important;
    user-select: none !important;
  }

  .mobile-preview-paper-stage input,
  .mobile-preview-paper-stage textarea,
  .a4-sheet.preview-mode-locked input,
  .a4-sheet.preview-mode-locked textarea {
    pointer-events: none !important;
    user-select: none !important;
    cursor: default !important;
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    background: transparent !important;
    outline: none !important;
  }

  /* 預覽任務圖畫面：移除虛線框與可編輯外框 */
  .mobile-preview-paper-stage .sheet-title-banner-box,
  .a4-sheet.preview-mode-locked .sheet-title-banner-box {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  .mobile-preview-paper-stage .task-name-pill-box,
  .a4-sheet.preview-mode-locked .task-name-pill-box {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  /* 預覽畫面：.footer-cheer-pill 移除 border 與 box-shadow */
  .mobile-preview-paper-stage .footer-cheer-pill,
  .a4-sheet.preview-mode-locked .footer-cheer-pill {
    border: none !important;
    box-shadow: none !important;
  }

  /* 預覽畫面：.reward-input-wrap 移除 border 與 box-shadow */
  .mobile-preview-paper-stage .reward-input-wrap,
  .a4-sheet.preview-mode-locked .reward-input-wrap {
    border: none !important;
    box-shadow: none !important;
  }

  /* 移除編輯功能與操作浮動按鈕 */
  .mobile-preview-paper-stage .row-actions-floating,
  .mobile-preview-paper-stage .mobile-canvas-badge,
  .mobile-preview-paper-stage .row-action-btn,
  .mobile-preview-paper-stage .task-row-drag-handle,
  .a4-sheet.preview-mode-locked .row-actions-floating,
  .a4-sheet.preview-mode-locked .mobile-canvas-badge,
  .a4-sheet.preview-mode-locked .row-action-btn,
  .a4-sheet.preview-mode-locked .task-row-drag-handle {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  .mobile-preview-paper-stage .task-row.is-selected,
  .a4-sheet.preview-mode-locked .task-row.is-selected {
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  /* ==========================================================================
     STEP 5: 下載 BOTTOM SHEET (Bottom Sheet Modal)
     ========================================================================== */
  .mobile-download-backdrop {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-download-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  #mobile-edit-task-backdrop {
    z-index: 1075 !important;
  }

  .mobile-download-sheet, .mobile-task-picker-sheet, .mobile-template-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    background: #FFFFFF;
    border-radius: 24px 24px 0 0 !important;
    z-index: 1060;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    max-height: 85vh;
    display: flex !important;
    flex-direction: column;
    box-sizing: border-box;
  }

  .mobile-download-sheet:not(.open),
  .mobile-task-picker-sheet:not(.open),
  .mobile-template-sheet:not(.open),
  .mobile-edit-task-sheet:not(.open) {
    pointer-events: none !important;
    visibility: hidden !important;
  }

  .mobile-download-sheet.open,
  .mobile-task-picker-sheet.open,
  .mobile-template-sheet.open,
  .mobile-edit-task-sheet.open {
    transform: translateY(0) !important;
    pointer-events: auto !important;
    visibility: visible !important;
  }

  /* Fixed height for add task drawer regardless of item count */
  #mobile-add-task-drawer,
  .mobile-task-picker-sheet {
    height: 72vh !important;
    max-height: 85vh !important;
  }

  .sheet-drag-pill-wrap {
    display: flex;
    justify-content: center;
    padding: 4px 0 10px;
    width: 100%;
  }

  .sheet-drag-pill {
    width: 38px;
    height: 4px;
    background: #D1D5DB;
    border-radius: 2px;
  }

  .download-sheet-header, .task-picker-header, .template-sheet-header, .edit-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    width: 100%;
  }

  .download-sheet-title, .task-picker-title {
    font-size: 18px;
    font-weight: 800;
    color: #18254A;
  }

  .sheet-close-x {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #F4F6FB;
    color: #747792;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
  }

  .sheet-back-arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #18254A;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
  }

  .download-sheet-view {
    display: none;
    flex-direction: column;
    width: 100%;
  }

  .download-sheet-view.active {
    display: flex;
  }

  .download-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .download-option-item {
    height: 68px;
    min-height: 68px;
    background: #FFFFFF;
    border: 1px solid #E7E6EF;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 14px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(24, 37, 74, 0.02);
    transition: all 0.15s ease;
    width: 100%;
    box-sizing: border-box;
    touch-action: manipulation;
  }

  .download-option-item:active {
    background: #F8FAFD;
    transform: scale(0.99);
  }

  .option-icon-squircle {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 20px;
    flex-shrink: 0;
  }

  .squircle-jpg {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  }

  .squircle-pdf {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  }

  .squircle-email {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  }

  .option-text {
    font-size: 16px;
    font-weight: 700;
    color: #18254A;
    flex: 1;
    text-align: left;
  }

  .option-text-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    text-align: left;
  }

  .option-title {
    font-size: 15px;
    font-weight: 700;
    color: #18254A;
    line-height: 1.25;
  }

  .option-subtitle {
    font-size: 11.5px;
    color: #718096;
    font-weight: 400;
    line-height: 1.25;
  }

  .option-chevron {
    color: #AAAABD;
    font-size: 14px;
  }

  .download-email-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 6px 0;
  }

  .mobile-email-field {
    width: 100%;
    height: 52px;
    border-radius: 8px;
    border: 1.5px solid #E7E6EF;
    padding: 0 16px;
    font-size: 15px;
    color: #18254A;
    background: #FAFAFC;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
  }

  .mobile-email-field:focus {
    border-color: #657CC4;
    background: #FFFFFF;
  }

  /* ==========================================================================
     New Task Picker Sheet: 搜尋 + 右側標籤, 點擊搜尋後熱門搜尋, 搜尋結果任務許願池
     ========================================================================== */

  /* Mode 1: 搜尋+右側標籤 (Default Browsing Bar) */
  .picker-tabs-bar {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 2px 0 8px;
    border-bottom: 1.5px solid #F1F2F6;
    margin-bottom: 10px;
    box-sizing: border-box;
    gap: 2px;
  }

  .picker-search-trigger-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #18254A;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.1s ease;
  }

  .picker-search-trigger-btn:active {
    background: #F4F7FE;
    transform: scale(0.92);
  }

  .picker-tabs-scroll {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 4px;
  }

  .picker-tabs-scroll::-webkit-scrollbar {
    display: none;
  }

  .picker-tab-item {
    border: none;
    background: transparent;
    color: #8C8FA7;
    font-size: 14.5px;
    font-weight: 500;
    padding: 8px 2px 10px;
    position: relative;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
    transition: color 0.15s ease;
  }

  .picker-tab-item.active {
    color: #18254A;
    font-weight: 800;
  }

  .picker-tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: #18254A;
    border-radius: 3px 3px 0 0;
  }

  .picker-sheet-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #F4F5F8;
    color: #8C8FA7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 6px;
    transition: all 0.15s ease;
  }

  .picker-sheet-close-btn:active {
    background: #E5E7EB;
    transform: scale(0.92);
  }

  /* Mode 2: 點擊搜尋按鈕後 (Search Input Bar) */
  .picker-search-bar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    width: 100%;
    gap: 12px;
    padding: 2px 0 12px;
    box-sizing: border-box;
  }

  .picker-search-bar.hidden {
    display: none !important;
  }

  .picker-search-input-box {
    flex: 1 1 0px !important;
    min-width: 0 !important;
    width: 0 !important;
    display: flex;
    align-items: center;
    background: #F3F4F6;
    border-radius: 10px;
    height: 40px;
    padding: 0 12px;
    box-sizing: border-box;
    border: 1.5px solid transparent;
    transition: border-color 0.2s ease, background 0.2s ease;
  }

  .picker-search-input-box:focus-within {
    border-color: #657CC4;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(101, 124, 196, 0.12);
  }

  .picker-search-icon {
    color: #9CA3AF;
    font-size: 14px;
    margin-right: 8px;
    flex-shrink: 0;
  }

  .picker-search-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14.5px;
    color: #1F2937;
    font-family: inherit;
    caret-color: #EF4444; /* Red blinking caret */
    min-width: 0;
  }

  .picker-search-clear-btn {
    border: none;
    background: transparent;
    color: #9CA3AF;
    font-size: 15px;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .picker-search-cancel-btn {
    border: none;
    background: transparent;
    color: #1F2937;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 6px 4px;
    font-family: inherit;
    transition: color 0.15s ease;
  }

  .picker-search-cancel-btn:active {
    color: #657CC4;
  }

  /* Hot Searches View (熱門搜尋 🔥) */
  .picker-hot-searches-view {
    padding: 4px 0 16px;
    animation: fadeIn 0.2s ease;
  }

  .hot-searches-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14.5px;
    font-weight: 800;
    color: #18254A;
    margin-bottom: 12px;
  }

  .hot-fire-emoji {
    font-size: 16px;
  }

  .hot-search-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
  }

  .hot-search-pill {
    border: none;
    background: #F3F4F6;
    color: #374151;
    border-radius: 9999px;
    padding: 6px 14px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, transform 0.1s ease;
  }

  .hot-search-pill:active {
    background: #E5E7EB;
    transform: scale(0.96);
  }

  /* Scrollable Container & Grid */
  .task-picker-scroll-container {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 24px;
  }

  .task-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 2px 0 10px;
  }

  /* Requirement 12: Picker Task Card Overlay with White Gradient & Text Shadow */
  .picker-task-card {
    background: #FFFFFF;
    border: 1.5px solid #E7E6EF;
    border-radius: 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    cursor: pointer;
    transition: all 0.15s ease;
    touch-action: manipulation;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
  }

  .picker-task-card:active {
    border-color: #657CC4;
    transform: scale(0.97);
  }

  .picker-task-thumb {
    width: 100%;
    height: 94px;
    border-radius: 12px;
    background: #F4F7FE;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    margin-bottom: 0;
  }

  .picker-task-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* padding: 4px 6px 18px;*/
    box-sizing: border-box;
  }

  .picker-task-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 16px 6px 6px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.85) 30%, rgba(255, 255, 255, 0.98) 100%);
    font-size: 13.5px;
    font-weight: 700;
    color: #18254A;
    line-height: 1.25;
    text-align: center;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.95), 0 1px 4px rgba(255, 255, 255, 0.7);
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Empty Search State */
  .picker-empty-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px 16px 12px;
    color: #6B7280;
  }

  .picker-empty-results .empty-icon {
    font-size: 28px;
    color: #D1D5DB;
    margin-bottom: 8px;
  }

  .picker-empty-results .empty-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 6px;
  }

  .picker-empty-results .empty-desc {
    font-size: 13px;
    color: #8C8FA7;
    margin: 0;
  }

  /* Wish Pool Banner Card (素材許願池) */
  .wish-pool-banner-card {
    background: #F8FAFC;
    border: 1.5px dashed #CBD5E1;
    border-radius: 16px;
    padding: 20px 18px 22px;
    margin: 18px 0 10px;
    text-align: center;
    color: #334155;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    animation: fadeInUp 0.25s ease;
  }

  .wish-pool-mascot-wrap {
    width: 100%;
    max-width: 200px;
    margin: 0 auto 10px;
    display: flex;
    justify-content: center;
  }

  .wish-pool-mascot-img {
    width: 100%;
    height: auto;
    max-height: 75px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.06));
  }

  .wish-pool-desc {
    font-size: 13.5px;
    line-height: 1.55;
    color: #475569;
    margin: 0 auto 16px;
    /* max-width: 250px; */
    font-weight: 500;
  }

  .btn-wish-pool-action {
    border: none;
    background: #4F67B5;
    color: #FFFFFF;
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 700;
    padding: 10px 28px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(79, 103, 181, 0.35);
    transition: background 0.15s ease, transform 0.1s ease;
  }

  .btn-wish-pool-action:active {
    background: #3F5496;
    transform: scale(0.96);
  }

  /* Wish Pool Modal Backdrop with Translucent White & Blur (Requirement 4) */
  .mobile-wish-pool-backdrop {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 1060;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-wish-pool-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Wish Pool Modal */
  .mobile-wish-pool-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 1070;
    padding: 20px;
    box-sizing: border-box;
  }

  .mobile-wish-pool-modal.hidden {
    display: none !important;
  }

  .wish-pool-dialog {
    background: #FFFFFF;
    border-radius: 20px;
    width: 100%;
    max-width: 380px;
    padding: 20px 20px 22px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .wish-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }

  .wish-dialog-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .wish-sparkle-icon {
    font-size: 18px;
  }

  .wish-dialog-title {
    font-size: 17px;
    font-weight: 800;
    color: #18254A;
    margin: 0;
  }

  .wish-hint-text {
    font-size: 13.5px;
    color: #6B7280;
    line-height: 1.5;
    margin: 0 0 16px;
  }

  .wish-input-group {
    margin-bottom: 14px;
    text-align: left;
  }

  .wish-input-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 6px;
  }

  .wish-text-input {
    width: 100%;
    height: 42px;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    padding: 0 12px;
    font-size: 14px;
    color: #1F2937;
    background: #F9FAFB;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
  }

  .wish-text-input:focus {
    border-color: #3B99FC;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.15);
  }

  .wish-dialog-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
  }

  .btn-submit-wish {
    flex: 1;
    background: #3B99FC !important;
    border-color: #3B99FC !important;
    color: #FFFFFF !important;
    font-weight: 700;
    border-radius: 8px;
    height: 42px;
  }

  /* Edit Task Bottom Sheet (底部滑出「任務名稱／刪除／確定」，列表保持原位置) */
  .mobile-edit-task-sheet,
  .mobile-edit-task-modal {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    background: #FFFFFF !important;
    border-radius: 20px 20px 0 0 !important;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15) !important;
    z-index: 1080 !important;
    padding: 8px 20px calc(24px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
    transform: translateY(100%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    pointer-events: none;
  }

  .mobile-edit-task-sheet.open,
  .mobile-edit-task-modal.open {
    transform: translateY(0) !important;
    pointer-events: auto !important;
  }

  .mobile-edit-task-sheet.hidden,
  .mobile-edit-task-modal.hidden {
    transform: translateY(100%) !important;
    display: none !important;
  }

  .edit-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 4px;
    border-bottom: 1px solid #F3F4F6;
  }

  .edit-sheet-title {
    font-size: 17px;
    font-weight: 700;
    color: #18254A;
    margin: 0;
  }

  .edit-sheet-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .edit-sheet-task-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #F9FAFB;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
  }

  .edit-task-preview-thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
  }

  .edit-task-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .edit-task-info-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
  }

  .edit-task-field-label {
    display: none !important;
  }

  .edit-task-title-input {
    width: 100%;
    font-size: 16px;
    font-weight: 700;
    color: #18254A;
    background: #FFFFFF;
    border: 1.5px solid #D1D5DB;
    border-radius: 8px;
    padding: 8px 12px;
    box-sizing: border-box;
    font-family: var(--font-family-base);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
  }

  .edit-task-title-input:focus {
    border-color: #657CC4;
    box-shadow: 0 0 0 3px rgba(101, 124, 196, 0.15);
  }

  .edit-task-title-display {
    display: none !important;
  }

  .edit-sheet-footer {
    display: flex;
    gap: 10px;
    padding-top: 4px;
    align-items: center;
  }

  /* Requirement 10: 刪除按鈕寬度再縮小 50% (原 flex: 1 約 150px -> 固定 78px) */
  .btn-delete-task {
    flex: 0 0 78px;
    width: 78px;
    height: 48px;
    border-radius: 10px;
    border: 1.5px solid #FCA5A5;
    background: #FEF2F2;
    color: #DC2626;
    font-size: 14.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0 8px;
    box-sizing: border-box;
  }

  .btn-delete-task:active {
    background: #FEE2E2;
    transform: scale(0.98);
  }

  .btn-save-edit {
    flex: 1;
    height: 48px !important;
    min-height: 48px !important;
    border-radius: 10px !important;
    font-size: 15.5px !important;
    font-weight: 700 !important;
  }

  /* Template Selector Sheet */
  .template-sheet-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .mobile-template-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px solid #E7E6EF;
    border-radius: 8px;
    background: #FFFFFF;
    cursor: pointer;
    transition: all 0.18s ease;
    touch-action: manipulation;
    position: relative;
    box-shadow: 0 2px 6px rgba(24, 37, 74, 0.02);
  }

  .mobile-template-card:active {
    background: #F4F7FE;
    transform: scale(0.99);
  }

  .mobile-template-card.active {
    border: 2px solid #657CC4 !important;
    background: #F0F6FF !important;
    box-shadow: 0 4px 14px rgba(101, 124, 196, 0.12) !important;
  }

  .template-selected-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #657CC4;
    color: #FFFFFF;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    margin-left: auto;
    flex-shrink: 0;
  }

  .mobile-template-card.active .template-selected-badge {
    display: flex;
  }

  .mobile-template-card.item-danger {
    border-color: #FEE2E2;
    background: #FFFBFB;
  }

  .mobile-template-card .template-item-title {
    color: #18254A !important;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .mobile-template-card .template-item-desc {
    display: none !important;
  }

  .mobile-template-card.item-danger .template-item-title {
    color: #DC2626 !important;
  }

  /* Mobile Image Saved / Download Modal (iOS/Mobile friendly) */
  .mobile-image-dialog {
    max-width: 320px;
    width: 86%;
    background: #FFFFFF;
    border-radius: 24px;
    overflow: hidden;
    padding: 28px 20px 22px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    box-sizing: border-box;
    margin: auto;
    text-align: center;
  }
  .mobile-image-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
  }
  .mobile-image-title {
    font-size: 18px;
    font-weight: 700;
    color: #18254A;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  .mobile-image-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  .mobile-image-actions .btn {
    width: 100%;
    font-size: 15px;
    font-weight: 700;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
  }
  .mobile-image-actions .btn-close-modal-img {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #E2E8F0;
  }
  .mobile-image-actions .btn-close-modal-img:hover {
    background: #E2E8F0;
    color: #1E293B;
  }

  /* Post-Download Retention Modal (任務圖已儲存於相簿中，下次還想繼續用？) */
  .post-download-dialog,
  .keep-using-guide-dialog {
    max-width: 320px;
    width: 86%;
    background: #FFFFFF;
    border-radius: 24px;
    overflow: hidden;
    padding: 28px 22px 24px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    box-sizing: border-box;
    margin: auto;
    text-align: center;
  }
  .post-download-icon-wrap,
  .guide-icon-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
  }
  .post-download-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #ECFDF5;
    color: #10B981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.18);
  }
  .guide-sparkle-emoji {
    font-size: 38px;
    display: block;
    animation: sparkle-bounce 1s ease-in-out infinite alternate;
  }
  @keyframes sparkle-bounce {
    from { transform: scale(1); }
    to { transform: scale(1.1) rotate(5deg); }
  }
  .post-download-header {
    margin-bottom: 22px;
  }
  .post-download-title,
  .guide-title {
    font-size: 18px;
    font-weight: 700;
    color: #18254A;
    margin: 0 0 6px 0;
    line-height: 1.4;
  }
  .keep-using-guide-dialog .guide-title {
    margin: 0 0 16px 0;
  }
  .post-download-subtitle {
    font-size: 15px;
    font-weight: 500;
    color: #4B5563;
    margin: 0;
    line-height: 1.4;
  }
  .guide-desc {
    font-size: 14px;
    color: #4B5563;
    margin: 0 0 14px 0;
    line-height: 1.5;
  }
  .guide-tip-card {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: 12px;
    padding: 12px;
    text-align: left;
    margin-bottom: 20px;
  }
  .guide-tip-title {
    font-size: 13px;
    font-weight: 700;
    color: #92400E;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .guide-tip-text {
    font-size: 12px;
    color: #78350F;
    line-height: 1.5;
    margin: 0;
  }
  .post-download-actions,
  .guide-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  .post-download-actions .btn,
  .guide-actions .btn {
    width: 100%;
    font-size: 15px;
    font-weight: 700;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
  }
  .post-download-actions .btn-dismiss-keep {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #E2E8F0;
  }
  .post-download-actions .btn-dismiss-keep:hover {
    background: #E2E8F0;
    color: #1E293B;
  }
}

/* ==========================================================================
   EXPORT LOADING OVERLAY (高解析圖表/PDF 產生中動畫)
   ========================================================================== */
.export-loading-backdrop {
  z-index: 10005 !important;
  background: rgba(15, 23, 42, 0.68) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  transition: opacity 0.22s ease;
}

.export-loading-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 20px;
  padding: 34px 24px 24px;
  width: 320px;
  max-width: 88vw;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(226, 232, 240, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: modalScaleUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

/* X Close Button in top right */
.export-loading-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #F1F5F9;
  color: #64748B;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.export-loading-close-btn:hover {
  background: #E2E8F0;
  color: #1E293B;
  transform: scale(1.06);
}

.export-loading-close-btn:active {
  transform: scale(0.95);
}

.export-loading-spinner-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.export-loading-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3.5px solid #EEF2F6;
  border-top-color: #3B82F6;
  border-right-color: #60A5FA;
  animation: exportSpin 0.9s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.export-loading-ring-inner {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #F0F7FF;
  animation: exportPulseGlow 1.8s ease-in-out infinite alternate;
}

.export-loading-icon-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #2563EB;
  z-index: 2;
  animation: exportIconFloat 1.8s ease-in-out infinite alternate;
}

.export-loading-text-wrap {
  margin-top: 12px;
  margin-bottom: 14px;
}

.export-loading-title {
  font-size: 16.5px;
  font-weight: 700;
  color: #18254A;
  margin: 0;
  font-family: var(--font-family-kids), var(--font-family-base);
  letter-spacing: 0.3px;
}

/* Progress bar container replacing bottom line */
.export-progress-container {
  width: 100%;
  margin-top: 4px;
}

.export-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: #EEF2F6;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.export-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 15%;
  background: linear-gradient(90deg, #3B82F6 0%, #2563EB 50%, #60A5FA 100%);
  border-radius: 999px;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.35);
}

.export-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: exportProgressShimmer 1.4s infinite;
}

.export-progress-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12.5px;
  color: #64748B;
  font-weight: 500;
}

.export-progress-percent {
  font-weight: 700;
  color: #2563EB;
  font-variant-numeric: tabular-nums;
}

@keyframes exportSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes exportPulseGlow {
  0% { transform: scale(0.92); opacity: 0.6; }
  100% { transform: scale(1.02); opacity: 1; }
}

@keyframes exportIconFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-2px); }
}

@keyframes exportProgressShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}



