/* ============================================================
   NKUST Racing — Theme overrides
   Three modes: glass (default), flat, editorial
   Plus density modes: compact / default / spacious
   ============================================================ */

:root {
  /* page chrome — colorful aurora ONLY in corners, so glass cards have
     something to blur but the center stays calm and cards read as distinct
     surfaces (not color smears). */
  --page-bg: #eef0f3;
  --page-gradient:
    radial-gradient(45% 36% at 0% 0%,    rgba(255,150,80,0.32)  0%, transparent 70%),
    radial-gradient(42% 36% at 100% 0%,  rgba(0,113,227,0.26)   0%, transparent 70%),
    radial-gradient(50% 42% at 0% 100%,  rgba(184,48,37,0.22)   0%, transparent 70%),
    radial-gradient(45% 38% at 100% 100%,rgba(46,107,127,0.26)  0%, transparent 70%),
    radial-gradient(40% 35% at 50% 100%, rgba(246,171,0,0.14)   0%, transparent 75%);

  /* card surfaces — frosted white glass */
  --card-fill:        rgba(255,255,255,0.66);
  --card-blur:        blur(28px) saturate(180%);
  --card-border:      0.5px solid rgba(255,255,255,0.55);
  --card-highlight:   inset 0 1px 0 rgba(255,255,255,0.7), inset 0 -0.5px 0 rgba(0,0,0,0.03);
  --card-shadow:      0 1px 3px rgba(0,0,0,0.04), 0 12px 32px rgba(0,0,0,0.05);
  --card-shadow-hover:0 2px 6px rgba(0,0,0,0.05), 0 20px 48px rgba(0,0,0,0.09);

  /* accent glass — tinted blue glass, same blur recipe as white glass
     so all surfaces feel like one material. */
  --card-fill-accent:   rgba(0,113,227,0.72);
  --card-border-accent: 0.5px solid rgba(255,255,255,0.4);
  --card-highlight-accent: inset 0 1px 0 rgba(255,255,255,0.35);

  /* layout scale — Apple HIG concentric radius (WWDC 2025) */
  --radius-card:   20px;   /* var(--radius-xl) */
  --radius-large:  28px;   /* var(--radius-2xl) — sheets, large panels */
  --radius-tile:   13px;   /* var(--radius-md) — inner tiles */
  --radius-input:  10px;   /* var(--radius-sm) */

  /* density (gap units) */
  --gap-zone:      28px;
  --gap-card:      14px;
  --gap-tight:     10px;
  --card-pad:      22px;
  --tile-pad:      18px 20px;
  --bento-row-h:   104px;

  /* type accents (overridden by editorial) */
  --section-head-family: var(--font-sans);
  --section-head-weight: 700;
  --section-head-size: 13px;
  --section-head-transform: uppercase;
  --section-head-tracking: 0.04em;

  --display-family: var(--font-sans);

  --hover-lift: -2px;
}

/* ───── DARK MODE — toggled via [data-appearance="dark"] ───── */
[data-appearance="dark"] {
  /* Soft dark page — darker than cards so glass surfaces float (not pure black) */
  --page-bg: #141417;
  --page-gradient:
    radial-gradient(45% 36% at 0% 0%,    rgba(255,120,60,0.16)  0%, transparent 72%),
    radial-gradient(42% 36% at 100% 0%,  rgba(10,132,255,0.15)  0%, transparent 72%),
    radial-gradient(50% 42% at 0% 100%,  rgba(255,69,58,0.10)   0%, transparent 72%),
    radial-gradient(45% 38% at 100% 100%,rgba(100,210,255,0.11) 0%, transparent 72%),
    radial-gradient(40% 35% at 50% 100%, rgba(255,214,10,0.07)  0%, transparent 78%);

  /* Dark glass — frosted elevated surface (Liquid Glass dark variant) */
  --card-fill:         rgba(44,44,50,0.74);
  --card-border:       0.5px solid rgba(255,255,255,0.09);
  --card-highlight:    inset 0 1px 0 rgba(255,255,255,0.06), inset 0 -0.5px 0 rgba(0,0,0,0.18);
  --card-shadow:       0 1px 3px rgba(0,0,0,0.18), 0 12px 32px rgba(0,0,0,0.28);
  --card-shadow-hover: 0 2px 6px rgba(0,0,0,0.26), 0 20px 48px rgba(0,0,0,0.40);

  /* Accent glass dark */
  --card-fill-accent:   rgba(10,132,255,0.70);
  --card-border-accent: 0.5px solid rgba(255,255,255,0.20);
  --card-highlight-accent: inset 0 1px 0 rgba(255,255,255,0.18);
}

/* Segmented control dark */
[data-appearance="dark"] .segmented-control {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.05);
}
[data-appearance="dark"] .segmented-item.active {
  background: rgba(255,255,255,0.12) !important;
  color: #ffffff !important;
  border-color: rgba(255,255,255,0.08) !important;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.30),
    0 4px 12px rgba(0,0,0,0.20),
    inset 0 1px 0 rgba(255,255,255,0.12) !important;
}

/* Buttons dark */
[data-appearance="dark"] .btn {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
}
[data-appearance="dark"] .btn:hover { background: rgba(255,255,255,0.13); }
[data-appearance="dark"] .btn.ghost:hover { background: rgba(255,255,255,0.08); }
[data-appearance="dark"] .btn.primary { color: #fff; }

/* Modal dark */
[data-appearance="dark"] .modal-card {
  background: rgba(42,42,47,0.96);
  border: 0.5px solid rgba(255,255,255,0.10);
}

/* Slide-over dark */
[data-appearance="dark"] .slide-over-panel {
  background: rgba(42,42,47,0.96);
  border-left-color: rgba(255,255,255,0.08);
}

/* Form inputs dark */
[data-appearance="dark"] .field input[type="text"],
[data-appearance="dark"] .field input[type="email"],
[data-appearance="dark"] .field input[type="number"],
[data-appearance="dark"] .field select,
[data-appearance="dark"] .field textarea {
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  border-bottom-color: var(--separator-opaque);
}
[data-appearance="dark"] .field input:focus,
[data-appearance="dark"] .field select:focus,
[data-appearance="dark"] .field textarea:focus {
  background: rgba(10,132,255,0.10);
  border-bottom-color: var(--blue);
}

/* ───── FLAT theme: functional, less blur, sharper corners ───── */
[data-theme="flat"] {
  --page-bg: #f4f4f6;
  --page-gradient: none;

  --card-fill:        rgba(255,255,255,0.92);
  --card-blur:        blur(0px) saturate(100%);
  --card-border:      0.5px solid rgba(0,0,0,0.10);
  --card-highlight:   none;
  --card-shadow:      0 1px 0 rgba(0,0,0,0.04);
  --card-shadow-hover:0 1px 0 rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.05);

  --card-fill-accent:   #0071e3;
  --card-border-accent: 0.5px solid #0071e3;
  --card-highlight-accent: none;

  --radius-card:   8px;
  --radius-large:  10px;
  --radius-tile:   6px;
  --radius-input:  6px;

  --section-head-size: 11px;
  --section-head-tracking: 0.08em;

  --hover-lift: 0px;
}

/* ───── EDITORIAL theme: magazine, more whitespace, serif heads ───── */
[data-theme="editorial"] {
  --page-bg: #f6f1e8;
  --page-gradient:
    radial-gradient(55% 50% at 10% 8%,  rgba(184,48,37,0.32) 0%, transparent 65%),
    radial-gradient(50% 50% at 90% 95%, rgba(28,61,94,0.32)  0%, transparent 65%),
    radial-gradient(40% 40% at 50% 30%, rgba(246,171,0,0.20) 0%, transparent 70%);

  --card-fill:        rgba(255,254,250,0.66);
  --card-blur:        blur(34px) saturate(180%);
  --card-border:      0.5px solid rgba(255,255,255,0.5);
  --card-highlight:   inset 0 1px 0 rgba(255,255,255,0.7);
  --card-shadow:      0 1px 3px rgba(0,0,0,0.03), 0 16px 40px rgba(0,0,0,0.06);

  --card-fill-accent:   rgba(0,113,227,0.68);
  --card-border-accent: 0.5px solid rgba(255,255,255,0.4);
  --card-highlight-accent: inset 0 1px 0 rgba(255,255,255,0.35);

  --radius-card:   20px;
  --radius-large:  28px;
  --radius-tile:   18px;
  --radius-input:  12px;

  --section-head-family: var(--font-serif);
  --section-head-weight: 700;
  --section-head-size: 22px;
  --section-head-transform: none;
  --section-head-tracking: -0.015em;

  --display-family: var(--font-serif);

  --hover-lift: -3px;
}

/* ───── DENSITY (orthogonal to theme) ───── */
[data-density="compact"] {
  --gap-zone:    20px;
  --gap-card:    10px;
  --gap-tight:   8px;
  --card-pad:    16px;
  --tile-pad:    14px 16px;
  --bento-row-h: 78px;
}
[data-density="spacious"] {
  --gap-zone:    40px;
  --gap-card:    20px;
  --gap-tight:   14px;
  --card-pad:    28px;
  --tile-pad:    24px 28px;
  --bento-row-h: 108px;
}

/* ============================================================
   Re-usable theme-aware utility classes
   ============================================================ */
.tcard {
  background: var(--card-fill);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-highlight), var(--card-shadow);
  transition: transform .42s var(--ease-back), box-shadow .3s var(--ease-out);
}
.tcard.large { border-radius: var(--radius-large); }
.tcard.tile  { border-radius: var(--radius-tile); }
.tcard.hoverable:hover {
  transform: translateY(var(--hover-lift));
  box-shadow: var(--card-highlight), var(--card-shadow-hover);
}

/* Accent-tinted glass — same blur recipe as .tcard so light glass and
   tinted glass feel like the same material. */
.tcard-accent {
  background: var(--card-fill-accent);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border: var(--card-border-accent);
  border-radius: var(--radius-card);
  box-shadow: var(--card-highlight-accent), var(--card-shadow);
  color: #fff;
  transition: transform .42s var(--ease-back), box-shadow .3s var(--ease-out);
}
.tcard-accent.large { border-radius: var(--radius-large); }
.tcard-accent.tile  { border-radius: var(--radius-tile); }
.tcard-accent.hoverable:hover {
  transform: translateY(var(--hover-lift));
  box-shadow: var(--card-highlight-accent), var(--card-shadow-hover);
}

.section-head {
  font-family: var(--section-head-family);
  display: flex;
  align-items: baseline;
  gap: 0;
  line-height: 1;
}

/* 中文主標題 — 輕、大、有呼吸感 */
.section-head-zh {
  font-weight: 300;
  font-size: 15px;
  letter-spacing: 0.18em;
  color: var(--label-primary, var(--ink));
}

/* 分隔點 — 細、有間距 */
.section-head-dot {
  font-weight: 300;
  font-size: 13px;
  color: var(--label-tertiary, var(--muted));
  margin: 0 5px;
  opacity: 0.55;
}

/* 英文副標題 — 細、小、有字距 */
.section-head-en {
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label-secondary, var(--faint));
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* 總覽頁小區塊標題 — 無玻璃效果，純排版 */
.overview-section-label {
  font-family: var(--section-head-family);
  font-weight: var(--section-head-weight);
  font-size: var(--section-head-size);
  letter-spacing: var(--section-head-tracking);
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

/* ─── Button — Apple HIG Prominent/Secondary/Ghost ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px;
  padding: 0 16px;
  min-width: 44px;             /* HIG: 44pt minimum touch target */
  background: var(--fill-secondary);
  color: var(--label-primary);
  border: 0;
  border-radius: var(--radius-sm);   /* 10px — HIG rounded rect */
  font: 600 15px/1 var(--font-sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background .15s var(--ease-out), transform .1s var(--ease-out), filter .15s;
  white-space: nowrap;
}
.btn:hover  { background: var(--fill-primary); }
.btn:active { transform: scale(0.95); filter: brightness(0.95); }

/* Primary — filled blue */
.btn.primary {
  background: var(--blue);
  color: #fff;
}
.btn.primary:hover  { filter: brightness(1.10); background: var(--blue); }
.btn.primary:active { transform: scale(0.95); filter: brightness(0.92); }

/* Ghost — transparent */
.btn.ghost   { background: transparent; }
.btn.ghost:hover { background: var(--fill-tertiary); }

/* Danger */
.btn.danger  { background: rgba(255,59,48,0.10); color: var(--red); }
.btn.danger:hover { background: rgba(255,59,48,0.16); }

.btn .icn { width: 14px; height: 14px; }

/* ─── Pill / Badge — Apple HIG Capsule ─── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font: 600 11px/1.4 var(--font-sans);   /* 11px sans — HIG caption1 */
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* dot indicator */
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Apple HIG: HIGH=red, MID=orange, LOW=green */
.pill.high  { background: rgba(255,59,48,0.10);  color: var(--red);    }
.pill.high::before  { background: var(--red);    }
.pill.mid   { background: rgba(255,149,0,0.10);  color: var(--orange); }
.pill.mid::before   { background: var(--orange); }
.pill.low   { background: rgba(52,199,89,0.10);  color: var(--green);  }
.pill.low::before   { background: var(--green);  }
.pill.muted { background: var(--fill-quaternary); color: var(--label-secondary); }
.pill.muted::before { background: var(--label-tertiary); }

/* Form inputs — borderless w/ bottom rule */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label {
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.field input[type="text"], .field input[type="email"], .field input[type="number"],
.field select, .field textarea {
  background: rgba(0,0,0,0.025);
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: var(--radius-input) var(--radius-input) 0 0;
  padding: 9px 12px;
  font: 400 13.5px/1.4 var(--font-sans);
  color: var(--ink);
  letter-spacing: -0.005em;
  transition: border-color .15s, background .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
  background: var(--accent-bg);
}
.field textarea { resize: vertical; min-height: 60px; }

/* Modal overlay */
.modal-back {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(20,20,25,0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  animation: modal-fade .25s var(--ease-out);
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 0.5px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-modal);
  max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  animation: modal-pop .45s var(--ease-out);
  position: relative;
}
@keyframes modal-pop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(24px);
  }
  35% {
    transform: scale(1.018) translateY(-2px);
  }
  55% {
    transform: scale(0.995) translateY(0.5px);
  }
  75% {
    transform: scale(1.002) translateY(-0.1px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Zoom-from-source — DetailPreview grows from the clicked card's position.
   transform-origin is set inline (JS) to the click point relative to the card. */
@keyframes detail-zoom {
  0%   { opacity: 0; transform: scale(0.80); }
  60%  { opacity: 1; transform: scale(1.01); }
  100% { opacity: 1; transform: scale(1); }
}

/* Drag handle */
.drag-handle {
  cursor: grab;
  color: var(--muted);
  opacity: 0; transition: opacity .2s;
}
.dragging .drag-handle, *:hover > .drag-handle { opacity: 1; }
.drag-handle:active { cursor: grabbing; }
.dragging { opacity: 0.5; }
.drag-over { background: var(--accent-bg) !important; }

/* ─── Premium Segmented Control ─── */
.segmented-control {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.035);
  padding: 2.5px;
  border-radius: 10px;
  border: 0.5px solid rgba(0, 0, 0, 0.05);
  position: relative;
  width: 100%;
}
[data-theme="glass"] .segmented-control {
  background: rgba(0, 0, 0, 0.055);
}
.segmented-item {
  flex: 1;
  text-align: center;
  padding: 7px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--faint);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s var(--ease-out);
  position: relative;
  z-index: 1;
  font-family: var(--font-sans);
}
.segmented-item.active {
  color: var(--ink);
  background: #ffffff;
  border: 0.5px solid rgba(0, 0, 0, 0.04);
  box-shadow: 
    0 1px 2px rgba(0, 0, 0, 0.04), 
    0 4px 12px rgba(0, 0, 0, 0.03), 
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transform: translateY(-0.5px);
}
[data-theme="flat"] .segmented-item.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: none;
  border: 0;
  transform: none;
}


/* ─── Unified SegmentedFilter — .seg-filter-wrap + .seg-btn ─── */
.seg-filter-wrap {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 999px;
  height: 28px;
  background: rgba(0, 0, 0, 0.055);
  flex-shrink: 0;
}
[data-appearance="dark"] .seg-filter-wrap {
  background: rgba(255, 255, 255, 0.08);
}

.seg-btn {
  padding: 0 11px;
  height: 24px;
  border-radius: 999px;
  border: 0;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s, color .15s, box-shadow .15s;
  /* default: muted text, transparent bg */
  background: transparent;
  color: var(--label-secondary);
}
.seg-btn:hover {
  color: var(--label-primary);
  background: rgba(0, 0, 0, 0.04);
}
[data-appearance="dark"] .seg-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Active — light mode: solid white pill */
.seg-btn.seg-btn--active {
  background: #ffffff;
  color: var(--label-primary);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.10),
    0 4px 12px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
/* Active — dark mode: translucent white pill */
[data-appearance="dark"] .seg-btn.seg-btn--active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Legacy view-toggle-btn kept for any remaining usages */
.view-toggle-btn {
  width: 28px; height: 24px;
  border: 0; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  color: var(--label-secondary);
  background: transparent;
}
.view-toggle-btn.active {
  background: #ffffff;
  color: var(--label-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.8);
}
[data-appearance="dark"] .view-toggle-btn.active {
  background: rgba(255,255,255,0.18);
  color: #ffffff;
}


/* ─── Premium Subsystem Grid Selector ─── */
.subsystem-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 4px;
}
@media (max-width: 480px) {
  .subsystem-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.subsystem-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.025);
  border: 0.5px solid rgba(0, 0, 0, 0.04);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.22s var(--ease-out);
}
.subsystem-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--faint);
  transform: translateY(-1px);
}
.subsystem-btn.active {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

/* ─── Glowing Range Slider ─── */
.range-slider-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  height: 24px;
  width: 100%;
}
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.05);
  outline: none;
  transition: background 0.3s;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 113, 227, 0.35);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out);
}
.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ─── Slide-over Detail Panel ─── */
.slide-over-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(10, 15, 25, 0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out);
}
.slide-over-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.slide-over-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 90vw;
  z-index: 160;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-left: 0.5px solid rgba(0, 0, 0, 0.08);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme="flat"] .slide-over-panel {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.05);
}
[data-theme="editorial"] .slide-over-panel {
  background: rgba(255, 254, 250, 0.94);
}
.slide-over-panel.open {
  transform: translateX(0);
}
.slide-over-header {
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid var(--rule);
}
.slide-over-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.slide-over-footer {
  padding: 16px 24px 24px;
  border-top: 0.5px solid var(--rule);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Drafting grid background simulator */
.blueprint-draft-grid {
  background: 
    radial-gradient(circle at 100% 100%, var(--accent-mid) 0%, transparent 60%),
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(135deg, #0d1e36, #050d18);
  background-size: 100% 100%, 20px 20px, 20px 20px, 100% 100%;
  border: 1px dashed rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.blueprint-draft-grid::after {
  content: "NO COVER · DRAFT";
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 7px;
  color: rgba(255,255,255,0.18);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── Apple HIG Layout & Responsive Overrides (Tahoe Size Classes) ─── */
:root {
  --hdr-pad: 40px;
  --page-tab-pad: 16px;
  --page-tab-fs: 13px;
}

@media (max-width: 1024px) {
  :root {
    --hdr-pad: 24px;
    --page-tab-pad: 12px;
  }
}

@media (max-width: 768px) {
  :root {
    /* Adaptive layout margins for compact width class */
    --gap-zone: 20px;
    --gap-card: 12px;
    --card-pad: 16px;
    
    /* Shrink header paddings and text sizes to prevent squishing */
    --hdr-pad: 16px;
    --page-tab-pad: 8px;
    --page-tab-fs: 11.5px;
    
    /* Make general viewport margins smaller */
    --s-8: 16px;
  }
  
  /* Prevent layout clipping or word wrapping bugs in navigation */
  header nav {
    gap: 2px !important;
  }
}

/* ─── Ultra-Premium View Transitions (Launchpad Style) ─── */
::view-transition-old(root) {
  animation: 90ms cubic-bezier(0.4, 0, 1, 1) both fade-out,
             300ms cubic-bezier(0.4, 0, 0.2, 1) both scale-down;
}
::view-transition-new(root) {
  animation: 210ms cubic-bezier(0, 0, 0.2, 1) 90ms both fade-in,
             300ms cubic-bezier(0.34, 1.56, 0.64, 1) 90ms both spring-up;
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scale-down {
  from { transform: scale(1); }
  to { transform: scale(0.985); }
}
@keyframes spring-up {
  from { transform: translateY(12px) scale(0.99); }
  to { transform: translateY(0) scale(1); }
}

/* ─── Premium Split-Pane Editor Layout ─── */
.split-editor-container {
  display: flex;
  gap: 28px;
  width: 100%;
}
.live-preview-pane {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-left: 0.5px solid var(--rule);
  padding-left: 28px;
  flex-shrink: 0;
}

/* Responsive overrides for split editor (Apple Size Classes) */
@media (max-width: 768px) {
  .split-editor-container {
    flex-direction: column;
    gap: 16px;
  }
  .live-preview-pane {
    display: none !important; /* Hide preview on mobile to focus inputs */
  }
  .modal-card {
    max-width: 100% !important; /* Allow forms to expand in mobile modal context */
  }
}

/* ─── WWDC 2025: Scroll Edge Effects ───────────────────────────────────────
   Replace hard dividers with soft blur mask on scroll edges.
   Apply .scroll-soft to any overflow-y: auto container.
   ── */
.scroll-soft {
  mask-image:
    linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 24px), transparent 100%);
  -webkit-mask-image:
    linear-gradient(to bottom, transparent 0px, black 24px, black calc(100% - 24px), transparent 100%);
}

/* ─── WWDC 2025: Inset Sidebar (Liquid Glass style) ──────────────────────── */
.sidebar-inset {
  background: color-mix(in srgb, var(--bg-secondary) 70%, transparent);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border-right: 0.5px solid var(--separator);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  margin: 8px 0 8px 8px;
  overflow: hidden;
}

/* ─── WWDC 2025: Liquid Glass Toolbar / Nav Bar ──────────────────────────── */
/* Already applied via header blur — add the Tahoe-style separator glow */
header + * .subBar,
.hdr-subbar {
  --edge-glow: inset 0 -1px 0 rgba(255,255,255,0.06);
}

/* ─── List Row — HIG inset separator (縮排分隔線) ────────────────────────── */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;           /* HIG: 44pt target + padding */
  padding: 0 16px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.list-row:hover  { background: var(--fill-quaternary); }
.list-row:active { background: var(--fill-tertiary); transform: scale(0.995); }

/* Inset separator — starts after icon (HIG pattern) */
.list-row + .list-row::before {
  content: '';
  position: absolute;
  top: 0; left: 60px; right: 0;
  height: 0.5px;
  background: var(--separator);
}

/* Icon slot in list row */
.list-row-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ─── Progress Bar — color-coded by value (HIG semantic) ─────────────────── */
.progress-bar-track {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--fill-tertiary);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-progress);
}
/* Color logic via data attribute */
.progress-bar-fill[data-state="overdue"]    { background: var(--red);    }
.progress-bar-fill[data-state="low"]        { background: var(--orange);  }
.progress-bar-fill[data-state="mid"]        { background: var(--blue);    }
.progress-bar-fill[data-state="done"]       { background: var(--green);   }

/* ─── KPI Widget — Apple widget-style tile (WWDC 2025) ──────────────────── */
.widget-tile {
  border-radius: var(--radius-large);
  padding: 20px;
  background: var(--card-fill);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border: var(--card-border);
  box-shadow: var(--card-highlight), var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .3s var(--ease-back), box-shadow .25s var(--ease-out);
}
.widget-tile:hover {
  transform: translateY(var(--hover-lift));
  box-shadow: var(--card-highlight), var(--card-shadow-hover);
}
.widget-tile .widget-eyebrow {
  font: 600 11px/1 var(--font-sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label-secondary);
}
.widget-tile .widget-value {
  font: 700 34px/1 var(--font-sans);
  letter-spacing: -0.04em;
  color: var(--label-primary);
  font-feature-settings: 'tnum';
}
.widget-tile .widget-foot {
  font: 400 13px/1.4 var(--font-sans);
  color: var(--label-tertiary);
}

/* Accent (hero) widget */
.widget-tile.accent {
  background: var(--blue);
  border: none;
  box-shadow: 0 4px 20px rgba(0,122,255,0.30), 0 1px 3px rgba(0,122,255,0.20);
}
.widget-tile.accent .widget-eyebrow { color: rgba(255,255,255,0.70); }
.widget-tile.accent .widget-value   { color: #ffffff; }
.widget-tile.accent .widget-foot    { color: rgba(255,255,255,0.55); }
.widget-tile.accent:hover {
  box-shadow: 0 8px 32px rgba(0,122,255,0.40), 0 2px 6px rgba(0,122,255,0.25);
}

/* ─── Status Strip (overdue / on-track / done) ───────────────────────────── */
.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 600 11px/1 var(--font-sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-strip.overdue { color: var(--red);    }
.status-strip.warning { color: var(--orange); }
.status-strip.ok      { color: var(--green);  }
.status-strip.neutral { color: var(--label-tertiary); }

/* ─── Gantt progress bar (4px track, semantic fill) ─────────────────────── */
.gantt-bar-track {
  height: 4px;
  background: var(--fill-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  flex: 1;
}
.gantt-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-progress);
}

/* ─── Today marker line ──────────────────────────────────────────────────── */
.gantt-today-line {
  width: 2px;
  background: var(--blue);
  opacity: 0.55;
  border-radius: 1px;
}

/* ─── Person Card ─────────────────────────────────────────────────────────── */
.person-card {
  border-radius: var(--radius-xl);
  padding: 20px;
  background: var(--card-fill);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border: var(--card-border);
  box-shadow: var(--card-highlight), var(--card-shadow);
  transition: transform .3s var(--ease-back), box-shadow .25s var(--ease-out);
  position: relative;
}
.person-card:hover {
  transform: translateY(var(--hover-lift));
  box-shadow: var(--card-highlight), var(--card-shadow-hover);
}
.person-card .person-actions {
  opacity: 0;
  transition: opacity .2s;
}
.person-card:hover .person-actions { opacity: 1; }

/* ─── Avatar gradient (name-hashed color) ────────────────────────────────── */
.avatar-gradient {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — Bottom Tab Bar  (iOS-style)
   只在 max-width: 768px 顯示
   ═══════════════════════════════════════════════════════════ */

/* Token：底部 Tab 高度（不含 safe area） */
:root {
  --bottom-tab-h: 54px;
}

/* Bottom Tab Bar 容器 */
.bottom-tab-bar {
  display: none; /* 桌面隱藏 */
}
/* 頁面圖示導覽：桌面隱藏，手機顯示 */
.hdr-page-icons { display: none; }

@media (max-width: 768px) {
  .bottom-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: calc(var(--bottom-tab-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(28px);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
    border-top: 0.5px solid var(--header-border);
    box-shadow: 0 -1px 0 rgba(0,0,0,0.04);
  }

  .bottom-tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px 0 0;
    min-height: 44px;
    font-family: var(--font-sans);
    font-size: 10px;
    letter-spacing: 0.01em;
    color: var(--label-tertiary);
    font-weight: 400;
    transition: color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-tab-btn.active {
    color: var(--blue);
    font-weight: 600;
  }

  .bottom-tab-btn:active {
    transform: scale(0.94);
  }

  /* 圖示 wrapper — 確保 SVG 大小一致 */
  .bottom-tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
  }

  /* Active tab 圖示：小藍點 pill 背景（iOS 17+ 風格） */
  .bottom-tab-btn.active .bottom-tab-icon {
    background: rgba(0, 122, 255, 0.12);
    border-radius: 8px;
    width: 36px;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — Header 精簡（隱藏上方 pageNav）
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* 隱藏上方三個頁面切換按鈕（已移至 Bottom Tab Bar） */
  .hdr-page-nav {
    display: none !important;
  }

  /* Sub-tabs 水平無捲軸 */
  .hdr-sub-nav {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 1px;
  }
  .hdr-sub-nav::-webkit-scrollbar {
    display: none;
  }

  /* Sub-tab 每個按鈕：防止文字換行 + 觸控回饋 */
  .hdr-sub-tab {
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .hdr-sub-tab:active {
    opacity: 0.6;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — Main content 底部 padding（讓 Bottom Tab 不擋內容）
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .main-content {
    padding: 16px 16px calc(var(--bottom-tab-h) + env(safe-area-inset-bottom) + 24px) !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — Modal → Bottom Sheet
   手機上 modal 改成從底部滑入的 Sheet
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* 覆蓋層：靠底對齊 */
  .modal-back {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  /* Sheet 卡片：全寬、圓角只在上方，底部留 tab bar 空間 */
  .modal-card {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: var(--radius-large) var(--radius-large) 0 0 !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    animation: sheet-slide-up 0.38s var(--ease-out) !important;
    padding-bottom: calc(var(--bottom-tab-h, 54px) + env(safe-area-inset-bottom) + 16px) !important;
  }

  /* Drag handle（視覺提示） */
  .modal-card::before {
    content: "";
    display: block;
    width: 36px;
    height: 5px;
    border-radius: 99px;
    background: var(--fill-secondary);
    margin: 10px auto -4px;
    flex-shrink: 0;
  }
}

@keyframes sheet-slide-up {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — Sub-tab：手機只顯示圖示，隱藏文字
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* 隱藏 sub-tab 裡的文字 span，保留 SVG icon */
  .hdr-sub-tab .sub-tab-label {
    display: none;
  }

  /* sub-tab 數字 badge 也隱藏，節省空間 */
  .hdr-sub-tab .sub-tab-count {
    display: none;
  }

  /* sub-tab 按鈕縮小：只剩圖示 padding */
  .hdr-sub-tab {
    padding: 10px 14px !important;
    gap: 0 !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — BentoBoard：8 欄 → 4 欄
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .bento-board {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  /* ── 真實比例 + 呼吸感
     4 col, 16px side-padding, 14px gap → col ≈ 74px
     2x2: 2cols+gap = 162px wide, 2rows+gap = 150px tall → near-square
     2x1: 162px wide × 68px tall → ≈ 2.4:1, feels like widget tile  */
  :root {
    --bento-row-h: 68px;
    --bento-gap:   14px;
  }

  /* 大圓角：配合進度圓環視覺語言 */
  .bento-board .tcard.tile {
    border-radius: 20px !important;
  }

  /* 總覽底部 4-up 摘要卡：4 欄 → 2×2 */
  .overview-summary-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* size 對應：3x2 → span 4（全寬），2x2/2x1/1x1 → span 2（半寬） */
  .bento-card-3x2 { grid-column: span 4 !important; }
  .bento-card-2x2 { grid-column: span 2 !important; }
  .bento-card-2x1 { grid-column: span 2 !important; }
  .bento-card-1x1 { grid-column: span 2 !important; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — Parts Kanban：水平滾動
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .parts-kanban-container {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
    margin-inline: -16px;
    padding-inline: 16px;
  }
  .parts-kanban-container::-webkit-scrollbar { display: none; }

  .parts-kanban-grid {
    grid-template-columns: repeat(7, 240px) !important;
    width: max-content;
  }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — Resources 列表：5 欄 grid → 二行卡片
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .resource-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding: 12px 14px !important;
  }

  .resource-row-line1 {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .resource-row-line2 {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 2px;
  }

  /* 隱藏序號欄位（手機空間太小） */
  .resource-row-index {
    display: none !important;
  }
}


/* ═══════════════════════════════════════════════════════════
   MOBILE — KPI 一列壓縮 + SectionHead wrap + filter 圖示化
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── KPI strip：4 tiles 一列橫排，字型壓縮 ── */
  .kpi-strip {
    flex-wrap: nowrap !important;
    gap: 8px !important;
  }
  .kpi-strip .widget-tile {
    flex: 1 1 0 !important;
    padding: 12px 6px 12px 14px !important; /* 將內容微幅往右推 */
    min-width: 0 !important;
  }
  .kpi-strip .widget-eyebrow {
    font-size: 8px !important;
    letter-spacing: 0.05em !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .kpi-strip .widget-value {
    font-size: 26px !important;
    line-height: 1.1 !important;
    letter-spacing: -0.02em !important;
  }
  .kpi-strip .widget-foot {
    font-size: 9px !important;
    margin-top: 3px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── SectionHead：title 與 actions 分兩行 ── */
  .section-head-row {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding-bottom: 4px !important;
  }
  .section-head-actions {
    width: 100% !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 6px !important;
    flex-shrink: 0 !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
  }
  .section-head-actions::-webkit-scrollbar { display: none; }

  /* ── SegmentedFilter shortLabel 模式（子系統 / role / gantt-view-toggle）── */
  /* 隱藏全名，顯示縮寫 */
  .subsystem-filter .seg-label,
  .view-filter .seg-label,
  .gantt-view-toggle .seg-label,
  .role-filter .seg-label { display: none; }

  .subsystem-filter .seg-short,
  .role-filter .seg-short {
    display: inline;
    font-size: 11.5px;
  }

  /* Icon only when no shortLabel (uiIcon / subIcon buttons) */
  .subsystem-filter button,
  .view-filter button {
    padding: 0 9px !important;
    min-width: 30px;
  }

  /* ── 新增按鈕：只留圖示 ── */
  .btn-new-task .btn-label {
    display: none;
  }
  .btn-new-task {
    padding: 0 10px !important;
    min-width: 32px;
  }
}

/* 桌面：.seg-short 永遠不顯示 */
@media (min-width: 769px) {
  .role-filter .seg-short { display: none; }
  /* 桌面 1x1 小卡：底列時間標籤空間不足，隱藏 */
  .bento-small-foot { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — Resources KPI：隱藏描述文字、label 不換行、隱藏分組標題
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* 描述文字 + 中文 label 佔太多空間，手機只留 eyebrow + 數字 */
  .resource-kpi-desc  { display: none !important; }
  .resource-kpi-label { display: none !important; }
  .resource-group-header { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — Gantt chart：縮短 label 欄，留更多空間給時間軸
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .gantt-ruler { padding-left: 130px !important; }
  .gantt-label { width: 130px !important; }
}

/* Mobile unified bars — hidden on desktop */
.worklog-mobile-bar,
.parts-mobile-bar,
.people-mobile-bar,
.resources-mobile-cat { display: none; }

/* ═══════════════════════════════════════════════════════════
   MOBILE — Header scroll-hide
   捲下 > 60px 後 header 絲滑收起，往上捲或回頂部即出現
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Fixed positioning — 脫離文件流 */
  .hdr-wrapper {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transition: transform 0.32s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
  }
  /* 手機：整個 wrapper 不整個 translateY，改為只讓主列 header 滑出 */
  .hdr-wrapper.hdr--hidden {
    transform: none !important;
  }
  /* 主列（logo＋頭像）：捲下時向上滑出 */
  .hdr-wrapper header {
    transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1),
                opacity 0.22s ease;
    height: 38px !important;
  }
  /* 縮小手機版 Logo 尺寸 */
  .hdr-wrapper header .hdr-logo-box {
    width: 22px !important;
    height: 22px !important;
  }
  .hdr-wrapper header .hdr-logo-img {
    height: 22px !important;
  }
  .hdr-wrapper header .hdr-wordmark {
    font-size: 13.5px !important;
  }
  .hdr-wrapper.hdr--hidden header {
    transform: translateY(-100%) !important;
    opacity: 0 !important;
  }
  /* sub-nav 列：始終可見，transition 讓它跟上 */
  .hdr-subbar {
    transition: transform 0.28s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
  }
  .hdr-wrapper.hdr--hidden .hdr-subbar {
    transform: translateY(-52px) !important; /* 補上主列消失的高度 */
  }
  /* main-content 頂部留出 header 實際高度（JS 寫入 --hdr-total-h）*/
  .main-content {
    /* 預設總高： 38 (header) + 34 (subbar) = 72px */
    padding-top: calc(var(--hdr-total-h, 72px) + 24px) !important;
  }

  /* ── Header actions：隱藏搜尋＋匯出，只留頭像；頭像推至右側 ── */
  .hdr-btn-search,
  .hdr-btn-export { display: none !important; }
  /* avatar 推至右上角，並微調往左移以對齊下方 icon */
  .hdr-wrapper header > div:last-child { 
    margin-left: auto !important; 
    margin-right: 12px !important; 
  }
  /* 底部導覽列改為頭像左側一鍵切換，隱藏 bottom tab bar */
  .bottom-tab-bar { display: none !important; }
  /* 頁面圖示導覽：手機顯示，目前頁面標藍 */
  .hdr-page-icons { display: flex; align-items: center; gap: 2px; margin-right: 10px; }
  .hdr-page-icon-btn.is-active {
    color: var(--blue) !important;
    background: rgba(0, 122, 255, 0.12) content-box !important;   /* 只填內框：比 44px 觸控區小一圈 */
    padding: 8px 4px !important;
    border-radius: 12px !important;
  }

  /* ── Section-head：移除 hint 小字，但保留標題 ── */
  /* .section-head { display: none !important; } */
  .section-head-actions .eyebrow { display: none !important; }
  .section-head-row { justify-content: flex-end !important; }

  /* ── 所有選擇欄統一玻璃質感背景 ── */
  .subsystem-filter,
  .view-filter,
  .view-toggle,
  .role-filter,
  .gantt-view-toggle {
    background: rgba(120, 120, 128, 0.16) !important;
    border-radius: 999px !important;
  }
  /* ── Active/selected 狀態統一 (預設為 Light Mode) ── */
  .seg-btn--active,
  .view-toggle-btn.active {
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.08) !important;
    color: #000000 !important;
    border: none !important;
    transform: none !important;
  }
  .seg-btn--active svg,
  .view-toggle-btn.active svg,
  .seg-btn--active svg *,
  .view-toggle-btn.active svg * {
    stroke: currentColor !important;
  }
  .seg-btn--active svg circle[fill],
  .view-toggle-btn.active svg circle[fill] {
    fill: currentColor !important;
  }

  /* ── Active/selected 狀態統一 (Dark Mode 覆寫) ── */
  [data-appearance="dark"] .seg-btn--active,
  [data-appearance="dark"] .view-toggle-btn.active {
    background: rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.12) !important;
    color: #ffffff !important;
  }
  [data-appearance="dark"] .seg-btn--active svg,
  [data-appearance="dark"] .view-toggle-btn.active svg,
  [data-appearance="dark"] .seg-btn--active svg *,
  [data-appearance="dark"] .view-toggle-btn.active svg * {
    stroke: currentColor !important;
  }
  [data-appearance="dark"] .seg-btn--active svg circle[fill],
  [data-appearance="dark"] .view-toggle-btn.active svg circle[fill] {
    fill: currentColor !important;
  }

  /* ── CardPreview → 置中圖卡（含左側留白）── */
  .card-preview-overlay {
    align-items: center !important;
    padding: 16px !important;
  }
  .card-preview-card {
    max-width: 100% !important;
    width: 100% !important;
    min-height: 0 !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    border-radius: 24px !important;
    animation: modal-pop .35s var(--ease-out) !important;
    padding-bottom: calc(var(--bottom-tab-h, 54px) + env(safe-area-inset-bottom) + 8px) !important;
  }
  .card-preview-card::before { display: none !important; }
  .card-preview-head {
    padding: 44px 28px 16px 36px !important;
  }

  /* ── Gantt row actions — hidden on mobile ── */
  .gantt-row-actions { display: none !important; }

  /* ── Section-head action buttons — ghost icon only ── */
  .section-head-actions .btn .btn-label { display: none !important; }
  .section-head-actions .btn {
    padding: 0 !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 0 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    color: var(--ink) !important;
    border: none !important;
    box-shadow: none !important;
  }
  .section-head-actions .btn > svg { width: 13px !important; height: 13px !important; stroke-width: 1.5px !important; stroke: var(--faint) !important; }

  /* ── Resources 手機：隱藏分類篩選（左側）只留 圖卡/列表 切換 ── */
  .section-head-actions .view-filter { display: none !important; }

  /* ── Worklog: subsystem scroll wrapper — left side scrolls, right controls fixed ── */
  .worklog-sub-scroll {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }
  .worklog-sub-scroll::-webkit-scrollbar { display: none; }
  .worklog-sub-scroll .subsystem-filter { width: max-content; }

  /* Prevent parent from double-scrolling */
  .worklog-view .section-head-actions { overflow: visible !important; }

  /* ── Worklog mobile unified glass pill bar ── */
  .worklog-mobile-bar,
  .parts-mobile-bar,
  .plans-mobile-bar,
  .people-mobile-bar {
    display: inline-flex !important;
    align-items: center !important;
    align-self: flex-end !important;
    gap: 0 !important;
    padding: 2px !important;
    background: rgba(120,120,128,0.16) !important;
    border-radius: 999px !important;
    height: 32px !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    max-width: 100% !important;
  }
  .worklog-mobile-bar::-webkit-scrollbar,
  .parts-mobile-bar::-webkit-scrollbar,
  .plans-mobile-bar::-webkit-scrollbar,
  .people-mobile-bar::-webkit-scrollbar { display: none; }

  /* ── Resources mobile unified glass pill ── */
  .resources-mobile-cat {
    display: inline-flex !important;
    align-items: center !important;
    align-self: flex-end !important;
    gap: 0 !important;
    padding: 2px !important;
    background: rgba(120,120,128,0.16) !important;
    border-radius: 999px !important;
    height: 32px !important;
  }
  .resources-mobile-cat::-webkit-scrollbar { display: none; }

  /* ── Both views: hide section-head-row on mobile (controls in mobile bar) ── */
  .worklog-view .section-head-row,
  .resources-view .section-head-row { display: none !important; }

  /* ── People & Plans: unify section-head-actions into a glass pill, right-aligned ── */
  /* Override global width:100% / flex-start on section-head-actions for these two views */
  .people-view .section-head-actions,
  .plans-view  .section-head-actions {
    width: auto !important;
    justify-content: flex-end !important;
    overflow-x: visible !important;
    padding-bottom: 0 !important;
  }
  /* Outer wrapper of the action buttons (last-child avoids eyebrow hint div) → inline-flex pill */
  .people-view .section-head-actions > div:last-child,
  .plans-view  .section-head-actions > div:last-child {
    display: inline-flex !important;
    align-items: center !important;
    background: rgba(120,120,128,0.16) !important;
    border-radius: 999px !important;
    padding: 2px !important;
    height: 32px !important;
    gap: 0 !important;
  }
  /* Remove nested pill from role-filter / view-toggle inside the outer pill */
  .people-view .role-filter,
  .plans-view  .view-toggle {
    background: transparent !important;
    padding: 0 !important;
    height: auto !important;
    border-radius: 0 !important;
    gap: 0 !important;
  }
  /* Tighten SegmentedFilter button padding inside people pill */
  .people-view .role-filter button {
    padding: 0 7px !important;
    height: 28px !important;
    font-size: 11px !important;
  }
  /* Add (+) button inside pill: icon-only ghost */
  .people-view .section-head-actions .btn,
  .plans-view  .section-head-actions .btn {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 999px !important;
    border: none !important;
    color: var(--ink) !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    min-width: 0 !important;
  }


  /* ── Resources view search bar — hidden on mobile ── */
  .section-search-box { display: none !important; }

  /* ── Bottom tab bar — icon only, no text ── */
  .bottom-tab-btn > span:not(.bottom-tab-icon) { display: none !important; }
  .bottom-tab-btn { min-width: 0 !important; padding: 10px 16px !important; }

  /* ════════════════════════════════════════════════════
     呼吸空間改善 — Breathing Space System
     ════════════════════════════════════════════════════ */

  /* 1. 收窄 gap tokens：讓各 section 間距更緊湊、有節奏感 */
  :root {
    --gap-zone: 24px;
    --gap-card:  8px;
  }

  /* 2. KPI strip：固定 8px gap，確保 4 卡等寬對齊 */
  .kpi-strip {
    gap: 8px !important;
    align-items: stretch !important;
  }
  .kpi-strip > * { flex: 1 1 0 !important; }

  /* KPI 卡：中文/英文保留一個 — 隱藏下方 foot，只留 eyebrow */
  .widget-foot { display: none !important; }

  /* 3. 頂部 sub-nav — 改為可橫滑，每個 tab 自然呼吸 */
  .hdr-sub-nav {
    justify-content: flex-end !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    padding: 0px 0px !important; /* 將 padding 移交給 tab 本身 */
    gap: 0px !important;
    width: 100% !important;
  }
  .hdr-sub-nav::-webkit-scrollbar { display: none; }
  .hdr-sub-tab {
    flex-shrink: 0 !important;
    padding: 0px 24px !important; /* 加寬至 24px，按鈕間距達到 48px */
    min-width: auto !important;
    height: 34px !important;
  }
  .hdr-sub-tab:last-child {
    padding-right: 16px !important; /* 恢復原狀，不更動 icon 位置 */
  }

  /* 4. section-head-row：刻意加大手機版的上下間距 */
  .section-head-row {
    margin-top: 16px !important;
    margin-bottom: 8px !important;
  }

  /* 5. 通用卡片：統一 padding 為 14px（稍小於桌面 16px） */
  .tcard.large { padding: 14px !important; }

  /* 6. 人員頁 person-card grid：單欄全寬 */
  .people-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* 7. 總覽本週重點卡片：手機半寬時改為卡片式堆疊
        - label 允許換行，移除單行省略
        - priority pill 移到 label 下方（flex-wrap）
        - date 縮至最小 */
  .weekly-focus-row {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  .weekly-focus-date {
    width: auto !important;
    flex-shrink: 0 !important;
    font-size: 8px !important;
    opacity: 0.7 !important;
  }
  .weekly-focus-label {
    white-space: normal !important;       /* 允許換行 */
    overflow: visible !important;
    text-overflow: unset !important;
    font-size: 11.5px !important;
    line-height: 1.35 !important;
    flex: 1 1 100% !important;           /* 獨佔一行 */
    order: 2 !important;                 /* date → label → pill */
  }
  .weekly-focus-date { order: 1 !important; }
  .weekly-focus-row .pill { order: 3 !important; flex-shrink: 0 !important; font-size: 9px !important; padding: 2px 7px !important; }
  /* SectionHead 本週重點卡：在手機隱藏 WEEKLY hint 節省空間 */
  .weekly-focus-card .section-head { display: flex !important; }

  /* ── WorklogView 間距：原先被寫死為 bento-gap (14px)，導致與其他頁面 (24px) 不同，在此移除 ── */
  /* .worklog-view {
    gap: var(--bento-gap, 14px) !important;
  } */
  .kpi-strip {
    gap: 10px !important;
  }

  /* ── Resources KPI 四欄：手機隱藏說明文字和中文標籤，只留數字 ── */
  .resource-kpi-desc  { display: none !important; }
  .resource-kpi-label { display: none !important; }

  /* ── Resources KPI：高度對齊 widget-tile（12px 8px padding, 26px 數字） ── */
  .resources-view .kpi-strip .tcard.tile {
    padding: 12px 8px !important;
  }
  .resource-kpi-num {
    margin-top: 4px !important;
  }
  /* font-size 是 inline style → 需要 !important 覆蓋 */
  .resource-kpi-num > div {
    font-size: 26px !important;
    line-height: 1.1 !important;
    letter-spacing: -0.02em !important;
  }

  /* ── Gantt chart：橫向可滑動，隱藏捲軸 ── */
  .gantt-scroll {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .gantt-scroll::-webkit-scrollbar { display: none; }
}

/* ============================================================
   桌面端一體化玻璃膠囊控制列 (Unified Control Bar)
   ============================================================ */
@media (min-width: 769px) {
  .kpi-strip {
    display: flex !important;
    align-items: stretch !important;
    gap: var(--gap-card) !important;
  }

  /* 控制列：純 flex，無玻璃底色 */
  .section-head-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 0 var(--gap-zone) !important;
    margin-bottom: 0 !important;
    box-shadow: none !important;
    height: auto !important;
    gap: 12px !important;
  }

  /* 卡片內部的 SectionHead：padding 小一點 */
  .tcard .section-head-row {
    padding: 0 0 8px !important;
    align-items: baseline !important;
  }



  .section-head-left {
    display: flex !important;
    align-items: baseline !important;
    gap: 10px !important;
    min-width: 0 !important;
  }

  .section-head {
    white-space: nowrap !important;
  }

  .section-head-zh {
    font-size: 15px !important;
    font-weight: 300 !important;
    letter-spacing: 0.18em !important;
  }

  .section-head-dot {
    font-size: 14px !important;
    margin: 0 6px !important;
  }

  .section-head-en {
    font-size: 11px !important;
    font-weight: 400 !important;
    letter-spacing: 0.07em !important;
  }

  .section-head-actions {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }

  /* 桌面端：seg-filter-wrap 稍微加深一點背景，貼近磨砂玻璃膠囊 */
  .seg-filter-wrap {
    background: rgba(120, 120, 128, 0.14) !important;
  }
  [data-appearance="dark"] .seg-filter-wrap {
    background: rgba(255, 255, 255, 0.10) !important;
  }

  /* 桌面端：按鈕 active 加大陰影層次 */
  .seg-btn.seg-btn--active {
    box-shadow:
      0 2px 8px rgba(0,0,0,0.12),
      0 1px 3px rgba(0,0,0,0.08),
      inset 0 1px 0 rgba(255,255,255,0.9) !important;
  }
  [data-appearance="dark"] .seg-btn.seg-btn--active {
    box-shadow:
      0 1px 2px rgba(0,0,0,0.35),
      inset 0 1px 0 rgba(255,255,255,0.14) !important;
  }
}

/* ============================================================
   Bento 拖拽彈簧動畫與虛擬陰影 (Drag & Drop)
   ============================================================ */
@media (min-width: 769px) {
  .parts-kanban-grid > .tcard {
    transition: transform 0.28s var(--ease-spring), 
                box-shadow 0.28s var(--ease-spring), 
                background-color 0.28s var(--ease-spring),
                outline-color 0.28s var(--ease-spring) !important;
  }

  .parts-kanban-grid > .tcard.drag-over {
    background: var(--accent-bg) !important;
    outline: 1.5px dashed var(--accent) !important;
    outline-offset: -3px !important;
    transform: scale(1.02) translateY(-2px);
    box-shadow: 
      0 12px 32px rgba(0, 122, 255, 0.08), 
      0 4px 12px rgba(0, 122, 255, 0.03) !important;
  }

  .tcard.dragging {
    opacity: 0.45 !important;
    transform: scale(0.96) rotate(-1deg) !important;
    box-shadow: var(--shadow-1) !important;
    border: 0.5px dashed var(--accent) !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   DECK — 簡報頁（Deck.jsx）
   16:9 舞台 + container query：字級用 --u（預設 1cqw），縮放時比例不變
   手機直拿（.is-portrait）：舞台改直式鋪滿，--u 放大、版型改成上下堆疊
   ═══════════════════════════════════════════════════════════ */
.deck-root {
  --u: 1cqw;                             /* 簡報字級／間距的單位：舞台寬的 1% */
  --deck-on-photo: #F5F5F7;              /* 照片上的文字：固定柔白（底下有深色 scrim） */
  --deck-on-photo-dim: rgba(245,245,247,0.72);
  position: fixed;
  inset: var(--hdr-total-h, 52px) 0 0 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  padding: 24px 40px calc(16px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  gap: 16px;
}
.deck-stage-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size;
}
.deck-stage {
  position: relative;
  width: min(100cqw, 100cqh * 16 / 9);
  aspect-ratio: 16 / 9;
  container-type: inline-size;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-3);
  border: 0.5px solid var(--separator);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* 切換動效 */
.deck-frame {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(0.985);
  pointer-events: none;
  transition: opacity 0.4s var(--ease-progress), transform 0.5s var(--ease-spring);
}
.deck-frame.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
  .deck-frame { transition: none; transform: none; }
}

/* 左右點擊區（透明） */
.deck-hit {
  position: absolute;
  top: 0; bottom: 0;
  width: 18%;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 2;
}
.deck-hit:disabled { cursor: default; }
.deck-hit--prev { left: 0; cursor: w-resize; }
.deck-hit--next { right: 0; cursor: e-resize; }

/* ── 投影片基本 ── */
.deck-slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  color: var(--label-primary);
  font-family: var(--font-system);
  box-sizing: border-box;
}
.deck-slide--pad { padding: calc(6.5 * var(--u)) calc(7 * var(--u)); }
.deck-slide--center { justify-content: center; }

.deck-eyebrow {
  font-size: calc(1.35 * var(--u));
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--label-secondary);
  margin-bottom: calc(1.4 * var(--u));
}
.deck-title-xl, .deck-title-lg, .deck-title-md {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.deck-title-xl { font-size: calc(7.2 * var(--u)); }
.deck-title-lg { font-size: calc(4.6 * var(--u)); }
.deck-title-md { font-size: calc(3.4 * var(--u)); margin-bottom: calc(3.2 * var(--u)); }
.deck-subtitle {
  margin: calc(1.6 * var(--u)) 0 0;
  font-size: calc(2 * var(--u));
  font-weight: 500;
}
.deck-body {
  margin: 0;
  font-size: calc(1.75 * var(--u));
  line-height: 1.7;
  color: var(--label-secondary);
}
.deck-body--wide { margin-top: calc(2.4 * var(--u)); max-width: calc(62 * var(--u)); }

/* ── 照片版（封面／結尾） ── */
.deck-slide--photo { justify-content: flex-end; }
.deck-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.deck-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10,10,12,0.82) 0%, rgba(10,10,12,0.55) 45%, rgba(10,10,12,0.05) 80%);
}
.deck-photo-text {
  position: relative;
  padding: 0 calc(7 * var(--u)) calc(6.5 * var(--u));
  color: var(--deck-on-photo);
}
.deck-slide--photo .deck-eyebrow,
.deck-slide--photo .deck-subtitle { color: var(--deck-on-photo-dim); }

.deck-contacts {
  display: flex;
  gap: calc(3.2 * var(--u));
  margin-top: calc(3.2 * var(--u));
}
.deck-contact { display: flex; flex-direction: column; gap: calc(0.5 * var(--u)); }
.deck-contact-label { font-size: calc(1.15 * var(--u)); color: var(--deck-on-photo-dim); letter-spacing: 0.04em; }
.deck-contact-value { font-size: calc(1.8 * var(--u)); font-weight: 600; }

/* ── 卡片（欄位／格狀） ── */
.deck-card {
  background: var(--bg-primary);
  border: 0.5px solid var(--separator);
  border-radius: calc(1.6 * var(--u));
  padding: calc(2.4 * var(--u));
}
.deck-card-head {
  font-size: calc(1.9 * var(--u));
  font-weight: 600;
  margin-bottom: calc(0.8 * var(--u));
}
.deck-columns {
  min-height: calc(24 * var(--u));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(2.4 * var(--u));
}
.deck-bullets {
  margin: calc(1 * var(--u)) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: calc(1.3 * var(--u));
}
.deck-bullets li {
  font-size: calc(1.75 * var(--u));
  color: var(--label-primary);
  padding-left: calc(2 * var(--u));
  position: relative;
}
.deck-bullets li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.7em;
  width: calc(0.7 * var(--u)); height: calc(0.7 * var(--u));
  border-radius: 50%;
  background: var(--label-tertiary);
}

.deck-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: calc(1.8 * var(--u));
}
.deck-cell {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  text-align: left;
  font: inherit;
  color: inherit;
  position: relative;
  z-index: 3;                 /* 高於左右翻頁點擊區 */
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}
.deck-cell:disabled { cursor: default; }
.deck-cell:not(:disabled):hover { background: var(--fill-quaternary); border-color: var(--separator-opaque); }
.deck-cell:not(:disabled):active { transform: scale(0.98); }
.deck-grid-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: calc(2 * var(--u));
}
.deck-grid-hint {
  font-size: calc(1.3 * var(--u));
  color: var(--label-tertiary);
  margin-bottom: calc(3.4 * var(--u));
}

/* 展開的系統介紹（覆蓋在格狀投影片上）：左側透明，露出底下常駐的 3D 車 */
.deck-detail {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: 46% 1fr;
  animation: deck-detail-in 0.35s var(--ease-spring);
}
.deck-slide--detail-open .deck-grid,
.deck-slide--detail-open .deck-grid-head { visibility: hidden; }
@keyframes deck-detail-in {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .deck-detail { animation: none; } }
.deck-detail-side {
  position: relative;
  overflow: hidden;
}
.deck-detail-emblem {   /* 沒有 3D 車的組（行銷、財務後勤）：大圖示 */
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--label-quaternary);
}
.deck-detail-emblem svg { width: calc(12 * var(--u)); height: calc(12 * var(--u)); }
.deck-detail-figure {   /* 去背人像：貼齊底部，完整顯示 */
  position: absolute;
  inset: calc(3 * var(--u)) calc(2 * var(--u)) 0;
  width: calc(100% - calc(4 * var(--u)));
  height: calc(100% - calc(3 * var(--u)));
  object-fit: contain;
  object-position: center bottom;
}

/* 常駐 3D 車：墊在所有投影片底下，由投影片的 car 欄位決定位置與顯示 */
.deck-car-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.deck-car-backdrop,
.deck-car-canvas {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s var(--ease-progress);
}
.deck-car-backdrop {
  background:
    radial-gradient(ellipse 55% 75% at 70% 58%, rgba(255,149,0,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 70% 90% at 68% 55%, #2A2D33 0%, #121316 62%, #0A0A0C 100%);
}
.deck-car-canvas { width: 100%; height: 100%; display: block; }
.deck-car-backdrop.is-on,
.deck-car-canvas.is-visible { opacity: 1; }

/* 爆炸圖上的系統標籤（位置每幀由 JS 投影） */
.deck-car-labels { position: absolute; inset: 0; overflow: hidden; }
.deck-car-label {
  position: absolute;
  left: 0; top: 0;
  opacity: 0;
  display: flex;
  align-items: center;
  gap: calc(0.6 * var(--u));
  padding: calc(0.45 * var(--u)) calc(1.1 * var(--u));
  border-radius: 999px;
  font-size: calc(1.25 * var(--u));
  font-weight: 600;
  white-space: nowrap;
  color: #F5F5F7;
  background: rgba(18,18,22,0.62);
  border: 0.5px solid rgba(255,255,255,0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  will-change: transform, opacity;
}
.deck-car-label::before {
  content: "";
  width: calc(0.55 * var(--u)); height: calc(0.55 * var(--u));
  border-radius: 50%;
  background: var(--orange);
}

/* 3D 舞台投影片（爆炸圖）：白字壓在深色背景上；模型還沒好時自己墊深色 */
.deck-stage-slide { color: var(--deck-on-photo); }
.deck-stage-slide .deck-eyebrow,
.deck-stage-slide .deck-body { color: var(--deck-on-photo-dim); }
.deck-stage-body { max-width: calc(34 * var(--u)); margin-top: calc(1.6 * var(--u)); }
.deck-root:not(.is-car-ready) .deck-stage-slide { background: #111214; }

/* 模型載好後，有 car 的投影片把照片淡掉，換成 3D 車（載入失敗就一直顯示照片） */
.deck-photo,
.deck-split-media img { transition: opacity 0.8s var(--ease-progress); }
.deck-root.is-car-ready .deck-slide--car .deck-photo,
.deck-root.is-car-ready .deck-slide--car .deck-split-media img { opacity: 0; }
.deck-car-status, .deck-car-note {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  font-size: calc(1.2 * var(--u));
  color: var(--label-tertiary);
}
.deck-car-status { top: 50%; transform: translateY(-50%); }
.deck-car-note { bottom: calc(3 * var(--u)); }
.deck-detail-title {
  display: flex;
  align-items: center;
  gap: calc(1.4 * var(--u));
  margin-bottom: calc(2.4 * var(--u));
}
.deck-detail-title .deck-title-md { margin: 0; }
.deck-detail-icon { color: var(--label-secondary); display: flex; }
.deck-detail-icon svg { width: calc(3 * var(--u)); height: calc(3 * var(--u)); }
.deck-detail-what { margin-bottom: calc(2.6 * var(--u)); }
.deck-detail-label {
  font-size: calc(1.2 * var(--u));
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--label-tertiary);
  margin-bottom: calc(1 * var(--u));
}
.deck-detail-main {
  padding: calc(5 * var(--u)) calc(6 * var(--u)) calc(4 * var(--u)) calc(4.5 * var(--u));
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.deck-steps {
  list-style: none;
  margin: calc(0.6 * var(--u)) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: calc(1.4 * var(--u));
}
.deck-steps li {
  display: flex;
  gap: calc(1.4 * var(--u));
  align-items: baseline;
  font-size: calc(1.6 * var(--u));
  line-height: 1.5;
}
.deck-detail-pager {
  display: flex;
  flex-wrap: wrap;
  gap: calc(0.8 * var(--u));
  margin-top: calc(3 * var(--u));
}
.deck-detail-tab {
  font: inherit;
  font-size: calc(1.25 * var(--u));
  padding: calc(0.6 * var(--u)) calc(1.4 * var(--u));
  border-radius: var(--radius-full);
  border: 0.5px solid var(--separator);
  background: transparent;
  color: var(--label-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.deck-detail-tab:hover { background: var(--fill-tertiary); color: var(--label-primary); }
.deck-detail-tab.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.deck-detail-close {
  position: absolute;
  top: calc(2 * var(--u)); right: calc(2 * var(--u));
  min-width: 44px; min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--fill-tertiary);
  color: var(--label-secondary);
  cursor: pointer;
  z-index: 1;
}
.deck-detail-close:hover { background: var(--fill-secondary); color: var(--label-primary); }
.deck-cell-icon {
  color: var(--label-secondary);
  margin-bottom: auto;
  display: flex;
}
.deck-cell-icon svg { width: calc(2.6 * var(--u)); height: calc(2.6 * var(--u)); }
.deck-cell-text { font-size: calc(1.5 * var(--u)); color: var(--label-secondary); line-height: 1.5; }

/* ── 左文右圖 ── */
.deck-split {
  flex-direction: row;
}
.deck-split-text {
  flex: 0 0 42%;
  padding: calc(6.5 * var(--u)) calc(3 * var(--u)) calc(6.5 * var(--u)) calc(7 * var(--u));
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}
.deck-split-media {
  flex: 1;
  position: relative;
}
.deck-split-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── 編號清單 ── */
.deck-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(2.4 * var(--u)) calc(4 * var(--u));
  align-content: center;
}
.deck-list-row { display: flex; gap: calc(1.8 * var(--u)); align-items: baseline; }
.deck-list-num {
  font-size: calc(1.5 * var(--u));
  font-weight: 600;
  font-feature-settings: var(--num-features);
  color: var(--label-tertiary);
}

/* ── 團隊管理：旗號（沿用 columns）／水線（沿用 split） ── */
.deck-flags { grid-template-columns: repeat(3, 1fr); min-height: 0; }
.deck-flags .deck-bullets { margin-top: calc(1.4 * var(--u)); gap: calc(0.9 * var(--u)); }
.deck-flags .deck-bullets li { font-size: calc(1.5 * var(--u)); line-height: 1.45; }
.deck-flags .deck-bullets li::before { top: 0.62em; }
.deck-flags-foot { margin-top: calc(2.2 * var(--u)); font-size: calc(1.6 * var(--u)); }

.deck-lamp-head { display: flex; align-items: center; gap: calc(1 * var(--u)); }
.deck-lamp {   /* 燈號：實心圓＋同色淡光暈 */
  width: calc(1.5 * var(--u)); height: calc(1.5 * var(--u));
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--lamp);
  box-shadow: 0 0 0 calc(0.45 * var(--u)) color-mix(in srgb, var(--lamp) 22%, transparent);
}
.deck-flow-arrow { font-size: calc(1.6 * var(--u)); color: var(--label-tertiary); margin: calc(0.8 * var(--u)) 0; }
.deck-flow-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(2.4 * var(--u));
  margin-top: calc(2.8 * var(--u));
  padding-top: calc(2 * var(--u));
  border-top: 0.5px solid var(--separator);
}
.deck-flow-fact-head { font-size: calc(1.5 * var(--u)); font-weight: 600; margin-bottom: calc(0.4 * var(--u)); }
.deck-title--lines { white-space: pre-line; }
.deck-aside { margin-top: calc(2.4 * var(--u)); padding: calc(1.8 * var(--u)) calc(2 * var(--u)); }
.deck-aside .deck-card-head { font-size: calc(1.5 * var(--u)); }
.deck-aside .deck-cell-text { font-size: calc(1.3 * var(--u)); }
.deck-wl-media { display: flex; align-items: center; padding: 0 calc(7 * var(--u)) 0 calc(2 * var(--u)); }
.deck-wl { width: 100%; height: auto; display: block; font-family: var(--font-system); }
.deck-wl-water { fill: var(--fill-quaternary); }
.deck-wl-line { stroke: var(--separator-opaque); stroke-width: 1.5; }
.deck-wl-hull { fill: var(--bg-primary); stroke: var(--separator-opaque); stroke-width: 1.5; stroke-linejoin: round; }
.deck-wl-hole { fill: var(--bg-secondary); stroke-width: 3; }
.deck-wl-hole--green { stroke: var(--green); }
.deck-wl-hole--red { stroke: var(--red); }
.deck-wl-head { font-size: 19px; font-weight: 600; }
.deck-wl-head--green { fill: var(--green); }
.deck-wl-head--red { fill: var(--red); }
.deck-wl-text { fill: var(--label-secondary); font-size: 15px; }

/* ── 控制列 ── */
.deck-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.deck-ctrl-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--label-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.deck-ctrl-btn:first-child svg { transform: rotate(180deg); }
.deck-ctrl-btn:hover:not(:disabled) { background: var(--fill-tertiary); color: var(--label-primary); }
.deck-ctrl-btn:active:not(:disabled) { transform: scale(0.95); }
.deck-ctrl-btn:disabled { color: var(--label-quaternary); cursor: default; }
.deck-dots { display: flex; gap: 2px; }
.deck-dot {
  width: 22px; height: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.deck-dot::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: var(--radius-full);
  background: var(--label-quaternary);
  transition: width 0.2s ease, margin 0.2s ease, background 0.2s ease;
}
.deck-dot:hover::after { background: var(--label-tertiary); }
.deck-dot.is-active::after { width: 18px; margin-left: -9px; background: var(--blue); }
.deck-counter {
  font-size: 13px;
  font-feature-settings: var(--num-features);
  color: var(--label-secondary);
  min-width: 44px;
  text-align: center;
}

/* ── 全螢幕：黑底、無圓角、控制列懸停才顯示 ── */
.deck-root.is-fullscreen {
  inset: 0;
  padding: 0;
  background: #000;
}
.deck-root.is-fullscreen .deck-stage { border-radius: 0; border: 0; box-shadow: none; }
.deck-root.is-fullscreen .deck-controls {
  position: absolute;
  left: 50%; bottom: 16px;
  transform: translateX(-50%);
  padding: 0 8px;
  border-radius: var(--radius-full);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.deck-root.is-fullscreen:hover .deck-controls { opacity: 1; }
/* 模擬全螢幕（iPhone Safari 沒有 Fullscreen API）：蓋過頂部工具列、鋪滿視窗 */
.deck-root.is-pseudo-full {
  z-index: 180;
  height: 100dvh;
}
/* 全螢幕時避開瀏海與主畫面指示條 */
.deck-root.is-fullscreen {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
/* 觸控裝置沒有 hover：控制列常駐（半透明），才能翻頁與離開全螢幕 */
@media (hover: none) {
  .deck-root.is-fullscreen .deck-controls {
    opacity: 0.85;
    bottom: calc(8px + env(safe-area-inset-bottom));
  }
}

/* 很窄的手機：藏起隊名文字，讓出空間給頁面圖示 */
@media (max-width: 359px) {
  .hdr-wordmark { display: none !important; }
}

@media (max-width: 768px) {
  .deck-root { padding: 16px 16px calc(12px + env(safe-area-inset-bottom)); gap: 8px; }
  .deck-stage { border-radius: var(--radius-md); }
  .deck-dots { display: none; }
}

/* ── 手機直拿：整份簡報改成上下捲動，每張一個畫面；版型改成上下堆疊 ── */
.deck-root.is-portrait { --u: 2.6cqw; padding: 0 0 env(safe-area-inset-bottom); gap: 0; }
/* 舞台貼齊螢幕邊緣，不留外框 */
.deck-root.is-portrait .deck-stage {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  border: 0;
  box-shadow: none;
}
/* 標題只在標點處換行，避免「加／入」這種斷法；太長才硬斷 */
.deck-root.is-portrait :is(.deck-title-xl, .deck-title-lg, .deck-title-md) {
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.deck-root.is-portrait .deck-stage {
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.deck-root.is-portrait .deck-stage::-webkit-scrollbar { display: none; }
/* 3D 車固定在畫面上，投影片從它上面捲過去 */
.deck-root.is-portrait .deck-car-layer {
  position: sticky;
  top: 0;
  height: 100cqh;
  margin-bottom: -100cqh;
}
.deck-root.is-portrait .deck-frame {
  position: relative;
  inset: auto;
  min-height: 100cqh;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: none;
  scroll-snap-align: start;
}
.deck-root.is-portrait .deck-slide { position: relative; inset: auto; min-height: 100cqh; }
/* 捲動時內容已經看得到，不再播進場動畫（避免閃一下） */
.deck-root.is-portrait .deck-frame * { animation: none !important; }
/* 翻頁點擊區、進度條、左右箭頭與圓點都不需要 */
.deck-root.is-portrait :is(.deck-hit, .deck-progress, .deck-dots, .deck-ctrl-btn--prev, .deck-ctrl-btn--next) { display: none; }
.deck-root.is-portrait .deck-detail-main { overflow-y: auto; scrollbar-width: none; }
/* 右下角浮動小膠囊：第幾張／全螢幕 */
.deck-root.is-portrait .deck-controls {
  position: absolute;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  gap: 0;
  padding: 0 2px 0 12px;
  border-radius: var(--radius-full);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 0.5px solid var(--header-border);
  opacity: 1;
  left: auto;
  transform: none;
  z-index: 6;
}
.deck-root.is-portrait .deck-counter { min-width: 0; }
/* 封面底部：提示往下滑 */
.deck-scroll-hint {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(2.4 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--deck-on-photo-dim);
  pointer-events: none;
}
.deck-root.is-portrait .deck-slide > * { flex-shrink: 0; }
/* 置中版型：內容超過一頁時從頂端開始捲，不往上溢出 */
.deck-root.is-portrait .deck-slide--center { justify-content: flex-start; }
.deck-root.is-portrait .deck-slide--center > :first-child { margin-top: auto; }
.deck-root.is-portrait .deck-slide--center > :last-child { margin-bottom: auto; }
.deck-root.is-portrait { --deck-bottom: calc(4 * var(--u) + 56px); }   /* 底部留給浮動計數器 */
.deck-root.is-portrait .deck-slide--pad { padding: calc(6 * var(--u)) calc(4.5 * var(--u)) var(--deck-bottom); }
.deck-root.is-portrait .deck-title-xl { font-size: calc(5.2 * var(--u)); }
.deck-root.is-portrait .deck-title-lg { font-size: calc(3.6 * var(--u)); }
.deck-root.is-portrait .deck-title-md { font-size: calc(2.9 * var(--u)); margin-bottom: calc(2.4 * var(--u)); }
.deck-root.is-portrait .deck-body--wide { max-width: none; }

/* 封面／結尾：車在上半，文字壓在下半的深色漸層上 */
.deck-root.is-portrait .deck-scrim {
  background: linear-gradient(0deg, rgba(10,10,12,0.9) 0%, rgba(10,10,12,0.6) 42%, rgba(10,10,12,0.05) 70%);
}
.deck-root.is-portrait .deck-photo-text { padding: 0 calc(4.5 * var(--u)) var(--deck-bottom); }
.deck-root.is-portrait .deck-contacts { flex-direction: column; gap: calc(1.6 * var(--u)); }

/* 爆炸圖：文字在上，車在下 */
.deck-root.is-portrait .deck-stage-body { max-width: none; }

/* 欄位／燈號／流程／清單：一欄 */
.deck-root.is-portrait .deck-columns,
.deck-root.is-portrait .deck-flags,
.deck-root.is-portrait .deck-list,
.deck-root.is-portrait .deck-flow-facts { grid-template-columns: 1fr; min-height: 0; }
.deck-root.is-portrait .deck-columns { gap: calc(1.6 * var(--u)); }
.deck-root.is-portrait .deck-list { gap: calc(1.8 * var(--u)); }
.deck-root.is-portrait .deck-flow-facts { gap: calc(1.2 * var(--u)); }
.deck-root.is-portrait .deck-card { padding: calc(1.8 * var(--u)); }
.deck-root.is-portrait .deck-bullets { gap: calc(0.8 * var(--u)); }

/* 組別卡片：兩欄三列 */
.deck-root.is-portrait .deck-grid {
  flex: 0 0 auto;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: none;
  grid-auto-rows: minmax(calc(14 * var(--u)), auto);
  gap: calc(1.2 * var(--u));
}
.deck-root.is-portrait .deck-grid-head { flex-direction: column; align-items: flex-start; gap: 0; }
.deck-root.is-portrait .deck-grid-hint { margin-bottom: calc(1.6 * var(--u)); }
.deck-root.is-portrait .deck-cell-icon { margin-bottom: calc(1.2 * var(--u)); }
/* 展開：上方 34% 給 3D 車／圖，下方文字可捲動 */
.deck-root.is-portrait .deck-detail { grid-template-columns: 1fr; grid-template-rows: 34% 1fr; }
.deck-root.is-portrait .deck-detail-main {
  justify-content: flex-start;
  overflow-y: auto;
  padding: calc(2 * var(--u)) calc(4.5 * var(--u)) var(--deck-bottom);
}
.deck-root.is-portrait .deck-detail-emblem svg { width: calc(8 * var(--u)); height: calc(8 * var(--u)); }

/* 左文右圖 → 上文下圖 */
.deck-root.is-portrait .deck-split { flex-direction: column; }
.deck-root.is-portrait .deck-split-text {
  flex: 0 0 auto;
  justify-content: flex-start;
  padding: calc(6 * var(--u)) calc(4.5 * var(--u)) calc(2 * var(--u));
}
.deck-root.is-portrait .deck-split-media { flex: 1 0 calc(40 * var(--u)); }
.deck-root.is-portrait .deck-wl-media { flex: 0 0 auto; padding: 0 calc(4.5 * var(--u)) var(--deck-bottom); }

/* ── DECK 動效：進場、封面緩慢推近、進度條 ───────────────── */

@keyframes deck-rise {
  from { opacity: 0; transform: translateY(calc(1.6 * var(--u))); }
  to   { opacity: 1; transform: none; }
}
@keyframes deck-pop {
  from { opacity: 0; transform: translateY(calc(1.2 * var(--u))) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes deck-kenburns {
  from { transform: scale(1); }
  to   { transform: scale(1.09); }
}

/* 只有目前這張會播；切回來時重新播一次 */
.deck-frame.is-active .deck-eyebrow      { animation: deck-rise 0.5s var(--ease-out) both; }
.deck-frame.is-active .deck-title-xl,
.deck-frame.is-active .deck-title-lg,
.deck-frame.is-active .deck-title-md     { animation: deck-rise 0.55s var(--ease-out) 0.06s both; }
.deck-frame.is-active .deck-subtitle,
.deck-frame.is-active .deck-body         { animation: deck-rise 0.55s var(--ease-out) 0.13s both; }
.deck-frame.is-active .deck-contacts,
.deck-frame.is-active .deck-bullets      { animation: deck-rise 0.55s var(--ease-out) 0.2s both; }

.deck-frame.is-active .deck-card,
.deck-frame.is-active .deck-list-row {
  animation: deck-pop 0.5s var(--ease-out) both;
  animation-delay: calc(0.14s + var(--i, 0) * 0.05s);
}
.deck-grid > *:nth-child(1),  .deck-list-row:nth-child(1),  .deck-columns > *:nth-child(1) { --i: 0; }
.deck-grid > *:nth-child(2),  .deck-list-row:nth-child(2),  .deck-columns > *:nth-child(2) { --i: 1; }
.deck-grid > *:nth-child(3),  .deck-list-row:nth-child(3),  .deck-columns > *:nth-child(3) { --i: 2; }
.deck-grid > *:nth-child(4),  .deck-list-row:nth-child(4) { --i: 3; }
.deck-grid > *:nth-child(5),  .deck-list-row:nth-child(5) { --i: 4; }
.deck-grid > *:nth-child(6),  .deck-list-row:nth-child(6) { --i: 5; }

/* 封面／結尾照片：極慢推近 */
.deck-frame.is-active .deck-photo {
  animation: deck-kenburns 24s linear both;
}
.deck-frame.is-active .deck-split-media img {
  animation: deck-kenburns 30s linear both;
}

/* 系統介紹展開時的內容進場 */
.deck-detail .deck-detail-title,
.deck-detail .deck-detail-label,
.deck-detail .deck-body,
.deck-detail .deck-steps li,
.deck-detail .deck-detail-pager { animation: deck-rise 0.45s var(--ease-out) both; }
.deck-detail .deck-detail-title  { animation-delay: 0.04s; }
.deck-detail .deck-body          { animation-delay: 0.1s; }
.deck-detail .deck-steps li:nth-child(1) { animation-delay: 0.16s; }
.deck-detail .deck-steps li:nth-child(2) { animation-delay: 0.22s; }
.deck-detail .deck-steps li:nth-child(3) { animation-delay: 0.28s; }
.deck-detail .deck-steps li:nth-child(4) { animation-delay: 0.34s; }
.deck-detail .deck-detail-pager  { animation-delay: 0.4s; }

/* 底部進度條 */
.deck-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(0.3 * var(--u));
  min-height: 2px;
  background: var(--fill-quaternary);
  z-index: 5;
}
.deck-progress-fill {
  height: 100%;
  background: var(--blue);
  transform-origin: left center;
  transition: transform 0.5s var(--ease-spring);
}

@media (prefers-reduced-motion: reduce) {
  .deck-frame.is-active *,
  .deck-detail * { animation: none !important; }
  .deck-progress-fill { transition: none; }
}

/* 工作台「零件規格」 */
.part-specs { max-width: 760px; height: calc(100vh - 200px); min-height: 520px; }
.part-specs > .tcard { height: 100%; }

@media (max-width: 768px) {
  .part-specs { height: calc(100vh - 220px); }
}

/* ── 學院 3D 世界（Academy.jsx ＋ AcademyWorld.jsx） ──
   整個畫面是 3D 場景；文字、地圖、步驟列都浮在上面，不加卡片外框。 */
.aw-root {
  position: fixed;
  inset: var(--hdr-total-h, 52px) 0 0 0;
  z-index: 10;
  background: var(--bg-primary);
  overflow: hidden;
  --aw-copy-w: min(460px, 34vw);
}
.aw-root.is-wide { --aw-copy-w: min(540px, 40vw); }
.aw-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.aw-canvas:active { cursor: grabbing; }
.aw-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.aw-labels > * { position: absolute; left: 0; top: 0; will-change: transform; }
.aw-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--label-secondary); pointer-events: none; }

/* 零件標籤：跟著 3D 上的點走 */
.aw-label {
  padding: 5px 12px; border-radius: 999px;
  background: var(--bg-secondary); color: var(--label-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 6px 20px rgba(0,0,0,0.08);
  font-size: 15px; font-weight: 600; white-space: nowrap;
  opacity: 0; transition: opacity 0.4s ease;
}
.aw-label.is-on { opacity: 1; transition-delay: 0.45s; }
.aw-label[data-tone="accent"] { color: var(--orange); }
.aw-label[data-tone="blue"] { color: var(--blue); }
.aw-label[data-tone="soft"] { color: var(--label-secondary); }
/* 尺寸數字：工程圖那種，蓋在尺寸線中間，不要藥丸外框 */
.aw-label[data-tone="dim"] { padding: 1px 7px; border-radius: 3px; box-shadow: none; background: var(--bg-primary); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

/* 平台名牌：遠處的站 */
.aw-place {
  display: flex; align-items: baseline; gap: 8px;
  border: 0; background: transparent; padding: 4px 8px; font: inherit;
  color: var(--label-primary); white-space: nowrap; cursor: pointer;
  transition: opacity 0.4s ease;
}
.aw-place-no { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--orange); letter-spacing: 0.06em; }
.aw-place-title { font-size: 15px; font-weight: 600; }
.aw-place.is-planned .aw-place-no, .aw-place.is-planned .aw-place-title { color: var(--label-tertiary); font-weight: 500; }
.aw-place:hover .aw-place-title { color: var(--orange); }

/* 左上：現在在哪 */
.aw-crumb { position: absolute; left: 76px; top: 22px; display: flex; align-items: baseline; gap: 12px; pointer-events: none; }
.aw-crumb-no { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--orange); letter-spacing: 0.08em; }
.aw-crumb-title { font-size: 16px; font-weight: 600; color: var(--label-primary); }
.aw-crumb-level { font-size: 13px; color: var(--label-tertiary); }

/* 右上：工具 */
.aw-tools { position: absolute; right: 24px; top: 16px; display: flex; gap: 8px; }
.aw-tool {
  height: 30px; padding: 0 14px; border-radius: 999px;
  border: 0; background: var(--fill-tertiary); color: var(--label-secondary);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.aw-tool:hover { color: var(--label-primary); }
.aw-tool.is-on { background: var(--label-primary); color: var(--bg-primary); }

/* 左側：路線地圖 */
.aw-rail {
  position: absolute; left: 24px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
}
.aw-rail::before { content: ""; position: absolute; left: 12px; top: 14px; bottom: 14px; width: 1px; background: var(--separator); }
.aw-rail-level { position: relative; margin: 10px 0 2px; padding: 0 0 0 30px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--label-tertiary); }
.aw-rail-level:first-of-type { margin-top: 6px; }
.aw-rail-stop {
  position: relative; display: flex; align-items: center; gap: 10px;
  height: 24px; padding: 0; border: 0; background: transparent;
  font: inherit; color: var(--label-primary); cursor: pointer;
}
.aw-rail-dot {
  width: 9px; height: 9px; margin: 0 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-primary); border: 1.5px solid var(--label-tertiary);
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}
.aw-rail-stop.is-done .aw-rail-dot { background: var(--label-secondary); border-color: var(--label-secondary); }
.aw-rail-stop.is-planned .aw-rail-dot { border-style: dotted; }
.aw-rail-stop.is-current .aw-rail-dot { background: var(--orange); border-color: var(--orange); transform: scale(1.5); }
.aw-rail-title {
  font-size: 13px; font-weight: 500; white-space: nowrap; color: var(--label-secondary);
  opacity: 0; transform: translateX(-4px); pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.aw-rail:hover .aw-rail-title { opacity: 1; transform: none; }
.aw-rail-stop:hover .aw-rail-title, .aw-rail-stop.is-current .aw-rail-title { color: var(--label-primary); }
.aw-rail-stop:hover .aw-rail-dot { border-color: var(--label-primary); }

/* 右側：這一步的文字。沒有底色，直接放在展品旁邊；
   字的外圍描一圈背景色的光暈，壓在 3D 場景上也讀得清楚。 */
.aw-copy {
  position: absolute; right: 5vw; top: 0; bottom: 0; width: var(--aw-copy-w);
  padding: 80px 0 120px;
  display: flex; flex-direction: column; justify-content: safe center;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  --halo: var(--bg-primary);
  text-shadow: 0 0 1px var(--halo), 0 0 6px var(--halo), 0 0 16px var(--halo), 0 0 32px var(--halo);
}
.aw-copy::-webkit-scrollbar { display: none; }
.awc { animation: awc-in 0.8s 0.25s cubic-bezier(0.22, 0.8, 0.2, 1) both; }
@keyframes awc-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.awc-kicker { font-size: 14px; font-weight: 600; color: var(--orange); margin-bottom: 14px; letter-spacing: 0.02em; }
.awc-title { font-size: 40px; line-height: 1.18; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 18px; color: var(--label-primary); text-wrap: balance; }
.awc--lead .awc-title { font-size: 60px; line-height: 1.06; letter-spacing: -0.03em; margin-bottom: 22px; }
.awc-body p { font-size: 20px; line-height: 1.65; color: var(--label-secondary); margin: 0 0 12px; text-wrap: pretty; }
.awc--lead .awc-body p { font-size: 22px; }
.awc-body p:last-child { margin-bottom: 0; }

.awc-expr { font-family: var(--font-mono); font-size: 34px; font-weight: 600; color: var(--orange); letter-spacing: -0.01em; margin: 6px 0 18px; }
.awc-where { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 6px; }
.awc-where dt { font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--label-primary); }
.awc-where dd { margin: 0; font-size: 15px; line-height: 1.5; color: var(--label-secondary); }
.awc-aside { font-size: 15px; line-height: 1.6; color: var(--label-secondary); margin: 0 0 18px; }

.awc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 26px 32px; margin-top: 8px; }
.awc-stat-value { font-size: 56px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; color: var(--label-primary); font-feature-settings: "tnum"; }
.awc-stat-unit { font-size: 17px; font-weight: 600; letter-spacing: 0; color: var(--label-tertiary); margin-left: 6px; }
.awc-stat-label { font-size: 15px; font-weight: 600; color: var(--orange); margin: 10px 0 4px; }
.awc-stat-text { font-size: 14px; line-height: 1.55; color: var(--label-secondary); margin: 0; }

.awc-quote { margin: 24px 0 0; font-size: 17px; line-height: 1.6; color: var(--label-primary); }
.awc-quote cite { display: block; margin-top: 6px; font-style: normal; font-size: 13px; color: var(--label-tertiary); }
.awc-reveal {
  margin-top: 14px; align-self: flex-start; height: 38px; padding: 0 18px; border-radius: 999px;
  border: 0; background: var(--label-primary); color: var(--bg-primary);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-shadow: none;
}
.awc-chart { margin-top: 18px; text-shadow: none; }
.awc-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.awc-chart-read { display: flex; gap: 32px; margin-bottom: 10px; }
.awc-chart-read div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--label-secondary); }
.awc-chart-read strong { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--label-primary); font-feature-settings: "tnum"; }
.awc-chart-read strong small { font-size: 13px; font-weight: 600; color: var(--label-tertiary); margin-left: 4px; }

/* 講稿：只有老師按 N 才看得到 */
.awc-note { margin-top: 30px; padding: 16px 0 0; border-top: 0.5px solid var(--separator); text-shadow: none; }
.awc-note-label--gap { margin-top: 18px; }
.awc-note-label { font-size: 12px; font-weight: 600; color: var(--label-tertiary); margin-bottom: 6px; }
.awc-note p { font-size: 15px; line-height: 1.7; color: var(--label-secondary); margin: 0; }
.awc-note ol { margin: 12px 0 0; padding-left: 20px; }
.awc-note li { font-size: 14px; line-height: 1.6; color: var(--label-secondary); margin-bottom: 8px; }
.awc-note li strong { color: var(--label-primary); font-weight: 600; }

.aw-sliders { margin-top: 30px; text-shadow: none; display: flex; flex-direction: column; gap: 16px; }
.aw-slider { display: grid; grid-template-columns: 96px 1fr 72px; align-items: center; gap: 14px; font-size: 14px; color: var(--label-secondary); }
.aw-slider input { width: 100%; accent-color: var(--orange); cursor: pointer; }
.aw-slider-value { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--label-primary); text-align: right; }
.aw-slider-value small { font-size: 11px; font-weight: 500; color: var(--label-secondary); margin-left: 3px; }

.aw-hint { position: absolute; left: 0; right: 0; bottom: 36px; text-align: center; font-size: 14px; color: var(--label-secondary); pointer-events: none; }

.aw-slider { padding: 6px 10px; margin: 0 -10px; border-radius: 10px; transition: background 0.2s ease; }
.aw-slider.is-active { background: var(--fill-quaternary, rgba(127,127,127,0.10)); }
.aw-slider-label { display: inline-flex; align-items: center; gap: 6px; }
.aw-sliders kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 5px; border: 0.5px solid var(--separator); background: var(--bg-secondary);
  font: 600 11px var(--font-mono); color: var(--label-secondary);
}
.aw-slider.is-active kbd { color: var(--orange); border-color: var(--orange); }
.aw-slider-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 12px; color: var(--label-tertiary); }

/* 旋鈕（取代原生滑桿）：一顆時置中放大，兩三顆橫排 */
.aw-sliders.aw-knobs { margin-top: 18px; gap: 10px; align-items: flex-start; }
.aw-sliders.aw-knobs.is-solo { align-items: center; }
.aw-knob-grid { display: flex; flex-wrap: wrap; gap: 6px 10px; width: 100%; justify-content: flex-start; }
.aw-knobs.is-solo .aw-knob-grid { justify-content: center; }
.aw-knob { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px 8px; border-radius: 14px; transition: background 0.2s ease; font-size: 13px; color: var(--label-secondary); }
.aw-knob.is-active { background: var(--fill-quaternary, rgba(127,127,127,0.10)); }
.aw-knob-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.aw-knob.is-active kbd { color: var(--orange); border-color: var(--orange); }
.aw-knob-row { display: flex; align-items: center; gap: 2px; }
.aw-knob-dial {
  position: relative; width: 104px; height: 104px; border-radius: 50%; cursor: grab; outline: none;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.aw-knob.is-solo .aw-knob-dial { width: 132px; height: 132px; }
.aw-knob-dial:active { cursor: grabbing; }
.aw-knob-dial:focus-visible { box-shadow: 0 0 0 2px var(--orange); }
.aw-knob-dial svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.aw-knob-track { fill: none; stroke: var(--fill-tertiary, rgba(127,127,127,0.22)); stroke-width: 6; stroke-linecap: round; }
.aw-knob-fill { fill: none; stroke: var(--orange); stroke-width: 6; stroke-linecap: round; }
.aw-knob-tick { stroke: var(--label-tertiary); stroke-width: 1.4; stroke-linecap: round; opacity: 0.55; }
.aw-knob-tick.is-on { stroke: var(--orange); opacity: 1; }
.aw-knob-cap { fill: var(--bg-secondary); stroke: var(--separator); stroke-width: 1; }
.aw-knob-dial:hover .aw-knob-cap, .aw-knob.is-active .aw-knob-cap { stroke: var(--orange); }
.aw-knob-dot { fill: var(--orange); }
.aw-knob-value { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; line-height: 1.05; }
.aw-knob-value b { font-family: var(--font-mono); font-size: 17px; font-weight: 700; color: var(--label-primary); }
.aw-knob.is-solo .aw-knob-value b { font-size: 22px; }
.aw-knob-value small { font-size: 10px; font-weight: 500; color: var(--label-secondary); margin-top: 1px; }
.aw-knob-step {
  width: 28px; height: 28px; border-radius: 50%; border: 0.5px solid var(--separator); background: var(--bg-secondary);
  color: var(--label-primary); font-size: 16px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.aw-knob-step:hover:not(:disabled) { color: var(--orange); border-color: var(--orange); }
.aw-knob-step:active:not(:disabled) { background: var(--fill-quaternary, rgba(127,127,127,0.18)); }
.aw-knob-step:disabled { opacity: 0.35; cursor: default; }

/* 第 0 站：文字放左下，讓出上面的路線俯視圖 */
.aw-copy.aw-copy--cover { top: auto; bottom: 120px; left: max(200px, 14vw); right: auto; width: min(560px, 60vw); padding: 0; overflow: visible; }
.aw-copy--cover .awc--lead .awc-title { font-size: 52px; margin-bottom: 12px; }

/* 第 0 站：一顆空白鍵，往下按＋呼吸燈 */
.aw-space {
  position: absolute; left: 50%; bottom: calc(34px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  border: 0; background: none; padding: 0; cursor: pointer; color: var(--label-secondary); font: inherit;
}
.aw-space-key {
  width: 180px; height: 40px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font: 600 13px var(--font-mono); letter-spacing: 0.08em; color: var(--label-primary);
  background: var(--bg-secondary);
  border: 1px solid color-mix(in srgb, var(--orange) 55%, var(--separator));
  animation: aw-space-press 2.4s ease-in-out infinite;
}
.aw-space-text { font-size: 13px; animation: aw-space-breathe 2.4s ease-in-out infinite; }
@keyframes aw-space-press {
  0%, 55%, 100% { transform: translateY(0); box-shadow: 0 4px 0 color-mix(in srgb, var(--orange) 35%, var(--separator)), 0 0 18px 2px color-mix(in srgb, var(--orange) 10%, transparent); }
  65%, 75%      { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--orange) 35%, var(--separator)), 0 0 26px 6px color-mix(in srgb, var(--orange) 40%, transparent); }
}
@keyframes aw-space-breathe { 0%, 100% { opacity: 0.45; } 70% { opacity: 1; } }
.aw-space:hover .aw-space-key { border-color: var(--orange); }

/* 下方：這一站的步驟。一格一步，左右兩個箭頭。 */
.aw-dock {
  position: absolute; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--bg-secondary) 78%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 0 0 0.5px var(--separator), 0 10px 30px rgba(0,0,0,0.10);
}
.aw-dock-arrow {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--label-primary); cursor: pointer;
}
.aw-dock-arrow:hover:not(:disabled) { background: var(--fill-tertiary); }
.aw-dock-arrow:disabled { opacity: 0.25; cursor: default; }
.aw-dock-arrow--next { background: var(--orange); color: #fff; }
.aw-dock-arrow--next:hover:not(:disabled) { background: var(--orange); filter: brightness(1.06); }
.aw-chev { width: 9px; height: 9px; border-top: 2px solid currentColor; border-right: 2px solid currentColor; transform: translateX(-2px) rotate(45deg); }
.aw-chev--left { transform: translateX(2px) rotate(-135deg); }
.aw-dock-steps { display: flex; align-items: center; gap: 5px; padding: 0 10px; }
.aw-seg { width: 22px; height: 16px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; transition: width 0.35s ease; }
.aw-seg::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 4px; border-radius: 2px; background: var(--fill-primary); transition: background 0.3s ease; }
.aw-seg.is-past::before { background: var(--label-secondary); }
.aw-seg.is-current { width: 40px; }
.aw-seg.is-current::before { background: var(--orange); }

@media (max-width: 768px) {
  .aw-root { --aw-copy-w: 100%; }
  .aw-rail { display: none; }
  .aw-crumb { left: 16px; top: 16px; }
  .aw-crumb-level { display: none; }
  .aw-tools { right: 12px; top: 10px; }
  .aw-copy { top: auto; right: 0; height: 52%; padding: 8px 20px 100px; justify-content: flex-start; }
  .awc-title { font-size: 26px; margin-bottom: 10px; }
  .awc--lead .awc-title { font-size: 34px; }
  .awc-body p, .awc--lead .awc-body p { font-size: 16px; }
  .awc-expr { font-size: 24px; }
  .awc-stat-value { font-size: 38px; }
  .aw-seg { width: 14px; } .aw-seg.is-current { width: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .awc { animation: none; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE — 首頁摘要＋任務清單／月曆（元件在 Dashboard.jsx 最下方）
   這些元件只在手機寬度渲染，所以不用包 media query。
   ═══════════════════════════════════════════════════════════ */
.mt-page { display: flex; flex-direction: column; gap: 12px; }
.mt-date { font-size: 13px; color: var(--label-secondary); margin-bottom: -10px; }
.mt-title { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; color: var(--label-primary); }
.mt-card {
  background: var(--bg-secondary); border: 0.5px solid var(--separator);
  border-radius: 16px; padding: 0 14px;
}
.mt-summary { padding: 14px 14px 6px; }
.mt-summary-label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.mt-summary-num { font-size: 34px; font-weight: 700; line-height: 1.15; color: var(--label-primary); margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.mt-summary-num span { font-size: 14px; font-weight: 500; color: var(--label-secondary); margin-left: 4px; }
.mt-red { color: var(--red); } .mt-blue { color: var(--blue); }
.mt-green { color: var(--green); } .mt-gray { color: var(--label-secondary); }
.mt-section { font-size: 13px; font-weight: 600; color: var(--label-secondary); margin: 8px 4px 6px; }
.mt-section.mt-red { color: var(--red); }
.mt-count { font-weight: 400; color: var(--label-tertiary); margin-left: 4px; font-variant-numeric: tabular-nums; }
.mt-row { display: flex; align-items: center; border-top: 0.5px solid var(--separator); }
.mt-card > .mt-row:first-child { border-top: 0; }
.mt-check {
  width: 44px; height: 48px; flex-shrink: 0; margin-left: -10px;
  border: 0; background: transparent; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; -webkit-tap-highlight-color: transparent;
}
.mt-check::before {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--label-tertiary); box-sizing: border-box;
}
.mt-check { position: relative; }
.mt-check[aria-checked="true"]::before { background: var(--blue); border-color: var(--blue); }
.mt-check svg { position: relative; }
.mt-row-main {
  flex: 1; min-width: 0; min-height: 48px; padding: 8px 0;
  border: 0; background: transparent; cursor: pointer; font-family: inherit; text-align: left;
  display: flex; align-items: center; gap: 10px; -webkit-tap-highlight-color: transparent;
}
.mt-row-title { flex: 1; min-width: 0; font-size: 16px; color: var(--label-primary); overflow-wrap: anywhere; }
.mt-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 12px; color: var(--label-secondary); white-space: nowrap; flex-shrink: 0; }
.mt-overdue { color: var(--red); font-weight: 600; }
.mt-row.is-done .mt-row-title { color: var(--label-tertiary); text-decoration: line-through; }
.mt-empty { font-size: 14px; color: var(--label-secondary); padding: 6px 2px 10px; }
.mt-more { font-size: 13px; color: var(--label-secondary); padding: 10px 0; border-top: 0.5px solid var(--separator); }
.mt-toolbar { display: flex; gap: 8px; align-items: stretch; }
.mt-owner {
  min-height: 46px; max-width: 42%; padding: 0 10px; border-radius: 12px;
  border: 0.5px solid var(--separator); background: var(--bg-secondary);
  color: var(--label-primary); font-family: inherit; font-size: 14px;
}
.mt-done-toggle {
  display: flex; align-items: center; gap: 4px; min-height: 44px; margin-top: 4px;
  border: 0; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 14px; color: var(--label-secondary); padding: 0 4px;
}
/* 月曆 */
.mt-cal { padding: 10px 8px 8px; }
.mt-cal-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 600; color: var(--label-primary); margin-bottom: 4px; }
.mt-cal-head button { width: 44px; height: 44px; border: 0; background: transparent; color: var(--blue); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mt-cal-head button:first-child svg { transform: rotate(180deg); }
.mt-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.mt-cal-dow { font-size: 12px; color: var(--label-tertiary); text-align: center; padding-bottom: 4px; }
.mt-cal-day {
  position: relative; height: 44px; border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 16px; color: var(--label-primary); border-radius: 12px;
  font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent;
}
.mt-cal-day.is-today { color: var(--blue); font-weight: 700; }
.mt-cal-day.is-sel { background: var(--blue); color: #fff; font-weight: 600; }
.mt-cal-dot { position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--blue); }
.mt-cal-dot.is-late { background: var(--red); }
.mt-cal-dot.is-done { background: var(--label-tertiary); }
.mt-cal-day.is-sel .mt-cal-dot { background: #fff; }

/* ═══════════════════════════════════════════════════════════
   MOBILE — 底部 5 格分頁列（首頁／任務／＋／零件／我）
   放在檔案後段，覆蓋前面「隱藏 bottom tab bar」的舊規則。
   元件在 src/Header.jsx。
   ═══════════════════════════════════════════════════════════ */
.qa-back, .me-page { display: none; }

@media (max-width: 768px) {
  .bottom-tab-bar { display: flex !important; }
  /* 5 格需要文字標籤才分得出來：恢復前面被隱藏的標籤 */
  .bottom-tab-bar .bottom-tab-btn > span:not(.bottom-tab-icon) { display: inline !important; }
  .bottom-tab-bar .bottom-tab-btn { padding: 6px 0 0 !important; }

  /* 頁面切換改由底部列負責：收掉 header 右側的頁面圖示與頭像（設定移到「我」） */
  .hdr-page-icons, .hdr-avatar-wrap { display: none !important; }

  /* 子分頁列：只顯示目前底部分頁所屬的分頁，並顯示文字 */
  .hdr-subbar--solo { display: none !important; }
  .hdr-sub-tab--offgroup { display: none !important; }
  .hdr-sub-nav { justify-content: flex-start !important; }
  .hdr-sub-tab { padding: 0 16px !important; gap: 6px !important; }
  .hdr-sub-tab:last-child { padding-right: 16px !important; }
  .hdr-sub-tab .sub-tab-label { display: inline !important; }

  /* 直式簡報：底部留出分頁列的高度 */
  .deck-root.is-portrait { padding-bottom: calc(var(--bottom-tab-h) + env(safe-area-inset-bottom)) !important; }

  /* 課程播放器是全螢幕、底部有自己的翻頁列：播放時收起分頁列（左上角可離開） */
  body:has(.aw-root) .bottom-tab-bar { display: none !important; }

  /* 中間的＋ */
  .bottom-tab-add {
    flex: 1; display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; padding: 0; cursor: pointer;
    min-height: 44px; -webkit-tap-highlight-color: transparent;
  }
  .bottom-tab-add-circle {
    width: 44px; height: 36px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--blue); color: #fff;
    transition: transform 0.1s;
  }
  .bottom-tab-add:active .bottom-tab-add-circle { transform: scale(0.92); }

  /* ＋ 快速新增選單（底部滑出） */
  .qa-back {
    display: flex; align-items: flex-end;
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0, 0, 0, 0.4);
    animation: qa-fade 0.2s ease;
  }
  .qa-sheet {
    width: 100%; box-sizing: border-box;
    background: var(--bg-secondary);
    border-radius: 20px 20px 0 0;
    padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
    animation: sheet-slide-up 0.3s var(--ease-out);
  }
  .qa-title {
    font-size: 13px; font-weight: 600; color: var(--label-secondary);
    padding: 0 6px 10px;
  }
  .qa-row, .me-row {
    display: flex; align-items: center; gap: 12px; width: 100%;
    min-height: 56px; padding: 8px 6px;
    border: none; background: transparent; cursor: pointer;
    font-family: inherit; text-align: left; color: var(--label-tertiary);
    border-bottom: 0.5px solid var(--separator);
    -webkit-tap-highlight-color: transparent;
  }
  .qa-row:active, .me-row:active { background: var(--fill-tertiary); }
  .qa-row-icon, .me-row-icon {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 122, 255, 0.12); color: var(--blue);
  }
  .qa-row-text, .me-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .qa-row-label, .me-row-label { font-size: 16px; font-weight: 500; color: var(--label-primary); }
  .qa-row-hint, .me-row-hint { font-size: 12px; color: var(--label-secondary); }
  .qa-cancel {
    width: 100%; min-height: 48px; margin-top: 12px;
    border: none; border-radius: 12px; cursor: pointer;
    background: var(--fill-tertiary); color: var(--label-primary);
    font-family: inherit; font-size: 16px; font-weight: 500;
  }

  /* 「我」頁面 */
  .me-page { display: block; }
  .me-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 16px; color: var(--label-primary); }
  .me-card {
    background: var(--bg-secondary); border: 0.5px solid var(--separator);
    border-radius: 16px; padding: 0 10px; overflow: hidden;
  }
  .me-card .me-row:last-child { border-bottom: none; }
  .me-section-label {
    font-size: 12px; font-weight: 600; color: var(--label-secondary);
    margin: 24px 6px 8px;
  }
}
/* 分段切換（「我」的外觀設定、任務的清單／月曆） */
.me-segment {
  display: flex; gap: 2px; padding: 3px;
  background: var(--fill-tertiary); border-radius: 12px;
}
.me-segment-btn {
  flex: 1; min-height: 40px; border: none; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--label-secondary);
  font-family: inherit; font-size: 14px; font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.me-segment-btn.is-active {
  background: var(--bg-secondary); color: var(--label-primary); font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}
@keyframes qa-fade { from { opacity: 0; } to { opacity: 1; } }

/* ═══════════════════════════════════════════════════════════
   MOBILE — 拿掉頂部列＋液態玻璃底部分頁列
   手機上不顯示隊徽那一列；只有「零件」這種有多個子分頁的頁面，
   才在頂部留一條子分頁切換。
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --bottom-tab-h: 82px; }   /* 浮動列 62px ＋ 上下留白，內容用這個值避開它 */

  .hdr-wrapper > header { display: none !important; }
  .hdr-wrapper--bare { display: none !important; }
  .hdr-wrapper { padding-top: env(safe-area-inset-top); }
  /* 沒有主列可以收了：捲動時子分頁列留在原位 */
  .hdr-wrapper.hdr--hidden .hdr-subbar { transform: none !important; }
  .main-content { padding-top: calc(max(var(--hdr-total-h, 0px), env(safe-area-inset-top)) + 20px) !important; }

  /* 液態玻璃：浮在內容上的膠囊，透出後面的內容並折出一圈高光 */
  .bottom-tab-bar {
    left: 12px !important; right: 12px !important;
    bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    height: 62px !important; padding: 0 6px !important;
    border-radius: 999px !important;
    border: 0.5px solid rgba(255, 255, 255, 0.55) !important;
    background: rgba(255, 255, 255, 0.42) !important;
    backdrop-filter: blur(22px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(22px) saturate(190%) !important;
    box-shadow:
      0 10px 30px rgba(0, 0, 0, 0.16),
      0 1px 3px rgba(0, 0, 0, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.75),
      inset 0 -1px 0 rgba(0, 0, 0, 0.05) !important;
    align-items: center;
  }
  :root[data-appearance="dark"] .bottom-tab-bar {
    border-color: rgba(255, 255, 255, 0.16) !important;
    background: rgba(44, 44, 48, 0.46) !important;
    box-shadow:
      0 10px 30px rgba(0, 0, 0, 0.45),
      inset 0 1px 0 rgba(255, 255, 255, 0.2),
      inset 0 -1px 0 rgba(0, 0, 0, 0.3) !important;
  }
  .bottom-tab-bar .bottom-tab-btn {
    height: 50px; min-height: 44px; padding: 0 !important; gap: 2px;
    border-radius: 999px; color: var(--label-secondary);
  }
  /* 目前分頁：一片更亮的玻璃 */
  .bottom-tab-bar .bottom-tab-btn.active {
    background: rgba(255, 255, 255, 0.6);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 1px 4px rgba(0, 0, 0, 0.08);
    color: var(--blue);
  }
  :root[data-appearance="dark"] .bottom-tab-bar .bottom-tab-btn.active {
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }
  .bottom-tab-bar .bottom-tab-btn.active .bottom-tab-icon { background: transparent !important; width: 24px !important; }
  .bottom-tab-add-circle { width: 46px !important; height: 46px !important; border-radius: 50% !important; }
  @media (prefers-reduced-transparency: reduce) {
    .bottom-tab-bar { background: var(--bg-secondary) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  }
}

/* ── 合併分頁的第二層切換（零件：管理／規格；資料：內部／外部）── */
.sub-switch { display: flex; gap: 28px; margin: 0 0 22px; border-bottom: 0.5px solid var(--separator, rgba(128,128,128,.25)); }
.sub-switch-btn { background: none; border: 0; padding: 0 0 10px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px; color: var(--label-secondary); font-family: var(--font-sans);
  box-shadow: inset 0 -1.5px 0 transparent; transition: color .15s, box-shadow .15s; }
.sub-switch-btn:hover { color: var(--label-primary); }
.sub-switch-btn.is-on { color: var(--label-primary); box-shadow: inset 0 -1.5px 0 var(--label-primary); }
.sub-switch-label { font-size: 17px; font-weight: 600; letter-spacing: .02em; }
.sub-switch-hint { font-size: 12px; color: var(--label-secondary); opacity: .75; font-weight: 400; }
.sub-switch-btn:not(.is-on) .sub-switch-label { font-weight: 500; }

/* ── 桌面：工作台分頁放在隊名右邊，省掉第二列；手機維持下面那一列 ── */
.hdr-inline-tabs { display: flex; align-items: stretch; height: 52px; margin-left: 28px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.hdr-inline-tabs::-webkit-scrollbar { display: none; }
.hdr-inline-tabs .hdr-sub-tab--offgroup { display: flex !important; }
@media (min-width: 769px) { .hdr-subbar { display: none !important; } }
@media (max-width: 768px) { .hdr-inline-tabs { display: none !important; } }
/* 分頁：只用英文字（HOME、LOG…），中文放在滑鼠提示 */
.hdr-sub-tab .sub-tab-en { font-family: var(--font-sans); font-size: 12px; font-weight: 500; letter-spacing: .14em; }
.hdr-sub-tab.is-active .sub-tab-en { font-weight: 600; }
