/* ==========================================================================
   DrawColor Studio - 日系療癒手繪畫冊設計系統 (v0.6.0)
   風格：空白畫冊 (Blank Sketchbook) + 手繪咖啡色邊框 + 色鉛筆粉彩平塗 + 和紙質地
   ========================================================================== */

:root {
  /* 核心色彩 Token - 日系紙張與暖咖啡墨水 */
  --bg-paper: #FDFBF7;           /* 米白畫紙 Cream White */
  --bg-oatmeal: #F5F0E6;         /* 燕麥牛皮紙底色 Oatmeal Kraft */
  --bg-card-default: #FFFDF9;    /* 白色便簽紙 */
  --bg-surface: rgba(253, 251, 247, 0.96);
  --bg-surface-elevated: #FAF6EE;
  
  /* 墨水與線條色彩（拒絕純黑 #000000） */
  --color-ink: #4A3728;          /* 暖心深咖啡墨水 */
  --color-ink-deep: #38291D;     /* 深焙咖啡色標題 */
  --color-pencil: #6B5B4F;       /* 鉛筆手寫字灰褐 */
  --color-pencil-light: #948275; /* 輕柔註解灰 */
  --color-slate-soft: #4F555D;   /* 柔和灰藍次要線條 */

  /* 粗糙手繪框線與陰影 */
  --border-ink: #4A3728;
  --border-subtle: rgba(74, 55, 40, 0.16);
  --border-dashed: rgba(74, 55, 40, 0.32);
  --border-light: rgba(74, 55, 40, 0.28);
  --shadow-offset: 5px 6px 0px #DDD4C7;
  --shadow-offset-hover: 7px 9px 0px #C9BEAF;
  --shadow-sm: 2px 3px 0px rgba(74, 55, 40, 0.12);
  --shadow-md: 4px 5px 0px rgba(74, 55, 40, 0.16);

  /* 六大主題粉彩平塗底色 (低飽和色鉛筆平塗質感) */
  --pastel-animals: #FFF9E6;     /* 淡鵝黃 / 奶油橘 */
  --pastel-plants: #EDF7ED;      /* 抹茶淡綠 / 薄荷綠 */
  --pastel-scenery: #E8F4F8;     /* 清晨天空淡藍 */
  --pastel-architecture: #FCE4EC; /* 柔和藕粉色 */
  --pastel-food: #F5EBE1;        /* 暖奶茶色 */
  --pastel-cartoon: #F3E8FF;     /* 淡紫丁香色 */

  /* 字體配置 */
  /* 字型：原專案用 Google Fonts（Zen Maru Gothic、M PLUS Rounded 1c、Gaegu、Caveat、Noto Sans TC）。
     LocalPapa 不連外部字型，所以改成各平台內建的圓體與中文字型；原字型名稱留在最前面，
     裝了的人照樣用原本的，沒裝的退到系統字型。 */
  --font-cjk: 'PingFang TC', 'Hiragino Maru Gothic ProN', 'Microsoft JhengHei UI', 'Microsoft JhengHei', 'Noto Sans TC', 'Yu Gothic UI';
  --font-title: 'Zen Maru Gothic', 'M PLUS Rounded 1c', var(--font-cjk), system-ui, sans-serif;
  --font-sans: 'M PLUS Rounded 1c', 'Zen Maru Gothic', var(--font-cjk), system-ui, sans-serif;
  --font-doodle: 'Gaegu', 'Caveat', 'Segoe Print', 'Bradley Hand', 'Marker Felt', var(--font-cjk), cursive;
  --font-handwriting: 'Caveat', 'Gaegu', 'Segoe Print', 'Bradley Hand', 'Marker Felt', var(--font-cjk), cursive;

  /* 圓角與手繪邊緣 */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --radius-hand-1: 255px 18px 230px 15px / 18px 240px 16px 250px;
  --radius-hand-2: 18px 245px 16px 230px / 235px 16px 245px 18px;

  /* 主題漸層與文字相容 Token */
  --grad-primary: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #6366f1 100%);
  --text-main: #38291D;
  --text-muted: #6B5B4F;

  /* 轉場 */
  --trans-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --trans-smooth: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 基礎重設 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.app-body {
  font-family: var(--font-sans);
  background-color: var(--bg-paper);
  color: var(--color-ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  /* 水彩畫紙 / 和紙微紋理底色 */
  background-image: 
    radial-gradient(rgba(74, 55, 40, 0.045) 1px, transparent 1px),
    radial-gradient(rgba(212, 163, 115, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, #FDFBF7 0%, #FAF5EB 100%);
  background-size: 28px 28px, 56px 56px, 100% 100%;
  background-attachment: fixed;
}

/* 溫馨手帳風滾動條 */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-track {
  background: #F3ECE1;
}
::-webkit-scrollbar-thumb {
  background: #C4B5A5;
  border-radius: var(--radius-full);
  border: 2px solid #F3ECE1;
}
::-webkit-scrollbar-thumb:hover {
  background: #A69482;
}

/* ==========================================================================
   頂部手帳工具列 (Header & Stepper)
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: #FFFFFF;
  border-bottom: 2.2px solid #3E2723;
  box-shadow: 0 3px 0 rgba(62, 39, 35, 0.06);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
  transition: transform var(--trans-fast);
}
.header-brand:hover {
  transform: translateY(-1px) rotate(-0.5deg);
}

.brand-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFDF9;
  border: 2px solid var(--border-ink);
  border-radius: 12px 14px 10px 13px;
  box-shadow: 2px 2px 0px rgba(74, 55, 40, 0.18);
}
.brand-icon svg {
  width: 82%;
  height: 82%;
}

.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand-title {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--color-ink-deep);
}

.app-version-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 20px / 12px;
  background: #FFF3CD;
  border: 1.6px dashed #D4A373;
  color: #795548;
  letter-spacing: 0.04em;
  box-shadow: 1px 1.5px 0px rgba(74, 55, 40, 0.1);
  transform: rotate(-1.5deg);
}

.brand-subtitle {
  font-family: var(--font-title);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--color-pencil);
}

/* 流程步驟指示器 (Flow Stepper) - 日系便簽手帳風格 */
.flow-stepper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #FFFFFF;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  border: 2px solid #3E2723;
  box-shadow: 2px 2.5px 0px rgba(62, 39, 35, 0.14);
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  padding: 0.3rem 0.7rem;
  border-radius: 12px;
  color: var(--color-pencil);
  font-family: var(--font-title);
  font-size: 0.86rem;
  font-weight: 700;
  transition: all var(--trans-smooth);
}
.step-item:hover {
  color: var(--color-ink);
  background: rgba(245, 235, 220, 0.6);
}
.step-item.active {
  color: var(--color-ink);
  background: #FFE8A3;
  border: 1.5px solid #4A3728;
  box-shadow: 1.5px 2px 0px rgba(74, 55, 40, 0.15);
  transform: rotate(-0.5deg);
}
.step-item.completed {
  color: #388E3C;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
  background: #EFE6DD;
  color: var(--color-ink);
}
.step-item.active .step-num {
  background: #4A3728;
  color: #FFFFFF;
}

.step-divider {
  width: 14px;
  height: 2px;
  background: var(--border-dashed);
}

/* 頂部右側匯入按鈕 - 紙膠帶/手帳便簽風格 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.15rem;
  background: #FFFDF9;
  border: 1.8px solid var(--border-ink);
  border-radius: 18px 245px 16px 230px / 235px 16px 245px 18px;
  box-shadow: 2.5px 3px 0px rgba(74, 55, 40, 0.16);
  color: var(--color-ink);
  font-family: var(--font-title);
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--trans-smooth);
}
.btn-ghost:hover {
  background: #FFF8E7;
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: 3.5px 4.5px 0px rgba(74, 55, 40, 0.22);
}

/* ==========================================================================
   視圖容器與頁面切換控制 (View Panels)
   ========================================================================== */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.view-panel {
  display: none;
  opacity: 0;
  transition: opacity 0.35s ease-out;
  padding: 2rem;
  width: 100%;
}
.view-panel.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  animation: fadeInView 0.35s ease forwards;
}

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

/* ==========================================================================
   [01 首頁分類] 瀏覽頁樣式 - 日系手繪溫馨塗鴉風首頁封面
   (奶油米黃漸層至淺草綠背景 + 左右動植物生態佈景 + 2x3 卡片網格)
   ========================================================================== */
#view-categories {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #FDF8E8 0%, #FAF2D8 35%, #EEF6DF 70%, #E6F0D8 100%);
  min-height: calc(100vh - 72px);
  padding: 1.5rem 1.25rem 4rem 1.25rem;
}

/* 首頁保留品牌起點，隱藏全站流程導覽、匯入快捷鍵與冗長頁尾 */
body:has(#view-categories.active) .flow-stepper,
body:has(#view-categories.active) .header-actions,
body:has(#view-categories.active) > .app-footer {
  display: none;
}

/* 首頁中央主題網格不再為兩側裝飾插圖預留欄位 */
#view-categories .side-decor {
  display: none;
}

#view-categories .home-cover-stage {
  max-width: 1140px;
}

#view-categories .categories-center-col {
  flex: 0 1 1140px;
  max-width: 1140px;
}

/* 首頁三欄式舞台佈局 */
.home-cover-stage {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1.5rem;
  max-width: 1720px;
  margin: 0 auto;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* 兩側裝飾區塊 (Side Illustration Zones) */
.side-decor {
  flex: 0 0 250px;
  max-width: 270px;
  position: sticky;
  top: 85px;
  z-index: 1;
}

.decor-card {
  width: 100%;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.55);
  border: 2.4px dashed rgba(62, 39, 35, 0.28);
  padding: 0.65rem;
  box-shadow: 3px 5px 0px rgba(62, 39, 35, 0.08);
  transition: transform 0.3s ease;
}
.decor-card:hover {
  transform: translateY(-4px);
}

.scene-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* 插圖內的微動畫 (限定首頁側邊手繪面板) */
.anim-float-gentle {
  animation: floatGentle 5s ease-in-out infinite alternate;
}
@keyframes floatGentle {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}

/* 萌寵呼吸動態 */
.anim-rabbit-card {
  transform-origin: 136px 122px;
  animation: rabbitBreathe 4.5s ease-in-out infinite alternate;
}
@keyframes rabbitBreathe {
  0% { transform: translate(52px, 68px) scale(1); }
  100% { transform: translate(52px, 65px) scale(1.02); }
}

.anim-fox-card {
  transform-origin: 147px 372px;
  animation: foxBreathe 5s ease-in-out infinite alternate;
}
@keyframes foxBreathe {
  0% { transform: translate(68px, 290px) rotate(0deg); }
  100% { transform: translate(68px, 288px) rotate(-1.2deg); }
}

.anim-dog-card {
  transform-origin: 136px 129px;
  animation: dogBreathe 4.2s ease-in-out infinite alternate;
}
@keyframes dogBreathe {
  0% { transform: translate(62px, 58px) scale(1); }
  100% { transform: translate(62px, 56px) scale(1.02); }
}

.anim-cat-card {
  transform-origin: 142px 370px;
  animation: catBreathe 4.8s ease-in-out infinite alternate;
}
@keyframes catBreathe {
  0% { transform: translate(70px, 268px) scale(1); }
  100% { transform: translate(70px, 265px) scale(1.018); }
}

/* 泡泡微飄 */
.anim-bubble-float-1 {
  animation: bubbleFloat1 4.5s ease-in-out infinite alternate;
}
@keyframes bubbleFloat1 {
  0% { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

.anim-bubble-float-2 {
  animation: bubbleFloat2 3.8s ease-in-out infinite alternate;
}
@keyframes bubbleFloat2 {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.08); }
}

.anim-bubble-float-3 {
  animation: bubbleFloat3 5.2s ease-in-out infinite alternate;
}
@keyframes bubbleFloat3 {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}

/* 蝴蝶起舞 */
.anim-butterfly-pink {
  transform-origin: 206px 49px;
  animation: flutterPink 4.5s ease-in-out infinite;
}
@keyframes flutterPink {
  0%, 100% { transform: translate(178px, 30px) rotate(0deg); }
  35% { transform: translate(182px, 24px) rotate(6deg) scale(1.04); }
  70% { transform: translate(174px, 34px) rotate(-4deg) scale(0.98); }
}

.anim-butterfly-blue {
  transform-origin: 41px 147px;
  animation: flutterBlue 4s ease-in-out infinite;
}
@keyframes flutterBlue {
  0%, 100% { transform: translate(18px, 125px) rotate(0deg); }
  40% { transform: translate(22px, 118px) rotate(-7deg) scale(1.05); }
  75% { transform: translate(15px, 130px) rotate(5deg) scale(0.96); }
}

/* 星星微閃爍 */
.anim-star-twinkle {
  animation: starTwinkle 2.8s ease-in-out infinite alternate;
}
.anim-star-twinkle-delay {
  animation: starTwinkle 3.2s ease-in-out infinite alternate-reverse;
}
@keyframes starTwinkle {
  0% { opacity: 0.75; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1.08); }
}

/* 花草微風輕拂搖曳 */
.anim-sway-gentle {
  transform-origin: bottom center;
  animation: plantSway 5s ease-in-out infinite alternate;
}
.anim-sway-gentle-delay {
  transform-origin: bottom center;
  animation: plantSway 6s ease-in-out infinite alternate-reverse;
}
@keyframes plantSway {
  0% { transform: rotate(-1.5deg); }
  100% { transform: rotate(1.8deg); }
}

.anim-leaf-gentle {
  animation: leafGentle 4.8s ease-in-out infinite alternate;
}
@keyframes leafGentle {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-4px) rotate(4deg); }
}

/* 中間核心視覺區 */
.categories-center-col {
  flex: 0 1 1140px;
  width: 100%;
  max-width: 1140px;
  z-index: 2;
}

.hero-banner {
  text-align: center;
  max-width: 860px;
  margin: 0.8rem auto 2.2rem auto;
  position: relative;
  z-index: 1;
}

/* 主標題 (H1) - 溫厚深咖啡手繪圓體 */
.hero-title {
  font-family: var(--font-title);
  font-size: clamp(2.2rem, 4.2vw, 3.15rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-bottom: 0;
  color: #3E2723;
  text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.85);
}

.categories-container {
  width: 100%;
  position: relative;
  z-index: 1;
}

/* 2 列 x 3 欄 網格佈局 */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.85rem;
  padding-bottom: 3.5rem;
}

/* ==========================================================================
   主題卡片 (Cards) - 粗黑框線 + 大圓角 + 純白背景留白作為邊距 + 右下突破插圖
   ========================================================================== */
.category-card {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  background: #1f2937;
  border: 2px solid rgba(62, 39, 35, 0.85);
  border-radius: 22px;
  box-shadow: 0 8px 20px rgba(62, 39, 35, 0.18);
  cursor: pointer;
  color: #FFFFFF;
  text-decoration: none;
  isolation: isolate;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(62, 39, 35, 0.28);
}

.category-card:focus-visible {
  outline: 3px solid #8B5CF6;
  outline-offset: 4px;
}

#view-categories .category-card-image {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

#view-categories .category-card:hover .category-card-image,
#view-categories .category-card:focus-visible .category-card-image {
  transform: scale(1.055);
}

/* 卡片內層彩色畫紙 */
.category-card-inner {
  background: var(--cat-bg, #FEF7D2);
  border-radius: 18px;
  padding: 1.45rem 1.35rem 1.35rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  z-index: 1;
  border: 1.5px solid rgba(62, 39, 35, 0.12);
}

.category-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.15rem;
  position: relative;
  z-index: 1;
}

/* 左上角主題圖示方盒 - 白底黑框 */
.category-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 2.2px solid #3E2723;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0px rgba(62, 39, 35, 0.16);
  transition: transform 0.25s ease;
}

.category-card:hover .doodle-svg {
  animation: doodleBounce 0.55s ease-in-out;
}

@keyframes doodleBounce {
  0%, 100% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(1.18) rotate(-7deg); }
  70% { transform: scale(1.08) rotate(5deg); }
}

.doodle-svg {
  width: 36px;
  height: 36px;
}

/* 右上角線稿數量膠囊 - 白底黑框膠囊 */
.category-count-pill {
  font-family: var(--font-title);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1.8px solid #3E2723;
  color: #3E2723;
  box-shadow: 1.5px 2px 0px rgba(62, 39, 35, 0.14);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.category-count-pill .pill-dot {
  font-size: 0.65rem;
  color: var(--cat-accent, #E6A23C);
}

.category-card-body {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* 主題主標題 (粗體) */
.category-title {
  font-family: var(--font-title);
  font-size: 1.42rem;
  font-weight: 900;
  margin-bottom: 0.2rem;
  color: #3E2723;
  letter-spacing: -0.01em;
}

/* 主題英文副標題 */
.category-subtitle {
  font-family: var(--font-title);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--cat-sub, #795548);
  margin-bottom: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* 簡短描述 */
.category-desc {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: #5D4037;
  line-height: 1.65;
  margin-bottom: 1.15rem;
  font-weight: 600;
}

/* Hashtag 標籤容器 */
.category-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.35rem;
}

/* 白底黑框圓角膠囊小標籤 */
.preview-tag.tag-pill {
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.22rem 0.68rem;
  background: #FFFFFF;
  border: 1.8px solid #3E2723;
  border-radius: 999px;
  color: #3E2723;
  box-shadow: 1px 1.5px 0px rgba(62, 39, 35, 0.12);
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}
.preview-tag.tag-pill:hover {
  background: #FFFDF0;
  transform: translateY(-2px);
  box-shadow: 2px 2.5px 0px rgba(62, 39, 35, 0.18);
}

.category-card-footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

/* 左下角行動按鈕 (CTA) - 膠囊狀白底黑框 */
.cat-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 1.15rem;
  background: #FFFFFF;
  border: 2px solid #3E2723;
  border-radius: 999px;
  box-shadow: 2px 2.5px 0px rgba(62, 39, 35, 0.16);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}
.cta-text {
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 900;
  color: #3E2723;
  letter-spacing: 0.02em;
}
.category-card:hover .cat-cta-btn {
  background: #FFFDF0;
  transform: translateY(-2px);
  box-shadow: 3px 4px 0px rgba(62, 39, 35, 0.22);
}

/* 右下角稍微突破框架的手繪小插圖 (Peek Doodle) */
.card-peek-badge {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 60px;
  height: 60px;
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(1.5px 2px 0px rgba(62, 39, 35, 0.14));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.peek-doodle-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.category-card:hover .card-peek-badge {
  transform: scale(1.18) rotate(6deg);
}

/* ==========================================================================
   首頁響應式斷點保護
   ========================================================================== */
@media (max-width: 1480px) {
  .home-cover-stage {
    gap: 1.25rem;
  }
  .side-decor {
    flex: 0 0 210px;
    max-width: 220px;
  }
}

@media (max-width: 1260px) {
  .side-decor {
    flex: 0 0 170px;
    max-width: 180px;
  }
}

@media (max-width: 1060px) {
  .home-cover-stage {
    flex-direction: column;
    align-items: center;
  }
  .side-decor {
    display: none;
  }
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .categories-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ==========================================================================
   [02 線稿選擇列表] (Gallery View) 樣式
   ========================================================================== */
#view-gallery {
  max-width: 1360px;
  margin: 0 auto;
}

body:has(#view-gallery.active) .brand-subtitle,
body:has(#view-gallery.active) .flow-stepper,
body:has(#view-gallery.active) > .app-footer {
  display: none;
}

body:has(#view-studio.active) .brand-subtitle,
body:has(#view-studio.active) .flow-stepper,
body:has(#view-studio.active) > .app-footer {
  display: none;
}

body:has(#view-showcase.active) .flow-stepper {
  display: none;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.gallery-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #FFFDF9;
  border: 1.8px solid var(--border-ink);
  color: var(--color-ink);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-title);
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 2px 2px 0px rgba(74, 55, 40, 0.14);
  transition: all var(--trans-fast);
}
.btn-back:hover {
  background: #FFF8E7;
  transform: translateX(-2px) rotate(-0.5deg);
  box-shadow: 3px 3px 0px rgba(74, 55, 40, 0.2);
}

.breadcrumb-separator {
  color: var(--color-pencil-light);
  font-size: 1rem;
  font-weight: bold;
}

.current-category-name {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--color-ink-deep);
}

.filter-tabs {
  display: flex;
  gap: 0.45rem;
  background: #EFE6DD;
  padding: 0.35rem;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  border: 1.8px solid var(--border-ink);
  box-shadow: 2px 2.5px 0px rgba(74, 55, 40, 0.12);
}

.filter-tab {
  background: transparent;
  border: none;
  color: var(--color-pencil);
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.4rem 0.95rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--trans-fast);
}
.filter-tab:hover {
  color: var(--color-ink);
  background: rgba(255, 255, 255, 0.5);
}
.filter-tab.active {
  background: #4A3728;
  color: #FFFFFF;
  box-shadow: 1.5px 2px 0px rgba(74, 55, 40, 0.18);
  transform: rotate(-0.5deg);
}

.linearts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.75rem;
  padding-bottom: 4rem;
}

/* 線稿卡片 - 日系手帳小卡風格 */
.lineart-card {
  background: #FFFDF9;
  border: 2px solid var(--border-ink);
  border-radius: 18px 245px 16px 230px / 235px 16px 245px 18px;
  box-shadow: 4px 5px 0px #DDD4C7;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--trans-smooth);
  display: flex;
  flex-direction: column;
}
.lineart-card:hover {
  transform: translateY(-4px) rotate(-0.5deg);
  box-shadow: 6px 8px 0px #DDD4C7;
}

.lineart-thumbnail-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem;
  border-bottom: 1.5px dashed rgba(74, 55, 40, 0.2);
}

.lineart-thumbnail-wrapper img,
.lineart-thumbnail-wrapper svg {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  transition: transform var(--trans-smooth);
}
.lineart-card:hover .lineart-thumbnail-wrapper img,
.lineart-card:hover .lineart-thumbnail-wrapper svg {
  transform: scale(1.04);
}

.lineart-badge-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 2;
}

.badge-ai {
  background: #F3E8FF;
  border: 1.5px solid #BA68C8;
  color: #7E57C2;
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  box-shadow: 1px 1.5px 0px rgba(74, 55, 40, 0.12);
}

.badge-diff {
  background: #FFF8E1;
  border: 1.5px solid #D4A373;
  color: #8D6E63;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  box-shadow: 1px 1.5px 0px rgba(74, 55, 40, 0.12);
}

.lineart-info {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lineart-title {
  font-family: var(--font-title);
  font-size: 1.12rem;
  font-weight: 900;
  color: var(--color-ink-deep);
}

.lineart-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--color-pencil);
  font-weight: 600;
}

.btn-start-coloring {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.55rem;
  background: #FFE8A3;
  border: 1.8px solid var(--border-ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  color: var(--color-ink-deep);
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 2px 2.5px 0px rgba(74, 55, 40, 0.14);
  transition: all var(--trans-fast);
}
.lineart-card:hover .btn-start-coloring {
  background: #FFD54F;
  transform: translateY(-1px);
  box-shadow: 3px 3.5px 0px rgba(74, 55, 40, 0.2);
}

/* ==========================================================================
   [03 自由填色畫布] (Studio View) 樣式
   ========================================================================== */
#view-studio {
  padding: 0.75rem 1.25rem 1.25rem 1.25rem;
  height: calc(100vh - 68px);
  overflow: hidden;
}

.studio-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 0.75rem;
}

.studio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  backdrop-filter: blur(14px);
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.artwork-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.artwork-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}
.artwork-category-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.2);
  color: var(--text-accent);
}

.history-controls, .zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--trans-fast);
}
.icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.zoom-level {
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 42px;
  text-align: center;
  color: var(--text-main);
}

.btn-primary-gradient {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.3rem;
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #6366f1 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-full);
  color: #ffffff !important;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.45);
  transition: all var(--trans-smooth);
}
.btn-primary-gradient span {
  color: #ffffff !important;
}
.btn-primary-gradient svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}
.btn-primary-gradient:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(139, 92, 246, 0.65);
  filter: brightness(1.06);
}

/* 工作區三欄佈局 (左側工具 + 中央畫布 + 右側色票) */
.studio-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 88px 1fr 280px;
  gap: 0.85rem;
  min-height: 0;
}

/* 左側工具欄 */
.studio-sidebar-tools {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  overflow-y: auto;
}

.tool-group-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  text-align: center;
  display: block;
}

.tool-btn {
  width: 66px;
  height: 64px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  cursor: pointer;
  margin-bottom: 0.5rem;
  transition: all var(--trans-fast);
}
.tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-light);
}
.tool-btn.active {
  background: rgba(139, 92, 246, 0.25);
  border-color: var(--border-glow);
  color: #fff;
  box-shadow: inset 0 0 12px rgba(139, 92, 246, 0.4);
}

.tool-name {
  font-size: 0.7rem;
  font-weight: 600;
}

.tool-properties {
  width: 100%;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.prop-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  color: var(--text-muted);
}
.prop-item input[type="range"] {
  width: 100%;
  accent-color: #8b5cf6;
}

.prop-lock-item {
  margin-top: 0.35rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  display: flex;
  justify-content: center;
}

.btn-lock-toggle {
  width: 66px !important;
  height: 64px !important;
  position: relative;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  transition: all 0.2s ease;
  user-select: none;
  margin-bottom: 0 !important;
}
.btn-lock-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}
.btn-lock-toggle.active {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: #10B981 !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}
.btn-lock-toggle .tool-icon {
  font-size: 1.15rem;
  line-height: 1;
}
.btn-lock-toggle .tool-name {
  font-size: 0.65rem;
  font-weight: 700;
  white-space: nowrap;
}
.btn-lock-toggle .lock-mini-badge {
  font-size: 0.58rem;
  font-weight: 800;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  line-height: 1;
}
.btn-lock-toggle.active .lock-mini-badge {
  background: #10B981;
  color: #FFFFFF;
}

/* 中央畫布畫架 */
.studio-canvas-stage {
  position: relative;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.8) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 2px 20px rgba(0, 0, 0, 0.5);
  user-select: none;
}

/* 浮動參考完稿範例對照視窗 (Floating Reference Window) */
.floating-reference-card {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  width: 220px;
  background: rgba(18, 24, 38, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(139, 92, 246, 0.25);
  overflow: hidden;
  transition: all var(--trans-smooth);
}

.ref-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ref-card-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f1f5f9;
}

.ref-btn-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans-fast);
}
.ref-btn-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.ref-card-body {
  padding: 0.6rem;
}

.ref-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ref-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: default;
}

.ref-color-magnifier {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: 120px;
  height: 120px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(15, 23, 42, 0.85);
  background: #fff;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 100ms ease;
}

.ref-color-magnifier.is-visible {
  opacity: 1;
  visibility: visible;
}

.ref-eyedropper-tip {
  position: absolute;
  z-index: 4;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #e2e8f0;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
  opacity: 0.85;
  transition: opacity var(--trans-fast);
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.25;
}

/* 折疊後之微縮觸發膠囊按鈕 */
.ref-pill-trigger {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.95rem;
  background: rgba(18, 24, 38, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 999px;
  color: #c084fc;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: all var(--trans-fast);
}
.ref-pill-trigger:hover {
  background: rgba(139, 92, 246, 0.25);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.canvas-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  overflow: hidden;
}

.canvas-transform-wrapper {
  position: relative;
  width: 800px;
  height: 800px;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  transform-origin: center center;
  transition: transform 0.05s ease-out;
}

/* 雙層畫布重疊堆疊 */
#color-canvas,
#lineart-canvas,
#preview-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

#color-canvas {
  z-index: 10;
  background: #ffffff;
  pointer-events: none;
}
#lineart-canvas {
  z-index: 20;
  pointer-events: none;
}
#preview-canvas {
  z-index: 30;
  pointer-events: auto; /* 允許接收滑鼠與觸控繪圖事件 */
  touch-action: none;   /* 阻擋瀏覽器預設滾動，確保繪圖手勢順暢 */
  cursor: crosshair;
}

.canvas-viewport.mode-pan #preview-canvas {
  cursor: grab;
}
.canvas-viewport.is-panning #preview-canvas {
  cursor: grabbing;
}
.canvas-viewport.is-panning .canvas-transform-wrapper {
  transition: none !important; /* 拖曳平移期間關閉過渡動畫，確保極致跟手流暢 */
}

/* 右側色票抽屜 */
.studio-palette-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.current-color-preview-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.color-swatch-large {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.color-meta {
  display: flex;
  flex-direction: column;
}
.color-hex-text {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  font-family: monospace;
}
.color-palette-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* 色票分頁 */
.palette-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.2rem;
  background: var(--bg-oatmeal, #F5F0E6);
  padding: 0.25rem;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--border-subtle, rgba(74, 55, 40, 0.16));
  min-width: 0;
}
.pal-tab {
  min-width: 0;
  background: transparent;
  border: 1.5px solid transparent;
  color: #6B5B4F;
  font-size: clamp(0.6rem, 0.72vw, 0.74rem);
  font-weight: 700;
  padding: 0.42rem 0.08rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
  text-align: center;
  transition: all var(--trans-fast);
}
.pal-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.6);
  color: #38291D;
}
.pal-tab.active {
  background: #ffffff;
  color: #38291D !important;
  font-weight: 800;
  border: 1.5px solid #4A3728;
  box-shadow: 0 2px 6px rgba(74, 55, 40, 0.14);
}

.palette-tab-content {
  display: none;
}
.palette-tab-content.active {
  display: block;
}

/* 基礎色票網格 (24色) */
.palette-grid-basic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}

.swatch-item {
  aspect-ratio: 1;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.swatch-item:hover {
  transform: scale(1.15);
  z-index: 5;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
.swatch-item.active {
  transform: scale(1.12);
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  z-index: 4;
}

/* 進階主題色票 */
.theme-selector-dropdown {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.theme-selector-dropdown label {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.theme-selector-dropdown select {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  outline: none;
}

.theme-palette-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
}

/* 自訂取色盤 */
.custom-color-picker-box {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.custom-color-picker-box input[type="color"] {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}
.custom-hex-input-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.custom-hex-input-row input {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.84rem;
}
.btn-xs {
  background: rgba(139, 92, 246, 0.3);
  border: 1px solid var(--border-glow);
  color: #fff;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
}

/* 最近使用色票 */
.recent-colors-section {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}
.recent-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  display: block;
  margin-bottom: 0.45rem;
}
.recent-swatches {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}
.recent-swatches .swatch-item {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 6px;
}

/* ==========================================================================
   [04 完成與輸出] (Showcase View) 樣式 - RWD & Viewport Fit
   ========================================================================== */
#view-showcase {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* 僅在展示廳階段啟用 body 視高限制與頁尾隱藏，確保不影響其他頁面 */
@media (min-width: 992px) {
  body.stage-showcase {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }
  body.stage-showcase .app-main {
    height: calc(100vh - 72px);
    max-height: calc(100vh - 72px);
    min-height: 0;
    overflow: hidden;
  }
  body.stage-showcase .app-footer {
    display: none !important;
  }

  /* 1. 【電腦與平板橫屏 (Desktop/Tablet Landscape)】：滿版視高 + 獨立滾動 */
  #view-showcase.active {
    height: calc(100vh - 72px);
    max-height: calc(100vh - 72px);
    overflow: hidden;
    padding: 0.75rem 2rem 0.95rem 2rem;
    box-sizing: border-box;
  }

  #view-showcase .showcase-container {
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #view-showcase .showcase-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
  }
  #view-showcase .showcase-heading {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-main);
  }
  #view-showcase .showcase-subheading {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
  }

  #view-showcase .showcase-main-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) 420px;
    gap: 1.5rem;
    align-items: center;
    flex: 1;
    min-height: 0; /* 重要：防止 flex child 撐破父容器，實現視窗自適應 */
    height: 100%;
    overflow: hidden;
  }

  /* 左側作品展示區：設定最大高度 (max-height: 70vh)，使其自動隨螢幕高度動態縮放 */
  #view-showcase .showcase-artwork-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(74, 55, 40, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    height: 100%;
    min-height: 0;
    max-height: 70vh;
    overflow: hidden;
  }

  #view-showcase .frame-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    transition: all var(--trans-smooth);
  }

  #view-showcase #showcase-canvas {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
  }

  /* 右側控制區設置獨立滾動條，確保右側選單可以上下順暢滑動，不影響全頁 */
  #view-showcase .showcase-control-panel {
    height: 100%;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.65rem;
    padding-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    scrollbar-width: thin;
    scrollbar-color: #C4B5A5 rgba(74, 55, 40, 0.06);
  }
}

/* 2. 【手機與平板直屏 (Mobile/Tablet Portrait)】：單欄流動佈局，取消 100vh */
@media (max-width: 991px) {
  body.stage-showcase {
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  body.stage-showcase .app-main {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.stage-showcase .app-footer {
    display: block !important;
  }

  #view-showcase.active {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 1rem 0.85rem 3rem 0.85rem;
  }

  #view-showcase .showcase-container {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #view-showcase .showcase-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-subtle);
  }
  #view-showcase .showcase-heading {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
  }
  #view-showcase .showcase-subheading {
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  #view-showcase .showcase-main-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.25rem !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* 頂部固定適當大小的作品預覽 */
  #view-showcase .showcase-artwork-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(74, 55, 40, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 0.75rem;
    width: 100%;
    height: auto !important;
    min-height: auto;
    max-height: none;
  }

  #view-showcase .frame-container {
    position: relative;
    width: 100%;
    max-width: min(85vw, 360px);
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
  }

  #view-showcase #showcase-canvas {
    width: 100%;
    height: 100%;
    display: block;
  }

  /* 下方順暢呈現相框、署名、下載與縮時控制區，手指滑動即可順暢操作 */
  #view-showcase .showcase-control-panel {
    width: 100%;
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
    padding-right: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }
}

/* 右側控制面板專屬精緻手帳風滾動條 */
#view-showcase .showcase-control-panel::-webkit-scrollbar {
  width: 7px;
}
#view-showcase .showcase-control-panel::-webkit-scrollbar-track {
  background: rgba(74, 55, 40, 0.05);
  border-radius: var(--radius-full);
}
#view-showcase .showcase-control-panel::-webkit-scrollbar-thumb {
  background: #C4B5A5;
  border-radius: var(--radius-full);
  border: 1.5px solid transparent;
  background-clip: padding-box;
}
#view-showcase .showcase-control-panel::-webkit-scrollbar-thumb:hover {
  background: #8D7B68;
}

/* 相框風格系統 */
.frame-container {
  position: relative;
  max-width: 540px;
  width: 100%;
  aspect-ratio: 1 / 1;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  transition: all var(--trans-smooth);
}

/* 01. 無相框 (原圖) */
.frame-none {
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 4px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
}
.frame-none .frame-inner-mat {
  box-shadow: none !important;
}
/* 02. 🍓 夢幻萌萌可愛框 (Cute / Kawaii Style) */
.frame-cute {
  padding: 24px;
  background: linear-gradient(135deg, #fbcfe8 0%, #f472b6 40%, #c084fc 80%, #fbcfe8 100%);
  border: 6px dashed #db2777;
  border-radius: 26px;
  box-shadow: 0 20px 50px rgba(244, 114, 182, 0.45), inset 0 0 16px rgba(255, 255, 255, 0.6);
  position: relative;
}
.frame-cute::before {
  content: '🌸';
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 1.4rem;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.frame-cute::after {
  content: '✨';
  position: absolute;
  bottom: 4px;
  right: 8px;
  font-size: 1.4rem;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* 03. 🎨 自定義色彩框 (Custom Color Frame) */
.frame-custom {
  padding: 22px;
  background: var(--custom-frame-color, #fbcfe8);
  border: 5px solid rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), inset 0 0 12px rgba(255, 255, 255, 0.35);
  transition: background 0.2s ease;
}

/* 04. 質感木質框 (Classic Wood Frame) */
.frame-wood {
  padding: 24px;
  background: linear-gradient(135deg, #7c4a24 0%, #a26b3e 30%, #5d3314 60%, #8d552a 100%);
  border: 7px solid #3b1d08;
  border-radius: 6px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.8), inset 0 0 14px rgba(0, 0, 0, 0.65);
  position: relative;
}
.frame-wood .frame-inner-mat {
  box-shadow: inset 0 0 0 3px #f7f3eb, inset 0 0 10px rgba(0, 0, 0, 0.4);
}

/* 05. 日系紙織框 (Washi Paper / Linen Frame) */
.frame-washi {
  padding: 22px;
  background: #F7F4EB;
  border: 5px solid #D5C9B8;
  border-radius: 6px;
  box-shadow: 0 18px 45px rgba(50, 40, 30, 0.45), inset 0 0 10px rgba(180, 160, 140, 0.2);
  position: relative;
}
.frame-washi .frame-inner-mat {
  border: 1px dashed #A89F91;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.12);
}

/* 06. 展覽卡紙框 (Museum Matboard Frame) */
.frame-matboard {
  padding: 34px;
  background: #EDEAE1;
  border: 1px solid #C8C3B5;
  border-radius: 2px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  position: relative;
}
.frame-matboard .frame-inner-mat {
  box-shadow: inset 3px 3px 7px rgba(0, 0, 0, 0.35), inset -1px -1px 3px rgba(255, 255, 255, 0.9);
  border: 1px solid #D1CCC0;
}

.frame-inner-mat {
  position: relative;
  width: 100%;
  height: 100%;
  background: #ffffff;
  overflow: hidden;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.25);
}

#showcase-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 匯出品牌落款的線上預覽層 */
#showcase-watermark-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 11;
  pointer-events: none;
}

/* 右側控制面板卡片區塊樣式 */
.card-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}
.section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* 相框風格按鈕群 */
.frame-style-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.frame-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
}
.frame-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}
.frame-btn.active {
  border-color: var(--border-glow);
  background: rgba(139, 92, 246, 0.2);
  color: #fff;
}

.frame-preview-box {
  width: 18px;
  height: 18px;
  border-radius: 3px;
}
.none-border { background: rgba(255, 255, 255, 0.15); border: 1.5px dashed rgba(255, 255, 255, 0.5); }
.cute-border { background: linear-gradient(135deg, #fbcfe8, #f472b6); border: 2px dashed #db2777; }
.custom-border { background: var(--custom-frame-color, #fbcfe8); border: 2px solid rgba(255, 255, 255, 0.4); }
.wood-border { background: linear-gradient(135deg, #8d552a, #5d3314); border: 2px solid #3b1d08; }
.washi-border { background: #F7F4EB; border: 2px solid #B8AC9C; }
.matboard-border { background: #EDEAE1; border: 2px solid #8F8878; }

/* 簽名輸入列與開關切換 */
.section-title-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

#view-showcase #section-signature .toggle-checkbox-compact {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.78rem;
  font-weight: 700;
  color: #7f1d1d;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.35);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  transition: all var(--trans-fast);
}

#view-showcase #section-signature .toggle-checkbox-compact:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: rgba(244, 63, 94, 0.6);
}

#view-showcase #section-signature .toggle-checkbox-compact input[type="checkbox"] {
  accent-color: #f43f5e;
  cursor: pointer;
  width: 15px;
  height: 15px;
}

.signature-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: opacity var(--trans-smooth);
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.input-group label {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.input-group input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

#view-showcase #section-signature .signature-inputs {
  gap: 0.8rem;
}

#view-showcase #section-signature .input-group {
  gap: 0.4rem;
}

#view-showcase #section-signature .input-group label {
  color: #6b5544;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

#view-showcase #section-signature .input-group input {
  background: #fffdf8;
  border: 1px solid #d8c8b6;
  border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(73, 51, 31, 0.05), 0 2px 6px rgba(73, 51, 31, 0.06);
  color: #382d25;
  padding: 0.65rem 0.85rem;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
}

#view-showcase #section-signature .input-group input:focus {
  border-color: #bb8066;
  box-shadow: 0 0 0 3px rgba(187, 128, 102, 0.16);
  outline: none;
}

/* 輸出按鈕 */
.export-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--grad-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
  transition: all var(--trans-fast);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-secondary {
  padding: 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* 延時縮時動畫 (Timelapse) */
#view-showcase .timelapse-section {
  border-color: var(--border-subtle);
  background: var(--bg-card-default);
  color: var(--text-main);
}

#view-showcase .timelapse-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

#view-showcase .timelapse-section .section-title,
#view-showcase .timelapse-section .speed-label,
#view-showcase .timelapse-section .timelapse-time {
  color: var(--text-main);
}

#view-showcase .timelapse-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.5rem;
}

#view-showcase .timelapse-scrubber-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

#view-showcase .timelapse-section .icon-btn-large {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-oatmeal);
  border: 1px solid var(--border-subtle);
  color: var(--color-ink-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--trans-fast);
}
#view-showcase .timelapse-section .icon-btn-large:hover {
  transform: scale(1.08);
}

#view-showcase .timelapse-progress-container {
  flex: 1;
}
#view-showcase .timelapse-progress-container input[type="range"] {
  width: 100%;
  accent-color: #ec4899;
}
#view-showcase .timelapse-section .timelapse-time {
  font-size: 0.85rem;
  font-family: monospace;
  color: var(--text-muted);
  min-width: 40px;
}

#view-showcase .timelapse-speed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#view-showcase .timelapse-section .speed-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}
#view-showcase .speed-btn-group {
  display: flex;
  gap: 0.35rem;
}
#view-showcase .timelapse-section .speed-btn {
  padding: 0.25rem 0.6rem;
  background: var(--bg-oatmeal);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--color-ink-deep);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
#view-showcase .timelapse-section .speed-btn.active {
  background: var(--color-ink);
  color: #fff;
  border-color: var(--color-ink);
}

#view-showcase .timelapse-section .btn-gradient-pulse {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, #f43f5e 0%, #a855f7 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.35);
  transition: all var(--trans-smooth);
}
#view-showcase .timelapse-section .btn-gradient-pulse:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(244, 63, 94, 0.5);
}
#view-showcase .timelapse-section .btn-gradient-pulse:disabled {
  cursor: wait;
  opacity: 0.82;
  transform: none;
}
.timelapse-export-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: timelapseExportSpin 0.75s linear infinite;
}
@keyframes timelapseExportSpin {
  to { transform: rotate(360deg); }
}

/* 全域 Toast 提示條 */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
  pointer-events: none;
}
.toast-item {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  color: #fff;
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: slideInToast 0.25s ease-out;
}
@keyframes slideInToast {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 儲存草稿按鈕 */
.btn-secondary-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #ffffff;
  border: 1.5px solid var(--color-ink, #4A3728);
  color: #38291D !important;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(74, 55, 40, 0.08);
  transition: all var(--trans-fast);
}
.btn-secondary-outline span {
  color: #38291D !important;
}
.btn-secondary-outline svg {
  color: #38291D;
  stroke: #38291D;
}
.btn-secondary-outline:hover {
  background: #FAF2D8;
  border-color: #38291D;
  color: #38291D !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 55, 40, 0.16);
}

/* 草稿卡片樣式 */
.draft-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all var(--trans-smooth);
}
.draft-card:hover {
  border-color: rgba(139, 92, 246, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.draft-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #ffffff;
}
.draft-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.draft-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.draft-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.draft-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}
.draft-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.draft-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.btn-resume-draft {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--trans-fast);
}
.btn-resume-draft:hover {
  opacity: 0.92;
}
.btn-delete-draft {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--trans-fast);
}
.btn-delete-draft:hover {
  background: rgba(239, 68, 68, 0.3);
}
.drafts-empty-box {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  background: rgba(15, 23, 42, 0.3);
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  gap: 0.85rem;
}

/* 自訂收藏色票 (含濃度) */
.favorites-action-box {
  margin-bottom: 0.75rem;
}
.btn-save-custom-swatch {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans-fast);
}
.btn-save-custom-swatch:hover {
  background: rgba(245, 158, 11, 0.28);
  border-color: rgba(245, 158, 11, 0.6);
  transform: translateY(-1px);
}
.custom-swatches-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.45rem;
  min-height: 80px;
}
.custom-swatch-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background-image: linear-gradient(45deg, #1e293b 25%, transparent 25%),
                    linear-gradient(-45deg, #1e293b 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #1e293b 75%),
                    linear-gradient(-45deg, transparent 75%, #1e293b 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
  background-color: #0f172a;
  overflow: hidden;
  transition: transform 0.12s ease;
}
.custom-swatch-item:hover {
  transform: scale(1.15);
  z-index: 5;
}
.custom-swatch-item.active {
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}
.custom-swatch-color-layer {
  position: absolute;
  inset: 0;
}
.custom-swatch-opacity-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 0.58rem;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 0 3px;
  border-radius: 3px;
  line-height: 1.2;
}
.custom-swatch-delete-btn {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  font-size: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}
.custom-swatch-item:hover .custom-swatch-delete-btn {
  display: flex;
}

/* 本作色彩基因展區樣式 */
.artwork-palette-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}
.artwork-palette-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
}
.artwork-palette-header .section-title {
  margin: 0;
}
.btn-xs-gradient {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  background: var(--grad-primary);
  border: none;
  color: #FFFFFF;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
  transition: all var(--trans-fast);
  white-space: nowrap;
}
.btn-xs-gradient:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}
.artwork-palette-save-icon {
  color: #FFFFFF;
  font-size: 1.2em;
  line-height: 1;
}
.extracted-swatches-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.extracted-swatch-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--trans-fast);
  user-select: none;
}
.extracted-swatch-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}
.pill-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.pill-hex-code {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: monospace;
  color: var(--text-main);
}
.custom-frame-color-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-top: 0.65rem;
}
.custom-frame-picker-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.custom-frame-picker-row input[type="color"] {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}
.custom-color-hex-text {
  font-size: 0.8rem;
  font-weight: 700;
  font-family: monospace;
  color: var(--text-main);
}
.frame-color-preset-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.preset-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.f-pill {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.f-pill:hover {
  transform: scale(1.2);
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.checkbox-label input[type="checkbox"] {
  cursor: pointer;
}
.app-footer {
  margin-top: 4rem;
  border-top: 2px dashed rgba(74, 55, 40, 0.2);
  padding: 1.75rem 2rem;
  background: #FAF5EB;
}
.footer-content {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.84rem;
  color: var(--color-pencil);
  font-weight: 600;
}
.footer-title {
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--color-ink-deep);
}
.footer-version-tag {
  background: #FFF3CD;
  border: 1.2px solid #D4A373;
  color: #795548;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}
.footer-sep {
  color: var(--text-dim);
}
@media (max-width: 1080px) {
  .studio-workspace {
    grid-template-columns: 76px 1fr 240px;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 0 1rem;
    height: 60px;
  }
  .flow-stepper {
    display: none;
  }
  .studio-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .studio-sidebar-tools {
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
  }
}

/* 回到 LocalPapa（本站加的，不是原專案的）：放在頂端導覽列最右邊 */
.lp-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border: 2px solid #3E2723;
  border-radius: 999px;
  background: #FFFDF9;
  color: #3E2723;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 2px 2.5px 0 rgba(62, 39, 35, 0.14);
  white-space: nowrap;
}
.lp-back:hover { transform: translateY(-1px); }
@media (max-width: 680px) {
  .lp-back .lp-back-text { display: none; }
  .lp-back { padding: 0.4rem 0.7rem; }
}

/* ===== LocalPapa 加的：小螢幕的填色畫面（原專案在 ≤768px 只把格線改成單欄，畫布區高度會塌成 2px、工具列變成一長條） =====
   順序：畫布 → 工具列（橫向捲動）→ 選項 → 色票。畫布在最上面，打開就能直接畫。 */
@media (max-width: 768px) {
  .studio-workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  .studio-workspace > * { min-width: 0; }
  /* 原本整個填色畫面被鎖在「視窗高度」裡，畫布區是最後一個被擠壓的，高度塌成一條；
     小螢幕讓頁面自己往下長，用頁面捲動而不是擠壓畫布 */
  .studio-layout { height: auto; }
  .studio-workspace { flex: none; min-height: auto; }
  .studio-canvas-stage { min-height: auto; }
  .studio-topbar { flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem; }
  .studio-topbar .topbar-left, .studio-topbar .topbar-center, .studio-topbar .topbar-right { gap: 0.5rem; flex-wrap: wrap; min-width: 0; }
  .studio-topbar .artwork-title { white-space: nowrap; }
  .studio-canvas-stage { order: -1; min-height: 0; padding: 0.5rem; }
  .studio-canvas-stage .canvas-viewport { height: auto; }
  .studio-sidebar-tools { flex-direction: column; max-height: none; overflow: visible; }
  .studio-sidebar-tools .tool-group {
    display: flex; flex-direction: row; flex-wrap: nowrap; gap: 0.4rem;
    height: auto; overflow-x: auto; padding-bottom: 0.25rem;
  }
  .studio-sidebar-tools .tool-group-label { display: none; }
  .studio-sidebar-tools .tool-btn { flex: 0 0 64px; }
  .studio-sidebar-tools .tool-properties { width: 100%; }
  .studio-palette-panel { max-height: none; }
}
