/* public/css/hud.css */
/* 純黑背景 + 參考圖螢光青藍線框 HUD + 原版 NTU COOL 三欄排版 */

:root {
  --bg-black: #000000;
  --box-bg: rgba(0, 245, 255, 0.025);
  --box-bg-strong: rgba(0, 12, 18, 0.94);

  --cyan: #00f5ff;
  --cyan-bright: #dffcff;
  --cyan-line: rgba(0, 245, 255, 0.44);
  --cyan-hair: rgba(0, 245, 255, 0.17);
  --cyan-glow: 0 0 14px rgba(0, 245, 255, 0.25);

  --amber: #ffb020;
  --amber-line: rgba(255, 176, 32, 0.48);
  --red: #ff3b5c;
  --red-line: rgba(255, 59, 92, 0.5);
  --green: #00ff9d;
  --green-line: rgba(0, 255, 157, 0.45);

  --text-main: #e8fcff;
  --text-sub: #82d7ea;
  --text-dim: #4a93a8;

  --font-display: "Orbitron", "Noto Sans TC", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --font-sans: "Noto Sans TC", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-black);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
}

.accent {
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(0, 245, 255, 0.65);
}

/* =========================================================
   純黑背景與微弱技術網格、掃描線（完全不擋點擊）
   ========================================================= */
.hud-bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 245, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

.hud-scanlines {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 245, 255, 0.015) 0px,
    rgba(0, 245, 255, 0.015) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.45;
}

/* =========================================================
   參考圖風格：純黑通透 45° 多邊形切角線框與發光斜邊
   注意：採用 background-image 繪製斜邊，使其鎖定在容器可視邊框盒，
   即使套用在 overflow-y: auto 捲動容器上也不會隨內容飄移。
   所有繼承 .hud-box 的子類別須使用 background-color，避免覆寫漸層斜邊。
   ========================================================= */
.hud-box {
  position: relative;
  --box-edge: var(--cyan);
  background-color: var(--box-bg);
  background-image:
    linear-gradient(135deg, transparent 7.6px, var(--box-edge) 7.6px, var(--box-edge) 9.6px, transparent 9.6px),
    linear-gradient(-45deg, transparent 7.6px, var(--box-edge) 7.6px, var(--box-edge) 9.6px, transparent 9.6px);
  background-position: top left, bottom right;
  background-size: 18px 18px;
  background-repeat: no-repeat;
  background-attachment: scroll;
  clip-path: polygon(
    12px 0,
    100% 0,
    100% calc(100% - 12px),
    calc(100% - 12px) 100%,
    0 100%,
    0 12px
  );
  box-shadow:
    inset 0 0 0 1px var(--cyan-line),
    inset 0 0 22px rgba(0, 245, 255, 0.04);
}

.hud-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--cyan-line);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--cyan);
  position: relative;
}

.hud-header-line::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 34px;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.line-node {
  width: 7px;
  height: 7px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  flex-shrink: 0;
}

.count-pill {
  padding: 1px 8px;
  border: 1px solid var(--cyan-line);
  background: rgba(0, 245, 255, 0.1);
  color: var(--cyan-bright);
  font-size: 0.72rem;
  font-weight: 700;
}

/* =========================================================
   原版 NTU COOL 全域雙層外殼（左側窄導航 + 右側主作業區）
   ========================================================= */
.cool-shell {
  position: relative;
  z-index: 10;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.cool-sidebar {
  width: 80px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  background: #000000;
  border-right: 1px solid var(--cyan-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px;
  gap: 12px;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding-bottom: 10px;
  width: 100%;
  border-bottom: 1px solid var(--cyan-hair);
}

.sidebar-brand svg {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 0 6px rgba(0, 245, 255, 0.55));
}

.sidebar-brand-label {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--cyan);
}

.sidebar-nav,
.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--cyan-hair);
}

.side-nav-btn {
  width: 100%;
  padding: 9px 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-sub);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.side-nav-btn svg {
  width: 20px;
  height: 20px;
}

.side-nav-btn:hover,
.side-nav-btn[aria-pressed="true"] {
  background: rgba(0, 245, 255, 0.1);
  border-color: var(--cyan-line);
  color: var(--cyan-bright);
}

.side-nav-btn.active {
  background: rgba(0, 245, 255, 0.14);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: inset 3px 0 0 var(--cyan), var(--cyan-glow);
}

/* 右側主作業區 */
.cool-main-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   頂部遙測狀態列
   ========================================================= */
.cool-topbar {
  flex-shrink: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 24px;
  background: rgba(0, 0, 0, 0.94);
  border-bottom: 1px solid var(--cyan-line);
}

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

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.96rem;
  letter-spacing: 0.08em;
}

.conn-badge {
  --badge-edge: var(--cyan-line);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
  box-shadow: inset 0 0 0 1px var(--cyan-line);
  background-color: rgba(0, 245, 255, 0.08);
  background-image:
    linear-gradient(135deg, transparent 3.5px, var(--badge-edge) 3.5px, var(--badge-edge) 5.1px, transparent 5.1px),
    linear-gradient(-45deg, transparent 3.5px, var(--badge-edge) 3.5px, var(--badge-edge) 5.1px, transparent 5.1px);
  background-position: top left, bottom right;
  background-size: 10px 10px;
  background-repeat: no-repeat;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.conn-badge.online {
  --badge-edge: var(--green-line);
  box-shadow: inset 0 0 0 1px var(--green-line);
  background-color: rgba(0, 255, 157, 0.08);
  color: var(--green);
}
.conn-badge.offline {
  --badge-edge: var(--red-line);
  box-shadow: inset 0 0 0 1px var(--red-line);
  background-color: rgba(255, 59, 92, 0.09);
  color: #ff7e96;
}

.conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.telemetry-pair {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.readout-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.readout-value {
  font-size: 0.8rem;
  color: var(--cyan-bright);
  font-weight: 500;
}

.telemetry-divider {
  width: 1px;
  height: 22px;
  background: var(--cyan-hair);
}

.user-chip {
  --chip-edge: var(--cyan-line);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 6px;
  border: 0;
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  box-shadow: inset 0 0 0 1px var(--chip-edge);
  background-color: rgba(0, 245, 255, 0.06);
  background-image:
    linear-gradient(135deg, transparent 4.2px, var(--chip-edge) 4.2px, var(--chip-edge) 5.8px, transparent 5.8px),
    linear-gradient(-45deg, transparent 4.2px, var(--chip-edge) 4.2px, var(--chip-edge) 5.8px, transparent 5.8px);
  background-position: top left, bottom right;
  background-size: 12px 12px;
  background-repeat: no-repeat;
  transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.user-chip:hover,
.user-chip[aria-expanded="true"] {
  --chip-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.16);
  box-shadow: inset 0 0 0 1px var(--cyan), 0 0 12px rgba(0, 245, 255, 0.25);
}

.user-chip-caret {
  font-size: 0.72rem;
  color: var(--cyan);
}

.user-menu {
  position: fixed;
  z-index: 75;
  min-width: 220px;
  padding: 12px;
  background-color: var(--box-bg-strong);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-menu[hidden] {
  display: none;
}

.user-menu-info {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--cyan-hair);
}

.user-menu-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--cyan-bright);
}

.user-menu-status {
  margin-top: 2px;
  font-size: 0.7rem;
  color: var(--text-sub);
}

.user-avatar, .user-initials {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--cyan);
}

.user-initials {
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(0, 245, 255, 0.12);
}

.user-name {
  font-size: 0.8rem;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   按鈕與表單控制項
   ========================================================= */
.hud-btn {
  --btn-edge: var(--cyan-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border: 0;
  clip-path: polygon(
    7px 0,
    100% 0,
    100% calc(100% - 7px),
    calc(100% - 7px) 100%,
    0 100%,
    0 7px
  );
  background-color: transparent;
  background-image:
    linear-gradient(135deg, transparent 4.2px, var(--btn-edge) 4.2px, var(--btn-edge) 5.8px, transparent 5.8px),
    linear-gradient(-45deg, transparent 4.2px, var(--btn-edge) 4.2px, var(--btn-edge) 5.8px, transparent 5.8px);
  background-position: top left, bottom right;
  background-size: 12px 12px;
  background-repeat: no-repeat;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.hud-btn-sm {
  padding: 5px 11px;
  font-size: 0.76rem;
}

.hud-btn-primary {
  --btn-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.18);
  box-shadow: inset 0 0 0 1px var(--cyan), var(--cyan-glow);
  color: #ffffff;
}
.hud-btn-primary:hover {
  --btn-edge: var(--cyan-bright);
  background-color: rgba(0, 245, 255, 0.3);
  box-shadow: inset 0 0 0 1px var(--cyan-bright), 0 0 20px rgba(0, 245, 255, 0.45);
}

.hud-btn-outline {
  --btn-edge: var(--cyan-line);
  background-color: rgba(0, 245, 255, 0.06);
  box-shadow: inset 0 0 0 1px var(--cyan-line);
  color: var(--cyan-bright);
}
.hud-btn-outline:hover {
  --btn-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.18);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.hud-btn-ghost {
  --btn-edge: var(--cyan-hair);
  background-color: rgba(0, 245, 255, 0.02);
  box-shadow: inset 0 0 0 1px var(--cyan-hair);
  color: var(--text-sub);
}
.hud-btn-ghost:hover,
.hud-btn-ghost[aria-pressed="true"] {
  --btn-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.14);
  box-shadow: inset 0 0 0 1px var(--cyan);
  color: var(--cyan-bright);
}

.kbd {
  padding: 1px 6px;
  border: 1px solid var(--cyan-line);
  background: rgba(0, 245, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--cyan);
}

.hud-input, .hud-select {
  background: #000000;
  border: 1px solid var(--cyan-line);
  color: var(--text-main);
  padding: 6px 10px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  outline: none;
}

.hud-input:focus, .hud-select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.25);
}

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

/* =========================================================
   主舞台、啟動掃描與 SSO 登入閘門
   ========================================================= */
.hud-stage {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 18px 24px 20px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

.view-panel {
  flex: 1;
  min-height: 0;
}

.view-boot {
  height: 100%;
  display: grid;
  place-items: center;
}

.boot-card {
  width: min(500px, 100%);
  padding: 28px;
}

.boot-title {
  margin: 4px 0 6px;
  font-size: 1.25rem;
}

.boot-status {
  margin: 0 0 18px;
  font-size: 0.88rem;
  color: var(--text-sub);
}

.boot-progress-track {
  height: 3px;
  background: rgba(0, 245, 255, 0.14);
  overflow: hidden;
}

.boot-progress-bar {
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  animation: sweepBar 1.3s ease-in-out infinite;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 20px;
  height: 100%;
  min-height: 0;
}

.login-brief {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.login-title {
  margin: 0;
  font-size: 1.38rem;
}

.login-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-sub);
}

.node-list {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  border-left: 1px solid var(--cyan-line);
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 0.83rem;
  color: var(--text-sub);
}

.node-list li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.node-dot {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  flex-shrink: 0;
}

.hud-alert {
  padding: 10px 12px;
  font-size: 0.83rem;
  border-left: 3px solid var(--cyan);
  background: rgba(0, 245, 255, 0.06);
  color: var(--text-main);
}
.hud-alert.ok { border-left-color: var(--green); color: var(--green); }
.hud-alert.warn { border-left-color: var(--amber); color: var(--amber); }
.hud-alert.err { border-left-color: var(--red); color: #ff8ea2; }

.login-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.login-terminal {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--cyan-line);
  background: rgba(0, 245, 255, 0.04);
}

.terminal-title {
  font-size: 0.74rem;
  color: var(--text-sub);
}

.terminal-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  border: 1px solid var(--green-line);
  color: var(--green);
}

.terminal-frame-wrap {
  flex: 1;
  background: #ffffff;
}

.terminal-frame-wrap iframe,
.proxy-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  min-height: 540px;
  border: 0;
  display: block;
}

/* =========================================================
   原版 COOL 兩欄首頁（中間課程網格 + 右側獨立捲動）
   ========================================================= */
.view-dashboard {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.tag {
  display: inline-block;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
}
.tag-cyan { color: var(--cyan); background: rgba(0, 245, 255, 0.08); }
.tag-amber { color: var(--amber); background: rgba(255, 176, 32, 0.1); }

.cool-layout {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: stretch;
}

.cool-dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.dash-head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.dash-title-wrap {
  min-width: 220px;
}

.dash-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
}

.telemetry-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-chip {
  --chip-edge: var(--cyan-line);
  padding: 6px 13px;
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
  box-shadow: inset 0 0 0 1px var(--cyan-line);
  background-color: rgba(0, 245, 255, 0.035);
  background-image:
    linear-gradient(135deg, transparent 4.2px, var(--chip-edge) 4.2px, var(--chip-edge) 5.8px, transparent 5.8px),
    linear-gradient(-45deg, transparent 4.2px, var(--chip-edge) 4.2px, var(--chip-edge) 5.8px, transparent 5.8px);
  background-position: top left, bottom right;
  background-size: 12px 12px;
  background-repeat: no-repeat;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stat-chip-alert {
  --chip-edge: var(--amber-line);
  box-shadow: inset 0 0 0 1px var(--amber-line);
}

.stat-label {
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  color: var(--text-sub);
}

.stat-val {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--cyan-bright);
}

.stat-chip-alert .stat-val.has-urgent {
  color: var(--amber);
  text-shadow: 0 0 10px rgba(255, 176, 32, 0.6);
}

.course-toolbar {
  flex-shrink: 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================
   原版 COOL 課程卡片網格（僅此區於首頁獨立捲動）
   ========================================================= */
.courses-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
  padding-right: 6px;
  padding-bottom: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 16px;
}

.course-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: #000000;
  background-image:
    linear-gradient(135deg, transparent 7.6px, var(--cyan) 7.6px, var(--cyan) 9.6px, transparent 9.6px),
    linear-gradient(-45deg, transparent 7.6px, var(--cyan) 7.6px, var(--cyan) 9.6px, transparent 9.6px);
  background-position: top left, bottom right;
  background-size: 18px 18px;
  background-repeat: no-repeat;
  clip-path: polygon(
    12px 0,
    100% 0,
    100% calc(100% - 12px),
    calc(100% - 12px) 100%,
    0 100%,
    0 12px
  );
  box-shadow: inset 0 0 0 1px var(--cyan-line);
  transition: box-shadow 0.16s ease, transform 0.14s ease, background-color 0.16s ease;
}

.course-card:hover {
  box-shadow: inset 0 0 0 1px var(--cyan), inset 0 0 22px rgba(0, 245, 255, 0.08);
  transform: translateY(-2px);
}

.course-banner {
  position: relative;
  height: 92px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-bottom: 1px solid var(--cyan-line);
  /* 疊加左上 45° 斜邊線，避免被橫幅背景色遮蓋 */
  background-image:
    linear-gradient(135deg, transparent 7.6px, var(--cyan) 7.6px, var(--cyan) 9.6px, transparent 9.6px),
    linear-gradient(rgba(0, 245, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, rgba(0, 245, 255, 0.14), rgba(0, 0, 0, 0.92));
  background-position: top left, 0 0, 0 0, 0 0;
  background-size: 18px 18px, 16px 16px, 16px 16px, 100% 100%;
  background-repeat: no-repeat, repeat, repeat, no-repeat;
  overflow: hidden;
  cursor: pointer;
}

.course-banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.24;
  filter: grayscale(100%) contrast(1.2);
  pointer-events: none;
}

.course-banner-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.course-code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan-bright);
  padding: 2px 7px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid var(--cyan-line);
  max-width: 78%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-fav {
  color: var(--amber);
  font-size: 0.92rem;
  text-shadow: 0 0 8px rgba(255, 176, 32, 0.65);
}

.course-term {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-sub);
}

.course-body {
  padding: 12px 14px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.course-name {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}

.course-name:hover {
  color: var(--cyan);
}

.course-quick-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--cyan-hair);
}

.quick-tab-btn {
  padding: 8px 4px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--cyan-hair);
  color: var(--text-sub);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.quick-tab-btn:last-child {
  border-right: 0;
}

.quick-tab-btn:hover {
  background: rgba(0, 245, 255, 0.12);
  color: var(--cyan-bright);
}

/* =========================================================
   右側資訊欄：To Do / Coming Up / 最新公告（參考圖節點導引線）
   ========================================================= */
.cool-right-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  padding-bottom: 12px;
}

.rail-section {
  flex-shrink: 0;
  padding: 14px 16px;
}

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-left: 8px;
  border-left: 1px solid var(--cyan-hair);
}

.rail-list::-webkit-scrollbar,
.courses-grid::-webkit-scrollbar,
.cool-right-rail::-webkit-scrollbar,
.course-tab-content::-webkit-scrollbar,
.course-subnav::-webkit-scrollbar,
.cmd-results::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 5px;
}
.rail-list::-webkit-scrollbar-thumb,
.courses-grid::-webkit-scrollbar-thumb,
.cool-right-rail::-webkit-scrollbar-thumb,
.course-tab-content::-webkit-scrollbar-thumb,
.course-subnav::-webkit-scrollbar-thumb,
.cmd-results::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.35);
}

.rail-item {
  --rail-edge: var(--cyan-hair);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px 8px 22px;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
  box-shadow: inset 0 0 0 1px var(--cyan-hair);
  background-color: rgba(0, 245, 255, 0.025);
  background-image:
    linear-gradient(225deg, transparent 5.6px, var(--rail-edge) 5.6px, var(--rail-edge) 7.4px, transparent 7.4px),
    linear-gradient(315deg, transparent 5.6px, var(--rail-edge) 5.6px, var(--rail-edge) 7.4px, transparent 7.4px);
  background-position: top right, bottom right;
  background-size: 14px 14px;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: background-color 0.14s ease, box-shadow 0.14s ease;
}

.rail-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 7px var(--cyan);
}

.rail-item.urgency-critical::before {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}
.rail-item.urgency-warning::before {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.rail-item:hover {
  --rail-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.11);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-course {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-countdown {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}
.item-countdown.critical { color: #ff7990; }
.item-countdown.warning { color: var(--amber); }
.item-countdown.normal { color: var(--cyan); }

.item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.item-sub {
  font-size: 0.73rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 20px 12px;
  text-align: center;
  border: 1px dashed var(--cyan-hair);
  color: var(--text-sub);
  font-size: 0.82rem;
}

/* =========================================================
   Modals (公告閱讀 / 代理視窗 / Cmd+K)
   ========================================================= */
.hud-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

#modal-content-reader {
  z-index: 85;
}

.hud-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(4px);
}

.hud-modal-dialog {
  position: relative;
  z-index: 1;
  background-color: var(--box-bg-strong);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  width: 100%;
  overflow: hidden;
}

.modal-md { max-width: 720px; }
.modal-xl { max-width: 1220px; height: 86vh; }
.modal-cmd { max-width: 640px; align-self: start; margin-top: 8vh; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cyan-hair);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title {
  margin: 4px 0 4px;
  font-size: 1.06rem;
}

.modal-meta {
  font-size: 0.74rem;
  color: var(--text-sub);
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  font-size: 0.92rem;
  color: var(--text-main);
}

.rich-html a { color: var(--cyan); }
.rich-html img { max-width: 100%; height: auto; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--cyan-hair);
}

.proxy-iframe-wrap {
  flex: 1;
  background: #ffffff;
}

.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--cyan-line);
}

.cmd-prefix {
  color: var(--cyan);
  font-weight: 700;
}

.cmd-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: var(--font-sans);
}

.cmd-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  cursor: pointer;
}

.cmd-item:hover,
.cmd-item.active {
  background: rgba(0, 245, 255, 0.14);
  border-color: var(--cyan-line);
}

.cmd-item-title {
  font-size: 0.88rem;
  font-weight: 500;
}

.cmd-item-sub {
  font-size: 0.74rem;
  color: var(--text-sub);
}

/* =========================================================
   深入課程 HUD 工作區（模組 / 作業 / 測驗外跳 / 討論 / 檔案 / 成績）
   ========================================================= */
.modal-lg {
  max-width: 880px;
}

.view-course {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.course-topbar {
  flex-shrink: 0;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.course-topbar-left,
.course-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.course-view-title {
  margin: 0;
  font-size: 1.24rem;
  font-weight: 700;
}

.course-view-meta {
  font-size: 0.7rem;
  color: var(--text-sub);
  letter-spacing: 0.08em;
}

.course-workspace {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.course-subnav {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 100%;
  overflow-y: auto;
  align-self: start;
}

.subnav-btn {
  --subnav-edge: var(--cyan-hair);
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  background-color: rgba(0, 245, 255, 0.02);
  background-image: linear-gradient(225deg, transparent 4.9px, var(--subnav-edge) 4.9px, var(--subnav-edge) 6.6px, transparent 6.6px);
  background-position: top right;
  background-size: 14px 14px;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px var(--cyan-hair);
  color: var(--text-sub);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  transition: background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.subnav-btn:hover {
  --subnav-edge: var(--cyan-line);
  background-color: rgba(0, 245, 255, 0.1);
  color: var(--cyan-bright);
  box-shadow: inset 0 0 0 1px var(--cyan-line);
}

.subnav-btn.active {
  --subnav-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.16);
  color: var(--cyan);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--cyan), inset 0 0 0 1px var(--cyan);
}

.subnav-btn-quiz {
  color: var(--amber);
}
.subnav-btn-quiz.active {
  --subnav-edge: var(--amber-line);
  box-shadow: inset 3px 0 0 var(--amber), inset 0 0 0 1px var(--amber-line);
  color: var(--amber);
}

.course-tab-content {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-right: 8px;
  padding-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.course-loading,
.course-empty-box,
.syllabus-box,
.grade-summary {
  padding: 18px 20px;
}

.module-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.module-toolbar-meta {
  font-size: 0.76rem;
  color: var(--text-sub);
}

.module-caret {
  color: var(--cyan);
  font-size: 0.84rem;
  width: 12px;
  display: inline-block;
  text-align: center;
}

.module-stack,
.course-list-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.module-card {
  padding: 12px 16px;
}

.module-header-btn {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text-main);
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--cyan-hair);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}

.module-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.module-idx {
  font-size: 0.7rem;
  color: var(--cyan);
  padding: 2px 6px;
  border: 1px solid var(--cyan-line);
}

.module-name {
  font-size: 0.96rem;
  font-weight: 700;
}

.module-items {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.module-subheader {
  padding: 6px 8px 2px;
  font-size: 0.78rem;
  color: var(--cyan);
  border-bottom: 1px dashed var(--cyan-hair);
}

.module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--cyan-hair);
  background: rgba(0, 245, 255, 0.02);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.module-item:hover {
  background: rgba(0, 245, 255, 0.1);
  border-color: var(--cyan);
}

.module-item-title {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text-main);
}

.module-item-hint {
  font-size: 0.72rem;
  color: var(--text-sub);
}

.course-row-card {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.course-row-card.clickable,
.file-row.clickable {
  cursor: pointer;
  transition: background-color 0.14s ease, box-shadow 0.14s ease;
}

.course-row-card.clickable:hover,
.file-row.clickable:hover {
  background-color: rgba(0, 245, 255, 0.07);
  box-shadow: inset 0 0 0 1px var(--cyan), var(--cyan-glow);
}

.row-card-title {
  margin: 0;
  font-size: 0.98rem;
  color: var(--text-main);
}

.row-card-desc {
  margin: 0;
  font-size: 0.83rem;
  color: var(--text-sub);
}

.row-card-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.integrity-banner {
  --box-edge: var(--amber);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: inset 0 0 0 1px var(--amber-line);
  background-color: rgba(255, 176, 32, 0.07);
}

.integrity-text {
  font-size: 0.84rem;
  color: #ffe0a3;
  flex: 1;
}

.quiz-action-row {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
}

.integrity-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-toolbar {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-search-input {
  flex: 1;
}

.file-row {
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.file-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.file-row-name {
  font-size: 0.88rem;
  font-weight: 500;
  word-break: break-all;
}

.file-row-meta {
  display: flex;
  gap: 14px;
  font-size: 0.74rem;
  color: var(--text-sub);
}

.pages-heading {
  margin-top: 8px;
}

.reply-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--cyan-line);
}

.reply-card {
  padding: 10px 12px;
  border: 1px solid var(--cyan-hair);
  background: rgba(0, 245, 255, 0.025);
}

.reply-meta {
  font-size: 0.72rem;
  color: var(--cyan);
  margin-bottom: 4px;
}

.reader-divider {
  margin: 18px 0 10px;
}

.reader-pdf-frame {
  width: 100%;
  height: 62vh;
  border: 1px solid var(--cyan-line);
  background: #ffffff;
}

.reader-image-preview {
  max-width: 100%;
  max-height: 62vh;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--cyan-line);
}

.tag-green {
  color: var(--green);
  background: rgba(0, 255, 157, 0.1);
}

.grade-summary-row {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--cyan-bright);
}

.grade-table-wrap {
  padding: 12px 16px;
  overflow-x: auto;
}

.grade-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.grade-table th,
.grade-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--cyan-hair);
}

.grade-table th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--cyan);
  letter-spacing: 0.08em;
}

.grade-bar-track {
  width: 110px;
  height: 7px;
  background: rgba(0, 245, 255, 0.12);
  border: 1px solid var(--cyan-hair);
}

.grade-bar-fill {
  height: 100%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

/* =========================================================
   側滑課程快速切換抽屜（Course Drawer）
   ========================================================= */
.course-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 80px;
  z-index: 35;
}

.course-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.course-drawer-panel {
  position: relative;
  z-index: 1;
  width: min(340px, 88vw);
  height: 100%;
  background-color: rgba(0, 10, 16, 0.96);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  animation: drawerSlideIn 0.18s ease-out both;
}

.drawer-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.drawer-title {
  margin: 0;
  font-size: 1.15rem;
}

.drawer-search-wrap {
  flex-shrink: 0;
}

.drawer-search-input {
  width: 100%;
}

.drawer-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-list::-webkit-scrollbar {
  width: 5px;
}
.drawer-list::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.35);
}

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

.drawer-group-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--cyan-line);
}

.drawer-group-toggle {
  width: 100%;
  text-align: left;
  background: rgba(0, 245, 255, 0.04);
  border: 0;
  border-bottom: 1px solid var(--cyan-hair);
  padding: 7px 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-sub);
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease;
}

.drawer-group-toggle:hover {
  background: rgba(0, 245, 255, 0.1);
  color: var(--cyan);
}

.drawer-course-item {
  --item-edge: var(--cyan-hair);
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border: 1px solid var(--cyan-hair);
  background-color: rgba(0, 245, 255, 0.025);
  background-image: linear-gradient(225deg, transparent 4.9px, var(--item-edge) 4.9px, var(--item-edge) 6.6px, transparent 6.6px);
  background-origin: border-box;
  background-position: top right;
  background-size: 14px 14px;
  background-repeat: no-repeat;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.drawer-course-item:hover {
  --item-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.11);
  border-color: var(--cyan);
}

.drawer-course-item.is-current {
  --item-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.16);
  border-color: var(--cyan);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.drawer-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--text-sub);
}

.drawer-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

@keyframes drawerSlideIn {
  from {
    opacity: 0;
    transform: translateX(-18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* =========================================================
   原生 HUD 行事曆工作區（月曆網格 / 議程清單 / 當日詳情）
   ========================================================= */
.view-calendar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.cal-topbar {
  flex-shrink: 0;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.cal-nav-group,
.cal-mode-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cal-month-title {
  margin: 0 0 0 8px;
  font-size: 1.08rem;
  color: var(--cyan-bright);
}

.cal-mode-group .hud-btn.active {
  --btn-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.16);
  box-shadow: inset 0 0 0 1px var(--cyan);
  color: var(--cyan);
}

.cal-workspace {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 315px;
  gap: 18px;
  align-items: stretch;
}

.cal-main-area,
.cal-side-panel {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}

.cal-main-area::-webkit-scrollbar,
.cal-side-panel::-webkit-scrollbar,
.cal-course-filters::-webkit-scrollbar {
  width: 5px;
}
.cal-main-area::-webkit-scrollbar-thumb,
.cal-side-panel::-webkit-scrollbar-thumb,
.cal-course-filters::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.35);
}

.cal-side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--cyan-line);
  border-left: 1px solid var(--cyan-line);
  background: #000000;
}

.cal-weekday {
  padding: 8px 6px;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
  background: rgba(0, 245, 255, 0.06);
  border-right: 1px solid var(--cyan-line);
  border-bottom: 1px solid var(--cyan-line);
}

.cal-cell {
  min-height: 108px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-right: 1px solid var(--cyan-hair);
  border-bottom: 1px solid var(--cyan-hair);
  background: #000000;
  cursor: pointer;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

.cal-cell:hover {
  background: rgba(0, 245, 255, 0.05);
}

.cal-cell.is-outside {
  opacity: 0.42;
}

.cal-cell.is-today {
  background: rgba(0, 245, 255, 0.07);
  box-shadow: inset 0 0 0 1px var(--cyan-line);
}

.cal-cell.is-selected {
  box-shadow: inset 0 0 0 1px var(--cyan), inset 0 0 18px rgba(0, 245, 255, 0.14);
}

.cal-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-day-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-sub);
}

.cal-cell.is-today .cal-day-num {
  color: var(--cyan);
}

.cal-day-badge {
  font-size: 0.62rem;
  padding: 0 5px;
  border: 1px solid var(--cyan-line);
  color: var(--cyan-bright);
}

.cal-cell-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cal-event-pill {
  width: 100%;
  text-align: left;
  padding: 2px 5px;
  border: 0;
  border-left: 2px solid var(--cyan);
  background: rgba(0, 245, 255, 0.12);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.cal-event-pill:hover {
  background: rgba(0, 245, 255, 0.24);
}

.cal-event-pill.kind-quiz {
  border-left-color: var(--amber);
  background: rgba(255, 176, 32, 0.15);
  color: #ffe2ab;
}

.cal-event-pill.kind-event {
  border-left-color: var(--green);
  background: rgba(0, 255, 157, 0.12);
}

.cal-more {
  font-size: 0.64rem;
  color: var(--text-dim);
  padding-left: 4px;
}

.cal-course-filters {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 220px;
  overflow-y: auto;
}

.cal-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-sub);
  cursor: pointer;
}

.cal-filter-item input {
  accent-color: var(--cyan);
}

.cal-filter-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   原生 HUD 完整收發版收件匣（Inbox & Compose）
   ========================================================= */
.view-inbox {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.inbox-topbar {
  flex-shrink: 0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.inbox-scope-group,
.inbox-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inbox-scope-group .hud-btn.active {
  --btn-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.16);
  box-shadow: inset 0 0 0 1px var(--cyan);
  color: var(--cyan);
}

.inbox-workspace {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: 345px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.inbox-list-pane {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inbox-list-pane::-webkit-scrollbar,
.inbox-messages::-webkit-scrollbar,
.compose-candidates::-webkit-scrollbar {
  width: 5px;
}
.inbox-list-pane::-webkit-scrollbar-thumb,
.inbox-messages::-webkit-scrollbar-thumb,
.compose-candidates::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.35);
}

.inbox-conv-item {
  --conv-edge: var(--cyan-hair);
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--cyan-hair);
  background-color: rgba(0, 245, 255, 0.02);
  background-image: linear-gradient(225deg, transparent 4.9px, var(--conv-edge) 4.9px, var(--conv-edge) 6.6px, transparent 6.6px);
  background-origin: border-box;
  background-position: top right;
  background-size: 14px 14px;
  background-repeat: no-repeat;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.inbox-conv-item:hover {
  --conv-edge: var(--cyan-line);
  background-color: rgba(0, 245, 255, 0.09);
  border-color: var(--cyan-line);
}

.inbox-conv-item.is-active {
  --conv-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.14);
  border-color: var(--cyan);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.inbox-conv-item.is-unread {
  --conv-edge: var(--cyan-line);
  border-color: var(--cyan-line);
}

.inbox-subj-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  flex-shrink: 0;
}

.inbox-thread-pane {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.inbox-thread-empty {
  padding: 28px;
}

.inbox-thread-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.inbox-thread-head {
  flex-shrink: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--cyan-line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.inbox-thread-subject {
  margin: 0 0 4px;
  font-size: 1.08rem;
}

.inbox-thread-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inbox-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inbox-msg-card {
  padding: 12px 14px;
  border: 1px solid var(--cyan-hair);
  background: rgba(0, 245, 255, 0.025);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inbox-msg-card.is-self {
  border-color: var(--cyan-line);
  background: rgba(0, 245, 255, 0.07);
}

.inbox-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--cyan);
}

.inbox-msg-time {
  color: var(--text-dim);
}

.inbox-msg-body {
  font-size: 0.88rem;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

.inbox-msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--cyan-hair);
}

.inbox-reply-box {
  flex-shrink: 0;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--cyan-line);
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-textarea {
  width: 100%;
  resize: vertical;
  background: #000000;
  border: 1px solid var(--cyan-line);
  color: var(--text-main);
  padding: 8px 10px;
  font-family: var(--font-sans);
  font-size: 0.86rem;
  outline: none;
}

.hud-textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 245, 255, 0.24);
}

.inbox-reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compose-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.compose-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compose-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
}

.compose-selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  align-items: center;
}

.compose-hint {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.inbox-search-combo,
.recipient-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.recipient-search-input {
  flex: 1;
}

.addressbook-anchor {
  position: relative;
}

.addressbook-menu {
  position: fixed;
  top: 72px;
  right: 24px;
  width: min(330px, 88vw);
  max-height: 340px;
  overflow-y: auto;
  padding: 10px;
  background-color: rgba(0, 10, 16, 0.98);
  box-shadow: inset 0 0 0 1px var(--cyan), 0 12px 34px rgba(0, 0, 0, 0.9), var(--cyan-glow);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.addressbook-menu-inline {
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  background-color: rgba(0, 10, 16, 0.96);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.addressbook-menu::-webkit-scrollbar,
.addressbook-menu-inline::-webkit-scrollbar {
  width: 5px;
}
.addressbook-menu::-webkit-scrollbar-thumb,
.addressbook-menu-inline::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.35);
}

.ab-menu-head {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: var(--cyan);
  padding: 2px 4px 6px;
  border-bottom: 1px solid var(--cyan-hair);
}

.ab-back-btn,
.ab-item-btn {
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: 1px solid transparent;
  background: rgba(0, 245, 255, 0.03);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.ab-back-btn {
  position: sticky;
  top: -10px;
  z-index: 3;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  border-bottom: 1px solid var(--cyan-line);
  background: #001018;
}

.ab-limit-note {
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--amber);
  border-top: 1px dashed var(--amber-line);
  text-align: center;
}

.ab-back-btn:hover,
.ab-item-btn:hover {
  background: rgba(0, 245, 255, 0.14);
  border-color: var(--cyan-line);
}

.ab-item-btn.is-selected {
  background: rgba(0, 245, 255, 0.18);
  border-color: var(--cyan);
  color: var(--cyan-bright);
}

.ab-item-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-sub);
  white-space: nowrap;
}

.compose-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 110px;
  overflow-y: auto;
  padding: 4px 0;
}

.compose-cand-btn {
  padding: 4px 9px;
  background: rgba(0, 245, 255, 0.05);
  border: 1px solid var(--cyan-hair);
  color: var(--text-sub);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  cursor: pointer;
}

.compose-cand-btn:hover {
  background: rgba(0, 245, 255, 0.16);
  border-color: var(--cyan);
  color: var(--cyan-bright);
}

.compose-discard-bar {
  padding: 12px 14px;
  border: 1px solid var(--amber-line);
  background: rgba(255, 176, 32, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compose-discard-msg {
  font-size: 0.84rem;
  color: #ffe2ab;
  font-weight: 500;
}

.compose-discard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.hud-btn-danger {
  --btn-edge: var(--red-line);
  background-color: rgba(255, 59, 92, 0.16);
  box-shadow: inset 0 0 0 1px var(--red-line);
  color: #ffb8c4;
}

.hud-btn-danger:hover {
  --btn-edge: var(--red);
  background-color: rgba(255, 59, 92, 0.28);
  box-shadow: inset 0 0 0 1px var(--red);
  color: #ffffff;
}

/* =========================================================
   統一前端文件解析引擎（PDF / XLSX / DOCX / PPTX / TEXT）
   ========================================================= */
.hud-modal-dialog.modal-lg:has(.doc-viewer-root) {
  max-width: min(1180px, 95vw);
}

.doc-viewer-root {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--cyan-line);
  background-color: rgba(0, 18, 28, 0.55);
}

.doc-toolbar-label {
  font-size: 0.76rem;
  color: var(--text-sub);
  padding: 0 4px;
}

.doc-page-input {
  width: 62px;
  padding: 4px 6px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.doc-stage {
  height: 62vh;
  overflow: auto;
  border: 1px solid var(--cyan-line);
  background-color: #000000;
  padding: 14px;
}

.doc-loading {
  padding: 36px 16px;
  text-align: center;
  color: var(--cyan);
  border: 1px dashed var(--cyan-line);
  background-color: rgba(0, 245, 255, 0.03);
}

.doc-error-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

/* PDF 檢視器 */
.doc-pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.doc-pdf-page-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--cyan-hair);
  background-color: rgba(0, 245, 255, 0.025);
}

.doc-pdf-page-tag {
  align-self: flex-start;
  font-size: 0.7rem;
  color: var(--text-dim);
}

.doc-pdf-canvas {
  display: block;
  background-color: #ffffff;
  box-shadow: 0 0 18px rgba(0, 245, 255, 0.14);
}

.doc-pdf-stage.is-hud-invert canvas {
  filter: invert(0.92) hue-rotate(180deg) contrast(1.06);
}

/* XLSX 互動電子表格 */
.doc-sheet-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.doc-sheet-search {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
  padding: 5px 10px;
  font-size: 0.82rem;
}

.doc-xlsx-stage {
  padding: 0;
}

.doc-xlsx-wrap {
  width: 100%;
}

.doc-xlsx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.doc-xlsx-table th,
.doc-xlsx-table td {
  padding: 6px 10px;
  border: 1px solid var(--cyan-hair);
  text-align: left;
  white-space: nowrap;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-xlsx-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: #03151f;
  color: var(--cyan);
  border-bottom: 1px solid var(--cyan-line);
}

.doc-xlsx-rownum,
.doc-xlsx-corner {
  position: sticky;
  left: 0;
  z-index: 1;
  background-color: #020e16;
  color: var(--text-dim);
  text-align: center;
  min-width: 42px;
}

.doc-xlsx-table thead th.doc-xlsx-corner {
  z-index: 3;
}

.doc-xlsx-first-row td {
  background-color: rgba(0, 245, 255, 0.06);
  color: var(--cyan-bright);
  font-weight: 600;
}

.doc-xlsx-table tbody tr:hover td {
  background-color: rgba(0, 245, 255, 0.08);
}

mark.doc-hit {
  background-color: rgba(0, 245, 255, 0.35);
  color: #ffffff;
  padding: 0 2px;
}

.doc-more-bar {
  padding: 12px;
  display: flex;
  justify-content: center;
}

/* DOCX 檢視器 */
.doc-docx-stage {
  background-color: #050d12;
}

.doc-docx-host {
  width: fit-content;
  min-width: 100%;
  margin: 0 auto;
}

.doc-docx-host .hud-docx-wrapper {
  background-color: transparent !important;
  padding: 8px !important;
}

.doc-docx-host.is-hud-dark {
  filter: invert(0.92) hue-rotate(180deg) contrast(1.04);
}

/* PPTX 簡報檢視器 */
.doc-pptx-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.doc-pptx-canvas {
  position: relative;
  width: min(920px, 100%);
  border: 1px solid var(--cyan);
  background-color: #02090e;
  box-shadow: inset 0 0 24px rgba(0, 245, 255, 0.08), 0 0 18px rgba(0, 245, 255, 0.14);
  overflow: hidden;
  flex-shrink: 0;
}

.doc-pptx-item {
  position: absolute;
  overflow: hidden;
}

.doc-pptx-img {
  object-fit: contain;
}

.doc-pptx-textbox {
  padding: 4px 6px;
  color: var(--text-main);
  overflow-y: auto;
  word-break: break-word;
}

.doc-pptx-textbox.is-title {
  color: var(--cyan-bright);
}

.doc-pptx-p {
  margin: 0 0 4px;
  line-height: 1.38;
}

.doc-pptx-p.lvl-1 { padding-left: 14px; }
.doc-pptx-p.lvl-2 { padding-left: 28px; }
.doc-pptx-p.lvl-3 { padding-left: 42px; }
.doc-pptx-p.lvl-4 { padding-left: 56px; }

.doc-pptx-bullet {
  color: var(--cyan);
}

.doc-pptx-table-wrap {
  overflow: auto;
}

.doc-pptx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.doc-pptx-table th,
.doc-pptx-table td {
  border: 1px solid var(--cyan-line);
  padding: 4px 6px;
  text-align: left;
  color: var(--text-main);
}

.doc-pptx-table th {
  background-color: rgba(0, 245, 255, 0.12);
  color: var(--cyan-bright);
}

.doc-pptx-flow-layer {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-pptx-flow-img {
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.doc-pptx-notes {
  width: min(920px, 100%);
  padding: 10px 14px;
  border: 1px solid var(--cyan-hair);
  background-color: rgba(0, 245, 255, 0.03);
}

.doc-pptx-notes-body {
  margin: 6px 0 0;
  white-space: pre-wrap;
  font-size: 0.85rem;
  color: var(--text-sub);
}

.doc-pptx-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--cyan-hair);
  background-color: rgba(0, 18, 28, 0.45);
}

.doc-pptx-outline {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-pptx-outline-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-pptx-outline-p {
  margin: 0;
  line-height: 1.5;
}

.doc-pptx-outline-p.is-title {
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--cyan-bright);
}

.doc-pptx-outline-img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  align-self: flex-start;
  border: 1px solid var(--cyan-hair);
}

.doc-pptx-outline-note {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--cyan-hair);
  font-size: 0.8rem;
  color: var(--text-sub);
  white-space: pre-wrap;
}

/* 純文字與程式碼預覽 */
.doc-code-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--cyan-bright);
}

/* 影片與音訊播放器（YouTube / COOL Video / 原生影音串流） */
.doc-video-stage {
  width: 100%;
}

.doc-video-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 64vh;
  border: 1px solid var(--cyan-line);
  background-color: #000000;
  overflow: hidden;
}

.doc-video-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.doc-video-player {
  width: 100%;
  max-height: 64vh;
  border: 1px solid var(--cyan-line);
  background-color: #000000;
  display: block;
}

.doc-cool-video-iframe {
  width: 100%;
  height: 64vh;
  border: 1px solid var(--cyan-line);
  background-color: #000000;
  display: block;
}

.doc-audio-wrap {
  padding: 20px;
  border: 1px solid var(--cyan-line);
  background-color: rgba(0, 18, 28, 0.55);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-audio-player {
  width: 100%;
}

/* 公告與討論區／回覆串附加檔案區塊 */
.rich-attachments-box {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--cyan-line);
  background-color: rgba(0, 18, 28, 0.45);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rich-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rich-attachment-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================
   作業詳情與系統內繳交工作區（Assignment Submission HUD）
   ========================================================= */
.assign-workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.assign-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assign-status-box,
.assign-submit-box {
  padding: 14px 16px;
  --box-bg: rgba(0, 14, 22, 0.72);
  --box-edge: var(--cyan-line);
}

.assign-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.assign-meta-line,
.assign-constraint {
  font-size: 0.76rem;
  color: var(--text-sub);
  line-height: 1.5;
}

.assign-submitted-preview {
  padding: 10px 12px;
  border: 1px solid var(--cyan-hair);
  background-color: rgba(0, 245, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.assign-preview-label {
  font-size: 0.72rem;
  color: var(--cyan-dim);
  letter-spacing: 0.06em;
}

.assign-preview-link {
  color: var(--cyan-bright);
  word-break: break-all;
  text-decoration: underline;
}

.assign-submitted-text {
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.86rem;
}

.assign-comments-wrap {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--cyan-hair);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assign-sub-title {
  font-size: 0.74rem;
  color: var(--cyan);
  letter-spacing: 0.08em;
}

.assign-comment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.assign-comment-text {
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: pre-wrap;
  line-height: 1.5;
}

.assign-inline-comment {
  display: flex;
  gap: 8px;
  align-items: center;
}

.assign-inline-comment .hud-input {
  flex: 1;
}

.assign-muted {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.assign-lock-exp {
  margin-top: 6px;
  font-size: 0.8rem;
}

.assign-resubmit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.assign-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assign-dropzone {
  padding: 22px 16px;
  border: 1px dashed var(--cyan-line);
  background-color: rgba(0, 245, 255, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.assign-dropzone:hover,
.assign-dropzone.is-dragover {
  border-color: var(--cyan);
  background-color: rgba(0, 245, 255, 0.09);
  box-shadow: inset 0 0 18px rgba(0, 245, 255, 0.14);
}

.assign-dropzone-title {
  font-size: 0.9rem;
  color: var(--cyan-bright);
  font-weight: 500;
}

.assign-dropzone-sub {
  font-size: 0.74rem;
  color: var(--text-sub);
}

.assign-file-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.assign-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--cyan-hair);
  background-color: rgba(0, 245, 255, 0.035);
}

.assign-file-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.assign-file-name {
  font-size: 0.85rem;
  color: var(--text-main);
  word-break: break-all;
}

.assign-file-size {
  font-size: 0.72rem;
  color: var(--text-sub);
}

.assign-file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.assign-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.assign-progress-label {
  font-size: 0.74rem;
  color: var(--cyan);
}

.assign-progress-track {
  width: 100%;
  height: 7px;
  border: 1px solid var(--cyan-line);
  background-color: rgba(0, 245, 255, 0.06);
  overflow: hidden;
}

.assign-progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  transition: width 0.15s ease;
}

.assign-submit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* =========================================================
   動畫與響應式設計
   ========================================================= */
@keyframes sweepBar {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

@media (max-width: 1080px) {
  html, body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .cool-shell,
  .cool-main-wrap,
  .hud-stage,
  .view-dashboard,
  .view-course,
  .view-calendar,
  .view-inbox,
  .cool-layout,
  .cool-dashboard-main,
  .courses-grid,
  .cool-right-rail,
  .course-workspace,
  .course-tab-content,
  .cal-workspace,
  .cal-main-area,
  .cal-side-panel,
  .inbox-workspace,
  .inbox-list-pane,
  .inbox-thread-pane,
  .inbox-thread-wrap,
  .inbox-messages,
  .login-layout,
  .login-terminal {
    height: auto;
    overflow: visible;
  }
  .cool-sidebar {
    height: auto;
  }
  .cool-layout,
  .login-layout,
  .course-workspace,
  .cal-workspace,
  .inbox-workspace {
    grid-template-columns: 1fr;
  }
  .course-subnav {
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .subnav-btn {
    width: auto;
  }
}

@media (max-width: 720px) {
  .cool-shell {
    flex-direction: column;
  }
  .cool-sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 1px solid var(--cyan-line);
    padding: 8px 10px;
  }
  .sidebar-brand {
    width: auto;
    border-bottom: 0;
    padding-bottom: 0;
    flex-direction: row;
  }
  .sidebar-nav,
  .sidebar-footer {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
  }
  .side-nav-btn {
    width: auto;
    padding: 6px 8px;
  }
  .hud-stage {
    padding: 14px;
  }
  .cool-topbar {
    padding: 10px 14px;
    flex-wrap: wrap;
  }
  .course-drawer {
    left: 0;
    z-index: 60;
  }
  .assign-inline-comment,
  .assign-file-row {
    flex-direction: column;
    align-items: stretch;
  }
  .assign-file-actions {
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
