    :root {
      --primary: #0284c7;
      --primary-dark: #0369a1;
      --primary-light: #e0f2fe;
      --success: #10b981;
      --success-light: #ecfdf5;
      --danger: #ef4444;
      --danger-light: #fef2f2;
      --warning: #f59e0b;
      --bg-page: #f8fafc;
      --bg-card: #ffffff;
      --text-main: #0f172a;
      --text-sub: #475569;
      --text-muted: #94a3b8;
      --border-color: #e2e8f0;
      --border-dark: #cbd5e1;
      --radius-sm: 8px;
      --radius-md: 14px;
      --radius-lg: 20px;
      --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
      --shadow-md: 0 4px 12px rgba(0,0,0,0.07);
      --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1);
    }

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

    body {
      font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Hiragino Sans GB", "Microsoft JhengHei", sans-serif;
      background-color: var(--bg-page);
      color: var(--text-main);
      line-height: 1.5;
      display: flex;
      flex-direction: column;
      height: 100vh;
      height: 100dvh;
      overflow: hidden;
      user-select: none;
    }

    /* 頂部導航列 */
    header {
      background: var(--bg-card);
      border-bottom: 1px solid var(--border-color);
      padding: 10px 16px;
      padding-top: calc(10px + env(safe-area-inset-top));
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-shrink: 0;
      z-index: 20;
    }

    .brand-title {
      font-size: 17px;
      font-weight: 800;
      color: var(--text-main);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .brand-badge {
      font-size: 11px;
      font-weight: 700;
      background: var(--primary-light);
      color: var(--primary-dark);
      padding: 2px 7px;
      border-radius: 99px;
    }
    .version-badge {
      font-size: 11px;
      font-weight: 700;
      background: #e2e8f0;
      color: var(--text-sub);
      padding: 2px 7px;
      border-radius: 6px;
      cursor: pointer;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      letter-spacing: 0.3px;
    }
    .version-badge:active {
      transform: scale(0.95);
      background: #cbd5e1;
    }

    /* 快速單章下拉選單 (Quick Dropdown) */
    .quick-dropdown {
      position: absolute;
      top: calc(100% + 8px);
      left: 0;
      background: #ffffff;
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
      min-width: 230px;
      z-index: 100;
      overflow: hidden;
      animation: fadeIn 0.15s ease-out;
    }
    .quick-dropdown-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 14px;
      font-size: 13px;
      font-weight: 600;
      color: var(--text-main);
      cursor: pointer;
      border-bottom: 1px solid #f1f5f9;
      transition: background 0.15s;
    }
    .quick-dropdown-item:last-child {
      border-bottom: none;
    }
    .quick-dropdown-item:hover, .quick-dropdown-item.active {
      background: var(--primary-light);
      color: var(--primary);
    }
    .quick-dropdown-item .item-meta {
      font-size: 11px;
      color: var(--text-muted);
    }

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

    .tool-btn {
      background: transparent;
      border: 1px solid var(--border-color);
      border-radius: var(--radius-sm);
      padding: 5px 9px;
      font-size: 13px;
      color: var(--text-sub);
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 4px;
      transition: all 0.15s;
    }
    .tool-btn:active {
      background: var(--border-color);
      transform: scale(0.96);
    }
    .tool-btn.active {
      background: var(--primary-light);
      border-color: var(--primary);
      color: var(--primary-dark);
    }

    /* 主內容滾動區 */
    main {
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      position: relative;
    }

    .view-container {
      display: none;
      padding: 16px;
      padding-bottom: calc(85px + env(safe-area-inset-bottom));
      max-width: 640px;
      margin: 0 auto;
      min-height: 100%;
    }
    .view-container.active {
      display: block;
      animation: fadeIn 0.2s ease-in-out;
    }

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

    /* 底部標籤導航欄 (iOS Tab Bar 風格) */
    nav.bottom-nav {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(255, 255, 255, 0.95);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-top: 1px solid var(--border-color);
      display: flex;
      justify-content: space-around;
      padding-bottom: env(safe-area-inset-bottom);
      z-index: 30;
    }

    .nav-item {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 8px 0 6px 0;
      background: transparent;
      border: none;
      cursor: pointer;
      color: var(--text-muted);
      transition: all 0.15s;
    }
    .nav-item .icon {
      font-size: 20px;
      margin-bottom: 2px;
      transition: transform 0.2s;
    }
    .nav-item .label {
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.2px;
    }
    .nav-item.active {
      color: var(--primary);
    }
    .nav-item.active .icon {
      transform: scale(1.15);
    }
    .badge-count {
      position: absolute;
      top: 4px;
      right: calc(50% - 20px);
      background: var(--danger);
      color: white;
      font-size: 10px;
      font-weight: 800;
      min-width: 17px;
      height: 17px;
      line-height: 17px;
      border-radius: 99px;
      text-align: center;
      padding: 0 4px;
    }

    /* ======================================================== */
    /* 1. 章節重點筆記 (View 1: Notes)                           */
    /* ======================================================== */
    .note-card {
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      margin-bottom: 14px;
      overflow: hidden;
      box-shadow: var(--shadow-sm);
    }
    .note-card-header {
      padding: 14px 16px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: pointer;
      background: #ffffff;
      border-bottom: 1px solid transparent;
      transition: background 0.15s;
    }
    .note-card.expanded .note-card-header {
      border-bottom-color: var(--border-color);
      background: #fcfdfe;
    }
    .note-card-title {
      font-size: 15px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 8px;
      color: var(--text-main);
    }
    .note-card-chevron {
      font-size: 13px;
      color: var(--text-muted);
      transition: transform 0.25s;
    }
    .note-card.expanded .note-card-chevron {
      transform: rotate(180deg);
    }
    .note-card-body {
      display: none;
      padding: 14px 16px;
      font-size: 14px;
      color: var(--text-sub);
      line-height: 1.6;
    }
    .note-card.expanded .note-card-body {
      display: block;
    }
    .note-subtitle {
      font-size: 13.5px;
      font-weight: 700;
      color: var(--primary-dark);
      margin-top: 10px;
      margin-bottom: 6px;
      padding-left: 6px;
      border-left: 3px solid var(--primary);
    }
    .note-subtitle:first-child {
      margin-top: 0;
    }
    .note-list {
      list-style: none;
      padding-left: 4px;
      margin-bottom: 12px;
    }
    .note-list li {
      position: relative;
      padding-left: 14px;
      margin-bottom: 6px;
    }
    .note-list li::before {
      content: "•";
      position: absolute;
      left: 0;
      color: var(--primary);
      font-weight: bold;
    }
    .hl {
      background: #fef08a; /* 醒目黃底高頻考點 */
      padding: 1px 4px;
      border-radius: 3px;
      font-weight: 600;
      color: #713f12;
    }
    .btn-study-section {
      width: 100%;
      margin-top: 10px;
      padding: 9px;
      background: var(--primary-light);
      color: var(--primary-dark);
      border: 1px solid #bae6fd;
      border-radius: var(--radius-sm);
      font-size: 13px;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
    }

    /* 比較對照表 */
    .table-container {
      overflow-x: auto;
      margin: 10px 0;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border-color);
    }
    .compare-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12.5px;
      text-align: left;
    }
    .compare-table th, .compare-table td {
      padding: 8px 10px;
      border-bottom: 1px solid var(--border-color);
      white-space: nowrap;
    }
    .compare-table th {
      background: #f1f5f9;
      font-weight: 700;
      color: var(--text-main);
    }

    /* 刷題範圍與模式狀態條 */
    .quiz-scope-banner {
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: #ffffff;
      border: 1px solid var(--border-color);
      border-radius: var(--radius-sm);
      padding: 6px 12px;
      margin-bottom: 10px;
      font-size: 12.5px;
      box-shadow: var(--shadow-sm);
    }
    .scope-info {
      display: flex;
      align-items: center;
      gap: 6px;
      font-weight: 700;
      color: var(--text-main);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .scope-reset-btn {
      background: var(--bg-page);
      border: 1px solid var(--border-color);
      color: var(--primary);
      font-weight: 700;
      font-size: 11.5px;
      padding: 3px 8px;
      border-radius: 4px;
      cursor: pointer;
      flex-shrink: 0;
      transition: all 0.15s;
    }
    .scope-reset-btn:active {
      background: var(--border-color);
      transform: scale(0.96);
    }

    .progress-bar-container {
      width: 100%;
      height: 6px;
      background: var(--border-color);
      border-radius: 99px;
      overflow: hidden;
      margin-bottom: 12px;
    }
    .progress-bar-fill {
      height: 100%;
      background: linear-gradient(90deg, #0284c7, #38bdf8);
      width: 0%;
      transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .quiz-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      font-size: 12.5px;
      color: var(--text-sub);
    }
    .quiz-tags {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .tag-section {
      background: #f1f5f9;
      color: var(--text-sub);
      padding: 2px 8px;
      border-radius: 4px;
      font-weight: 600;
      max-width: 200px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .tag-mistake-count {
      background: var(--danger-light);
      color: var(--danger);
      padding: 2px 6px;
      border-radius: 4px;
      font-weight: 700;
      display: none;
    }
    .card-fav-btn {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      background: #ffffff;
      border: 1px solid var(--border-color);
      padding: 2px 8px;
      border-radius: 99px;
      font-size: 12px;
      font-weight: 700;
      color: var(--text-sub);
      cursor: pointer;
      transition: all 0.15s;
    }
    .card-fav-btn:active {
      transform: scale(0.94);
    }
    .card-fav-btn.active {
      background: #fef3c7;
      border-color: #fde68a;
      color: #b45309;
    }
    .card-fav-btn.active #card-fav-icon {
      color: #f59e0b;
    }

    .card-box {
      background: var(--bg-card);
      border: 1.5px solid var(--border-color);
      border-radius: var(--radius-lg);
      padding: 20px 18px;
      box-shadow: var(--shadow-md);
      position: relative;
      transition: transform 0.2s, box-shadow 0.2s;
    }

    .q-stem {
      font-size: 16.5px;
      font-weight: 700;
      line-height: 1.55;
      color: var(--text-main);
      margin-bottom: 16px;
    }

    .options-group {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-bottom: 14px;
    }

    .option-item {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 12px 14px;
      border: 1.5px solid var(--border-color);
      border-radius: var(--radius-md);
      background: #ffffff;
      cursor: pointer;
      font-size: 15px;
      line-height: 1.45;
      color: var(--text-main);
      transition: all 0.15s ease-out;
      position: relative;
    }
    .option-item:active {
      transform: scale(0.98);
      background: #f8fafc;
    }

    .opt-letter {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: #f1f5f9;
      color: var(--text-sub);
      font-size: 13px;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      margin-top: 1px;
      transition: all 0.15s;
    }
    .opt-text {
      flex: 1;
    }

    /* 答題回饋狀態 */
    .option-item.correct {
      border-color: var(--success);
      background-color: var(--success-light);
      color: #065f46;
      font-weight: 600;
    }
    .option-item.correct .opt-letter {
      background: var(--success);
      color: #ffffff;
    }
    .option-item.wrong {
      border-color: var(--danger);
      background-color: var(--danger-light);
      color: #991b1b;
    }
    .option-item.wrong .opt-letter {
      background: var(--danger);
      color: #ffffff;
    }
    .option-item.show-correct {
      border-color: var(--success);
      background-color: var(--success-light);
      border-style: dashed;
    }

    /* 題目與詳解分隔線 */
    .quiz-divider {
      border: 0;
      border-top: 1.5px dashed var(--border-dark);
      margin: 16px 0 12px 0;
      display: none;
    }

    /* 詳解視圖 */
    .explanation-card {
      display: none;
      background: #f8fafc;
      border-left: 3.5px solid var(--primary);
      border-radius: 4px;
      padding: 10px 12px;
      animation: fadeIn 0.25s ease-out;
    }
    .exp-title {
      font-size: 13px;
      font-weight: 800;
      color: var(--primary-dark);
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .exp-body {
      font-size: 13.5px;
      color: var(--text-sub);
      line-height: 1.55;
    }

    /* 刷題容器底部預留空間，確保展開完整詳解時不被底部浮動列遮擋 */
    #view-quiz {
      padding-bottom: calc(140px + env(safe-area-inset-bottom));
    }

    /* 浮動於底部的刷題導航操作列 (Floating Bottom Bar) */
    .floating-quiz-bar {
      position: fixed;
      bottom: calc(56px + env(safe-area-inset-bottom));
      left: 0;
      right: 0;
      max-width: 640px;
      margin: 0 auto;
      padding: 9px 16px;
      background: rgba(255, 255, 255, 0.94);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-top: 1px solid var(--border-color);
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      z-index: 25;
      box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    }
    .floating-quiz-bar .btn-action {
      flex: 1;
      padding: 11px 0;
      font-size: 14.5px;
    }
    .floating-quiz-bar .btn-action.retry-btn {
      background: #fef3c7;
      border-color: #fde68a;
      color: #92400e;
      flex: 1.1;
    }

    /* 卡片操作通用按鈕 */
    .card-actions {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 16px;
      gap: 10px;
    }
    .btn-action {
      flex: 1;
      padding: 12px 0;
      font-size: 15px;
      font-weight: 700;
      border-radius: var(--radius-md);
      border: 1px solid var(--border-color);
      background: var(--bg-card);
      color: var(--text-sub);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      box-shadow: var(--shadow-sm);
      transition: all 0.15s;
    }
    .btn-action:active {
      transform: scale(0.97);
    }
    .btn-action.primary {
      background: var(--primary);
      color: #ffffff;
      border-color: var(--primary);
    }
    .btn-action.success {
      background: var(--success);
      color: #ffffff;
      border-color: var(--success);
    }

    /* ======================================================== */
    /* 3. 錯題庫 (View 3: Mistake Notebook)                      */
    /* ======================================================== */
    .mistake-header-banner {
      background: linear-gradient(135deg, #ef4444, #f87171);
      color: white;
      border-radius: var(--radius-md);
      padding: 18px 20px;
      margin-bottom: 16px;
      box-shadow: var(--shadow-md);
    }
    .mistake-stats {
      font-size: 26px;
      font-weight: 900;
      margin-bottom: 4px;
    }
    .mistake-desc {
      font-size: 13px;
      opacity: 0.95;
    }
    .mistake-actions-bar {
      display: flex;
      gap: 10px;
      margin-bottom: 16px;
    }

    .mistake-item-card {
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      padding: 14px 16px;
      margin-bottom: 12px;
      box-shadow: var(--shadow-sm);
    }
    .mistake-item-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 12px;
      color: var(--text-muted);
      margin-bottom: 8px;
    }
    .mistake-badge {
      background: var(--danger-light);
      color: var(--danger);
      font-weight: 700;
      padding: 2px 7px;
      border-radius: 4px;
    }
    .mistake-item-title {
      font-size: 14.5px;
      font-weight: 700;
      color: var(--text-main);
      margin-bottom: 8px;
    }
    .mistake-item-ans {
      font-size: 13px;
      color: #065f46;
      background: var(--success-light);
      padding: 4px 8px;
      border-radius: 4px;
      display: inline-block;
      margin-bottom: 8px;
      font-weight: 700;
    }
    .mistake-item-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 6px;
    }
    .btn-sm {
      padding: 4px 10px;
      font-size: 12px;
      font-weight: 600;
      border-radius: var(--radius-sm);
      cursor: pointer;
      border: 1px solid var(--border-color);
      background: #ffffff;
      color: var(--text-sub);
    }
    .btn-sm.danger {
      color: var(--danger);
      border-color: #fecaca;
    }

    .empty-state {
      text-align: center;
      padding: 50px 20px;
      color: var(--text-muted);
    }
    .empty-icon {
      font-size: 48px;
      margin-bottom: 12px;
    }

    /* 複習專區子分頁切換列 (iOS Segmented Control) */
    .review-subtab-bar {
      display: flex;
      background: #e2e8f0;
      border-radius: var(--radius-sm);
      padding: 3px;
      margin-bottom: 14px;
    }
    .review-subtab {
      flex: 1;
      padding: 7px 0;
      font-size: 13.5px;
      font-weight: 700;
      text-align: center;
      background: transparent;
      border: none;
      border-radius: 6px;
      color: var(--text-sub);
      cursor: pointer;
      transition: all 0.15s;
    }
    .review-subtab.active {
      background: #ffffff;
      color: var(--text-main);
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    /* 複習專區章節篩選 Pill 橫向滾動列 */
    .review-chapter-filter-scroll {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      margin-bottom: 14px;
      padding-bottom: 3px;
    }
    .review-chapter-filter-scroll::-webkit-scrollbar {
      display: none;
    }
    .review-filter-pills {
      display: flex;
      gap: 7px;
      min-width: max-content;
    }
    .filter-pill {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 5px 11px;
      background: #f1f5f9;
      color: var(--text-sub);
      border: 1px solid var(--border-color);
      border-radius: 20px;
      font-size: 12.5px;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.15s ease;
    }
    .filter-pill:hover {
      background: #e2e8f0;
    }
    .filter-pill.active {
      background: var(--primary);
      color: #ffffff;
      border-color: var(--primary);
      box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    }
    .filter-pill .pill-count {
      font-size: 11px;
      padding: 1px 6px;
      border-radius: 10px;
      background: rgba(0, 0, 0, 0.07);
    }
    .filter-pill.active .pill-count {
      background: rgba(255, 255, 255, 0.25);
      color: #ffffff;
    }

    .chapter-mistake-pill {
      display: inline-flex;
      align-items: center;
      font-size: 11px;
      font-weight: 700;
      color: #dc2626;
      background: #fee2e2;
      padding: 2px 7px;
      border-radius: 10px;
      margin-left: 6px;
      cursor: pointer;
      transition: transform 0.15s ease;
    }
    .chapter-mistake-pill:hover {
      background: #fecaca;
      transform: scale(1.04);
    }

    /* 設定與版本資訊彈窗 (Modal) */
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(15, 23, 42, 0.55);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 100;
      padding: 16px;
      animation: fadeIn 0.18s ease-out;
    }
    .modal-card {
      background: var(--bg-card);
      width: 100%;
      max-width: 440px;
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-lg);
      border: 1px solid var(--border-color);
      overflow: hidden;
      animation: popIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes popIn {
      from { transform: scale(0.92); opacity: 0; }
      to { transform: scale(1); opacity: 1; }
    }
    .modal-header {
      padding: 14px 18px;
      border-bottom: 1px solid var(--border-color);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .modal-title {
      font-size: 16px;
      font-weight: 800;
      color: var(--text-main);
    }
    .modal-close-btn {
      background: transparent;
      border: none;
      font-size: 18px;
      color: var(--text-muted);
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 4px;
    }
    .modal-body {
      padding: 16px 18px 20px 18px;
      max-height: 80vh;
      overflow-y: auto;
    }
    .settings-group-title {
      font-size: 12px;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--text-muted);
      margin-bottom: 8px;
    }
    .version-info-box {
      background: var(--bg-page);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      padding: 10px 14px;
    }
    .version-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 12.5px;
      padding: 4px 0;
    }
    .version-row .v-label {
      color: var(--text-sub);
    }
    .version-row .v-val {
      font-weight: 600;
      color: var(--text-main);
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    }
    .setting-item-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 6px 0;
    }
    .setting-item-title {
      font-size: 14.5px;
      font-weight: 700;
      color: var(--text-main);
    }
    .setting-item-desc {
      font-size: 11.5px;
      color: var(--text-muted);
      margin-top: 1px;
    }
    /* Switch toggle 開關 */
    .switch-toggle {
      position: relative;
      display: inline-block;
      width: 44px;
      height: 24px;
      flex-shrink: 0;
    }
    .switch-toggle input {
      opacity: 0;
      width: 0;
      height: 0;
    }
    .switch-toggle .slider {
      position: absolute;
      cursor: pointer;
      top: 0; left: 0; right: 0; bottom: 0;
      background-color: #cbd5e1;
      transition: .22s;
      border-radius: 24px;
    }
    .switch-toggle .slider:before {
      position: absolute;
      content: "";
      height: 18px;
      width: 18px;
      left: 3px;
      bottom: 3px;
      background-color: white;
      transition: .22s;
      border-radius: 50%;
    }
    .switch-toggle input:checked + .slider {
      background-color: var(--primary);
    }
    .switch-toggle input:checked + .slider:before {
      transform: translateX(20px);
    }

    /* 浮動提示訊息 (Toast) */
    .app-toast {
      position: fixed;
      top: calc(70px + env(safe-area-inset-top));
      left: 50%;
      transform: translateX(-50%) translateY(-20px);
      background: rgba(15, 23, 42, 0.9);
      color: #ffffff;
      padding: 8px 16px;
      border-radius: 99px;
      font-size: 13px;
      font-weight: 600;
      pointer-events: none;
      opacity: 0;
      transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
      z-index: 1000;
      box-shadow: 0 4px 12px rgba(0,0,0,0.15);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      max-width: 90%;
      text-align: center;
    }
    .app-toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    /* 章節選擇彈窗 (Chapter Selector Modal) 樣式 */
    .chapter-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .chapter-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: var(--bg-page);
      border: 1.5px solid var(--border-color);
      border-radius: var(--radius-md);
      padding: 10px 14px;
      cursor: pointer;
      transition: all 0.15s;
    }
    .chapter-item:hover, .chapter-item:active {
      background: var(--primary-light);
      border-color: var(--primary);
    }
    .chapter-item.active {
      background: var(--primary-light);
      border-color: var(--primary);
    }
    .chapter-item-left {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .chapter-item-icon {
      font-size: 22px;
      flex-shrink: 0;
    }
    .chapter-item-title {
      font-size: 14px;
      font-weight: 700;
      color: var(--text-main);
    }
    .chapter-item-meta {
      font-size: 11.5px;
      color: var(--text-muted);
      margin-top: 2px;
    }
    .chapter-item-badge {
      font-size: 11px;
      font-weight: 700;
      background: #ffffff;
      border: 1px solid var(--border-color);
      padding: 2px 8px;
      border-radius: 99px;
      color: var(--text-sub);
      flex-shrink: 0;
    }
    .chapter-item.active .chapter-item-badge {
      background: var(--primary);
      color: #ffffff;
      border-color: var(--primary);
    }

    /* 跨章節自由多選區塊 */
    .multi-chapter-box {
      display: flex;
      flex-direction: column;
      gap: 8px;
      background: var(--bg-page);
      border: 1px solid var(--border-color);
      border-radius: var(--radius-md);
      padding: 12px 14px;
    }
    .multi-chapter-item {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 13.5px;
      font-weight: 600;
      color: var(--text-main);
      cursor: pointer;
      padding: 4px 0;
    }
    .multi-chapter-item input[type="checkbox"] {
      width: 18px;
      height: 18px;
      accent-color: var(--primary);
      cursor: pointer;
    }
