/* === 翻課星球 · 六邊形寵物系統 全域樣式 === */
:root {
  --bg-deep: #0a0b16;
  --bg-surface: rgba(22, 25, 48, 0.75);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(0, 229, 255, 0.5);

  --text-main: #f0f3fa;
  --text-muted: #9aa5be;
  --text-highlight: #00e5ff;

  --accent-cyan: #00e5ff;
  --accent-purple: #b388ff;
  --accent-gold: #ffd700;
  --accent-orange: #ff6d00;
  --accent-red: #ff3366;
  --accent-green: #00e676;

  --font-base: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --shadow-glow: 0 0 20px rgba(0, 229, 255, 0.25);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

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

body {
  font-family: var(--font-base);
  background: radial-gradient(circle at 50% 15%, #181b36 0%, #080912 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* === 玻璃態通用容器 === */
.glass-card {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.glass-panel {
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  transition: all 0.25s ease;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

/* === 頂部導航列 === */
.main-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(10, 12, 24, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.nav-logo {
  font-size: 1.5rem;
}

.nav-tabs {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-glass);
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.25s ease;
}

.nav-tab-btn.active {
  background: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.4);
}

.btn-icon-tool {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: #fff;
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon-tool:hover {
  border-color: var(--accent-cyan);
  transform: scale(1.05);
}

/* === 內容版面 === */
.app-container {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

/* === 教師中控台 === */
.dashboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.mode-switch-group {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: var(--radius-pill);
}

.btn-mode {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-mode.active {
  background: linear-gradient(135deg, #00e5ff, #7c4dff);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 229, 255, 0.35);
}

.class-selector-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-family {
  background: linear-gradient(135deg, #ff9800, #f50057);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: bold;
}

/* === 成員名冊卡片區 === */
.roster-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.member-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.member-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 229, 255, 0.4);
}

.member-card.selected {
  border-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.12);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.3);
}

.card-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
}

.card-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.card-avatar-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-avatar-wrap .pet-img-container {
  width: 76px;
  height: 76px;
  max-width: 76px;
  max-height: 76px;
  padding: 4px;
  border-radius: 12px;
}

.pet-mini-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pet-svg-avatar {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s ease;
}

.member-card:hover .pet-svg-avatar,
.member-card:hover .pet-img-container {
  transform: scale(1.06);
}

.seat-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  background: #000;
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.card-info {
  text-align: center;
  width: 100%;
}

.member-name {
  font-size: 1.05rem;
  font-weight: 700;
  display: block;
}

.pet-stage-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.card-meta {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 8px 0;
}

.token-pill, .exp-pill {
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
}

.token-pill {
  color: var(--accent-gold);
}

.exp-pill {
  color: var(--accent-cyan);
}

.card-title-tag {
  margin-top: 4px;
}

.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: transform 0.15s;
}

.btn-icon:hover {
  transform: scale(1.2);
}

/* === 加分鍵盤矩陣 === */
.scoring-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scoring-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1.05rem;
}

.scoring-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: normal;
}

.behavior-btn-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.btn-behavior {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--hex-color, var(--accent-cyan));
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.btn-behavior:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-behavior.negative {
  border-left-color: var(--accent-red);
}

.beh-icon {
  font-size: 1.4rem;
}

.beh-body {
  flex: 1;
}

.beh-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
}

.beh-hex {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.beh-points {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-green);
}

.btn-behavior.negative .beh-points {
  color: var(--accent-red);
}

.custom-scoring-row {
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: 400px;
}

/* === 個人遊戲艙 (Student Pod) === */
.pod-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pod-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.pod-wealth-pills {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.pill-gold, .pill-exp, .pill-pity {
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--border-glass);
}

.pill-gold { color: var(--accent-gold); }
.pill-exp { color: var(--accent-cyan); }
.pill-pity { color: var(--accent-purple); }

.pod-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .pod-main-grid {
    grid-template-columns: 1fr;
  }
}

.pet-stage-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.pet-visual-pedestal {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pet-svg-large-wrap,
.pet-img-large-wrap {
  width: 180px;
  height: 180px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: floatAnim 3.5s ease-in-out infinite;
}

.pet-img-large-wrap .pet-img-container {
  max-width: 180px;
  max-height: 180px;
  padding: 6px;
}

@keyframes floatAnim {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.pedestal-glow {
  position: absolute;
  bottom: 10px;
  width: 140px;
  height: 30px;
  border-radius: 50%;
  filter: blur(25px);
  opacity: 0.6;
}

.pet-name-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 15px;
}

.evolution-progress-box {
  width: 100%;
  margin-bottom: 20px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

.progress-bar-fill {
  height: 100%;
  transition: width 0.5s ease;
}

.pet-action-grid {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 380px;
}

.pet-action-grid .btn {
  flex: 1;
}

/* === 六邊形雷達圖區 === */
.hexagon-insight-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hex-card-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.radar-canvas-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
}

.hex-eval-feedback {
  text-align: center;
  margin-bottom: 15px;
}

.eval-comment {
  font-style: italic;
  color: var(--accent-cyan);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.dominant-row {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hex-stats-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.stat-chip {
  background: rgba(0, 0, 0, 0.35);
  border-left: 3px solid #fff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.chip-val {
  font-weight: bold;
  color: #fff;
}

/* === 商店與背包 === */
.shop-inventory-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.shop-item-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.shop-item-card.disabled {
  opacity: 0.5;
}

.item-icon {
  font-size: 2rem;
}

.item-body {
  flex: 1;
}

.item-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.item-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 3px 0;
}

.item-cost {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.inventory-area {
  padding-top: 15px;
  border-top: 1px solid var(--border-glass);
}

.inventory-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.inventory-ticket {
  background: rgba(255, 215, 0, 0.15);
  border: 1px dashed var(--accent-gold);
  color: var(--accent-gold);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
}

/* === 大螢幕 HUD (Big Screen) === */
.hud-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hud-live-tag {
  background: var(--accent-red);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  animation: pulseTag 1.5s infinite;
}

@keyframes pulseTag {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.hud-boss-stage {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  transition: transform 0.2s;
}

.hud-boss-stage.hit-shake {
  animation: shakeAnim 0.35s ease;
}

@keyframes shakeAnim {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-8px, 4px); }
  40% { transform: translate(8px, -4px); }
  60% { transform: translate(-6px, 2px); }
  80% { transform: translate(6px, -2px); }
}

.boss-identity-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.boss-avatar-box {
  width: 90px;
  height: 90px;
  background: rgba(255, 51, 102, 0.2);
  border: 2px solid var(--accent-red);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
}

.boss-info-box {
  flex: 1;
}

.boss-name-text {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
}

.boss-desc-text {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.boss-hp-numbers {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-red);
}

.boss-hp-track {
  width: 100%;
  height: 28px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-pill);
  border: 2px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff3366, #ff9100);
  box-shadow: 0 0 15px rgba(255, 51, 102, 0.6);
  transition: width 0.4s ease-out;
}

.boss-victory-banner {
  background: linear-gradient(135deg, #ffd700, #ff6d00);
  color: #000;
  padding: 14px;
  border-radius: var(--radius-md);
  font-weight: 800;
  text-align: center;
  font-size: 1.2rem;
  animation: bounceBanner 0.6s ease infinite alternate;
}

@keyframes bounceBanner {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}

.hud-bottom-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .hud-bottom-grid {
    grid-template-columns: 1fr;
  }
}

.hud-log-stream {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.hud-log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.log-time { color: var(--text-muted); font-size: 0.75rem; }
.log-badge { font-weight: bold; }
.log-impact { color: var(--accent-green); font-weight: 700; }
.log-dmg { color: var(--accent-red); font-weight: 800; margin-left: auto; }

.stars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.star-item-card {
  padding: 12px;
  text-align: center;
  border-top: 3px solid #fff;
}

.star-icon-row span { font-size: 1.4rem; }
.star-icon-row small { display: block; color: var(--text-muted); font-size: 0.75rem; }
.star-winner { font-size: 1rem; margin: 6px 0; color: #fff; }
.star-score { font-size: 0.75rem; color: var(--accent-cyan); font-weight: 600; }

/* === 按鈕與表單共用元件 === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #00e5ff, #0072ff);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 229, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.5);
}

.btn-accent {
  background: linear-gradient(135deg, #b388ff, #7c4dff);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: #fff;
}

.btn-outline:hover {
  border-color: #fff;
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}

.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-xs { padding: 4px 10px; font-size: 0.75rem; }
.btn-disabled { background: #333; color: #777; cursor: not-allowed; }

.badge {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-subtle { background: rgba(255, 255, 255, 0.1); color: var(--text-muted); }
.badge-accent { background: rgba(0, 229, 255, 0.2); color: var(--accent-cyan); }
.badge-title { background: rgba(179, 136, 255, 0.25); color: var(--accent-purple); }

.form-input, .form-select {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-glass);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-cyan);
}

/* === 視窗與彈出框 (Modal) === */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-window {
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-window.large {
  max-width: 850px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.btn-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  flex: 1;
}

.modal-footer {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.floating-toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: rgba(0, 229, 255, 0.95);
  color: #000;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  z-index: 1000;
}

.floating-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* === QR Code 名片卡列印網格 === */
.qr-print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.qr-print-card {
  background: #ffffff;
  color: #000;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.qr-card-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.qr-badge {
  background: #000;
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.qr-img-wrap img {
  width: 130px;
  height: 130px;
  display: block;
}

.qr-card-footer small {
  display: block;
  font-size: 0.75rem;
  color: #666;
  margin-top: 6px;
}

.qr-direct-link {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: #0066cc;
  text-decoration: none;
}

@media print {
  body * {
    visibility: hidden;
  }
  .qr-print-grid, .qr-print-grid * {
    visibility: visible;
  }
  .qr-print-grid {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    background: #fff;
    padding: 20px;
  }
}

/* === 📖 完整寵物圖鑑與數值展覽館 (Bestiary) === */
.bestiary-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.bestiary-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.affinity-filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-glass);
}

.filter-tab-btn {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab-btn:hover {
  border-color: var(--tab-color, var(--accent-cyan));
  color: #fff;
}

.filter-tab-btn.active {
  background: var(--tab-color, var(--accent-cyan));
  border-color: var(--tab-color, var(--accent-cyan));
  color: #000;
  font-weight: 800;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.4);
}

.bestiary-affinities-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.affinity-showcase-box {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.affinity-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.affinity-title-row h3 {
  font-size: 1.4rem;
  color: #fff;
}

.affinity-lore {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.evolution-timeline-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

@media (max-width: 1300px) {
  .evolution-timeline-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 800px) {
  .evolution-timeline-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .evolution-timeline-grid {
    grid-template-columns: 1fr;
  }
}

.stage-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  border-radius: var(--radius-md);
  position: relative;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
}

.stage-card.mythic-card {
  border-color: var(--accent-gold);
  background: radial-gradient(circle at 50% 20%, rgba(255, 215, 0, 0.15) 0%, rgba(20, 22, 40, 0.8) 100%);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.25);
}

.stage-badge-pill {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-glass);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.stage-visual-wrap, .pet-mini-preview, .pet-img-large-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
}

.pet-img-container {
  width: 100%;
  max-width: 170px;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border-radius: 14px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pet-img-container:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 229, 255, 0.4);
  border-color: var(--accent-cyan);
}

.pet-ai-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.stage-card.mythic-card .pet-img-container {
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.stage-name-box {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}

.stage-stats-table {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  margin-bottom: 12px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.stat-row strong {
  color: #fff;
}

.exp-tag {
  color: var(--accent-cyan);
  font-weight: 700;
}

.stage-lore-box {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent-gold);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.stage-lore-text {
  font-size: 0.74rem;
  color: #cfd8dc;
  line-height: 1.45;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stage-skill-box {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent-cyan);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.skill-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-bottom: 3px;
}

.skill-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* === 分批產製排程進度看板 (Pipeline Ledger Banner) === */
.pipeline-ledger-banner {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(0, 229, 255, 0.08));
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.pipeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.pipeline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.pipeline-status-badge {
  background: rgba(255, 215, 0, 0.2);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.pipeline-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pipeline-card-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.pipeline-card-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}

.stage-prompt-box {
  width: 100%;
  text-align: left;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.btn-copy-prompt {
  background: rgba(0, 229, 255, 0.2);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-copy-prompt:hover {
  background: var(--accent-cyan);
  color: #000;
}

.prompt-text {
  font-size: 0.7rem;
  color: #8892b0;
  word-break: break-all;
  font-family: monospace;
  max-height: 50px;
  overflow-y: auto;
  line-height: 1.3;
}

/* === 3.0 全域矩陣圖鑑與全息尊爵卡片樣式 === */
.title-with-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.badge-pill-glow {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 109, 0, 0.25));
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

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

.filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.class-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.branch-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.branch-synergy-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.tier-5-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* === 全息尊爵卡片 (Procedural Holographic Card) === */
.pet-img-container.pet-procedural-card {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  position: relative;
  overflow: visible !important;
}

.pet-procedural-card .procedural-svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 14px;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.55));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.pet-procedural-card:hover .procedural-svg {
  transform: translateY(-3px) scale(1.02);
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.75)) drop-shadow(0 0 16px var(--aff-color));
}

/* === 金色神話呼吸光芒 (Golden Mythic Breathing Aura) === */
@keyframes mythicGoldBreath {
  0% {
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.4)) drop-shadow(0 4px 16px rgba(0, 0, 0, 0.6));
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.35);
  }
  50% {
    filter: drop-shadow(0 0 26px rgba(255, 215, 0, 0.85)) drop-shadow(0 6px 22px rgba(255, 215, 0, 0.45));
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.7);
  }
  100% {
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.4)) drop-shadow(0 4px 16px rgba(0, 0, 0, 0.6));
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.35);
  }
}

.pet-procedural-card.mythic-card-glow .procedural-svg {
  animation: mythicGoldBreath 3s infinite ease-in-out;
}

.pet-img-container.mythic-pulse,
.stage-card.mythic-card .pet-img-container {
  animation: mythicGoldBreath 3s infinite ease-in-out;
  border-color: var(--accent-gold) !important;
}

.pill-class {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* === 24 行為核發雙重分類篩選樣式 === */
.scoring-filters-panel {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
}

.filter-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: #c9d1d9;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.filter-chip.active {
  background: var(--chip-color, var(--accent-cyan));
  color: #000;
  font-weight: 700;
  border-color: var(--chip-color, var(--accent-cyan));
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

/* === 40 人平板個人艙 QR Code 桌牌列印樣式 === */
.desk-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.desk-qr-card {
  background: #ffffff;
  color: #1a1a1a;
  border: 2px dashed #9aa5be;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  break-inside: avoid;
  page-break-inside: avoid;
}

.desk-card-header {
  padding: 8px 12px;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

.desk-card-seat {
  font-size: 1.1rem;
}

.desk-card-class {
  font-size: 0.85rem;
  opacity: 0.9;
}

.desk-card-body {
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.desk-card-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.desk-student-name {
  font-size: 1.25rem;
  font-weight: 900;
  color: #111;
  margin-bottom: 6px;
}

.desk-pet-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.desk-pet-img-wrap {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
  border: 1px solid #ddd;
}

.desk-pet-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.desk-pet-label {
  font-size: 0.72rem;
  color: #555;
  margin-top: 4px;
}

.desk-card-right {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.desk-qr-box {
  width: 110px;
  height: 110px;
  padding: 4px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.desk-qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.desk-qr-tip {
  font-size: 0.7rem;
  color: #666;
  margin-top: 4px;
  font-weight: 600;
}

.desk-card-footer {
  background: #f7f9fa;
  border-top: 1px solid #e1e4e8;
  padding: 4px 10px;
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: #777;
}

/* === 列印專用樣式 (@media print) === */
@media print {
  body * {
    visibility: hidden;
  }
  .modal-backdrop#qrDeskCardModal,
  .modal-backdrop#qrDeskCardModal * {
    visibility: visible;
  }
  .modal-backdrop#qrDeskCardModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: transparent !important;
    padding: 0;
  }
  .modal-window.large {
    max-width: 100% !important;
    max-height: none !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .modal-header,
  .modal-footer {
    display: none !important;
  }
  .desk-qr-print-container {
    padding: 0 !important;
    overflow: visible !important;
  }
  .desk-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12mm !important;
  }
  .desk-qr-card {
    border: 1px dashed #444 !important;
    box-shadow: none !important;
  }
}

/* === 啟蒙契約儀式：盟寵自由選擇與五階神秘鎖定 === */
.starter-modal-window {
  max-width: 1080px !important;
  max-height: 94vh !important;
  display: flex;
  flex-direction: column;
}

.starter-modal-body {
  overflow-y: auto;
  padding: 18px 24px;
}

.starter-step-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}

.starter-step-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.step-badge {
  background: var(--accent-cyan);
  color: #000;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}

.starter-aff-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.starter-aff-card {
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.2s ease;
}

.starter-aff-card:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-2px);
  border-color: var(--aff-color);
}

.starter-aff-card.selected {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--aff-color);
  box-shadow: 0 0 14px var(--aff-color);
}

.aff-icon-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-bottom: 6px;
  box-shadow: 0 0 8px currentColor;
}

.aff-title {
  font-weight: 700;
  font-size: 0.9rem;
}

.aff-hex {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.starter-cls-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.starter-cls-card {
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.starter-cls-card:hover {
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-2px);
  border-color: var(--cls-color);
}

.starter-cls-card.selected {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--cls-color);
  box-shadow: 0 0 14px var(--cls-color);
}

.cls-icon {
  font-size: 1.6rem;
}

.cls-title {
  font-weight: 700;
  font-size: 0.92rem;
}

.cls-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.starter-branch-banner {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.starter-stages-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.starter-stage-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  position: relative;
  text-align: center;
}

.starter-stage-card.visible {
  border-color: rgba(0, 229, 255, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.stage-top-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(0, 229, 255, 0.2);
  color: var(--accent-cyan);
  display: inline-block;
  margin-bottom: 8px;
}

.stage-top-pill.locked-pill {
  background: rgba(255, 255, 255, 0.08);
  color: #888;
}

.starter-stage-card .stage-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.starter-stage-card .stage-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage-name {
  font-weight: 700;
  font-size: 0.88rem;
  margin: 8px 0 4px 0;
  color: #fff;
}

.stage-bst-pill {
  font-size: 0.7rem;
  font-weight: 800;
  color: #00e5ff;
  margin-bottom: 6px;
}

.stage-skill-box {
  text-align: left;
  font-size: 0.75rem;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.stage-brief {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.35;
  margin-top: 4px;
}

/* 🔒 神秘黑影封印樣式 */
.starter-stage-card.locked {
  border: 1px dashed rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.4);
  filter: grayscale(0.5);
}

.locked-silhouette {
  background: radial-gradient(circle at center, #1b2032 0%, #080a10 100%) !important;
  flex-direction: column;
}

.mystery-lock-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.4));
  animation: lockPulse 2s infinite ease-in-out;
}

.mystery-qmark {
  font-weight: 900;
  font-size: 1.1rem;
  color: #667799;
  letter-spacing: 2px;
  margin-top: 4px;
}

.locked-name {
  color: #7788aa !important;
}

.locked-bst {
  color: #556677 !important;
}

.locked-desc {
  font-size: 0.72rem;
  color: #778899;
  line-height: 1.4;
  text-align: center;
}

@keyframes lockPulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.08); opacity: 1; filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.8)); }
  100% { transform: scale(1); opacity: 0.8; }
}

@media (max-width: 900px) {
  .starter-aff-grid { grid-template-columns: repeat(3, 1fr); }
  .starter-cls-grid { grid-template-columns: repeat(2, 1fr); }
  .starter-stages-row { grid-template-columns: repeat(2, 1fr); }
}




