@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Noto+Sans+TC:wght@300;400;500;700&display=swap');

:root {
  /* POBI STUDIO Artisanal Stationery Brand Colors (Kraft Leather & Deep Ink) */
  --pobi-blue: #8B5A2B;            /* 溫潤牛皮皮革棕 */
  --pobi-green: #B45309;           /* 典雅復古琥珀 */
  --pobi-background: #FFFFFF;
  --pobi-surface: #FAF7F0;
  --pobi-dark-background: #0B1220;

  /* Light Theme (Default: 溫潤米黃書頁紙張 + 實體手作牛皮筆記本質感) */
  color-scheme: light;
  --bg-primary: #F4EFEB;           /* 典雅書桌/桌面底色 */
  --bg-secondary: #FAF7F0;         /* 溫潤米白筆記卡片底色 */
  --notebook-paper: #FAF6ED;       /* 經典米黃書頁色 (Warm Cream / Ivory) */
  --notebook-desk: #ECE6DE;        /* 木質/皮革書桌質感 */
  --notebook-line: rgba(140, 110, 80, 0.08); /* 筆記紙橫線淡印 */
  --notebook-margin: rgba(180, 83, 9, 0.22); /* 活頁裝訂與邊界紅暖墨水線 */
  --notebook-stitch: rgba(120, 80, 40, 0.15); /* 車縫裝訂線 */

  --glass-bg: #FAF7F0;
  --glass-border: #D8D0C5;         /* 實體裝訂紙張邊緣邊框 */
  --glass-highlight: #F0EAE1;
  
  --text-primary: #1C1917;         /* Deep Charcoal Ink 碳墨深黑 (最高對比與溫暖易讀性) */
  --text-secondary: #44403C;       /* 深暖灰石墨墨水色 */
  --text-muted: #78716C;           /* 輔助墨水色 (維持高易讀性) */
  
  --accent-primary: #8B5A2B;       /* 牛皮皮革原色 */
  --accent-secondary: #B45309;     /* 復古琥珀銅 */
  --accent-gradient: linear-gradient(135deg, #8B5A2B, #B45309);
  --accent-gradient-hover: linear-gradient(135deg, #78350F, #92400E);
  --title-gradient: linear-gradient(135deg, #1C1917 0%, #78350F 100%);
  
  --success: #4D7C0F;             /* 典雅苔綠 (自然手帳感) */
  --success-glow: rgba(77, 124, 15, 0.16);
  --danger: #B91C1C;
  --danger-glow: rgba(185, 28, 28, 0.14);
  --warning: #92400E;             /* 溫暖赭黃/焦糖，高對比易讀 (WCAG AAA) */
  --warning-bg: #FEF3C7;
  --warning-border: #D97706;
  --warning-text: #78350F;
  --warning-glow: rgba(180, 83, 9, 0.14);
  
  --shadow-sm: 0 1px 3px rgba(60, 40, 20, 0.05);
  --shadow-md: 0 4px 14px rgba(60, 40, 20, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(60, 40, 20, 0.1), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 35px rgba(60, 40, 20, 0.14), 0 5px 12px rgba(0, 0, 0, 0.06);
  
  --washi-tape-green: rgba(77, 124, 15, 0.32);
  --washi-tape-blue: rgba(139, 90, 43, 0.25);
  --washi-tape-amber: rgba(180, 83, 9, 0.28);

  --font-sans: 'Outfit', 'Noto Sans TC', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Safe Area Insets for iOS (Notch / Dynamic Island) & Android Status Bar */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --top-navbar-padding-top: env(safe-area-inset-top, 0px);
}

/* 針對 iOS / iPadOS (Safari, Chrome, Brave, PWA 全螢幕模式) */

/* iPad 在全螢幕下因無實體瀏海導致 env() 回報 0px，強制保留至少 28px 狀態列避讓安全距離；iPhone 瀏海機型則採用 44px~48px */

html.has-system-status-bar,
@supports (-webkit-touch-callout: none) {
  :root {
    --top-navbar-padding-top: max(env(safe-area-inset-top, 0px), 28px);
  }
}

.top-navbar {
  padding-top: var(--top-navbar-padding-top) !important;
  padding-left: calc(24px + env(safe-area-inset-left, 0px)) !important;
  padding-right: calc(24px + env(safe-area-inset-right, 0px)) !important;
  min-height: calc(64px + var(--top-navbar-padding-top)) !important;
  box-sizing: border-box !important;
}

[data-theme="dark"] {
  color-scheme: dark;
  /* Dark Theme (深色工程風 + 深色皮革活頁手帳) */
  --bg-primary: #0B1220;           /* POBI Dark 主背景 */
  --bg-secondary: #121D2F;         /* 深海軍藍活頁夾卡片底色 */
  --notebook-paper: #121E31;       /* 深色紙張底色 */
  --notebook-desk: #080D17;        /* 深色桌面 */
  --notebook-line: rgba(255, 255, 255, 0.05);
  --notebook-margin: rgba(74, 222, 128, 0.3);
  --notebook-stitch: rgba(255, 255, 255, 0.12);

  --glass-bg: rgba(18, 29, 47, 0.95);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-highlight: rgba(0, 31, 101, 0.5);
  
  --text-primary: #FFFFFF;         /* 純白高對比 */
  --text-secondary: #E2E8F0;       /* 白銀灰 (高可讀性，絕非深色字) */
  --text-muted: #94A3B8;           /* 淺灰字體 */
  
  --accent-primary: #F59E0B;       /* 溫暖琥珀金 */
  --accent-secondary: #D97706;     /* 復古黃銅金 */
  --accent-gradient: linear-gradient(135deg, #D97706, #F59E0B);
  --accent-gradient-hover: linear-gradient(135deg, #B45309, #D97706);
  --title-gradient: linear-gradient(135deg, #FFFFFF 15%, #FDE68A 85%);
  
  --success: #84CC16;
  --success-glow: rgba(132, 204, 22, 0.25);
  --danger: #EF4444;
  --danger-glow: rgba(239, 68, 68, 0.25);
  --warning: #FBBF24;
  --warning-bg: rgba(245, 158, 11, 0.16);
  --warning-border: rgba(251, 191, 36, 0.5);
  --warning-text: #FDE68A;
  --warning-glow: rgba(251, 191, 36, 0.25);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.65);
  --shadow-xl: 0 20px 35px rgba(0, 0, 0, 0.75);

  --washi-tape-green: rgba(34, 197, 94, 0.4);
  --washi-tape-blue: rgba(56, 189, 248, 0.4);
  --washi-tape-amber: rgba(251, 191, 36, 0.4);
}

/* Global Reset & Base Styling */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ambient Desk Atmosphere (溫暖木質/皮革書桌氛圍，告別冰冷AI光斑) */

.bg-ambient-lights {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.7) 0%, transparent 65%),
    linear-gradient(180deg, rgba(0, 31, 101, 0.02) 0%, rgba(25, 122, 39, 0.02) 100%);
}

[data-theme="dark"] .bg-ambient-lights {
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(0, 31, 101, 0.3) 0%, transparent 75%),
    #0B1220;
}

.pobi-gradient {
  background: linear-gradient(135deg, var(--pobi-blue), var(--pobi-green));
}

/* =======================================================
   Physical Notebook & Hardcover Skeuomorphic Styles
   ======================================================= */

/* Physical Notebook Outer Frame & Binder Spine */

.notebook-desk {
  background-color: var(--notebook-desk);
}

.notebook-page {
  background-color: var(--notebook-paper);
  background-image: 
    linear-gradient(to right, var(--notebook-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--notebook-line) 1px, transparent 1px);
  background-size: 22px 22px;
  border: 1px solid var(--glass-border);
  box-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.05),
    0 10px 28px rgba(60, 40, 20, 0.08),
    -3px 0 0 -1px var(--notebook-paper),
    -4px 0 0 0 var(--glass-border),
    -7px 0 0 -1px var(--notebook-paper),
    -8px 0 0 0 var(--glass-border);
  position: relative;
}

/* Hardcover Book Cover (實體精裝書本封面 - 用於登入頁面) */

.hardcover-book-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  perspective: 1000px;
}

.hardcover-book {
  position: relative;
  background: linear-gradient(145deg, #6B3E18 0%, #8B5A2B 50%, #A06332 100%);
  border-radius: 6px 18px 18px 6px;
  padding: 34px 28px 34px 42px;
  box-shadow: 
    -15px 0 28px rgba(0, 0, 0, 0.45),      /* 書脊左側立體厚度陰影 */
    0 18px 45px rgba(60, 35, 10, 0.28),     /* 書底投影 */
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset -3px 0 8px rgba(0, 0, 0, 0.35);    /* 書槽開闔壓痕 */
  border-left: 20px solid #4D280A;          /* 精裝厚實書脊 */
  overflow: hidden;
}

/* 書脊上的燙金/車縫凹槽線 */

.hardcover-book::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, 
    transparent 0%, 
    rgba(255, 215, 0, 0.35) 20%, 
    rgba(255, 215, 0, 0.35) 80%, 
    transparent 100%
  );
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.6);
  z-index: 5;
}

/* 封面車縫線外框 */

.cover-stitched-frame {
  position: absolute;
  inset: 10px 10px 10px 18px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 4px 12px 12px 4px;
  pointer-events: none;
  z-index: 2;
}

/* 書角金色包角 (Brass Book Corners) */

.book-corner-brass {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2px solid #D4AF37;
  pointer-events: none;
  z-index: 10;
}

.book-corner-tr {
  top: 4px;
  right: 4px;
  border-left: none;
  border-bottom: none;
  border-radius: 0 14px 0 0;
  background: radial-gradient(circle at top right, rgba(212, 175, 55, 0.45) 0%, transparent 70%);
}

.book-corner-br {
  bottom: 4px;
  right: 4px;
  border-left: none;
  border-top: none;
  border-radius: 0 0 14px 0;
  background: radial-gradient(circle at bottom right, rgba(212, 175, 55, 0.45) 0%, transparent 70%);
}

/* 垂掛緞面書籤絲帶 (Bookmark Ribbon) */

.book-ribbon-tag {
  position: absolute;
  top: -2px;
  right: 36px;
  width: 22px;
  height: 64px;
  background: linear-gradient(180deg, #D97706 0%, #92400E 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  z-index: 15;
  pointer-events: none;
}

/* 封面上的米黃藏書票/扉頁 (Bookplate Insertion Page) */

.bookplate-insert {
  position: relative;
  background: #FAF6ED;                      /* 溫潤米黃紙質 */
  background-image: radial-gradient(rgba(0, 31, 101, 0.05) 1px, transparent 1px);
  background-size: 16px 16px;
  border: 1px solid #D4C9BA;
  border-radius: 8px;
  padding: 28px 24px 22px 24px;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.18),
    0 8px 20px rgba(0, 0, 0, 0.12);
  z-index: 5;
}

/* Physical Notebook Spiral Binder / Spine indicator */

.notebook-binder-edge {
  position: relative;
}

.notebook-binder-edge::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 16px;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 28px,
    rgba(0, 31, 101, 0.12) 28px,
    rgba(0, 31, 101, 0.2) 32px,
    transparent 36px
  );
  border-right: 1px dashed var(--glass-border);
  pointer-events: none;
  z-index: 2;
}

/* Notebook Header with Bookmark Ribbon */

.notebook-header-ribbon {
  position: relative;
}

.notebook-header-ribbon::after {
  content: "";
  position: absolute;
  top: 0;
  right: 28px;
  width: 14px;
  height: 38px;
  background: linear-gradient(180deg, var(--accent-secondary), #0e5218);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* Scrapbook Washi Tape Strips - 依使用者要求全部隱藏/移除 */

.washi-tape-strip,
.washi-tape-blue,
.washi-tape-amber,
.washi-card {
  position: relative;
}

.washi-tape-strip::before,
.washi-tape-blue::before,
.washi-tape-amber::before,
.washi-card::before {
  display: none !important;
  content: none !important;
}

/* Clipped Scrapbook Flashcard (剪貼卡片質感) */

.scrapbook-card {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: 
    0 2px 6px rgba(0, 31, 101, 0.05),
    0 8px 20px rgba(0, 31, 101, 0.08);
  position: relative;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}

.scrapbook-card:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 4px 10px rgba(0, 31, 101, 0.08),
    0 14px 28px rgba(0, 31, 101, 0.12);
}

/* Sticky Memo Note (剪貼便利貼新增框) */

.memo-note {
  background: var(--notebook-paper);
  border: 1.5px dashed var(--accent-secondary);
  border-radius: 10px;
  box-shadow: 2px 4px 14px rgba(0, 31, 101, 0.08);
  position: relative;
}

/* Notebook Index Tab (側邊活頁索引貼) */

.notebook-index-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  border-top: 2px solid var(--accent-secondary);
  background: var(--glass-bg);
  box-shadow: 0 -2px 6px rgba(0, 31, 101, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
}

.notebook-index-tab.active {
  background: var(--notebook-paper);
  border-top: 3px solid var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 -4px 10px rgba(0, 31, 101, 0.09);
}

/* Glassmorphism Styles */

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(0, 31, 101, 0.25);
}

/* Typography & Headers */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.title-gradient {
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--text-primary);
}

.navbar-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

[data-theme="light"] .navbar-title {
  color: #1C1917;
  background: linear-gradient(135deg, #1C1917 0%, #78350F 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .navbar-title {
  color: #FFFFFF;
  background: linear-gradient(135deg, #FFFFFF 15%, #FDE68A 85%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Sidebar Specific High-Contrast Elements */

.sidebar-section2-title {
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

[data-theme="light"] .sidebar-section2-title {
  color: #92400E; /* 深琥珀棕色，淺色底超清晰 */
}

[data-theme="dark"] .sidebar-section2-title {
  color: #FCD34D; /* 明亮金色，深色底清晰可辨 */
}

/* Sidebar Add Subject Button */

.btn-sidebar-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 3px 8px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 6px;
  transition: all 0.2s ease;
}

[data-theme="light"] .btn-sidebar-add {
  background: #E8F5E9;
  border: 1px solid #A5D6A7;
  color: #14532D;
}

[data-theme="light"] .btn-sidebar-add:hover {
  background: #C8E6C9;
}

[data-theme="dark"] .btn-sidebar-add {
  background: rgba(74, 222, 128, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #4ADE80;
}

[data-theme="dark"] .btn-sidebar-add:hover {
  background: rgba(74, 222, 128, 0.28);
}

/* Scope Badges with High Contrast */

.scope-badge-global {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  flex-shrink: 0;
}

[data-theme="light"] .scope-badge-global {
  background: #E8F5E9;
  color: #14532D;
  border: 1px solid #C8E6C9;
}

[data-theme="dark"] .scope-badge-global {
  background: rgba(34, 197, 94, 0.22);
  color: #4ADE80;
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.scope-badge-subject {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  flex-shrink: 0;
}

[data-theme="light"] .scope-badge-subject {
  background: #EDE9FE;
  color: #4C1D95;
  border: 1px solid #DDD6FE;
}

[data-theme="dark"] .scope-badge-subject {
  background: rgba(165, 180, 252, 0.22);
  color: #C7D2FE;
  border: 1px solid rgba(165, 180, 252, 0.35);
}

.scope-badge-chapter {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  flex-shrink: 0;
}

[data-theme="light"] .scope-badge-chapter {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

[data-theme="dark"] .scope-badge-chapter {
  background: rgba(251, 191, 36, 0.22);
  color: #FDE047;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 31, 101, 0.22);
}

.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 31, 101, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--glass-highlight);
  border-color: var(--text-secondary);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--danger-glow);
}

.btn-danger:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-text {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 12px;
}

.btn-text:hover {
  color: var(--text-primary);
  background: var(--glass-bg);
}

/* Inputs & Form Controls */

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

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
}

.input:focus {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 3px rgba(25, 122, 39, 0.18);
}

.input::placeholder {
  color: var(--text-muted);
}

select.input {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--glass-border) !important;
  font-weight: 500;
}

select.input option,
select.input optgroup,
select option,
select optgroup {
  background-color: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  font-weight: 500;
}

[data-theme="light"] select.input {
  background-color: #ffffff !important;
  color: #1C1917 !important;
  border-color: rgba(140, 110, 80, 0.25) !important;
  font-weight: 600;
}

[data-theme="light"] select.input option,
[data-theme="light"] select.input optgroup,
[data-theme="light"] select option,
[data-theme="light"] select optgroup {
  background-color: #ffffff !important;
  color: #1C1917 !important;
  font-weight: 600;
}

[data-theme="dark"] select.input {
  background-color: #101B2E !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  font-weight: 500;
}

[data-theme="dark"] select.input option,
[data-theme="dark"] select.input optgroup,
[data-theme="dark"] select option,
[data-theme="dark"] select optgroup {
  background-color: #101B2E !important;
  color: #ffffff !important;
  font-weight: 500;
}

[data-theme="light"] select option,
[data-theme="light"] select optgroup {
  background-color: #ffffff;
  color: #0f172a;
  font-weight: 500;
}

.input-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Layout Utilities */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.grid {
  display: grid;
  gap: 24px;
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }

.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
}

/* Animations */

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

.animate-fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Custom Collapsible details/summary */

.collapsible-container {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.1);
  margin-top: 12px;
}

.collapsible-trigger {
  padding: 12px 16px;
  background: var(--glass-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  transition: background 0.2s ease;
}

.collapsible-trigger:hover {
  background: var(--glass-highlight);
}

.collapsible-content {
  padding: 16px;
  border-top: 1px solid var(--glass-border);
  animation: fadeIn 0.3s ease;
}

/* Print CSS Stylesheet */

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
    font-family: 'Noto Sans TC', sans-serif !important;
  }
  
  .bg-ambient-lights,
  header,
  nav,
  .no-print,
  .btn,
  .theme-toggle,
  .collapsible-trigger svg,
  .sidebar,
  .filters-container {
    display: none !important;
  }

  .container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .print-page {
    page-break-after: always;
  }

  /* Force display of answers in Complete/解析 mode during print */
  .print-solution-mode .collapsible-content {
    display: block !important;
    border-top: 1px dashed #cccccc !important;
    margin-top: 10px !important;
    padding-top: 10px !important;
  }

  /* Force hide answers in Practice/練習 mode during print */
  .print-practice-mode .collapsible-container,
  .print-practice-mode .collapsible-content,
  .print-practice-mode .answer-section {
    display: none !important;
  }

  .mistake-card-print {
    border: 1px solid #000000 !important;
    border-radius: 4px !important;
    padding: 15px !important;
    margin-bottom: 25px !important;
    page-break-inside: avoid !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .mistake-card-print h3 {
    border-bottom: 1px solid #000000 !important;
    padding-bottom: 5px !important;
    margin-bottom: 10px !important;
  }

  .print-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }

  img {
    max-width: 80% !important;
    max-height: 4in !important;
    display: block !important;
    margin: 10px 0 !important;
    page-break-inside: avoid !important;
  }
}

/* ========================================
   Modal Overlay & Content
   ======================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

/* ========================================
   Sidebar Transitions
   ======================================== */

.sidebar {
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed {
  width: 48px !important;
}

.sidebar-expanded {
  width: 300px;
}

/* ========================================
   Spin Animation (for loaders)
   ======================================== */

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ========================================
   Responsive Layout
   ======================================== */

/* Mobile: <768px */

@media (max-width: 767px) {
  /* Navbar responsive with Safe Area Top padding */
  .top-navbar {
    height: auto !important;
    min-height: calc(56px + var(--top-navbar-padding-top)) !important;
    padding-top: calc(8px + var(--top-navbar-padding-top)) !important;
    padding-bottom: 8px !important;
    padding-left: calc(12px + env(safe-area-inset-left, 0px)) !important;
    padding-right: calc(12px + env(safe-area-inset-right, 0px)) !important;
    flex-wrap: wrap;
    gap: 8px;
  }

  .navbar-brand {
    flex: 1;
    min-width: 0;
  }

  .navbar-title {
    font-size: 1rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navbar-actions {
    flex-wrap: wrap;
    gap: 6px !important;
    justify-content: flex-end;
  }

  .navbar-btn-text {
    display: none;
  }

  .navbar-user-info {
    display: none;
  }

  /* Sidebar defaults collapsed on mobile with Safe Area */
  .sidebar-expanded {
    position: fixed;
    left: 0;
    top: calc(56px + var(--top-navbar-padding-top)) !important;
    z-index: 40;
    width: 280px !important;
    height: calc(100vh - 56px - var(--top-navbar-padding-top)) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    background: var(--bg-secondary) !important;
  }

  .sidebar-collapsed {
    width: 40px !important;
  }

  /* Main content full width */
  .main-layout {
    flex-direction: row;
  }

  /* Glass card adjustments */
  .glass-card {
    padding: 16px;
  }

  .glass {
    padding: 16px;
  }

  /* Table responsive */
  .glass-card table {
    font-size: 0.8rem;
  }

  .glass-card th, .glass-card td {
    padding: 8px 10px !important;
  }
}

/* Tablet: 768px - 1024px */

@media (min-width: 768px) and (max-width: 1024px) {
  .sidebar-expanded {
    width: 240px !important;
  }

  .navbar-btn-text {
    display: none;
  }

  .top-navbar {
    padding-top: var(--top-navbar-padding-top) !important;
    padding-left: calc(16px + env(safe-area-inset-left, 0px)) !important;
    padding-right: calc(16px + env(safe-area-inset-right, 0px)) !important;
    min-height: calc(64px + var(--top-navbar-padding-top)) !important;
  }

  .glass-card {
    padding: 20px;
  }
}

/* Desktop: >1024px */

@media (min-width: 1025px) {
  .sidebar-expanded {
    width: 300px;
  }
}

/* High Contrast Warning Alert Banner & Tags (WCAG AAA Compliant in Light & Dark Modes) */

.warning-alert-banner {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  border: 1.5px solid var(--warning-border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--warning-text);
  box-shadow: var(--shadow-sm);
}

.warning-alert-banner svg {
  color: var(--warning-border);
  flex-shrink: 0;
  margin-top: 2px;
}

.warning-alert-banner strong {
  color: var(--warning-text);
  font-weight: 700;
}

.badge-warning-contrast {
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.badge-recommended-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #D97706;
  color: #FFFFFF;
  display: inline-block;
}

[data-theme="dark"] .badge-recommended-tag {
  background: #FBBF24;
  color: #0F172A;
}
/* POBI STUDIO brand interface, isolated from the original application. */
:root {
  color-scheme: light;
  --pobi-blue: #8B5A2B;
  --pobi-green: #B45309;
  --pobi-background: #FFFFFF;
  --pobi-surface: #FAF7F0;
  --pobi-dark-background: #0B1220;
  --bg-primary: #F4EFEB;
  --bg-secondary: #FAF7F0;
  --notebook-paper: #FAF6ED;
  --notebook-desk: #ECE6DE;
  --notebook-line: rgba(140, 110, 80, 0.08);
  --notebook-margin: rgba(180, 83, 9, 0.22);
  --notebook-stitch: rgba(120, 80, 40, 0.15);
  --glass-bg: rgba(250, 247, 240, 0.94);
  --glass-border: #D8D0C5;
  --glass-highlight: #F0EAE1;
  --text-primary: #1C1917;
  --text-secondary: #44403C;
  --text-muted: #78716C;
  --accent-primary: #8B5A2B;
  --accent-secondary: #B45309;
  --accent-gradient: linear-gradient(135deg, #8B5A2B, #B45309);
  --accent-gradient-hover: linear-gradient(135deg, #78350F, #92400E);
  --title-gradient: linear-gradient(135deg, #1C1917, #78350F);
  --success: #4D7C0F;
  --success-glow: rgba(77, 124, 15, 0.13);
  --shadow-sm: 0 1px 3px rgba(60, 40, 20, 0.06);
  --shadow-md: 0 5px 16px rgba(60, 40, 20, 0.08);
  --shadow-lg: 0 14px 30px rgba(60, 40, 20, 0.11);
  --shadow-xl: 0 22px 42px rgba(60, 40, 20, 0.14);
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: #0B1220;
  --bg-secondary: #111D31;
  --notebook-paper: #111D31;
  --notebook-desk: #0B1220;
  --notebook-line: rgba(255,255,255,.045);
  --glass-bg: rgba(17,29,49,.96);
  --glass-border: #334155;
  --glass-highlight: #1a2638;
  --text-primary: #FFFFFF;
  --text-secondary: #F1F5F9;
  --text-muted: #CBD5E1;
  --accent-primary: #38bdf8;
  --accent-secondary: #4ade80;
  --accent-gradient: linear-gradient(100deg, #38bdf8, #4ade80);
  --title-gradient: linear-gradient(100deg, #FFFFFF, #FFFFFF);
  --success: #4ade80;
}
html, body { background: var(--bg-primary); }
body { font-family: 'Noto Sans TC', 'Segoe UI', sans-serif; letter-spacing: .005em; }
.bg-ambient-lights { background: linear-gradient(180deg, rgba(139,90,43,.03), transparent 270px) !important; }
.glass { background: var(--glass-bg) !important; border-color: var(--glass-border) !important; box-shadow: var(--shadow-sm) !important; backdrop-filter: none !important; }
.top-navbar { min-height: 66px !important; padding: 8px 28px !important; border-bottom: 1px solid var(--glass-border) !important; box-shadow: 0 2px 8px rgba(60,40,20,.035) !important; }
html:not([data-theme="dark"]) .navbar-title { color: var(--pobi-blue) !important; background: none !important; -webkit-text-fill-color: var(--pobi-blue) !important; font-size: 1.04rem !important; letter-spacing: .015em; }
[data-theme="dark"] .navbar-title,
[data-theme="dark"] .binder-spine-brand-title {
  color: #ffffff !important;
  background: none !important;
  -webkit-text-fill-color: #ffffff !important;
  font-size: 1.04rem !important;
  letter-spacing: .015em;
}
.navbar-brand img { border-radius: 7px !important; }
.top-navbar .no-print button { border-radius: 5px !important; font-weight: 550; }
html:not([data-theme="dark"]) .btn-primary, 
html:not([data-theme="dark"]) button.bg-pobi-blue,
html:not([data-theme="dark"]) .notebook-primary-btn { 
  background: #ede4d5 !important; 
  border: 1px solid #cbbaa3 !important; 
  color: #342211 !important; 
  font-weight: 600 !important;
  box-shadow: 0 1px 3px rgba(60, 40, 20, 0.08) !important; 
}
html:not([data-theme="dark"]) .btn-primary:hover, 
html:not([data-theme="dark"]) button.bg-pobi-blue:hover,
html:not([data-theme="dark"]) .notebook-primary-btn:hover { 
  background: #dfcfb9 !important; 
  border-color: #bda68a !important; 
  color: #1c1208 !important; 
}
html:not([data-theme="dark"]) .btn-secondary, 
html:not([data-theme="dark"]) .notebook-tool-btn { 
  background: #faf6ee !important; 
  color: #4a3c30 !important; 
  border: 1px solid #dfd4c3 !important; 
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.04) !important; 
  border-radius: 5px !important; 
}
html:not([data-theme="dark"]) .btn-secondary:hover, 
html:not([data-theme="dark"]) .notebook-tool-btn:hover { 
  background: #eee4d3 !important; 
  color: #2b1f15 !important; 
  border-color: #cbbaa3 !important; 
}

[data-theme="dark"] .btn-primary, 
[data-theme="dark"] button.bg-pobi-blue { 
  background: #9a6332 !important; 
  border-color: #b47842 !important; 
  color: #ffffff !important; 
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important; 
}
[data-theme="dark"] .btn-primary:hover, 
[data-theme="dark"] button.bg-pobi-blue:hover { 
  background: #b0723a !important; 
  border-color: #c9854b !important; 
}
[data-theme="dark"] .btn-secondary, 
[data-theme="dark"] .notebook-tool-btn { 
  background: #1e2633 !important; 
  color: #f1f5f9 !important; 
  border: 1px solid #334155 !important; 
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important; 
  border-radius: 5px !important; 
}
[data-theme="dark"] .btn-secondary:hover, 
[data-theme="dark"] .notebook-tool-btn:hover { 
  background: #2a3547 !important; 
  color: #ffffff !important; 
  border-color: #64748b !important; 
}
button, input, select, textarea { border-radius: 5px; }
.bookshelf-room { min-height: calc(100vh - 66px); padding: 42px 32px 64px; background: transparent !important; }
.bookshelf-header { max-width: 1220px; margin-bottom: 29px; padding-bottom: 20px; border-bottom: 1px solid var(--glass-border); align-items: end; }
.bookshelf-title-group h1 { color: var(--pobi-blue); font-size: 1.7rem; letter-spacing: -.025em; gap: 10px; }
.bookshelf-title-group h1 svg { color: var(--pobi-blue) !important; }
.bookshelf-title-group p { color: var(--text-muted); font-size: .87rem; }
.bookshelf-actions { gap: 8px; }
.bookshelf-stage { max-width: 1220px; gap: 38px; }
html:not([data-theme="dark"]) .shelf-unit,
.shelf-unit-light { padding: 20px 22px 0; border: 1px solid #DFD5C6; border-radius: 8px 8px 2px 2px; background: linear-gradient(180deg,#FAF7F0,#F2EBDA); box-shadow: 0 6px 18px rgba(60,40,20,.05); }
html[data-theme="dark"] .shelf-unit,
html.dark .shelf-unit,
.shelf-unit-dark { padding: 20px 22px 0; border: 1px solid #232D3F !important; border-radius: 8px 8px 2px 2px; background: linear-gradient(180deg, #161F2E, #0F1724) !important; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important; }
.shelf-books-row { grid-template-columns: repeat(auto-fill,minmax(176px,1fr)); gap: 23px 22px; padding: 0 8px 14px; margin-bottom: 0; }
.book-item-wrapper { transition: transform .2s ease; }
.book-item-wrapper:hover { transform: translateY(-5px); }
.book-cover { aspect-ratio: 1 / 1.32; border-radius: 4px 7px 7px 4px; box-shadow: -4px 3px 10px rgba(0,0,0,.18), 4px 8px 14px rgba(60,40,20,.18), inset 2px 0 3px rgba(255,255,255,.18); }
.book-cover::before { width: 13px; }
.book-frame { inset: 10px 9px 10px 17px; }
.book-frame-inner { border-color: rgba(255,255,255,.3); }
.book-badge-icon { color: #fff !important; }
.book-badge-icon svg { color: #fff !important; }
.book-title { color: #fff !important; font-size: 1.22rem; letter-spacing: .035em; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.book-series-tag, .book-footer, .book-mistake-pill { color: rgba(255,255,255,.88) !important; }
.book-progress-track { background: rgba(255,255,255,.22); }
.book-progress-bar { background: #fff !important; }
.book-mistake-pill { background: rgba(0,0,0,.13); border: 1px solid rgba(255,255,255,.22); }
.book-corner-brass { opacity: .35; }
.book-ribbon { opacity: .6; }
.shelf-plank { height: 13px; margin: 0 -22px; border-radius: 0 0 3px 3px; background: linear-gradient(180deg,#D7C4A5,#BFA784 40%,#A68D6A) !important; box-shadow: 0 9px 15px rgba(60,40,20,.15); }
.shelf-plank::before { background: linear-gradient(90deg,rgba(255,255,255,.8),rgba(255,255,255,.25)); }
.add-book-cover { aspect-ratio: 1/1.32; border: 1px dashed #C8B9A6; border-radius: 5px; background: #FAF7F0; color: #5C4028; box-shadow: none; }
.add-book-cover:hover { border-color: #B45309; color: #B45309; background: #FFFDF9; transform: translateY(-4px); }
.add-book-icon-circle { border-color: #D4C5B2; color: #8B5A2B; }
.add-book-text { color: #5C4028; }
.add-book-subtext { color: var(--text-muted); }
.notebook-backdrop { min-height: calc(100vh - 66px); padding: 23px 28px 54px; background: var(--notebook-desk, #EDE6D8); }
.notebook-top-bar { max-width: 1280px; margin-bottom: 17px; }
.notebook-breadcrumb { font-size: .86rem; }
.notebook-breadcrumb-back { color: #5c3e21; background: #faf6ee; border: 1px solid #dcd1bf; border-radius: 5px; box-shadow: none; }
.notebook-hardcover-edge { border-radius: 9px; box-shadow: 0 15px 30px rgba(60,40,20,.18); }
.notebook-book-body { min-height: 710px; background: #f5efe4; border-radius: 6px; box-shadow: 0 3px 12px rgba(60,40,20,.08), inset 0 0 0 1px #ded2be; }
.notebook-page-left, .notebook-page-right { background-color: #f5efe4 !important; padding-top: 32px; padding-bottom: 34px; }
.notebook-page-left { padding-left: 37px; padding-right: 30px; }
.notebook-page-right { padding-left: 30px; padding-right: 37px; }
.notebook-page-lined { background-image: linear-gradient(rgba(140,110,80,.07) 1px,transparent 1px) !important; background-size: 100% 34px !important; }
.notebook-center-seam { width: 30px; background: linear-gradient(90deg,#ebe2d3,#d5c6b0 50%,#ebe2d3) !important; box-shadow: inset 0 0 8px rgba(0,0,0,.15); }
.binder-ring { background: linear-gradient(180deg,#fffdf5,#d4af37 40%,#9e7b16 80%,#4a3704) !important; box-shadow: 0 2px 4px rgba(40,25,10,.35),inset 0 1px #fff; }
.binder-ring::before,.binder-ring::after { background: #3b2816 !important; box-shadow: none; }
html:not([data-theme="dark"]) .editorial-badge { color: #8b5a2b; letter-spacing: .11em; }
[data-theme="dark"] .editorial-badge { color: #e2d5c3; letter-spacing: .11em; font-weight: 700; }
.notebook-mobile-toggle { background: #f0e7d8; border: 1px solid #ddd1bf; border-radius: 5px; }
.notebook-mobile-toggle-btn { border-radius: 4px; }
.notebook-mobile-toggle-btn.active { color: #1C1917 !important; font-weight: 700; background: #FDE68A; }
.notebook-spread-outer { max-width: 1280px; }
html:not([data-theme="dark"]) .notebook-page-left .bg-bg-secondary\/80, 
html:not([data-theme="dark"]) .notebook-page-left .bg-glass-highlight\/70 { background-color: rgba(255,253,248,0.92) !important; border-color: #dfd4c3 !important; }
html:not([data-theme="dark"]) .notebook-page-left .text-success, 
html:not([data-theme="dark"]) .notebook-page-left .bg-success { color: #4D7C0F !important; }
html:not([data-theme="dark"]) .notebook-page-left .bg-success { background-color: #4D7C0F !important; }
html:not([data-theme="dark"]) .notebook-page-left .text-pobi-blue { color: #7d4e24 !important; }
html:not([data-theme="dark"]) .notebook-page-left .bg-pobi-blue { background-color: #8b5a2b !important; }
html:not([data-theme="dark"]) .notebook-page-left [class*="bg-amber"], 
html:not([data-theme="dark"]) .notebook-page-left [class*="text-amber"] { color: #8b5a2b !important; }
html:not([data-theme="dark"]) .notebook-page-left [class*="bg-amber"] { background-color: #eddcc6 !important; }
.notebook-outer-tabs { gap: 9px; }
.notebook-tab-item { box-shadow: 1px 2px 6px rgba(60,40,20,.08); background: #f7f2e8; border-color: #dfd4c3; color: #4a3c30; }
.notebook-tab-item.active { background: #FDE68A; border-color: #D97706; color: #1C1917 !important; font-weight: 700; box-shadow: 0 2px 8px rgba(180,83,9,.2); }
html:not([data-theme="dark"]) .notebook-tool-btn { padding: 7px 10px; font-weight: 550; background: #faf6ee !important; color: #4a3c30 !important; border: 1px solid #dfd4c3 !important; }
html:not([data-theme="dark"]) .notebook-tool-btn:hover { background: #ede2d1 !important; color: #2e2319 !important; border-color: #cbbaa3 !important; }
.notebook-sheet-content, .modal-content { border: 1px solid #DCE3EC !important; border-radius: 7px !important; box-shadow: 0 18px 48px rgba(11,18,32,.2) !important; }
.notebook-sheet-overlay, .modal-overlay { background: rgba(11,18,32,.42) !important; backdrop-filter: blur(2px) !important; }
input, select, textarea { border-color: #D4C9BA !important; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(217,119,6,.35) !important; border-color: #B45309 !important; }
@media (max-width: 900px) {
  .bookshelf-room { padding: 28px 18px 48px; }
  .bookshelf-header { align-items: flex-start; }
  .bookshelf-actions { flex-wrap: wrap; justify-content: flex-start; }
  .shelf-books-row { grid-template-columns: repeat(auto-fill,minmax(152px,1fr)); gap: 19px; }
  .notebook-book-body { min-height: unset; }
}
@media (max-width: 640px) {
  .top-navbar { padding: 8px 12px !important; }
  .navbar-title { font-size: .92rem !important; }
  .top-navbar .no-print button:nth-child(n+2) { display: none !important; }
  .navbar-btn-text, .navbar-user-info { display: none !important; }
  .bookshelf-room { padding: 23px 13px 36px; }
  .bookshelf-header { margin-bottom: 18px; padding-bottom: 16px; }
  .bookshelf-title-group h1 { font-size: 1.35rem; }
  .bookshelf-actions { gap: 5px; }
  .bookshelf-actions .notebook-tool-btn { padding: 7px 8px; font-size: .75rem; }
  .shelf-unit { padding: 15px 12px 0; }
  .shelf-books-row { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px 13px; }
  .book-cover { padding: 17px 13px; }
  .book-title { font-size: 1.05rem; }
  .shelf-plank { margin: 0 -12px; }
  .notebook-backdrop { padding: 16px 11px 32px; }
  .notebook-top-bar { align-items: flex-start; gap: 10px; flex-direction: column; }
  .notebook-book-body { border-radius: 5px; }
  .notebook-page-left, .notebook-page-right { padding: 23px 17px; }
  .notebook-center-seam { display: none; }
  .notebook-spread-outer { max-width: 100%; }
}
/* Lightweight utility compatibility for the copied UI, which has no Tailwind build step. */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.block { display: block; }
.hidden { display: none !important; }
.relative { position: relative; }
.absolute { position: absolute; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.gap-1 { gap: .25rem; }
.gap-1\.5 { gap: .375rem; }
.gap-2 { gap: .5rem; }
.gap-2\.5 { gap: .625rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.grid-cols-2 { grid-template-columns: repeat(2,minmax(0,1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3,minmax(0,1fr)); }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-3 { padding-left: .75rem; padding-right: .75rem; }
.py-1 { padding-top: .25rem; padding-bottom: .25rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.pt-0\.5 { padding-top: .125rem; }
.mt-0\.5 { margin-top: .125rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mb-0\.5 { margin-bottom: .125rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.pb-2 { padding-bottom: .5rem; }
.pb-4 { padding-bottom: 1rem; }
.border { border: 1px solid var(--glass-border); }
.border-b { border-bottom: 1px solid var(--glass-border); }
.border-x { border-left: 1px solid var(--glass-border); border-right: 1px solid var(--glass-border); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: 9999px; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-xs { font-size: .75rem; line-height: 1.35; }
.text-2xl { font-size: 1.5rem; line-height: 1.2; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.tracking-tight { letter-spacing: -.02em; }
.leading-none { line-height: 1; }
.bg-bg-secondary\/80 { background-color: #F6F8FB; }
.bg-glass-highlight\/70 { background-color: #F2F5F9; }
.text-success { color: var(--pobi-green); }
.text-pobi-blue { color: var(--pobi-blue); }
.bg-success { background-color: var(--pobi-green); }
.bg-pobi-blue { background-color: var(--pobi-blue); }
@media (min-width: 769px) {
  .notebook-book-body > .w-full.md\:hidden { display: none !important; }
}
.notebook-spread-outer { display: block; padding-bottom: 50px; }
.notebook-book-body { width: 100%; }
.notebook-outer-tabs { position: absolute; right: 10px; bottom: 0; flex-direction: row; gap: 7px; margin: 0; padding: 0; }
.notebook-tab-item { border: 1px solid var(--glass-border); border-radius: 5px; padding: 7px 11px; font-size: .78rem; }
.notebook-tab-item.active { transform: none; }
@media (max-width: 768px) {
  .notebook-spread-outer { display: flex; padding-bottom: 0; }
  .notebook-outer-tabs { position: static; margin-bottom: 11px; }
}
@media (min-width: 769px) {
  .notebook-page-left.md\\:flex,
  .notebook-page-left.block,
  .notebook-page-right.md\\:flex,
  .notebook-page-right.block { display: flex !important; }
}
@media (min-width: 769px) {
  .notebook-page-left[class~="md:flex"],
  .notebook-page-left.block,
  .notebook-page-right[class~="md:flex"],
  .notebook-page-right.block { display: flex !important; }
}
.w-3 { width: .75rem; }
.h-3 { height: .75rem; }
.w-3\.5 { width: .875rem; }
.h-3\.5 { height: .875rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-7 { width: 1.75rem; }
.h-7 { height: 1.75rem; }
.text-white { color: #fff !important; }
.notebook-top-bar .notebook-tool-btn.bg-pobi-blue { color: #fff !important; background: var(--pobi-blue) !important; border-color: var(--pobi-blue) !important; }
.bookshelf-actions button[title="切換至傳統後台模式"] { display: none !important; }
/* Editorial polish and responsive hierarchy. */
.bookshelf-header { margin-bottom: 24px; }
.bookshelf-title-group h1 { font-family: 'Noto Serif TC', 'Songti TC', Georgia, serif; font-weight: 650; }
.bookshelf-stage { gap: 18px; }
.shelf-unit { padding: 17px 17px 0; }
.shelf-books-row { grid-template-columns: repeat(auto-fit,minmax(145px,1fr)); gap: 16px; }
.book-cover { aspect-ratio: 1 / 1.24; padding: 17px 14px; }
.book-item-wrapper:hover .book-cover { transform: translateY(-2px); }
.book-cover::before { border-color: rgba(255,255,255,.23); }
.book-ribbon, .book-corner-brass { opacity: .28; }
.book-title { font-family: 'Noto Serif TC', 'Songti TC', Georgia, serif; font-size: 1.17rem; }
.book-progress-bar { background: rgba(255,255,255,.88) !important; }
.shelf-plank { margin-left: -17px; margin-right: -17px; }
html:not([data-theme="dark"]) .dashboard-snapshot { display: grid; grid-template-columns: 1.25fr repeat(3,1fr); gap: 20px; align-items: center; padding: 19px 24px; border: 1px solid var(--glass-border); border-radius: 7px; background: #fff; box-shadow: 0 3px 12px rgba(60,40,20,.035); }
html[data-theme="dark"] .dashboard-snapshot,
html.dark .dashboard-snapshot { display: grid; grid-template-columns: 1.25fr repeat(3,1fr); gap: 20px; align-items: center; padding: 19px 24px; border: 1px solid #232D3F; border-radius: 7px; background: #111827 !important; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.dashboard-snapshot-heading { border-right: 1px solid var(--glass-border); }
.dashboard-snapshot-heading .eyebrow { color: var(--pobi-green); font-size: 10px; letter-spacing: .14em; }
.dashboard-snapshot-heading h2 { margin: 5px 0 8px; color: var(--pobi-blue); font: 600 20px/1.25 'Noto Serif TC','Songti TC',Georgia,serif; }
.dashboard-snapshot-link { border: 0; background: transparent; padding: 0; color: var(--pobi-green); font-size: 12px; font-weight: 600; }
.dashboard-snapshot-link:hover { color: var(--pobi-blue); }
.dashboard-snapshot-stat { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 3px 8px; }
.dashboard-snapshot-stat > span { color: var(--text-muted); font-size: 12px; }
.dashboard-snapshot-stat strong { grid-column: 2; grid-row: 1 / span 2; color: var(--pobi-blue); font: 600 28px/1 Georgia,serif; }
.dashboard-snapshot-stat small { color: #7A8799; font-size: 10px; }
.notebook-backdrop { background: transparent; padding-top: 16px; }
.notebook-spread-outer { padding-bottom: 32px; }
.notebook-hardcover-edge { inset: -4px; border-radius: 8px; box-shadow: 0 14px 30px rgba(60,40,20,.2); }
.notebook-book-body { min-height: 540px; height: calc(100vh - 160px); max-height: 820px; background: #f5efe4; border-radius: 8px; box-shadow: 0 3px 10px rgba(60,40,20,.08), inset 0 0 0 1px #ded1be; }
.notebook-page-left { padding: 30px 26px 26px 36px !important; display: flex !important; flex-direction: column !important; box-sizing: border-box !important; overflow-y: auto !important; scrollbar-width: thin; }
.notebook-page-right { padding: 30px 36px 26px 26px !important; display: flex !important; flex-direction: column !important; box-sizing: border-box !important; overflow-y: auto !important; scrollbar-width: thin; }
.notebook-page-left > .flex.items-center.justify-between { border-color: #ded1be !important; }
html:not([data-theme="dark"]) .notebook-page-left h2, html:not([data-theme="dark"]) .notebook-page-right h3 { font-family: 'Noto Serif TC','Songti TC',Georgia,serif; color: #1c1917 !important; }
[data-theme="dark"] .notebook-page-left h2, [data-theme="dark"] .notebook-page-right h3 { font-family: 'Noto Serif TC','Songti TC',Georgia,serif; color: #f8fafc !important; }
.notebook-page-left .grid.grid-cols-3 { display: grid !important; grid-template-columns: repeat(3,minmax(0,1fr)) !important; }
.notebook-page-left .rounded-xl { border-radius: 8px; }
html:not([data-theme="dark"]) .notebook-page-left .bg-bg-secondary\/80, html:not([data-theme="dark"]) .notebook-page-left .bg-glass-highlight\/70 { box-shadow: none !important; background-color: rgba(255,253,248,.92) !important; border-color: #dfd4c3 !important; }
[data-theme="dark"] .notebook-page-left .bg-bg-secondary\/80, [data-theme="dark"] .notebook-page-left .bg-glass-highlight\/70 { box-shadow: none !important; background-color: rgba(22, 29, 39, 0.95) !important; border-color: #2e3a4d !important; }
.notebook-page-left .text-amber-500 { color: #8b5a2b !important; }
.notebook-page-left .notebook-study-tip { border-left: 2px solid #8b5a2b; }
html:not([data-theme="dark"]) .notebook-page-right .notebook-tool-btn { padding: 7px 11px; font-size: 12px; font-weight: 600; background: #faf6ee !important; border: 1px solid #dfd4c3 !important; color: #1c1917 !important; }
html:not([data-theme="dark"]) .notebook-page-right .notebook-prompt-btn { border-color: #d97706 !important; color: #1c1917 !important; background: #faf5eb !important; }
html:not([data-theme="dark"]) .notebook-page-right .notebook-prompt-btn:hover { color: #1c1917 !important; background: #fde68a !important; border-color: #b45309 !important; }
[data-theme="dark"] .notebook-page-right .notebook-tool-btn { padding: 7px 11px; font-size: 12px; font-weight: 600; background: #1e293b !important; border: 1px solid #334155 !important; color: #f8fafc !important; }
[data-theme="dark"] .notebook-page-right .notebook-tool-btn:hover { background: #273549 !important; border-color: #f59e0b !important; color: #ffffff !important; }
[data-theme="dark"] .notebook-page-right .notebook-prompt-btn { border-color: #d97706 !important; color: #fbbf24 !important; background: rgba(217,119,6,0.15) !important; }
[data-theme="dark"] .notebook-page-right .notebook-prompt-btn:hover { color: #ffffff !important; background: #d97706 !important; }
.notebook-page-right .border-b { border-color: #ded1be; }
html:not([data-theme="dark"]) .notebook-page-right .rounded-xl.border { border-radius: 8px; box-shadow: none; background: rgba(255,253,248,.92) !important; border-color: #dfd4c3 !important; }
[data-theme="dark"] .notebook-page-right .rounded-xl.border { border-radius: 8px; box-shadow: none; background: rgba(22, 29, 39, 0.95) !important; border-color: #2e3a4d !important; }
.notebook-page-right .rounded-xl.border > .p-3 { min-height: 58px; padding: 12px 16px; gap: 10px; }
html:not([data-theme="dark"]) .notebook-page-right .rounded-xl.border .text-sm.font-bold { display: block; min-width: 0; flex: 1 1 auto; max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #1c1917 !important; }
[data-theme="dark"] .notebook-page-right .rounded-xl.border .text-sm.font-bold { display: block; min-width: 0; flex: 1 1 auto; max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f8fafc !important; }
.notebook-page-right .leader-line { min-width: 10px; border-color: #cbbaa5 !important; }
html:not([data-theme="dark"]) .notebook-page-right .rounded-xl.border button { flex: 0 0 auto; color: #1c1917 !important; }
[data-theme="dark"] .notebook-page-right .rounded-xl.border button { flex: 0 0 auto; color: #f8fafc !important; background: #1e293b !important; border: 1px solid #334155 !important; }
.notebook-directory-note { margin-top: auto; padding: 14px 15px 13px; border-left: 2px solid #8b5a2b; background: #faf5eb; }
.notebook-directory-note-label { color: #8b5a2b; font-size: 9px; font-weight: 700; letter-spacing: .15em; }
.notebook-directory-note p { margin: 5px 0 0; max-width: 390px; color: #5a4a3b; font-size: 11px; line-height: 1.7; }
.notebook-outer-tabs { right: 6px; }
.notebook-tab-item { padding: 6px 10px; font-size: 11px; }
@media (max-width: 1100px) and (min-width: 769px) {
  .shelf-books-row { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; }
  .book-cover { aspect-ratio: 1 / 1.22; padding: 14px 11px; }
  .book-title { font-size: 1.02rem; }
  .book-series-tag { font-size: 9px; }
  .dashboard-snapshot { gap: 13px; padding: 16px; }
  .dashboard-snapshot-stat small { font-size: 9px; }
  .notebook-page-left { padding-left: 24px !important; padding-right: 18px !important; }
  .notebook-page-right { padding-left: 18px !important; padding-right: 24px !important; }
}
@media (max-width: 768px) {
  .shelf-books-row { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
  .book-cover { aspect-ratio: 1 / 1.25; }
  .dashboard-snapshot { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; padding: 15px; }
  .dashboard-snapshot-heading { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--glass-border); padding-bottom: 11px; }
  .dashboard-snapshot-heading h2 { margin-bottom: 4px; }
  .dashboard-snapshot-stat { grid-template-columns: 1fr; gap: 3px; }
  .dashboard-snapshot-stat strong { grid-column: auto; grid-row: auto; font-size: 24px; }
  .notebook-directory-note { margin-top: 18px; }
}

/* POBI STUDIO Header & Navigation Styles */
.pobi-navbar {
  min-height: calc(66px + var(--top-navbar-padding-top, env(safe-area-inset-top, 0px)));
  padding-top: var(--top-navbar-padding-top, env(safe-area-inset-top, 0px));
  padding-left: max(3vw, 24px);
  padding-right: max(3vw, 24px);
  background: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--glass-border) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(60, 40, 20, 0.04);
}

.pobi-wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.pobi-brand-symbol {
  width: 36px;
  height: 36px;
  background: var(--pobi-blue);
  color: #ffffff;
  display: grid;
  place-items: center;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(60, 40, 20, 0.2);
}

.pobi-brand-symbol svg {
  color: #ffffff !important;
}

.pobi-wordmark-text {
  display: flex;
  flex-direction: column;
}

.pobi-wordmark-title {
  font-family: 'DM Sans', 'Noto Serif TC', serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--pobi-blue);
  line-height: 1.15;
}

.pobi-wordmark-sub {
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

.pobi-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.pobi-nav-item {
  height: 42px;
  padding: 0 14px;
  background: transparent;
  border: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  cursor: pointer;
}

.pobi-nav-item:hover {
  color: var(--pobi-blue);
  background: rgba(139, 90, 43, 0.06);
}

.pobi-nav-item.active {
  color: var(--pobi-blue);
  font-weight: 650;
  background: rgba(139, 90, 43, 0.1);
}

.pobi-nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 12px;
  right: 12px;
  height: 2.5px;
  background: var(--pobi-green);
  border-radius: 2px;
}

.pobi-account-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pobi-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  background: var(--pobi-surface);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--pobi-blue);
}

.pobi-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--pobi-blue);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.pobi-icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.pobi-icon-btn:hover {
  background: var(--pobi-surface);
  color: var(--pobi-blue);
  border-color: rgba(139, 90, 43, 0.25);
}

/* Image Upload & Lightbox Styling */
.pobi-image-preview-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.pobi-image-thumb-box {
  position: relative;
  width: 100px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--pobi-surface);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(60, 40, 20, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pobi-image-thumb-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(60, 40, 20, 0.12);
}

.pobi-image-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pobi-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.78);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 1000;
  cursor: zoom-out;
}

.pobi-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 88vh;
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pobi-lightbox-content img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.pobi-lightbox-close {
  position: absolute;
  top: -42px;
  right: 0;
  background: rgba(255, 255, 255, 0.18);
  border: 0;
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pobi-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

@media (max-width: 900px) {
  .pobi-navbar {
    padding-left: 14px;
    padding-right: 14px;
    flex-wrap: wrap;
    min-height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 10px;
  }
  .pobi-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    gap: 2px;
  }
  .pobi-nav-item {
    font-size: 0.8rem;
    padding: 0 9px;
    height: 34px;
    white-space: nowrap;
  }
}
/* ==========================================================================
   POBI STUDIO: REFINED DIGITAL BINDER SYSTEM (V2.5)
   Design Core: Vintage Kraft Paper, Obsidian Dark Leather, Instant Response
   ========================================================================== */

:root {
  /* Typography */
  --font-serif: 'Noto Serif TC', 'Songti TC', 'Source Han Serif TC', Georgia, serif;
  --font-sans: 'Noto Sans TC', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Surfaces & Paper - Material 1: Classic Vintage Kraft (Default Light) */
  --desk-bg: #eae3d6;
  --desk-pattern: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.45) 0%, rgba(220, 210, 195, 0.5) 100%);
  --binder-surface: #f7f2e7;
  --binder-paper: #faf6ee;
  --binder-paper-border: #d9cfbe;
  
  /* Harmonized Warm Kraft Spine */
  --binder-spine-bg: #ede4d5;
  --binder-spine-border: #d9cdbe;
  --binder-spine-text: #2f251c;
  --binder-spine-text-muted: #7a6c5d;
  --binder-spine-hover: #e2d7c5;
  --binder-spine-active: #d6caa140;
  --binder-spine-active-pill: #d8cdbe;
  --binder-rings: #8a7c6f;
  --binder-stitch: rgba(140, 110, 80, 0.25);
  
  --binder-text-title: #231c16;
  --binder-text-body: #342d26;
  --binder-text-muted: #6e6459;
  
  --binder-accent: #8b5a2b;
  --binder-accent-soft: rgba(139, 90, 43, 0.1);
  --binder-accent-border: rgba(139, 90, 43, 0.25);
  
  --binder-shadow-desk: 0 10px 30px rgba(60, 45, 30, 0.12), 0 2px 8px rgba(60, 45, 30, 0.06);
  --binder-shadow-page: 0 4px 18px rgba(50, 40, 30, 0.08), inset 0 0 40px rgba(180, 150, 110, 0.06);
  --binder-tab-radius: 6px 12px 12px 6px;
}

[data-theme="dark"] {
  /* Surfaces & Paper - Material 4: Obsidian Dark Leather (Night Mode) */
  --desk-bg: #0d1117;
  --desk-pattern: radial-gradient(circle at 50% 30%, rgba(30, 38, 50, 0.3) 0%, rgba(10, 14, 20, 0.8) 100%);
  --binder-surface: #161b22;
  --binder-paper: #1c212a;
  --binder-paper-border: #2d3545;

  /* Harmonized Obsidian Dark Spine */
  --binder-spine-bg: #121720;
  --binder-spine-border: #232c3b;
  --binder-spine-text: #f1f5f9;
  --binder-spine-text-muted: #cbd5e1;
  --binder-spine-hover: #1c2433;
  --binder-spine-active: #253043;
  --binder-spine-active-pill: #283347;
  --binder-rings: #484f58;
  --binder-stitch: rgba(255, 255, 255, 0.1);

  --binder-text-title: #ffffff;
  --binder-text-body: #f1f5f9;
  --binder-text-muted: #cbd5e1;

  --binder-accent: #58a6ff;
  --binder-accent-soft: rgba(88, 166, 255, 0.12);
  --binder-accent-border: rgba(88, 166, 255, 0.3);

  --binder-shadow-desk: 0 12px 35px rgba(0, 0, 0, 0.5);
  --binder-shadow-page: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 0 40px rgba(0, 0, 0, 0.3);
}

/* Typography Utility Classes */
.font-binder-title {
  font-family: var(--font-serif) !important;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.font-binder-body {
  font-family: var(--font-sans) !important;
}

/* App Outer Shell */
.binder-app-shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--desk-bg);
  background-image: var(--desk-pattern);
  color: var(--binder-text-body);
  font-family: var(--font-sans);
}

/* Left Spine Navigation (書脊導航列) */
.binder-spine-nav {
  background-color: var(--binder-spine-bg);
  color: var(--binder-spine-text);
  border-right: 1px solid var(--binder-spine-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 190px;
  min-width: 190px;
  flex-shrink: 0;
  z-index: 40;
  position: relative;
  user-select: none;
  box-shadow: 2px 0 8px rgba(60, 45, 30, 0.04);
}

.binder-spine-nav.sidebar-collapsed {
  width: 54px !important;
  min-width: 54px !important;
}

/* Brand Spine Header */
.binder-spine-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--binder-spine-text);
  cursor: pointer;
  text-align: left;
}

.binder-spine-brand:hover {
  opacity: 0.9;
}

.binder-spine-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--binder-accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(80, 50, 20, 0.2);
}

.binder-spine-brand-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--binder-spine-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.binder-spine-brand-sub {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--binder-spine-text-muted);
  display: block;
}

/* Navigation Menu Items */
.binder-nav-list {
  padding: 6px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.binder-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px !important;
  min-height: 33px !important;
  height: 33px !important;
  border-radius: 6px;
  color: var(--binder-spine-text);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  width: 100%;
  position: relative;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.binder-nav-item::after {
  display: none !important;
}

.binder-nav-item:hover {
  background: var(--binder-spine-hover);
  color: var(--binder-spine-text);
}

html:not([data-theme="dark"]) .binder-nav-item.active {
  background: #ded1be !important;
  color: #2b1f15 !important;
  font-weight: 700 !important;
  box-shadow: inset 3px 0 0 #8b5a2b !important;
}

html:not([data-theme="dark"]) .binder-nav-item.active .binder-nav-icon {
  color: #8b5a2b !important;
}

.binder-spine-nav.sidebar-collapsed .binder-nav-item.active {
  box-shadow: none !important;
  border-radius: 6px;
}

[data-theme="dark"] .binder-nav-item.active {
  background: #253043 !important;
  box-shadow: inset 3px 0 0 var(--binder-accent) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

[data-theme="dark"] .binder-nav-item.active .binder-nav-icon {
  color: #58a6ff !important;
}

.binder-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
}

/* Bottom User & System Tools on Spine */
.binder-spine-footer {
  padding: 8px 6px 10px 6px;
  border-top: 1px solid var(--binder-spine-border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.binder-spine-user-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--binder-spine-hover);
  color: var(--binder-spine-text);
  font-size: 0.78rem;
}

.binder-spine-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--binder-accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* Main Content Stage */
.binder-main-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  position: relative;
}

/* Top Header Bar */
.binder-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  min-height: 54px;
  border-bottom: 1px solid var(--binder-paper-border);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 20;
}

[data-theme="dark"] .binder-top-bar {
  background: rgba(22, 27, 34, 0.6);
  border-bottom: 1px solid var(--binder-paper-border);
}

.binder-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--binder-text-muted);
}

.binder-breadcrumb-item.active {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--binder-text-title);
  font-size: 1rem;
}

/* Binder Main Paper Container */
.binder-stage-container {
  flex: 1;
  padding: 24px 32px 48px 32px;
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .binder-spine-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    min-width: 100% !important;
    height: 56px;
    flex-direction: row;
    z-index: 50;
    border-right: none;
    border-top: 1px solid rgba(0, 0, 0, 0.2);
  }
  .binder-spine-brand,
  .binder-spine-footer {
    display: none;
  }
  .binder-nav-list {
    flex-direction: row;
    justify-content: space-around;
    padding: 4px;
    width: 100%;
  }
  .binder-nav-item {
    flex-direction: column;
    gap: 2px;
    font-size: 0.68rem;
    padding: 6px 4px;
    align-items: center;
    justify-content: center;
  }
  .binder-stage-container {
    padding: 16px 12px 72px 12px;
  }
}


/* ==========================================================================
   AUTHENTIC VINTAGE KRAFT PAPER & NOTEBOOK INNER SPREAD STYLING
   ========================================================================== */

:root {
  --notebook-paper: #f5efe4 !important;
  --bg-secondary: #fbf7ee !important;
  --notebook-line: rgba(140, 110, 80, 0.08) !important;
}

[data-theme="dark"] {
  --notebook-paper: #191f28 !important;
  --bg-secondary: #212936 !important;
  --notebook-line: rgba(255, 255, 255, 0.04) !important;
}

/* Notebook Book Body */
.notebook-book-body {
  background: var(--notebook-paper, #f5efe4) !important;
  border-radius: 8px !important;
  box-shadow: 0 14px 40px rgba(60, 42, 25, 0.18), 0 2px 8px rgba(60, 42, 25, 0.08) !important;
  border: 1px solid #dcd1be !important;
}

/* Notebook Pages (Left & Right Spread) */
.notebook-page-left,
.notebook-page-right {
  background-color: var(--notebook-paper, #f5efe4) !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.45) 0%, rgba(235, 222, 204, 0.35) 100%),
    linear-gradient(rgba(140, 110, 80, 0.065) 1px, transparent 1px) !important;
  background-size: 100% 100%, 100% 32px !important;
  color: #342d26 !important;
}

[data-theme="dark"] .notebook-page-left,
[data-theme="dark"] .notebook-page-right {
  background-color: #191f28 !important;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) !important;
  background-size: 100% 32px !important;
  color: #c9d1d9 !important;
}

/* Center Seam Gutter & Brass Rings */
.notebook-center-seam {
  width: 32px !important;
  background: linear-gradient(90deg, rgba(60, 40, 20, 0.07), rgba(60, 40, 20, 0.22) 50%, rgba(60, 40, 20, 0.07)) !important;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.15) !important;
}

.binder-ring {
  background: linear-gradient(180deg, #fffcf0 0%, #d4af37 38%, #a48118 72%, #4d3a06 100%) !important;
  box-shadow: 0 2px 4px rgba(40, 25, 10, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.9) !important;
}

.binder-ring::before,
.binder-ring::after {
  background: #3b2a1a !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8) !important;
}

/* Inner Notebook Cards & Summary Boxes */
html:not([data-theme="dark"]) .notebook-page-left .bg-bg-secondary\/80,
html:not([data-theme="dark"]) .notebook-page-left .bg-glass-highlight\/70,
html:not([data-theme="dark"]) .notebook-page-right .bg-bg-secondary,
html:not([data-theme="dark"]) .notebook-page-right .rounded-xl.border {
  background-color: rgba(255, 253, 248, 0.92) !important;
  border: 1px solid #dfd4c3 !important;
  box-shadow: 0 1px 4px rgba(70, 50, 30, 0.04) !important;
  color: #342d26 !important;
}

[data-theme="dark"] .notebook-page-left .bg-bg-secondary\/80,
[data-theme="dark"] .notebook-page-left .bg-glass-highlight\/70,
[data-theme="dark"] .notebook-page-right .bg-bg-secondary,
[data-theme="dark"] .notebook-page-right .rounded-xl.border {
  background-color: rgba(28, 35, 46, 0.92) !important;
  border-color: #2e3a4e !important;
  box-shadow: none !important;
  color: #c9d1d9 !important;
}

/* Notebook Titles */
.notebook-page-left h2,
.notebook-page-right h3 {
  font-family: var(--font-serif) !important;
  color: #231c16 !important;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .notebook-page-left h2,
[data-theme="dark"] .notebook-page-right h3 {
  color: #f0f6fc !important;
}

/* Leather Action Buttons inside Notebook */
html:not([data-theme="dark"]) button.bg-pobi-blue,
html:not([data-theme="dark"]) .notebook-tool-btn.bg-pobi-blue,
html:not([data-theme="dark"]) .notebook-page-right .bg-pobi-blue {
  background-color: #fde68a !important;
  border: 1.5px solid #d97706 !important;
  color: #1c1917 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.2) !important;
}

html:not([data-theme="dark"]) button.bg-pobi-blue:hover,
html:not([data-theme="dark"]) .notebook-tool-btn.bg-pobi-blue:hover,
html:not([data-theme="dark"]) .notebook-page-right .bg-pobi-blue:hover {
  background-color: #fcd34d !important;
  border-color: #b45309 !important;
  color: #1c1917 !important;
}

[data-theme="dark"] button.bg-pobi-blue,
[data-theme="dark"] .notebook-tool-btn.bg-pobi-blue,
[data-theme="dark"] .notebook-page-right .bg-pobi-blue {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  border: 1.5px solid #f59e0b !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35) !important;
}

[data-theme="dark"] button.bg-pobi-blue:hover,
[data-theme="dark"] .notebook-tool-btn.bg-pobi-blue:hover,
[data-theme="dark"] .notebook-page-right .bg-pobi-blue:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  border-color: #fbbf24 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.45) !important;
}

html:not([data-theme="dark"]) .notebook-tool-btn {
  background: #fbf7ee !important;
  color: #4a3c30 !important;
  border: 1px solid #dfd5c4 !important;
}

html:not([data-theme="dark"]) .notebook-tool-btn:hover {
  background: #ede3d3 !important;
  color: #2b221a !important;
  border-color: #cbbba6 !important;
}

/* ==========================================================================
   HIGH CONTRAST DARK MODE TYPOGRAPHY & ELEMENTS (WCAG AAA)
   ========================================================================== */

[data-theme="dark"] {
  --text-primary: #ffffff !important;
  --text-secondary: #f1f5f9 !important;
  --text-muted: #cbd5e1 !important;
  --success: #4ade80 !important;
  --danger: #f87171 !important;
  --warning: #fbbf24 !important;
  --warning-border: #fbbf24 !important;
  --glass-border: #334155 !important;
}

/* Brand Title Contrast (POBI STUDIO 標題淺色模式深色、深色模式純白色字體) */
html:not([data-theme="dark"]) .binder-spine-brand-title {
  color: #231c16 !important;
  -webkit-text-fill-color: #231c16 !important;
}

[data-theme="dark"] .binder-spine-brand-title,
[data-theme="dark"] .navbar-title {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

[data-theme="dark"] .binder-spine-brand-sub {
  color: #cbd5e1 !important;
}

/* Headings & Text Classes */
[data-theme="dark"] .text-text-primary,
[data-theme="dark"] .text-primary,
[data-theme="dark"] .text-text-secondary,
[data-theme="dark"] .text-secondary {
  color: #ffffff !important;
}

[data-theme="dark"] .text-text-muted,
[data-theme="dark"] .text-muted {
  color: #cbd5e1 !important;
}

/* High Contrast Vibrant Metric Numbers */
[data-theme="dark"] .text-success,
[data-theme="dark"] .notebook-page-left .text-success {
  color: #4ade80 !important;
}

[data-theme="dark"] .text-danger,
[data-theme="dark"] .notebook-page-left .text-danger {
  color: #f87171 !important;
}

[data-theme="dark"] .text-warning,
[data-theme="dark"] .text-warning-border,
[data-theme="dark"] .notebook-page-left .text-warning-border,
[data-theme="dark"] .notebook-page-left [class*="text-amber"] {
  color: #fbbf24 !important;
}

[data-theme="dark"] .bg-success,
[data-theme="dark"] .notebook-page-left .bg-success {
  background-color: #22c55e !important;
}

[data-theme="dark"] .bg-danger,
[data-theme="dark"] .notebook-page-left .bg-danger {
  background-color: #ef4444 !important;
}

[data-theme="dark"] .bg-warning,
[data-theme="dark"] .notebook-page-left .bg-warning {
  background-color: #f59e0b !important;
}

[data-theme="dark"] .text-pobi-blue,
[data-theme="dark"] .notebook-page-left .text-pobi-blue {
  color: #60a5fa !important;
}

/* Editorial Badges & Metadata Tags */
[data-theme="dark"] .editorial-badge {
  color: #e2d5c3 !important;
  font-weight: 700 !important;
  letter-spacing: 0.12em !important;
}

[data-theme="dark"] .notebook-page-left .bg-glass-highlight,
[data-theme="dark"] .notebook-page-right .bg-glass-highlight {
  background-color: rgba(255, 255, 255, 0.08) !important;
  border-color: #3b4d66 !important;
  color: #f1f5f9 !important;
}

/* Tool Buttons in Dark Mode */
[data-theme="dark"] .notebook-tool-btn {
  background-color: #1e2633 !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .notebook-tool-btn:hover {
  background-color: #2b3648 !important;
  color: #ffffff !important;
  border-color: #60a5fa !important;
}

/* Primary Action Buttons in Dark Mode (e.g. 建立第一個章節, 新增錯題) - 璀璨琥珀金漸層 */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] button.btn-primary,
[data-theme="dark"] button.bg-pobi-blue,
[data-theme="dark"] .notebook-page-right .btn-primary {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  border: 1.5px solid #f59e0b !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.4) !important;
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] button.btn-primary:hover,
[data-theme="dark"] button.bg-pobi-blue:hover,
[data-theme="dark"] .notebook-page-right .btn-primary:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  border-color: #fbbf24 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5) !important;
}

/* Back Button & Secondary Row Buttons */
[data-theme="dark"] .notebook-breadcrumb-back {
  background-color: #1e2633 !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}

[data-theme="dark"] .notebook-breadcrumb-back:hover {
  background-color: #2b3648 !important;
  color: #ffffff !important;
  border-color: #64748b !important;
}

[data-theme="dark"] button.bg-bg-secondary {
  background-color: #1e2633 !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

[data-theme="dark"] button.bg-bg-secondary:hover {
  background-color: #2b3648 !important;
  color: #ffffff !important;
  border-color: #60a5fa !important;
}

/* Tree Directory & Inner Cards */
[data-theme="dark"] .notebook-page-left .bg-bg-secondary\/80,
[data-theme="dark"] .notebook-page-left .bg-glass-highlight\/70,
[data-theme="dark"] .notebook-page-right .bg-bg-secondary,
[data-theme="dark"] .notebook-page-right .rounded-xl.border {
  background-color: rgba(22, 29, 39, 0.95) !important;
  border-color: #2e3a4d !important;
  color: #f1f5f9 !important;
}

[data-theme="dark"] .leader-line,
[data-theme="dark"] .notebook-page-right .leader-line {
  border-bottom: 1px dotted rgba(255, 255, 255, 0.3) !important;
}

[data-theme="dark"] .border-glass-border {
  border-color: #2e3a4d !important;
}

/* ==========================================================================
   BINDER AUTH DOSSIER (活頁手帳簽到扉頁 / 登入頁面)
   ========================================================================== */

.binder-auth-stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background-color: var(--desk-bg);
  background-image: var(--desk-pattern);
  position: relative;
}

.binder-auth-top-bar {
  position: absolute;
  top: 16px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 20;
}

.binder-auth-theme-btn {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: var(--binder-surface);
  border: 1px solid var(--binder-paper-border);
  color: var(--binder-text-body);
}

.binder-auth-wrapper {
  width: 100%;
  max-width: 460px;
  position: relative;
}

.binder-auth-card {
  position: relative;
  background-color: var(--binder-paper);
  border-radius: 10px;
  border: 1px solid var(--binder-paper-border);
  box-shadow: var(--binder-shadow-desk);
  padding: 36px 32px 28px 32px;
  overflow: hidden;
}

/* 左側活頁夾裝訂邊緣與扣環 */
.binder-auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 18px;
  background: linear-gradient(90deg, rgba(60, 40, 20, 0.08), transparent);
  border-right: 1px dashed var(--binder-stitch);
  pointer-events: none;
}

.binder-auth-rings {
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 28px 0;
  pointer-events: none;
  z-index: 10;
}

.binder-auth-ring-hole {
  width: 10px;
  height: 18px;
  background: linear-gradient(180deg, #fffdf5 0%, #d4af37 40%, #9e7b16 80%, #4a3704 100%);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.binder-auth-header {
  text-align: center;
  margin-bottom: 24px;
  padding-left: 12px;
}

.binder-auth-logo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: var(--binder-accent);
  color: #ffffff;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.binder-auth-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

html:not([data-theme="dark"]) .binder-auth-badge {
  color: #8b5a2b;
}

[data-theme="dark"] .binder-auth-badge {
  color: #e2d5c3;
}

.binder-auth-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  color: var(--binder-text-title);
}

[data-theme="dark"] .binder-auth-title {
  color: #ffffff !important;
}

.binder-auth-subtitle {
  font-size: 0.82rem;
  color: var(--binder-text-muted);
}

/* 輸入框組件 */
.binder-auth-input-group {
  margin-bottom: 18px;
  padding-left: 12px;
}

.binder-auth-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--binder-text-body);
}

.binder-auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.binder-auth-input-icon {
  position: absolute;
  left: 12px;
  color: var(--binder-text-muted);
  pointer-events: none;
}

.binder-auth-input {
  width: 100%;
  height: 42px;
  padding: 8px 12px 8px 38px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

html:not([data-theme="dark"]) .binder-auth-input {
  background-color: #fdfbf7;
  border: 1px solid #d5c8b5;
  color: #2b1f15;
}

html:not([data-theme="dark"]) .binder-auth-input:focus {
  border-color: #8b5a2b;
  box-shadow: 0 0 0 2px rgba(139, 90, 43, 0.15);
}

[data-theme="dark"] .binder-auth-input {
  background-color: #121720;
  border: 1px solid #334155;
  color: #ffffff;
}

[data-theme="dark"] .binder-auth-input:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

/* 登入按鈕 (淺色模式使用淺色按鈕，深色模式高對比) */
.binder-auth-submit-btn {
  width: calc(100% - 12px);
  margin-left: 12px;
  height: 44px;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

html:not([data-theme="dark"]) .binder-auth-submit-btn {
  background-color: #ede4d5 !important;
  border: 1px solid #cbbaa3 !important;
  color: #342211 !important;
  box-shadow: 0 1px 3px rgba(60, 40, 20, 0.08) !important;
}

html:not([data-theme="dark"]) .binder-auth-submit-btn:hover {
  background-color: #dfcfb9 !important;
  border-color: #bda68a !important;
  color: #1c1208 !important;
}

[data-theme="dark"] .binder-auth-submit-btn {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  border: 1.5px solid #f59e0b !important;
  color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.4) !important;
}

[data-theme="dark"] .binder-auth-submit-btn:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  border-color: #fbbf24 !important;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5) !important;
}

/* 訪客體驗按鈕 (淺色模式使用淺色，深色模式暗調) */
.binder-auth-demo-btn {
  width: calc(100% - 12px);
  margin-left: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

html:not([data-theme="dark"]) .binder-auth-demo-btn {
  background-color: #f7f2e8 !important;
  border: 1px solid #dcd1be !important;
  color: #4a3c30 !important;
}

html:not([data-theme="dark"]) .binder-auth-demo-btn:hover {
  background-color: #ede3d3 !important;
  color: #2b1f15 !important;
  border-color: #cbbaa3 !important;
}

[data-theme="dark"] .binder-auth-demo-btn {
  background-color: #1e2633 !important;
  border: 1px solid #334155 !important;
  color: #cbd5e1 !important;
}

[data-theme="dark"] .binder-auth-demo-btn:hover {
  background-color: #283447 !important;
  color: #ffffff !important;
  border-color: #60a5fa !important;
}

/* ==========================================================================
   PHASE 2: BINDER MISTAKE CARD & SELF-TESTING MODE (活頁錯題卡與主動自測模式)
   ========================================================================== */

/* 頂部章節活頁標籤橫向滑軌 (Binder Index Tabs) */
.binder-index-tabs-rail {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 4px 10px 4px;
  margin-bottom: 12px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  min-height: 48px;
  box-sizing: border-box;
}

.binder-index-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.85rem;
  line-height: 1.4;
  font-weight: 600;
  border-radius: 6px 12px 12px 6px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

html:not([data-theme="dark"]) .binder-index-tab {
  background: #f0e6d6;
  border: 1px solid #dcd1bf;
  color: #4a3c30;
}

html:not([data-theme="dark"]) .binder-index-tab:hover {
  background: #e6dac6;
  color: #2b1f15;
}

html:not([data-theme="dark"]) .binder-index-tab.active {
  background: #fde68a !important;
  border-color: #d97706 !important;
  color: #1c1917 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.22) !important;
}

[data-theme="dark"] .binder-index-tab {
  background: #1c2433;
  border: 1px solid #2e3a4e;
  color: #cbd5e1;
}

[data-theme="dark"] .binder-index-tab:hover {
  background: #253043;
  color: #ffffff;
}

[data-theme="dark"] .binder-index-tab.active {
  background: #2563eb !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

/* 錯題卡片容器 (Binder Card) */
.binder-mistake-card {
  position: relative;
  border-radius: 8px;
  padding: 18px 20px 16px 20px;
  background-color: var(--binder-paper);
  border: 1px solid var(--binder-paper-border);
  box-shadow: 0 2px 8px rgba(50, 40, 30, 0.04);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.binder-mistake-card.selected {
  border-color: var(--binder-accent) !important;
  box-shadow: 0 0 0 1px var(--binder-accent), 0 3px 12px rgba(0, 0, 0, 0.08) !important;
}

/* 卡片左側打孔裝訂指示 */
.binder-mistake-card::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 6px;
  bottom: 10px;
  width: 4px;
  border-left: 2px dotted var(--binder-stitch);
  pointer-events: none;
}

/* 標籤膠囊 (Pill Tag) */
.binder-pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

/* 掌握度一鍵循環切換按鈕 - 依使用者要求文字全數強制使用高對比純黑色 */
.binder-fam-cycle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.15s;
  color: #000000 !important;
}

.binder-fam-cycle-btn:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.binder-fam-cycle-btn.fam-success {
  background: #bbf7d0 !important;
  border-color: #86efac !important;
  color: #000000 !important;
}

[data-theme="dark"] .binder-fam-cycle-btn.fam-success {
  background: #86efac !important;
  border-color: #4ade80 !important;
  color: #000000 !important;
}

.binder-fam-cycle-btn.fam-warning {
  background: #fde68a !important;
  border-color: #fcd34d !important;
  color: #000000 !important;
}

[data-theme="dark"] .binder-fam-cycle-btn.fam-warning {
  background: #fde68a !important;
  border-color: #fbbf24 !important;
  color: #000000 !important;
}

.binder-fam-cycle-btn.fam-danger {
  background: #fecaca !important;
  border-color: #fca5a5 !important;
  color: #000000 !important;
}

[data-theme="dark"] .binder-fam-cycle-btn.fam-danger {
  background: #fca5a5 !important;
  border-color: #f87171 !important;
  color: #000000 !important;
}

/* 全域掌握度標籤與按鈕文字一律黑色 */
.fam-chip,
.badge-familiarity,
.mastery-text-black,
.binder-mastery-badge {
  color: #000000 !important;
  font-weight: 700 !important;
}

/* 主動回想拉開解析條 (Self-Testing Reveal Bar) */
.binder-reveal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s;
}

html:not([data-theme="dark"]) .binder-reveal-bar {
  background: #f2ece0;
  border: 1px solid #dcd1bf;
  color: #5a493a;
}

html:not([data-theme="dark"]) .binder-reveal-bar:hover {
  background: #eadecd;
  color: #2b1f15;
}

html:not([data-theme="dark"]) .binder-reveal-bar.is-expanded {
  background: #ede3d3;
  border-color: #cbbaa3;
  color: #8b5a2b;
}

[data-theme="dark"] .binder-reveal-bar {
  background: #18202c;
  border: 1px solid #2e3a4e;
  color: #cbd5e1;
}

[data-theme="dark"] .binder-reveal-bar:hover {
  background: #202b3b;
  color: #ffffff;
}

[data-theme="dark"] .binder-reveal-bar.is-expanded {
  background: #202b3b;
  border-color: #3b82f6;
  color: #60a5fa;
}

/* 詳解答案展開區塊 (Answer & Solution Block) */
.binder-answer-dossier {
  border-radius: 6px;
  padding: 12px 14px;
  border-top: none;
}

html:not([data-theme="dark"]) .binder-answer-dossier {
  background: rgba(255, 253, 248, 0.95);
  border: 1px dashed #dcd1be;
}

[data-theme="dark"] .binder-answer-dossier {
  background: rgba(18, 24, 34, 0.95);
  border: 1px dashed #2e3a4e;
}

/* ==========================================================================
   IN-NOTEBOOK EDITOR & FULL IMAGE VIEWER (書本內新增與完整圖文檢視)
   ========================================================================== */

/* 書本內題目卡片完整圖文容器 */
.binder-question-card {
  position: relative;
  background-color: var(--binder-paper);
  border: 1px solid var(--binder-paper-border);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(60, 45, 30, 0.05);
}

.binder-question-card:last-child {
  margin-bottom: 0;
}

/* 題目與詳解圖片完整高畫質展示 (Full-Width High-Res Media) */
.binder-full-image-wrapper {
  position: relative;
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--binder-paper-border);
  background: rgba(0, 0, 0, 0.02);
  cursor: zoom-in;
  display: inline-block;
  max-width: 100%;
}

.binder-full-image {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.binder-image-zoom-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

/* 書本內編輯表單 (In-Book Editor Form) */
.binder-inbook-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.binder-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.binder-form-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--binder-text-body);
}

.binder-form-input,
.binder-form-textarea,
.binder-form-select {
  width: 100%;
  border-radius: 6px;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
}

html:not([data-theme="dark"]) .binder-form-input,
html:not([data-theme="dark"]) .binder-form-textarea,
html:not([data-theme="dark"]) .binder-form-select {
  background: #fdfbf7;
  border: 1px solid #d5c8b5;
  color: #2b1f15;
}

html:not([data-theme="dark"]) .binder-form-input:focus,
html:not([data-theme="dark"]) .binder-form-textarea:focus,
html:not([data-theme="dark"]) .binder-form-select:focus {
  border-color: #8b5a2b;
}

[data-theme="dark"] .binder-form-input,
[data-theme="dark"] .binder-form-textarea,
[data-theme="dark"] .binder-form-select {
  background: #141a24;
  border: 1px solid #2e3a4e;
  color: #ffffff;
}

[data-theme="dark"] .binder-form-input:focus,
[data-theme="dark"] .binder-form-textarea:focus,
[data-theme="dark"] .binder-form-select:focus {
  border-color: #58a6ff;
}

/* 上傳與剪貼簿粘貼區 (Image Upload & Paste Zone) */
.binder-paste-zone {
  border: 1.5px dashed var(--binder-paper-border);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

html:not([data-theme="dark"]) .binder-paste-zone {
  background: #fbf7ef;
}

html:not([data-theme="dark"]) .binder-paste-zone:hover {
  background: #f4ecdf;
  border-color: #8b5a2b;
}

[data-theme="dark"] .binder-paste-zone {
  background: #151c27;
}

[data-theme="dark"] .binder-paste-zone:hover {
  background: #1d2533;
  border-color: #58a6ff;
}

/* 全螢幕相簿燈箱 (Full-Screen Lightbox Modal) */
.binder-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 18, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.binder-lightbox-content {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.binder-lightbox-img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

.binder-lightbox-close-btn {
  position: absolute;
  top: -44px;
  right: 0;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.binder-lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ==========================================================================
   膠帶圖案全部徹底移除 (Remove All Washi Tape Strips)
   ========================================================================== */
.washi-tape-strip,
.washi-tape-amber,
.washi-tape-blue,
.washi-card,
.memo-note {
  position: relative !important;
}

.washi-tape-strip::before,
.washi-tape-amber::before,
.washi-tape-blue::before,
.washi-card::before,
.memo-note::before,
.washi-tape-strip::after,
.washi-tape-amber::after,
.washi-tape-blue::after,
.washi-card::after,
.memo-note::after,
[class*="washi"]::before,
[class*="washi"]::after,
[class*="tape"]::before,
[class*="tape"]::after {
  display: none !important;
  content: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* ==========================================================================
   淺色模式全面禁止白色字體 (Zero White Text in Light Mode Mandate)
   換為顯眼高對比深色字體
   ========================================================================== */
/* ==========================================================================
   LIGHT MODE ZERO-WHITE-TEXT MANDATE (淺色模式嚴格防禦：絕不允許按鈕文字或選取項變白)
   ========================================================================== */
html:not([data-theme="dark"]) button,
html:not([data-theme="dark"]) .btn,
html:not([data-theme="dark"]) .btn-primary,
html:not([data-theme="dark"]) button.btn-primary,
html:not([data-theme="dark"]) .btn-secondary,
html:not([data-theme="dark"]) button.btn-secondary,
html:not([data-theme="dark"]) .notebook-primary-btn,
html:not([data-theme="dark"]) button.bg-pobi-blue,
html:not([data-theme="dark"]) .bg-pobi-blue,
html:not([data-theme="dark"]) .badge,
html:not([data-theme="dark"]) .binder-pill-tag,
html:not([data-theme="dark"]) .fam-chip,
html:not([data-theme="dark"]) .mastery-badge,
html:not([data-theme="dark"]) .binder-fam-cycle-btn,
html:not([data-theme="dark"]) .modal-content button,
html:not([data-theme="dark"]) .notebook-tool-btn,
html:not([data-theme="dark"]) .notebook-prompt-btn,
html:not([data-theme="dark"]) .notebook-tab-item,
html:not([data-theme="dark"]) .active,
html:not([data-theme="dark"]) [class*="active"],
html:not([data-theme="dark"]) .selected,
html:not([data-theme="dark"]) [class*="selected"] {
  color: #1C1917 !important; /* 顯眼高對比深墨黑，確保在任何淺金、米黃背景皆清晰可見 */
}

html:not([data-theme="dark"]) button svg,
html:not([data-theme="dark"]) .btn svg,
html:not([data-theme="dark"]) .active svg,
html:not([data-theme="dark"]) [class*="active"] svg {
  color: inherit !important;
  stroke: currentColor !important;
}

/* 淺色模式下主要按鈕背景配色 - 溫潤琥珀暖金搭配深色邊框，字體黑亮醒目 */
html:not([data-theme="dark"]) .btn-primary,
html:not([data-theme="dark"]) button.btn-primary,
html:not([data-theme="dark"]) .notebook-primary-btn {
  background: #fde68a !important;
  border: 1.5px solid #d97706 !important;
  color: #1c1917 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.2) !important;
}

html:not([data-theme="dark"]) .btn-primary:hover,
html:not([data-theme="dark"]) button.btn-primary:hover,
html:not([data-theme="dark"]) .notebook-primary-btn:hover {
  background: #fcd34d !important;
  border-color: #b45309 !important;
  color: #000000 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(217, 119, 6, 0.3) !important;
}

/* 淺色模式下次要/工具按鈕背景與文字 */
html:not([data-theme="dark"]) .btn-secondary,
html:not([data-theme="dark"]) button.btn-secondary,
html:not([data-theme="dark"]) .notebook-tool-btn {
  background: #fdfbf7 !important;
  border: 1.5px solid #d6cfc7 !important;
  color: #1c1917 !important;
  font-weight: 600 !important;
}

html:not([data-theme="dark"]) .btn-secondary:hover,
html:not([data-theme="dark"]) button.btn-secondary:hover,
html:not([data-theme="dark"]) .notebook-tool-btn:hover {
  background: #f5eee6 !important;
  border-color: #b5a99c !important;
  color: #000000 !important;
}

/* 淺色模式標籤全面高對比深色 */
html:not([data-theme="dark"]) .binder-pill-tag,
html:not([data-theme="dark"]) .badge,
html:not([data-theme="dark"]) .binder-mastery-badge {
  color: #1c1917 !important;
  font-weight: 650 !important;
}

/* 圖片操作工具列與紅筆標註按鈕 */
.binder-full-image-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--bg-secondary);
}

.binder-full-image {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  display: block;
}

.binder-image-action-bar {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.binder-image-annotate-btn,
.binder-image-zoom-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 650;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.15);
  transition: all 0.15s;
  backdrop-filter: blur(4px);
  user-select: none;
}

.binder-image-annotate-btn {
  background: rgba(254, 226, 226, 0.95) !important;
  color: #991b1b !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

.binder-image-annotate-btn:hover {
  background: #fee2e2 !important;
  color: #7f1d1d !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(185, 28, 28, 0.25);
}

.binder-image-zoom-btn {
  background: rgba(255, 255, 255, 0.9) !important;
  color: #1c1917 !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
}

.binder-image-zoom-btn:hover {
  background: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   TABLET & MOBILE RESPONSIVE ENHANCEMENTS (平版與行動端自適應優化)
   ========================================================================== */

/* 1. Tablet & Responsive Breakpoints (< 992px) */
.notebook-tablet-toggle-container {
  display: none;
}

@media (max-width: 992px) {
  .notebook-tablet-toggle-container {
    display: block !important;
  }

  .notebook-book-body {
    flex-direction: column !important;
    min-height: auto !important;
    border-radius: 6px !important;
  }

  .notebook-center-seam {
    display: none !important;
  }

  .notebook-spread-outer {
    max-width: 100% !important;
    padding-bottom: 20px !important;
  }

  /* Show page switcher tabs on tablet portrait & mobile */
  .notebook-book-body > .notebook-tablet-toggle-container {
    display: block !important;
  }

  .notebook-mobile-toggle {
    display: flex !important;
    background: rgba(139, 90, 43, 0.08) !important;
    padding: 4px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(139, 90, 43, 0.2) !important;
    gap: 6px !important;
    margin-bottom: 8px !important;
  }

  .notebook-mobile-toggle-btn {
    flex: 1 !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    border: none !important;
    cursor: pointer !important;
    background: transparent !important;
    color: var(--text-secondary, #4a3c30) !important;
    transition: all 0.15s ease !important;
  }

  .notebook-mobile-toggle-btn.active {
    background: #fde68a !important;
    border: 1px solid #d97706 !important;
    color: #1c1917 !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25) !important;
  }

  /* Ensure single page takes 100% width on tablet portrait and only the active one displays */
  .notebook-book-body .notebook-page-left:not(.tablet-page-active),
  .notebook-book-body .notebook-page-right:not(.tablet-page-active) {
    display: none !important;
  }

  .notebook-book-body .notebook-page-left.tablet-page-active,
  .notebook-book-body .notebook-page-right.tablet-page-active {
    display: flex !important;
    width: 100% !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
    padding: 24px 20px !important;
  }

  /* Responsive action buttons for images */
  .binder-image-action-bar {
    opacity: 1 !important;
    visibility: visible !important;
  }

  .binder-image-annotate-btn,
  .binder-image-zoom-btn {
    padding: 7px 12px !important;
    font-size: 0.82rem !important;
    min-height: 36px !important;
  }
}

/* 2. Compact Touch Devices & Mobile (< 640px) */
@media (max-width: 640px) {
  .binder-spine-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    height: 58px !important;
    z-index: 9999 !important;
    border-top: 1.5px solid var(--glass-border) !important;
    border-right: none !important;
    background: var(--binder-spine-bg) !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    padding: 4px 6px !important;
  }

  .binder-stage-container {
    padding: 12px 10px 76px 10px !important;
  }

  .notebook-page-left,
  .notebook-page-right {
    padding: 16px 12px !important;
  }

  /* Mobile PDF sheet padding */
  #print-sheet-preview {
    padding: 24px 16px !important;
  }

  /* Mobile Annotator full viewport */
  .image-annotator-overlay {
    padding: 0 !important;
  }

  .image-annotator-overlay > div {
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }
}

/* 3. Touch Screen & Stylus / Apple Pencil Support */
@media (pointer: coarse) {
  .binder-image-action-bar {
    opacity: 1 !important;
  }

  button, 
  .notebook-tool-btn, 
  .notebook-primary-btn {
    touch-action: manipulation;
  }
}

/* ========================================================
   實體試卷列印工坊按鈕樣式 (徹底移除深棕色，改用溫潤琥珀金與現代夜空藍)
   ======================================================== */
.export-opt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  background: #ffffff;
  border: 1.5px solid #d4c9ba;
  color: #4b5563;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.export-opt-btn:hover {
  background: #fdfbf7;
  border-color: #b45309;
  color: #1c1917;
  transform: translateY(-1px);
}

.export-opt-btn.active {
  background: #fde68a !important;
  border: 1.5px solid #d97706 !important;
  color: #1c1917 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25) !important;
}

.export-check-icon {
  color: #b45309 !important;
}

.export-active-settings-bar {
  background: #fdfbf7 !important;
  border: 1.5px solid #e2d9cc !important;
  color: #4b5563 !important;
}

.export-settings-label {
  color: #78350f !important;
}

.export-settings-tag {
  background: #fef3c7 !important;
  border: 1px solid #d97706 !important;
  color: #78350f !important;
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.78rem;
}

/* 深色模式下的列印工坊按鈕 */
[data-theme="dark"] .export-opt-btn {
  background: #1e293b !important;
  border: 1.5px solid #334155 !important;
  color: #cbd5e1 !important;
  box-shadow: none !important;
}

[data-theme="dark"] .export-opt-btn:hover {
  background: #24344d !important;
  border-color: #f59e0b !important;
  color: #ffffff !important;
}

[data-theme="dark"] .export-opt-btn.active {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  border: 1.5px solid #f59e0b !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.45) !important;
}

[data-theme="dark"] .export-check-icon {
  color: #ffffff !important;
}

[data-theme="dark"] .export-active-settings-bar {
  background: #0f172a !important;
  border: 1.5px solid #1e293b !important;
  color: #94a3b8 !important;
}

[data-theme="dark"] .export-settings-label {
  color: #fbbf24 !important;
}

[data-theme="dark"] .export-settings-tag {
  background: #1e293b !important;
  border: 1px solid #d97706 !important;
  color: #fcd34d !important;
}

/* ========================================================
   深色模式下書架暗夜沉穩氛圍 (曜黑皮革與深邃黑檀木)
   ======================================================== */
[data-theme="dark"] .bookshelf-room {
  background: transparent !important;
}

[data-theme="dark"] .shelf-unit {
  background: linear-gradient(180deg, #131a26, #0d121b) !important;
  border: 1px solid #243044 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .shelf-plank {
  background: linear-gradient(180deg, #2a201a, #1a1410 40%, #0f0c0a) !important;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .shelf-plank::before {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.03)) !important;
}

[data-theme="dark"] .add-book-cover {
  background: #111827 !important;
  border-color: #374151 !important;
  color: #9ca3af !important;
  box-shadow: none !important;
}

[data-theme="dark"] .add-book-cover:hover {
  background: #1f2937 !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
}

[data-theme="dark"] .add-book-icon-circle {
  border-color: #374151 !important;
  color: #f59e0b !important;
}

[data-theme="dark"] .dashboard-snapshot {
  background: #131a26 !important;
  border-color: #243044 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .dashboard-snapshot-stat strong {
  color: #f8fafc !important;
}

[data-theme="dark"] .dashboard-snapshot-stat span {
  color: #94a3b8 !important;
}

[data-theme="dark"] .dashboard-snapshot-heading h2 {
  color: #f8fafc !important;
}

/* ========================================================
   錯題本內頁排版改良 (文字與外框邊界充裕，深色高對比)
   ======================================================== */
.notebook-page-left {
  padding: 32px 28px 28px 38px !important;
}

.notebook-page-right {
  padding: 32px 38px 28px 28px !important;
}

@media (max-width: 900px) {
  .notebook-page-left, .notebook-page-right {
    padding: 24px 20px !important;
  }
}

/* ========================================================
   精裝手帳高質感按鈕與深色模式高對比排版 (Pobi Impeccable Craft)
   ======================================================== */

/* 深色模式手帳文字高對比：徹底解決黑字問題 */
html[data-theme="dark"] .notebook-chapter-title,
html.dark .notebook-chapter-title,
[data-theme="dark"] .notebook-chapter-title {
  color: #F8FAFC !important;
  font-weight: 600 !important;
}

html[data-theme="dark"] .notebook-stat-label,
html.dark .notebook-stat-label,
[data-theme="dark"] .notebook-stat-label {
  color: #F1F5F9 !important;
  font-weight: 600 !important;
}

html[data-theme="dark"] .notebook-stat-pct,
html.dark .notebook-stat-pct,
[data-theme="dark"] .notebook-stat-pct {
  color: #CBD5E1 !important;
}

/* 1. 新增大章節高質感按鈕 */
.notebook-header-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

html:not([data-theme="dark"]) .notebook-header-add-btn {
  background: linear-gradient(180deg, #FDFBF7 0%, #F5EFE6 100%) !important;
  border: 1px solid #D6C8B4 !important;
  color: #45321B !important;
}

html:not([data-theme="dark"]) .notebook-header-add-btn:hover {
  background: linear-gradient(180deg, #FFFFFF 0%, #EDE4D5 100%) !important;
  border-color: #B49A76 !important;
  color: #1F150B !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(70, 50, 30, 0.1) !important;
}

html[data-theme="dark"] .notebook-header-add-btn,
html.dark .notebook-header-add-btn {
  background: linear-gradient(180deg, #1E293B 0%, #151E2E 100%) !important;
  border: 1px solid #3B4D66 !important;
  color: #F1F5F9 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .notebook-header-add-btn:hover,
html.dark .notebook-header-add-btn:hover {
  background: linear-gradient(180deg, #2A384F 0%, #1E293B 100%) !important;
  border-color: #F59E0B !important;
  color: #FFFFFF !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15) !important;
}

/* 2. 瀏覽全部題目膠囊按鈕 */
.notebook-all-mistakes-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

html:not([data-theme="dark"]) .notebook-all-mistakes-btn {
  background: rgba(245, 241, 234, 0.8) !important;
  border: 1px solid #DFD7CA !important;
  color: #5C4835 !important;
}

html:not([data-theme="dark"]) .notebook-all-mistakes-btn:hover {
  background: #EAE3D5 !important;
  border-color: #BFAEA0 !important;
  color: #2D1E10 !important;
}

html[data-theme="dark"] .notebook-all-mistakes-btn,
html.dark .notebook-all-mistakes-btn {
  background: rgba(30, 41, 59, 0.8) !important;
  border: 1px solid #334155 !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .notebook-all-mistakes-btn:hover,
html.dark .notebook-all-mistakes-btn:hover {
  background: rgba(51, 65, 85, 0.9) !important;
  border-color: #475569 !important;
  color: #F8FAFC !important;
}

/* 3. 章節列表「檢視題目」按鈕 */
.notebook-chapter-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

html:not([data-theme="dark"]) .notebook-chapter-action-btn {
  background: #FDFBF7 !important;
  border: 1px solid #D6CBBF !important;
  color: #3C2E1F !important;
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.05);
}

html:not([data-theme="dark"]) .notebook-chapter-action-btn:hover {
  background: #F4ECE0 !important;
  border-color: #BCAE9E !important;
  color: #1A1208 !important;
}

html[data-theme="dark"] .notebook-chapter-action-btn,
html.dark .notebook-chapter-action-btn {
  background: #1E293B !important;
  border: 1px solid #334155 !important;
  color: #F1F5F9 !important;
}

html[data-theme="dark"] .notebook-chapter-action-btn:hover,
html.dark .notebook-chapter-action-btn:hover {
  background: #2D3D54 !important;
  border-color: #475569 !important;
  color: #FFFFFF !important;
}

/* 4. 章節列表「+」新增單元小按鈕 */
.notebook-chapter-plus-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

html:not([data-theme="dark"]) .notebook-chapter-plus-btn {
  background: #F8F4ED !important;
  border: 1px solid #DFD5C7 !important;
  color: #6B553E !important;
}

html:not([data-theme="dark"]) .notebook-chapter-plus-btn:hover {
  background: #EFE8DC !important;
  border-color: #BBAA94 !important;
  color: #261B0E !important;
}

html[data-theme="dark"] .notebook-chapter-plus-btn,
html.dark .notebook-chapter-plus-btn {
  background: #1E293B !important;
  border: 1px solid #334155 !important;
  color: #94A3B8 !important;
}

html[data-theme="dark"] .notebook-chapter-plus-btn:hover,
html.dark .notebook-chapter-plus-btn:hover {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #F8FAFC !important;
}

/* 5. 左頁管理標籤按鈕 */
.notebook-tag-manage-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

html:not([data-theme="dark"]) .notebook-tag-manage-btn {
  background: #FDFBF7 !important;
  border: 1px solid #D6CBBF !important;
  color: #5C4733 !important;
}

html:not([data-theme="dark"]) .notebook-tag-manage-btn:hover {
  background: #F2E9DB !important;
  border-color: #BFAEA0 !important;
  color: #241A0E !important;
}

html[data-theme="dark"] .notebook-tag-manage-btn,
html.dark .notebook-tag-manage-btn {
  background: #1E293B !important;
  border: 1px solid #334155 !important;
  color: #F1F5F9 !important;
}

html[data-theme="dark"] .notebook-tag-manage-btn:hover,
html.dark .notebook-tag-manage-btn:hover {
  background: #2D3D54 !important;
  color: #FFFFFF !important;
}

/* 6. 主要確認按鈕 (notebook-primary-btn) 全局尺寸與深淺色打磨 */
.notebook-primary-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: 42px !important;
  height: auto !important;
  padding: 10px 24px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  border-radius: 9px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

html:not([data-theme="dark"]) .notebook-primary-btn {
  background: linear-gradient(180deg, #FDE68A 0%, #F59E0B 100%) !important;
  border: 1.5px solid #D97706 !important;
  color: #451A03 !important;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25) !important;
}

html:not([data-theme="dark"]) .notebook-primary-btn:hover {
  background: linear-gradient(180deg, #FEF08A 0%, #D97706 100%) !important;
  border-color: #B45309 !important;
  color: #1E0B00 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35) !important;
}

html[data-theme="dark"] .notebook-primary-btn,
html.dark .notebook-primary-btn {
  background: linear-gradient(180deg, #D97706 0%, #B45309 100%) !important;
  border: 1px solid #F59E0B !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.4) !important;
}

html[data-theme="dark"] .notebook-primary-btn:hover,
html.dark .notebook-primary-btn:hover {
  background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%) !important;
  border-color: #FBBF24 !important;
  color: #FFFFFF !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5) !important;
}

.notebook-primary-btn:active {
  transform: translateY(1px) !important;
}

/* 6-1. 新增大章節 / 單元彈窗專屬按鈕與輸入框 */
.notebook-dialog-cancel-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 40px !important;
  min-height: 40px !important;
  min-width: 86px !important;
  padding: 0 20px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
}

html:not([data-theme="dark"]) .notebook-dialog-cancel-btn {
  background: #F4ECE1 !important;
  border: 1px solid #D8CABE !important;
  color: #4A3A2A !important;
}

html:not([data-theme="dark"]) .notebook-dialog-cancel-btn:hover {
  background: #EAE0D3 !important;
  border-color: #BCAE9E !important;
  color: #1F150B !important;
}

html[data-theme="dark"] .notebook-dialog-cancel-btn,
html.dark .notebook-dialog-cancel-btn {
  background: #1E293B !important;
  border: 1px solid #334155 !important;
  color: #E2E8F0 !important;
}

html[data-theme="dark"] .notebook-dialog-cancel-btn:hover,
html.dark .notebook-dialog-cancel-btn:hover {
  background: #2D3D54 !important;
  border-color: #475569 !important;
  color: #FFFFFF !important;
}

.notebook-dialog-submit-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 40px !important;
  min-height: 40px !important;
  min-width: 104px !important;
  padding: 0 24px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
}

html:not([data-theme="dark"]) .notebook-dialog-submit-btn {
  background: linear-gradient(180deg, #FDE68A 0%, #F59E0B 100%) !important;
  border: 1.5px solid #D97706 !important;
  color: #451A03 !important;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25) !important;
}

html:not([data-theme="dark"]) .notebook-dialog-submit-btn:hover {
  background: linear-gradient(180deg, #FEF08A 0%, #D97706 100%) !important;
  border-color: #B45309 !important;
  color: #1E0B00 !important;
  transform: translateY(-1px) !important;
}

html[data-theme="dark"] .notebook-dialog-submit-btn,
html.dark .notebook-dialog-submit-btn {
  background: linear-gradient(180deg, #D97706 0%, #B45309 100%) !important;
  border: 1px solid #F59E0B !important;
  color: #FFFFFF !important;
  box-shadow: 0 3px 10px rgba(180, 83, 9, 0.4) !important;
}

html[data-theme="dark"] .notebook-dialog-submit-btn:hover,
html.dark .notebook-dialog-submit-btn:hover {
  background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%) !important;
  border-color: #FBBF24 !important;
  color: #FFFFFF !important;
  transform: translateY(-1px) !important;
}

.notebook-dialog-input {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  height: 44px !important;
  padding: 10px 14px !important;
  font-size: 15px !important;
  border-radius: 8px !important;
  outline: none !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
}

html:not([data-theme="dark"]) .notebook-dialog-input {
  background: #FFFFFF !important;
  border: 1.5px solid #D6C8B8 !important;
  color: #1C1917 !important;
}

html:not([data-theme="dark"]) .notebook-dialog-input:focus {
  border-color: #D97706 !important;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15) !important;
}

html[data-theme="dark"] .notebook-dialog-input,
html.dark .notebook-dialog-input {
  background: #0F172A !important;
  border: 1.5px solid #334155 !important;
  color: #F8FAFC !important;
}

html[data-theme="dark"] .notebook-dialog-input:focus,
html.dark .notebook-dialog-input:focus {
  border-color: #F59E0B !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25) !important;
}

/* 7. 次要/取消按鈕 (notebook-tool-btn) 全局深色模式 */
html[data-theme="dark"] .notebook-tool-btn,
html.dark .notebook-tool-btn {
  background: #1E293B !important;
  border: 1px solid #334155 !important;
  color: #E2E8F0 !important;
}

html[data-theme="dark"] .notebook-tool-btn:hover,
html.dark .notebook-tool-btn:hover {
  background: #2D3D54 !important;
  border-color: #475569 !important;
  color: #FFFFFF !important;
}

/* 8. 實體 A4 列印工坊在深色模式下文字亮白 */
html[data-theme="dark"] .export-opt-btn,
html.dark .export-opt-btn,
[data-theme="dark"] .export-opt-btn {
  color: #F1F5F9 !important;
}

html[data-theme="dark"] .export-opt-btn.active,
html.dark .export-opt-btn.active,
[data-theme="dark"] .export-opt-btn.active {
  color: #FFFFFF !important;
}

/* ========================================================
   錯題手帳編輯頁高質感按鈕體系 (Familiarity & Tag Pills)
   ======================================================== */

/* 9. 掌握度三級按鈕 (精熟綠、複習黃、加強紅) */
.notebook-fam-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 10px 22px !important;
  min-height: 42px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  white-space: nowrap !important;
}

html:not([data-theme="dark"]) .notebook-fam-btn {
  background: #FDFCFA !important;
  border: 1.5px solid #D6C8B8 !important;
  color: #4A3C30 !important;
  box-shadow: 0 1px 3px rgba(60, 40, 20, 0.05) !important;
}

html:not([data-theme="dark"]) .notebook-fam-btn:hover {
  background: #F5EFE6 !important;
  border-color: #BBAA94 !important;
  color: #1F150B !important;
}

html[data-theme="dark"] .notebook-fam-btn,
html.dark .notebook-fam-btn {
  background: #1E293B !important;
  border: 1.5px solid #334155 !important;
  color: #E2E8F0 !important;
}

html[data-theme="dark"] .notebook-fam-btn:hover,
html.dark .notebook-fam-btn:hover {
  background: #2D3D54 !important;
  border-color: #475569 !important;
  color: #FFFFFF !important;
}

/* 精熟掌握 (綠色系) 選中 */
html:not([data-theme="dark"]) .notebook-fam-btn.selected-mastered {
  background: #ECFDF5 !important;
  border: 2px solid #10B981 !important;
  color: #065F46 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25) !important;
  transform: translateY(-1px) !important;
}

html[data-theme="dark"] .notebook-fam-btn.selected-mastered,
html.dark .notebook-fam-btn.selected-mastered {
  background: rgba(16, 185, 129, 0.22) !important;
  border: 2px solid #34D399 !important;
  color: #6EE7B7 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35) !important;
  transform: translateY(-1px) !important;
}

/* 一般複習 (黃色系) 選中 */
html:not([data-theme="dark"]) .notebook-fam-btn.selected-reviewing {
  background: #FEF3C7 !important;
  border: 2px solid #F59E0B !important;
  color: #92400E !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25) !important;
  transform: translateY(-1px) !important;
}

html[data-theme="dark"] .notebook-fam-btn.selected-reviewing,
html.dark .notebook-fam-btn.selected-reviewing {
  background: rgba(245, 158, 11, 0.22) !important;
  border: 2px solid #FBBF24 !important;
  color: #FDE68A !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35) !important;
  transform: translateY(-1px) !important;
}

/* 重點待加強 (紅色系) 選中 */
html:not([data-theme="dark"]) .notebook-fam-btn.selected-urgent {
  background: #FFE4E6 !important;
  border: 2px solid #F43F5E !important;
  color: #9F1239 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.25) !important;
  transform: translateY(-1px) !important;
}

html[data-theme="dark"] .notebook-fam-btn.selected-urgent,
html.dark .notebook-fam-btn.selected-urgent {
  background: rgba(244, 63, 94, 0.22) !important;
  border: 2px solid #FB7185 !important;
  color: #FECDD3 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(244, 63, 94, 0.35) !important;
  transform: translateY(-1px) !important;
}

/* 10. 錯因標籤 (可多選) 圓角膠囊按鈕 */
.notebook-reason-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 8px 18px !important;
  min-height: 34px !important;
  border-radius: 9999px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
}

html:not([data-theme="dark"]) .notebook-reason-btn {
  background: #F8F4EE !important;
  border: 1px solid #DFD5C7 !important;
  color: #5C4835 !important;
}

html:not([data-theme="dark"]) .notebook-reason-btn:hover {
  background: #EFE8DC !important;
  border-color: #BBAA94 !important;
  color: #261B0E !important;
}

html[data-theme="dark"] .notebook-reason-btn,
html.dark .notebook-reason-btn {
  background: #1E293B !important;
  border: 1px solid #334155 !important;
  color: #CBD5E1 !important;
}

html[data-theme="dark"] .notebook-reason-btn:hover,
html.dark .notebook-reason-btn:hover {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #FFFFFF !important;
}

/* 錯因標籤選中狀態 */
html:not([data-theme="dark"]) .notebook-reason-btn.selected {
  background: #FEF3C7 !important;
  border: 1.5px solid #D97706 !important;
  color: #78350F !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.15) !important;
}

html[data-theme="dark"] .notebook-reason-btn.selected,
html.dark .notebook-reason-btn.selected {
  background: rgba(217, 119, 6, 0.28) !important;
  border: 1.5px solid #F59E0B !important;
  color: #FDE68A !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3) !important;
}

/* 11. 編輯頁底部按鈕 (取消與儲存貼入本手帳) */
.notebook-cancel-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 44px !important;
  padding: 0 24px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

html:not([data-theme="dark"]) .notebook-cancel-btn {
  background: #F8F4EE !important;
  border: 1px solid #D6C8B8 !important;
  color: #5C4835 !important;
}

html:not([data-theme="dark"]) .notebook-cancel-btn:hover {
  background: #EFE8DC !important;
  border-color: #BBAA94 !important;
  color: #261B0E !important;
}

html[data-theme="dark"] .notebook-cancel-btn,
html.dark .notebook-cancel-btn {
  background: #1E293B !important;
  border: 1px solid #334155 !important;
  color: #E2E8F0 !important;
}

html[data-theme="dark"] .notebook-cancel-btn:hover,
html.dark .notebook-cancel-btn:hover {
  background: #2D3D54 !important;
  border-color: #475569 !important;
  color: #FFFFFF !important;
}

.notebook-submit-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  height: 44px !important;
  padding: 0 28px !important;
  border-radius: 10px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

html:not([data-theme="dark"]) .notebook-submit-btn {
  background: linear-gradient(180deg, #FDE68A 0%, #F59E0B 100%) !important;
  border: 1.5px solid #D97706 !important;
  color: #451A03 !important;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25) !important;
}

html:not([data-theme="dark"]) .notebook-submit-btn:hover {
  background: linear-gradient(180deg, #FEF08A 0%, #D97706 100%) !important;
  border-color: #B45309 !important;
  color: #1E0B00 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.35) !important;
}

html[data-theme="dark"] .notebook-submit-btn,
html.dark .notebook-submit-btn {
  background: linear-gradient(180deg, #D97706 0%, #B45309 100%) !important;
  border: 1px solid #F59E0B !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.35) !important;
}

html[data-theme="dark"] .notebook-submit-btn:hover,
html.dark .notebook-submit-btn:hover {
  background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%) !important;
  border-color: #FBBF24 !important;
  color: #FFFFFF !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45) !important;
}

.notebook-submit-btn:active {
  transform: translateY(1px) !important;
}
/* ==========================================================================
   POBINOTES V2: IMPECCABLE DESIGN SYSTEM (BOOKSHELF & OPEN NOTEBOOK)
   Design Tenet: Artisanal Stationery, Debossed Hot-Foil & Authentic Physical Depth
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BOOKSHELF ROOM (實體數位書房)
   -------------------------------------------------------------------------- */
.bookshelf-room {
  width: 100%;
  min-height: calc(100vh - 64px);
  padding: 40px 32px 80px 32px;
  background: radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.6) 0%, transparent 80%), var(--bg-primary);
  display: flex;
  flex-direction: column;
  position: relative;
}

[data-theme="dark"] .bookshelf-room {
  background: radial-gradient(circle at 50% 10%, rgba(30, 41, 59, 0.4) 0%, transparent 80%), var(--bg-primary);
}

.bookshelf-header {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto 44px auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 24px;
}

.bookshelf-title-group h1 {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.bookshelf-title-group p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

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

.bookshelf-stage {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.shelf-unit {
  position: relative;
  padding-bottom: 28px;
}

.shelf-books-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 36px 28px;
  align-items: flex-end;
  padding: 0 20px;
  margin-bottom: -4px;
  z-index: 2;
  position: relative;
}

/* 建築級多層實木層架 (Architectural Solid Wood Shelf Plank) */
.shelf-plank {
  height: 24px;
  background: linear-gradient(180deg, #E6DDD1 0%, #D8CABE 40%, #B8A493 100%);
  border-radius: 4px;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.06),
    0 8px 16px rgba(60, 40, 20, 0.08),
    0 22px 32px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1;
}

.shelf-plank::before {
  /* 層架上方受光倒角斜切面 (Top Bevel Reflection) */
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.2) 100%);
  border-radius: 4px 4px 0 0;
}

.shelf-plank::after {
  /* 書架下緣在牆面投射的自然環境陰影 (Drop Ambient Shadow) */
  content: '';
  position: absolute;
  bottom: -16px;
  left: 12px;
  right: 12px;
  height: 16px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.22) 0%, transparent 75%);
  filter: blur(6px);
  z-index: -1;
}

[data-theme="dark"] .shelf-plank {
  background: linear-gradient(180deg, #334155 0%, #1E293B 40%, #0F172A 100%);
  box-shadow: 
    0 2px 6px rgba(0, 0, 0, 0.3),
    0 12px 24px rgba(0, 0, 0, 0.45),
    0 24px 38px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .shelf-plank::before {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.05) 100%);
}

/* --------------------------------------------------------------------------
   2. ARTISANAL 3D HARDCOVER BOOK (工藝級精裝燙金書封)
   -------------------------------------------------------------------------- */
.book-item-wrapper {
  perspective: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.book-item-wrapper:hover {
  transform: translateY(-10px) rotateY(-4deg) rotateZ(0.5deg);
}

.book-cover {
  width: 100%;
  aspect-ratio: 1 / 1.48;
  border-radius: 4px 10px 10px 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 18px;
  box-shadow:
    -8px 4px 16px -2px rgba(0, 0, 0, 0.42),
    8px 14px 26px rgba(0, 20, 60, 0.22),
    inset 2px 0 3px rgba(255, 255, 255, 0.18),
    inset 0 0 0 1px rgba(0, 0, 0, 0.25);
  transition: box-shadow 0.35s ease, transform 0.35s ease;
  overflow: hidden;
}

.book-item-wrapper:hover .book-cover {
  box-shadow:
    -12px 8px 24px -2px rgba(0, 0, 0, 0.5),
    12px 22px 36px rgba(0, 20, 60, 0.3),
    inset 2px 0 4px rgba(255, 255, 255, 0.25);
}

/* 書脊活頁溝槽 (French Joint / Hinge Crease) */
.book-cover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 18px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.45) 0%,
    rgba(0, 0, 0, 0.18) 40%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(0, 0, 0, 0.35) 60%,
    transparent 100%
  );
  border-right: 1px solid rgba(0, 0, 0, 0.25);
  z-index: 3;
}

/* 右側書頁層疊邊緣厚度 (Fore-edge Paper Depth) */
.book-cover::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 0;
  bottom: 5px;
  width: 6px;
  background: repeating-linear-gradient(
    180deg,
    #FAF6ED,
    #FAF6ED 2px,
    #E2D9CC 2px,
    #E2D9CC 4px
  );
  border-radius: 0 4px 4px 0;
  box-shadow: -1px 0 3px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

/* 絲織書籤絲帶 (Grosgrain Silk Ribbon) */
.book-ribbon {
  position: absolute;
  top: 0;
  right: 26px;
  width: 14px;
  height: 42px;
  box-shadow: 1px 3px 8px rgba(0, 0, 0, 0.45);
  z-index: 4;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  transition: height 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.book-item-wrapper:hover .book-ribbon {
  height: 52px;
}

/* 典藏燙金邊框 (Debossed Hot-Stamp Gold Frame) */
.book-frame {
  position: absolute;
  top: 10px;
  left: 24px;
  right: 12px;
  bottom: 10px;
  border: 1px solid rgba(243, 210, 122, 0.35);
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  z-index: 2;
}

.book-frame-inner {
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border: 1px dashed rgba(243, 210, 122, 0.22);
  border-radius: 2px;
}

/* 金屬黃銅包角 (Brass Corner Bracket) */
.book-corner-brass {
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  z-index: 3;
}

.book-corner-tr {
  top: 2px;
  right: 2px;
  border-top: 2px solid rgba(243, 210, 122, 0.7);
  border-right: 2px solid rgba(243, 210, 122, 0.7);
  border-radius: 0 8px 0 0;
}

.book-corner-br {
  bottom: 2px;
  right: 2px;
  border-bottom: 2px solid rgba(243, 210, 122, 0.7);
  border-right: 2px solid rgba(243, 210, 122, 0.7);
  border-radius: 0 0 8px 0;
}

.book-header {
  position: relative;
  z-index: 4;
  padding-left: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.book-badge-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  box-shadow: 
    inset 0 1px 2px rgba(0, 0, 0, 0.4),
    0 1px 1px rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(243, 210, 122, 0.4);
}

.book-mistake-pill {
  padding: 3px 9px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.32);
  color: #FAF6ED;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.25);
}

.book-body {
  position: relative;
  z-index: 4;
  padding-left: 10px;
  margin-top: auto;
  margin-bottom: auto;
  text-align: center;
}

.book-series-tag {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(243, 210, 122, 0.85);
  font-weight: 600;
  margin-bottom: 4px;
}

.book-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  color: #FAF6ED;
  letter-spacing: 0.06em;
  text-shadow: 
    0 -1px 1px rgba(0, 0, 0, 0.6),
    0 1px 2px rgba(243, 210, 122, 0.35);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

.book-footer {
  position: relative;
  z-index: 4;
  padding-left: 10px;
}

.book-progress-wrapper {
  width: 100%;
}

.book-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.book-progress-track {
  width: 100%;
  height: 5px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.book-progress-bar {
  height: 100%;
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(243, 210, 122, 0.4);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 典藏活頁冊收錄卡片 (Add Book Card - Archive Binder Style) */
.add-book-cover {
  width: 100%;
  aspect-ratio: 1 / 1.48;
  border-radius: 6px 10px 10px 6px;
  border: 1.5px dashed var(--glass-border);
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  position: relative;
}

.add-book-cover:hover {
  border-color: var(--pobi-blue);
  background: var(--glass-highlight);
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.add-book-icon-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.add-book-cover:hover .add-book-icon-circle {
  transform: scale(1.08);
  border-color: var(--pobi-blue);
  color: var(--pobi-blue);
}

.add-book-text {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.add-book-subtext {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   3. OPEN DOUBLE-PAGE NOTEBOOK (工藝級雙頁展開手帳)
   -------------------------------------------------------------------------- */
.notebook-backdrop {
  width: 100%;
  min-height: calc(100vh - 64px);
  background: var(--notebook-desk);
  padding: 28px 24px 64px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.notebook-top-bar {
  max-width: 1340px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 0 8px;
}

.notebook-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.notebook-breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.notebook-breadcrumb-back:hover {
  background: var(--glass-highlight);
  border-color: var(--text-muted);
  transform: translateX(-2px);
}

.notebook-spread-outer {
  max-width: 1340px;
  width: 100%;
  position: relative;
  display: flex;
  align-items: stretch;
}

/* 雙頁活頁手帳本體 */
.notebook-book-body {
  flex: 1;
  min-height: 540px;
  height: calc(100vh - 160px);
  max-height: 780px;
  background: var(--notebook-paper);
  border-radius: 12px;
  box-shadow: 
    0 20px 48px rgba(60, 40, 20, 0.16),
    0 4px 12px rgba(60, 40, 20, 0.08),
    inset 0 0 0 1px rgba(60, 40, 20, 0.08);
  display: flex;
  position: relative;
  overflow: hidden;
}

/* 精裝皮質底殼邊緣 */
.notebook-hardcover-edge {
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 16px;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.28);
  z-index: 0;
}

.notebook-book-body {
  z-index: 1;
}

/* 中間書脊裝訂凹槽與中縫陰影 (Center Gutter) */
.notebook-center-seam {
  width: 38px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.08) 0%,
    rgba(0, 0, 0, 0.18) 45%,
    rgba(0, 0, 0, 0.28) 50%,
    rgba(0, 0, 0, 0.18) 55%,
    rgba(0, 0, 0, 0.08) 100%
  );
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding: 36px 0;
  z-index: 5;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.2);
}

/* 活頁金屬環 (Polished Steel Binder Rings) */
.binder-ring {
  width: 24px;
  height: 8px;
  background: linear-gradient(180deg, #FFFFFF 0%, #CBD5E1 35%, #64748B 70%, #1E293B 100%);
  border-radius: 4px;
  box-shadow: 
    0 2px 5px rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.9);
  position: relative;
}

.binder-ring::before,
.binder-ring::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0F172A;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
  top: 1px;
}

.binder-ring::before { left: -5px; }
.binder-ring::after { right: -5px; }

/* 左頁 (Left Page: Editorial Academic Profile) */
.notebook-page-left {
  flex: 1;
  padding: 40px 42px 44px 48px;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.5), transparent 75%);
  position: relative;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
}

/* 右頁 (Right Page: Syllabus & Directory) */
.notebook-page-right {
  flex: 1;
  padding: 40px 48px 44px 42px;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.5), transparent 75%);
  position: relative;
}

/* 紙張印刷微橫線淡印底紋 (Fine Printed Rules) */
.notebook-page-lined {
  background-image: linear-gradient(var(--notebook-line) 1px, transparent 1px);
  background-size: 100% 32px;
}

/* 出版品風格章節目錄點狀引導線 (Dotted Leader Line) */
.leader-line {
  flex: 1;
  margin: 0 10px;
  border-bottom: 1px dotted var(--text-muted);
  opacity: 0.35;
  height: 0.8em;
}

/* 活頁夾外側實體索引書籤頁籤 (Physical Japanese Index Tabs) */
.notebook-outer-tabs {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-left: 2px;
  padding-top: 48px;
  z-index: 2;
}

.notebook-tab-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px 12px 14px;
  border-radius: 0 10px 10px 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-left: none;
  cursor: pointer;
  box-shadow: 2px 4px 12px rgba(60, 40, 20, 0.08);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  white-space: nowrap;
}

.notebook-tab-item:hover {
  color: var(--text-primary);
  transform: translateX(4px);
  background: var(--glass-highlight);
}

.notebook-tab-item.active {
  color: #1C1917;
  background: #FDE68A;
  border-color: #D97706;
  transform: translateX(8px);
  box-shadow: 4px 6px 16px rgba(180, 83, 9, 0.24);
}

/* --------------------------------------------------------------------------
   4. EDITORIAL STATS & TOOL BUTTONS (精緻出版排印與火漆印章感按鈕)
   -------------------------------------------------------------------------- */
.editorial-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.editorial-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 16px 0;
  width: 100%;
}

.notebook-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: var(--shadow-sm);
}

.notebook-tool-btn:hover {
  background: var(--glass-highlight);
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* 抽屜側滑面板 */
.notebook-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.2s ease;
}

.notebook-sheet-content {
  width: 100%;
  max-width: 580px;
  height: 100%;
  background: var(--bg-secondary);
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInRight 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --------------------------------------------------------------------------
   5. RESPONSIVE DESIGN (多端自適應)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .notebook-book-body {
    min-height: 660px;
  }
  .notebook-page-left,
  .notebook-page-right {
    padding: 28px 24px;
  }
}

@media (max-width: 768px) {
  .bookshelf-room {
    padding: 20px 14px 48px 14px;
  }

  .shelf-books-row {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 24px 16px;
    padding: 0 8px;
  }

  .notebook-spread-outer {
    flex-direction: column;
  }

  .notebook-outer-tabs {
    flex-direction: row;
    overflow-x: auto;
    margin-left: 0;
    margin-bottom: 14px;
    padding-top: 0;
    padding-bottom: 4px;
  }

  .notebook-tab-item {
    border-radius: 8px;
    border-left: 1px solid var(--glass-border);
    padding: 9px 14px;
  }

  .notebook-tab-item.active {
    transform: none;
  }

  .notebook-book-body {
    flex-direction: column;
    min-height: auto;
  }

  .notebook-center-seam {
    display: none;
  }

  .notebook-page-left,
  .notebook-page-right {
    padding: 24px 18px;
    border-right: none;
  }

  .notebook-mobile-toggle {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 18px;
    gap: 4px;
  }

  .notebook-mobile-toggle-btn {
    flex: 1;
    padding: 9px 0;
    font-size: 0.86rem;
    font-weight: 700;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
  }

  .notebook-mobile-toggle-btn.active {
    background: var(--accent-primary);
    color: #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  }
}
