:root {
      --bg: #070b12;
      --surface: #0e1626;
      --surface2: #162238;
      --surface3: #1f304d;
      --line: #21324d;
      --text: #f1f5f9;
      --muted: #8496b0;
      --accent: #3b82f6;
      --accent2: #8b5cf6;
      --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
      --danger: #ef4444;
      --success: #10b981;
      --radius: 16px;
      --bottom-bar-h: 68px;
      --shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    }
    [data-theme="light"] {
      --bg: #f8fafc;
      --surface: #ffffff;
      --surface2: #f1f5f9;
      --surface3: #e2e8f0;
      --line: #e2e8f0;
      --text: #0f172a;
      --muted: #64748b;
      --accent: #2563eb;
      --accent2: #7c3aed;
      --accent-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
      --danger: #dc2626;
      --success: #059669;
      --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    }
    * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
    body {
      background: var(--bg);
      color: var(--text);
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", "Microsoft JhengHei", sans-serif;
      line-height: 1.5;
      padding-bottom: calc(var(--bottom-bar-h) + env(safe-area-inset-bottom, 20px) + 20px);
      min-height: 100vh;
      overflow-x: hidden;
    }

    /* 頂部主權導覽列 */
    header {
      position: sticky;
      top: 0;
      z-index: 90;
      background: color-mix(in srgb, var(--bg) 88%, transparent);
      backdrop-filter: blur(20px);
      border-bottom: 1px solid var(--line);
      padding: 12px 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      font-weight: 800;
      font-size: 1.15rem;
      letter-spacing: -0.3px;
      cursor: pointer;
    }
    .logo-badge {
      width: 32px;
      height: 32px;
      border-radius: 9px;
      background: var(--accent-gradient);
      display: grid;
      place-items: center;
      color: #fff;
      font-weight: 900;
      font-size: 0.85rem;
      box-shadow: 0 0 16px rgba(59, 130, 246, 0.45);
    }
    .user-pill {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 5px 12px;
      border-radius: 999px;
      background: var(--surface);
      border: 1px solid var(--line);
      font-size: 0.82rem;
    }
    .user-avatar {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      background: var(--accent-gradient);
      color: #fff;
      display: grid;
      place-items: center;
      font-weight: 700;
      font-size: 0.7rem;
    }

    /* 主區域容器 */
    main {
      max-width: 680px;
      margin: 16px auto 0;
      padding: 0 16px;
    }

    /* 視圖標題 */
    .view-header {
      margin-bottom: 16px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .view-title {
      font-size: 1.35rem;
      font-weight: 800;
      letter-spacing: -0.5px;
    }
    .view-sub {
      font-size: 0.82rem;
      color: var(--muted);
    }

    /* 動態貼文串流卡片 */
    .feed { display: flex; flex-direction: column; gap: 16px; }
    .card {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 18px;
      box-shadow: var(--shadow);
      transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .card-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 12px;
    }
    .author-info { display: flex; align-items: center; gap: 8px; }
    .author-name { font-weight: 600; font-size: 0.92rem; }
    .nexus-tag {
      font-size: 0.72rem;
      color: var(--muted);
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    }
    .kind-pill {
      font-size: 0.72rem;
      padding: 3px 9px;
      border-radius: 999px;
      background: var(--surface2);
      color: var(--muted);
      border: 1px solid var(--line);
      font-weight: 500;
    }

    /* 貼文文字主體 */
    .card-content-body {
      font-size: 0.96rem;
      color: var(--text);
      line-height: 1.6;
      margin-bottom: 14px;
      word-break: break-word;
      cursor: pointer;
    }

    /* 隨附檔案 / 附件展示區 (Attachments) */
    .attachments-block {
      background: var(--surface2);
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 12px 14px;
      margin-bottom: 14px;
    }
    .attach-head {
      font-size: 0.78rem;
      color: var(--muted);
      font-weight: 600;
      margin-bottom: 8px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .attach-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .file-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: var(--surface);
      border: 1px solid var(--line);
      padding: 5px 10px;
      border-radius: 8px;
      font-size: 0.8rem;
      color: var(--text);
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    }
    .file-chip-size { color: var(--muted); font-size: 0.72rem; }

    /* 原生音訊嵌入展示 */
    .audio-embed-box {
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px solid var(--line);
    }

    /* 操作列 (Actions) */
    .card-actions {
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-top: 1px solid var(--line);
      padding-top: 12px;
      gap: 6px;
      flex-wrap: wrap;
    }
    .action-left { display: flex; gap: 5px; flex-wrap: wrap; }
    .act-btn {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 6px 11px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: var(--surface);
      color: var(--muted);
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s;
    }
    .act-btn:hover { color: var(--text); background: var(--surface2); }
    .act-btn.liked { color: #f43f5e; border-color: rgba(244, 63, 94, 0.4); background: rgba(244, 63, 94, 0.08); }
    .act-btn.btn-open { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
    .act-btn.btn-edit { color: #f59e0b; }
    .act-btn.btn-delete { color: var(--danger); }
    .act-btn.btn-delete:hover { background: rgba(239, 68, 68, 0.15); border-color: var(--danger); }
    .act-btn.make-it-me {
      background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.12));
      border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
      color: #38bdf8;
    }
    .act-btn.make-it-me:hover {
      background: var(--accent-gradient);
      color: #fff;
    }

    /* 討論抽屜 (Thread Events) */
    .drawer {
      margin-top: 14px;
      padding-top: 14px;
      border-top: 1px dashed var(--line);
      display: none;
    }
    .drawer.open { display: block; animation: fadeIn 0.2s ease; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
    .event-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
    .event-item {
      background: var(--surface2);
      border: 1px solid var(--line);
      border-radius: 9px;
      padding: 9px 12px;
      font-size: 0.85rem;
    }
    .event-head {
      display: flex;
      justify-content: space-between;
      font-size: 0.74rem;
      color: var(--muted);
      margin-bottom: 3px;
    }
    .drawer-compose { display: flex; gap: 6px; }
    .drawer-input {
      flex: 1;
      padding: 8px 12px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: var(--surface);
      color: var(--text);
      font-size: 0.85rem;
      outline: none;
    }
    .drawer-btn {
      padding: 8px 14px;
      border-radius: 8px;
      border: 0;
      background: var(--accent);
      color: #fff;
      font-weight: 600;
      font-size: 0.85rem;
      cursor: pointer;
    }

    /* 手機底部導覽列 (Bottom Nav Bar) */
    .bottom-bar {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      height: var(--bottom-bar-h);
      padding-bottom: env(safe-area-inset-bottom, 12px);
      background: color-mix(in srgb, var(--surface) 92%, transparent);
      backdrop-filter: blur(24px);
      border-top: 1px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: space-around;
      z-index: 100;
    }
    .bar-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      background: transparent;
      border: 0;
      color: var(--muted);
      cursor: pointer;
      font-size: 0.75rem;
      font-weight: 600;
      padding: 6px 20px;
      transition: all 0.15s;
    }
    .bar-item .icon { font-size: 1.3rem; }
    .bar-item.active { color: var(--accent); }
    .bar-plus-btn {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: var(--accent-gradient);
      border: 0;
      color: #fff;
      font-size: 1.8rem;
      font-weight: 300;
      display: grid;
      place-items: center;
      box-shadow: 0 4px 18px rgba(59, 130, 246, 0.45);
      cursor: pointer;
      transform: translateY(-8px);
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .bar-plus-btn:active { transform: translateY(-4px) scale(0.94); }

    /* 浮層模態框共通 (Modal & Sheets) */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.65);
      backdrop-filter: blur(5px);
      z-index: 200;
      display: none;
      align-items: flex-end;
      justify-content: center;
    }
    .modal-overlay.open { display: flex; animation: overlayFade 0.22s ease; }
    @keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }

    .bottom-sheet {
      width: 100%;
      max-width: 680px;
      max-height: 88vh;
      overflow-y: auto;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 24px 24px 0 0;
      padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 12px));
      box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
      transform: translateY(100%);
      transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .modal-overlay.open .bottom-sheet { transform: translateY(0); }

    .sheet-handle {
      width: 40px;
      height: 4px;
      border-radius: 999px;
      background: var(--line);
      margin: 0 auto 16px;
    }
    .sheet-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 14px;
    }
    .sheet-title { font-weight: 700; font-size: 1.15rem; }
    .sheet-close {
      background: var(--surface2);
      border: 0;
      color: var(--muted);
      width: 28px;
      height: 28px;
      border-radius: 50%;
      cursor: pointer;
      display: grid;
      place-items: center;
      font-weight: 700;
    }

    /* 仿 Gemini 單一全能輸入框 (無主題/標題欄) */
    .gemini-composer-box {
      background: var(--surface2);
      border: 1px solid var(--line);
      border-radius: 18px;
      padding: 14px 16px;
      margin-bottom: 14px;
      transition: border-color 0.2s;
    }
    .gemini-composer-box:focus-within {
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    }
    .gemini-textarea {
      width: 100%;
      border: 0;
      background: transparent;
      color: var(--text);
      font-size: 1rem;
      line-height: 1.6;
      outline: none;
      resize: none;
      min-height: 110px;
      font-family: inherit;
    }
    .gemini-textarea::placeholder { color: var(--muted); }

    /* 附加檔案展示預覽 */
    .attached-files-container {
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px dashed var(--line);
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }
    .attached-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: var(--surface3);
      padding: 4px 10px;
      border-radius: 999px;
      font-size: 0.78rem;
      color: var(--text);
    }
    .remove-pill-btn {
      cursor: pointer;
      color: var(--muted);
      font-weight: 700;
      margin-left: 2px;
    }
    .remove-pill-btn:hover { color: var(--danger); }

    /* 拖曳區提示 */
    .drop-hint-bar {
      border: 1.5px dashed var(--line);
      border-radius: 12px;
      padding: 12px;
      text-align: center;
      font-size: 0.82rem;
      color: var(--muted);
      margin-bottom: 14px;
      cursor: pointer;
      transition: all 0.2s;
    }
    .drop-hint-bar.dragover {
      border-color: var(--accent);
      background: rgba(59, 130, 246, 0.08);
      color: var(--text);
    }

    /* 抽屜底端操作 */
    .composer-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .attach-buttons { display: flex; gap: 8px; }
    .attach-btn {
      padding: 8px 14px;
      border-radius: 10px;
      border: 1px solid var(--line);
      background: var(--surface2);
      color: var(--muted);
      cursor: pointer;
      font-size: 0.84rem;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    .attach-btn:hover { color: var(--text); }
    .publish-submit-btn {
      padding: 10px 22px;
      border-radius: 12px;
      border: 0;
      background: var(--accent-gradient);
      color: #fff;
      font-weight: 700;
      font-size: 0.95rem;
      cursor: pointer;
      box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
    }

    /* 舞台閱讀檢視器 (Stage Modal) */
    .stage-meta-info {
      background: var(--surface2);
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 12px;
      font-size: 0.8rem;
      color: var(--muted);
      margin-bottom: 14px;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
    }
    .stage-body-text {
      background: var(--surface2);
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 16px;
      font-size: 0.98rem;
      line-height: 1.7;
      color: var(--text);
      margin-bottom: 16px;
      white-space: pre-wrap;
      word-break: break-word;
    }

    /* 浮窗提示 */
    .toast {
      position: fixed;
      bottom: calc(var(--bottom-bar-h) + 20px);
      left: 50%;
      transform: translate(-50%, 100px);
      background: var(--surface);
      border: 1px solid var(--accent);
      color: var(--text);
      padding: 10px 18px;
      border-radius: 10px;
      box-shadow: var(--shadow);
      font-size: 0.88rem;
      opacity: 0;
      transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
      z-index: 1000;
      white-space: nowrap;
    }
    .toast.show { transform: translate(-50%, 0); opacity: 1; }
  
    /* 主權保險庫路徑面板 (Sovereign Vault Panel) */
    .vault-banner {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 14px 16px;
      margin-bottom: 16px;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
      animation: fadeIn 0.25s ease-out;
    }
    .vault-header-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
    }
    .vault-badge-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 0.78rem;
      font-weight: 700;
      color: var(--success);
      background: rgba(16, 185, 129, 0.12);
      border: 1px solid rgba(16, 185, 129, 0.3);
      padding: 3px 10px;
      border-radius: 999px;
    }
    .status-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--success);
      box-shadow: 0 0 8px var(--success);
    }
    .vault-btn-sm {
      background: var(--surface2);
      border: 1px solid var(--line);
      color: var(--text);
      font-size: 0.8rem;
      font-weight: 600;
      padding: 5px 12px;
      border-radius: 8px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      transition: all 0.2s;
    }
    .vault-btn-sm:hover {
      background: var(--surface3);
      border-color: var(--accent);
    }
    .vault-path-box {
      background: var(--surface2);
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 8px 12px;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 0.82rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      word-break: break-all;
    }
    .vault-path-value {
      color: var(--accent);
      font-weight: 600;
    }
    .vault-sub-bar {
      margin-top: 8px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.76rem;
      color: var(--muted);
      flex-wrap: wrap;
      gap: 6px;
    }
    .app-chip {
      background: var(--surface2);
      border: 1px solid var(--line);
      color: var(--text);
      padding: 2px 8px;
      border-radius: 6px;
      font-size: 0.74rem;
      font-weight: 600;
    }

    /* 設定彈窗 (Settings Modal) */
    .settings-tab-bar {
      display: flex;
      gap: 8px;
      border-bottom: 1px solid var(--line);
      padding-bottom: 10px;
      margin-bottom: 16px;
    }
    .settings-tab-btn {
      background: transparent;
      border: none;
      color: var(--muted);
      font-size: 0.88rem;
      font-weight: 600;
      padding: 6px 12px;
      cursor: pointer;
      border-radius: 8px;
      transition: all 0.2s;
    }
    .settings-tab-btn.active {
      color: var(--text);
      background: var(--surface2);
      border: 1px solid var(--line);
    }
    .settings-preset-btn {
      background: var(--surface2);
      border: 1px solid var(--line);
      color: var(--text);
      padding: 6px 12px;
      border-radius: 8px;
      font-size: 0.8rem;
      cursor: pointer;
      transition: all 0.2s;
    }
    .settings-preset-btn:hover {
      border-color: var(--accent);
    }
    .settings-preset-btn.active {
      background: var(--accent);
      color: #fff;
      border-color: var(--accent);
    }
    .field-label {
      font-size: 0.85rem;
      font-weight: 700;
      color: var(--text);
      margin-bottom: 6px;
      display: block;
    }
    .field-desc {
      font-size: 0.78rem;
      color: var(--muted);
      margin-bottom: 10px;
      line-height: 1.45;
    }
    .app-override-row {
      background: var(--surface2);
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 12px;
      margin-bottom: 12px;
    }
    .app-override-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }
    .app-override-title {
      font-size: 0.88rem;
      font-weight: 700;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .app-override-badge {
      font-size: 0.72rem;
      padding: 2px 8px;
      border-radius: 4px;
      background: var(--surface3);
      color: var(--muted);
      font-weight: 600;
    }
    .app-override-badge.custom-active {
      background: rgba(139, 92, 246, 0.2);
      color: #c084fc;
      border: 1px solid rgba(139, 92, 246, 0.4);
    }
    .app-override-select {
      width: 100%;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--text);
      padding: 8px 10px;
      border-radius: 8px;
      font-size: 0.85rem;
      outline: none;
    }
    .app-custom-input {
      margin-top: 8px;
      width: 100%;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--text);
      padding: 8px 10px;
      border-radius: 8px;
      font-size: 0.82rem;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      outline: none;
    }
    .btn-run-app {
      background: linear-gradient(135deg, #10b981, #059669);
      color: #fff;
      border: none;
      padding: 5px 12px;
      border-radius: 8px;
      font-size: 0.8rem;
      font-weight: 700;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      margin-left: 8px;
    }

  
    /* 全域 @ AI 特工快捷列與徽章 */
    .mention-bar {
      display: flex;
      gap: 6px;
      align-items: center;
      margin-bottom: 6px;
      overflow-x: auto;
      padding: 2px 0 4px;
      scrollbar-width: none;
    }
    .mention-bar::-webkit-scrollbar { display: none; }
    .mention-label {
      font-size: 0.72rem;
      color: var(--muted);
      white-space: nowrap;
      margin-right: 2px;
    }
    .mention-tag-btn {
      background: var(--surface2);
      border: 1px solid var(--line);
      color: var(--text);
      padding: 3px 9px;
      border-radius: 999px;
      font-size: 0.75rem;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      display: inline-flex;
      align-items: center;
      gap: 3px;
      transition: all 0.15s;
    }
    .mention-tag-btn:hover {
      border-color: var(--accent);
      background: var(--surface3);
    }
    .mention-tag-btn.hermes {
      border-color: rgba(59, 130, 246, 0.45);
      color: #60a5fa;
      background: rgba(59, 130, 246, 0.12);
    }
    .event-item.ai-reply {
      border-left: 3px solid var(--accent);
      background: rgba(59, 130, 246, 0.08);
      border-radius: 8px;
      padding: 8px 10px;
      margin-bottom: 8px;
    }

  
    /* 留言編輯與刪除控制列 */
    .comment-actions {
      display: inline-flex;
      gap: 6px;
      align-items: center;
      margin-left: 8px;
    }
    .comment-act-btn {
      background: none;
      border: none;
      color: var(--muted);
      cursor: pointer;
      font-size: 0.72rem;
      padding: 1px 4px;
      border-radius: 4px;
      transition: all 0.15s;
    }
    .comment-act-btn:hover {
      background: var(--surface3);
      color: var(--text);
    }
    .comment-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      margin-top: 4px;
    }
    .comment-chip {
      background: var(--surface);
      border: 1px solid var(--line);
      padding: 2px 7px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-family: monospace;
      color: var(--accent);
    }

    /* 內嵌沙盒層級警示條 (Sandbox Nesting Indicator) */
    .sandbox-nesting-bar {
      background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(139, 92, 246, 0.15));
      border: 1px solid rgba(239, 68, 68, 0.35);
      border-radius: 10px;
      padding: 8px 12px;
      margin-bottom: 12px;
      font-size: 0.78rem;
      color: #fca5a5;
      display: flex;
      justify-content: space-between;
      align-items: center;
      animation: fadeIn 0.25s;
    }
    .sandbox-pop-btn {
      background: var(--accent);
      color: #fff;
      border: none;
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 0.74rem;
      font-weight: 700;
      cursor: pointer;
    }

  
    /* === 響應式居中總版型：Menu Bar 緊貼作品內容旁邊 === */
    .app-layout {
      display: block;
      width: 100%;
    }
    .desktop-sidebar {
      display: none;
    }

    @media (min-width: 900px) {
      body {
        padding-bottom: 0 !important;
        background: var(--bg);
      }
      header:not(.shell-header) {
        display: none !important;
      }
      .bottom-bar {
        display: none !important;
      }

      /* 外層水平居中容器：整體最大寬度 1080px (260px 選單 + 820px 內容) */
      .app-layout {
        display: flex !important;
        justify-content: center !important;
        max-width: 1080px !important;
        margin: 0 auto !important;
        min-height: 100vh;
        position: relative;
      }

      /* 側邊導覽列：黏性停駐於視窗左側，緊密貼合主內容區 */
      .desktop-sidebar {
        display: flex !important;
        flex-direction: column !important;
        width: 260px !important;
        flex-shrink: 0 !important;
        position: sticky !important;
        top: 0 !important;
        height: 100vh !important;
        background: var(--surface) !important;
        border-right: 1px solid var(--line) !important;
        padding: 24px 14px !important;
        box-sizing: border-box !important;
        z-index: 90;
      }
      .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        cursor: pointer;
        padding: 8px 10px 22px;
        border-bottom: 1px solid var(--line);
        margin-bottom: 18px;
      }
      .sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 8px;
        flex: 1;
        overflow-y: auto;
      }
      .sidebar-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        border-radius: 12px;
        color: var(--muted);
        background: transparent;
        border: 0;
        font-size: 0.96rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.16s ease;
        text-align: left;
        width: 100%;
      }
      .sidebar-item:hover {
        background: var(--surface2);
        color: var(--text);
      }
      .sidebar-item.active {
        background: var(--accent-gradient);
        color: #fff;
        box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
      }
      .sidebar-item .item-icon {
        font-size: 1.25rem;
        width: 26px;
        display: grid;
        place-items: center;
      }
      .sidebar-user {
        border-top: 1px solid var(--line);
        padding-top: 16px;
        display: flex;
        align-items: center;
        gap: 10px;
        cursor: pointer;
        padding: 12px 10px;
        border-radius: 12px;
        transition: background 0.16s ease;
      }
      .sidebar-user:hover {
        background: var(--surface2);
      }

      /* 主作品與內容區域：緊鄰側邊欄右側，寬度飽滿，無縫相接 */
      main {
        flex: 1 !important;
        max-width: 820px !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 30px 28px 60px !important;
        box-sizing: border-box !important;
      }
      .view-header, #vault-banner, .feed {
        width: 100% !important;
        max-width: 100% !important;
      }
    }

    @media (max-width: 899px) {
      .desktop-sidebar {
        display: none !important;
      }
      .app-layout {
        display: block !important;
        max-width: 100% !important;
        margin: 0 !important;
      }
      main {
        max-width: 680px !important;
        margin: 16px auto 0 !important;
        padding: 0 16px !important;
      }
      .bottom-bar {
        display: flex !important;
      }
    }

    /* === 個人主權中心 (Me Hub Modal / Drawer) === */
    .me-hub-sheet {
      width: 100%;
      max-width: 740px !important;
      max-height: 88vh;
      overflow-y: auto;
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 20px 20px 0 0;
      padding: 22px 20px 32px;
    }
    @media (min-width: 900px) {
      .modal-overlay {
        align-items: center !important;
      }
      .me-hub-sheet {
        border-radius: 20px !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
      }
    }
    .hub-tabs {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      border-bottom: 1px solid var(--line);
      padding-bottom: 10px;
      margin-bottom: 18px;
    }
    .hub-tab-btn {
      padding: 8px 14px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: var(--surface2);
      color: var(--muted);
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      transition: all 0.15s ease;
    }
    .hub-tab-btn.active {
      background: var(--accent);
      color: #fff;
      border-color: var(--accent);
    }
    .hub-content-section {
      display: none;
    }
    .hub-content-section.active {
      display: block;
    }
    .setting-card {
      background: var(--surface2);
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 14px 16px;
      margin-bottom: 14px;
    }
    .menu-customizer-table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 10px;
      font-size: 0.82rem;
    }
    .menu-customizer-table th, .menu-customizer-table td {
      border: 1px solid var(--line);
      padding: 8px 10px;
      text-align: left;
    }
    .menu-customizer-table th {
      background: var(--surface3);
      color: var(--muted);
    }

  
    /* 防止 Edge 瀏覽器自帶的密碼眼睛按鈕與自定義按鈕重疊 */
    input[type="password"]::-ms-reveal,
    input[type="password"]::-ms-clear {
      display: none;
    }
/* 統一頂欄：全面隱藏舊版內層重複 header，保留唯一響應式 .shell-header */
header:not(.shell-header) { display: none !important; }
