/* ==========================================================================
   3D 細胞與胞器立體模型 (Cell-3D Unified Suite) 樣式表
   科技毛玻璃風格 (Glassmorphism) + 響應式佈局 (RWD) + 行動端觸控優化
   ========================================================================== */

:root {
  --bg-primary: #090d16;
  --panel-bg: rgba(15, 23, 42, 0.78);
  --panel-border: rgba(255, 255, 255, 0.12);
  --panel-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-cyan: #38bdf8;
  --accent-cyan-glow: rgba(56, 189, 248, 0.35);
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  font-family: var(--font-sans);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* 3D WebGL 畫布容器 */
#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  touch-action: none; /* 防止行動裝置滑動手勢觸發頁面捲動 */
}

/* 頂部主導航欄 */
.top-header {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.back-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.back-home-btn:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

.app-title-group h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #ffffff 30%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-title-group p {
  font-size: 11px;
  color: var(--text-muted);
}

/* 頂部中央模型切換分頁列 */
.nav-tab-container {
  pointer-events: auto;
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.8);
  padding: 6px;
  border-radius: 40px;
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--panel-shadow);
  max-width: 680px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tab-container::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 30px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.tab-btn.active {
  color: #0f172a;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  font-weight: 600;
  box-shadow: 0 0 16px var(--accent-cyan-glow);
}

.tab-btn .tab-icon {
  font-size: 14px;
}

/* 懸浮解說資訊卡 (HUD Info Card) */
#info-card {
  position: absolute;
  top: 76px;
  right: 18px;
  width: 360px;
  max-height: calc(100vh - 96px);
  z-index: 20;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--panel-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.card-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.card-title-wrap .badge {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
}

.card-title-wrap h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.card-title-wrap .sub-en {
  font-size: 12px;
  color: var(--text-dim);
  font-family: monospace;
}

.card-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.card-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.card-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-body::-webkit-scrollbar {
  width: 5px;
}
.card-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}

.info-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.info-text {
  font-size: 13px;
  line-height: 1.55;
  color: #cbd5e1;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-item .meta-k {
  font-size: 11px;
  color: var(--text-dim);
}

.meta-item .meta-v {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 2px;
}

/* 構造清單標籤與交互 */
.structure-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.structure-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 12px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.structure-tag:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
  color: #fff;
  transform: translateY(-1px);
}

.structure-tag.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.structure-tag .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-cyan);
}

/* 課綱重點條列 */
.curriculum-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.curriculum-list li {
  position: relative;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #cbd5e1;
}

.curriculum-list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent-cyan);
  font-size: 11px;
}

/* 懸浮工具列 (Bottom Toolbar) */
.floating-toolbar {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-bg);
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--panel-shadow);
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.tool-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.tool-btn .btn-icon {
  font-size: 14px;
}

/* 提示與狀態吐司 (Status Toast) */
#toast-notification {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--panel-border);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12.5px;
  color: var(--accent-cyan);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 30;
}

#toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* 構造點擊詳細資訊浮動提示 (Tooltip) */
#hover-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 40;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -130%);
  display: none;
  white-space: nowrap;
}

/* 響應式微調 (Responsive for Tablets & Mobile) */
@media (max-width: 900px) {
  .top-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .nav-tab-container {
    max-width: 100%;
    order: 2;
  }

  #info-card {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 48vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    transform: translateY(0);
  }

  #info-card.collapsed {
    transform: translateY(calc(100% - 54px));
  }

  .floating-toolbar {
    bottom: 56px;
    left: 12px;
    padding: 6px 10px;
  }

  .tool-btn {
    padding: 6px 10px;
    font-size: 11.5px;
  }
}

@media (max-width: 600px) {
  .brand-section .app-title-group h1 {
    font-size: 15px;
  }

  .tab-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .tool-btn .btn-text {
    display: none; /* 小螢幕僅顯示圖示 */
  }
}
