/* 長安願景島 - 主樣式表 */
@import url('https://fonts.googleapis.com/css2?family=LXGW+WenKai+TC:wght@400;700&family=Noto+Sans+TC:wght@400;500;700&display=swap');

:root {
  /* 主色與強調色 (強化對比，全站文字皆 >= WCAG AA 4.5:1，搭配繪本童趣立體感) */
  --primary: #b91c4a;
  --primary-hover: #96143a;
  --primary-text: #8f163b;
  --primary-light: #ffe4ec;
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --accent-text: #9a3412;
  --accent-light: #ffedd5;
  --badge-bg: #b45309;
  --badge-ink: #ffffff;
  --toy-lip: #8f163b;

  /* 預設主題：櫻花 (預設/黃昏) */
  --bg: #fdf0f2;
  --surface: rgba(255, 255, 255, 0.98);
  --surface-solid: #ffffff;
  --surface-card: #fff6f8;
  --ink: #170a10;
  --muted: #4a2a36;
  --line: rgba(143, 22, 59, 0.42);
  --glass-bg: rgba(255, 255, 255, 0.96);
  --shadow: 0 4px 0 rgba(143, 22, 59, 0.28), 0 10px 24px rgba(23, 10, 16, 0.18);
  --shadow-lg: 0 6px 0 rgba(143, 22, 59, 0.3), 0 16px 36px rgba(23, 10, 16, 0.25);

  --font-title: 'LXGW WenKai TC', 'Noto Sans TC', cursive, sans-serif;
  --font-body: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 主題 2：奶霜 (白天) */
html[data-theme="cream"] {
  --bg: #fbf6ee;
  --surface: rgba(255, 255, 252, 0.98);
  --surface-solid: #ffffff;
  --surface-card: #fef6e4;
  --ink: #17110a;
  --muted: #47392a;
  --primary: #b91c4a;
  --primary-hover: #96143a;
  --primary-text: #8f163b;
  --primary-light: #ffe4ec;
  --accent: #ea580c;
  --accent-text: #8c3504;
  --badge-bg: #9a3412;
  --badge-ink: #ffffff;
  --toy-lip: #7c2d12;
  --line: rgba(124, 45, 18, 0.4);
  --glass-bg: rgba(255, 254, 249, 0.96);
  --shadow: 0 4px 0 rgba(124, 45, 18, 0.26), 0 10px 24px rgba(23, 17, 10, 0.18);
  --shadow-lg: 0 6px 0 rgba(124, 45, 18, 0.28), 0 16px 36px rgba(23, 17, 10, 0.26);
}

/* 主題 3：紫夜 (夜晚 - 亮字配深底高對比＋糖果霓虹童趣) */
html[data-theme="night"] {
  --bg: #2a1f33;
  --surface: rgba(22, 14, 36, 0.97);
  --surface-solid: #160e24;
  --surface-card: #261a3b;
  --ink: #ffffff;
  --muted: #ede2fa;
  --primary: #e11d68;
  --primary-hover: #f43f82;
  --primary-text: #ff99c8;
  --accent: #fbbf24;
  --accent-text: #ffd166;
  --badge-bg: #ffd166;
  --badge-ink: #160e24;
  --toy-lip: #0a0512;
  --line: rgba(255, 185, 225, 0.5);
  --glass-bg: rgba(22, 14, 36, 0.95);
  --shadow: 0 4px 0 rgba(0, 0, 0, 0.65), 0 10px 28px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 6px 0 rgba(0, 0, 0, 0.72), 0 16px 42px rgba(0, 0, 0, 0.7);
  --primary-light: #471d3d;
  --accent-light: #4a3110;
}

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

html, body {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  position: relative;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--ink);
  user-select: none;
  transition: background-color 1.5s ease, color 0.5s ease;
}

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

#three-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* 透明流星 Canvas */
#meteor-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 2;
  pointer-events: none;
}

/* 3D 浮動島嶼名稱標籤 */
#labels-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  z-index: 3;
  pointer-events: none;
}

.island-label {
  position: absolute;
  pointer-events: auto;
  transform: translate(-50%, -100%);
  background: var(--surface-solid);
  border: 2.5px solid var(--primary-text);
  color: var(--ink);
  padding: 6px 13px;
  border-radius: 22px;
  font-family: var(--font-title);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 4px 0 var(--toy-lip), 0 8px 18px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.25s;
  white-space: nowrap;
}

.island-label:hover {
  transform: translate(-50%, -118%) scale(1.08);
  background: var(--primary);
  color: #ffffff;
  border-color: #ffffff;
}

.island-label .badge {
  background: var(--badge-bg);
  color: var(--badge-ink);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 700;
}

/* 各島標籤童趣高對比彩色徽章 */
.island-label:nth-of-type(2) .badge { background: #0369a1; color: #ffffff; }
.island-label:nth-of-type(3) .badge { background: #047857; color: #ffffff; }
.island-label:nth-of-type(4) .badge { background: #6d28d9; color: #ffffff; }
.island-label:nth-of-type(5) .badge { background: #b91c4a; color: #ffffff; }
.island-label:nth-of-type(6) .badge { background: #b45309; color: #ffffff; }

html[data-theme="night"] .island-label:nth-of-type(2) .badge { background: #38bdf8; color: #160e24; }
html[data-theme="night"] .island-label:nth-of-type(3) .badge { background: #4ade80; color: #160e24; }
html[data-theme="night"] .island-label:nth-of-type(4) .badge { background: #c084fc; color: #160e24; }
html[data-theme="night"] .island-label:nth-of-type(5) .badge { background: #fb7185; color: #160e24; }
html[data-theme="night"] .island-label:nth-of-type(6) .badge { background: #ffd166; color: #160e24; }

/* 對話泡泡浮動層 */
.dialogue-bubble {
  position: absolute;
  pointer-events: auto;
  transform: translate(-50%, -120%);
  background: var(--surface-solid);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 12px 16px;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  max-width: 280px;
  min-width: 200px;
  font-size: 13px;
  z-index: 20;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dialogue-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 10px 10px 0;
  border-style: solid;
  border-color: var(--surface-solid) transparent;
  display: block;
  width: 0;
}

.dialogue-bubble .bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.dialogue-bubble .bubble-name {
  font-weight: 700;
  color: var(--primary-text);
  font-family: var(--font-title);
  font-size: 15px;
}

.dialogue-bubble .bubble-role {
  font-size: 11px;
  color: var(--muted);
}

.dialogue-bubble .bubble-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
}

.dialogue-bubble .bubble-text {
  line-height: 1.5;
  margin-bottom: 8px;
  font-size: 13px;
}

.dialogue-bubble .bubble-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.bubble-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 12.5px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--surface-card);
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.bubble-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.bubble-btn.trade {
  background: var(--badge-bg);
  color: var(--badge-ink);
  border-color: var(--badge-bg);
  font-weight: 700;
}

.bubble-btn.trade:hover {
  background: var(--accent-hover);
  color: #fff;
}

@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, -90%) scale(0.85); }
  to { opacity: 1; transform: translate(-50%, -120%) scale(1); }
}

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

.brand-container {
  pointer-events: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid var(--line);
  padding: 8px 16px;
  border-radius: 26px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mascot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fde047, #34d399);
  border: 2.5px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 3px 0 #b45309, 0 5px 12px rgba(52, 211, 153, 0.35);
  cursor: pointer;
  animation: mascotBob 3.2s ease-in-out infinite;
  transition: transform 0.2s;
}

@keyframes mascotBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(6deg); }
}

.brand-mascot:hover {
  transform: scale(1.14) rotate(8deg);
}

.brand-info h1 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-text);
  line-height: 1.2;
}

.brand-info p {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

/* 頂部快捷按鈕組 */
.top-actions {
  pointer-events: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-pill {
  pointer-events: auto;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  border-radius: 22px;
  border: 2px solid var(--line);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.btn-pill:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-pill:active {
  transform: translateY(1px);
}

.btn-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-pill.btn-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  gap: 0;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 16px;
}

/* 畫面上方明顯位置：靠左配置（接在標題列右側），完全不與右側按鈕重疊 */
.top-enrollment-wrap {
  position: static;
  margin-left: 16px;
  margin-right: auto;
  z-index: 12;
  pointer-events: none;
  flex-shrink: 0;
}

.top-enrollment-btn {
  pointer-events: auto;
  min-height: 48px;
  padding: 10px 24px;
  border-radius: 999px;
  border: 2.5px solid #ffffff;
  background: linear-gradient(135deg, #c2410c, #ea580c);
  color: #ffffff;
  font-family: var(--font-title);
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 5px 0 #7c2d12, 0 10px 24px rgba(124, 45, 18, 0.42), 0 0 0 4px rgba(251, 191, 36, 0.45);
  transition: var(--transition);
  white-space: nowrap;
}

.top-enrollment-btn:hover {
  background: linear-gradient(135deg, #9a3412, #c2410c);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 7px 0 #7c2d12, 0 14px 28px rgba(124, 45, 18, 0.5), 0 0 0 5px rgba(251, 191, 36, 0.6);
}

.top-enrollment-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #7c2d12, 0 6px 14px rgba(124, 45, 18, 0.35);
}

html[data-theme="night"] .top-enrollment-btn {
  background: linear-gradient(135deg, #fbbf24, #fde047);
  color: #160e24;
  border-color: #ffffff;
  box-shadow: 0 5px 0 #b45309, 0 10px 24px rgba(251, 191, 36, 0.45), 0 0 0 4px rgba(253, 224, 71, 0.35);
}

html[data-theme="night"] .top-enrollment-btn:hover {
  background: linear-gradient(135deg, #fde047, #fef08a);
}

@media (max-width: 1180px) {
  .top-enrollment-wrap {
    position: fixed;
    top: 132px;
    left: 20px;
    margin: 0;
  }
}

/* 提示訊息 Toast */
.island-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-solid);
  border: 1.5px solid var(--accent);
  color: var(--ink);
  padding: 9px 18px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 600;
  z-index: 200;
  max-width: calc(100vw - 32px);
  text-align: center;
  animation: popIn 0.25s ease;
}

@media (max-width: 1180px) {
  .island-toast {
    top: 128px;
  }
}

/* 右側功能懸浮面板 (羅盤 / 時鐘 / 快捷操作) */
.right-hud {
  position: absolute;
  top: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 10;
  pointer-events: none;
}

.hud-item {
  pointer-events: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid var(--line);
  padding: 8px 12px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 羅盤指示器 */
.compass-box {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 2px solid var(--primary);
  background: var(--surface-solid);
  cursor: pointer;
}

.compass-needle {
  width: 4px;
  height: 32px;
  position: absolute;
  background: linear-gradient(to bottom, #ef4444 50%, #94a3b8 50%);
  border-radius: 2px;
  transform-origin: center center;
  transition: transform 0.1s linear;
}

.compass-box::after {
  content: 'N';
  position: absolute;
  top: 1px;
  font-size: 9px;
  font-weight: bold;
  color: #ef4444;
}

/* 底部功能工作列 */
.bottom-dock {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid var(--line);
  padding: 6px 12px;
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  max-width: 95vw;
  overflow-x: auto;
  scrollbar-width: none;
}

.bottom-dock::-webkit-scrollbar {
  display: none;
}

.dock-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 20px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: var(--transition);
}

.dock-btn:hover {
  background: rgba(168, 44, 88, 0.16);
  color: var(--primary-text);
  transform: translateY(-2px);
}

.dock-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.dock-btn-featured {
  background: var(--badge-bg);
  color: var(--badge-ink);
  font-weight: 700;
}

.dock-btn-featured:hover {
  background: var(--accent-hover);
  color: #ffffff;
  transform: translateY(-2px);
}

/* 背包 HUD 徽章 */
.backpack-badge {
  background: var(--badge-bg);
  color: var(--badge-ink);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

/* 側邊主內容面板 (桌機側邊 / 手機底部抽屜) */
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface-solid);
  border-left: 2.5px solid var(--line);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.25);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.drawer-panel::before,
.modal-content::before {
  content: '';
  display: block;
  width: 100%;
  height: 7px;
  flex-shrink: 0;
  background: linear-gradient(90deg, #e11d48 0%, #f97316 20%, #facc15 40%, #10b981 60%, #0ea5e9 80%, #8b5cf6 100%);
}

.drawer-panel.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-bg);
}

.drawer-title-group {
  display: flex;
  flex-direction: column;
}

.drawer-tag {
  font-size: 12px;
  color: var(--accent-text);
  font-weight: 700;
}

.drawer-title {
  font-family: var(--font-title);
  font-size: 21px;
  font-weight: 700;
  color: var(--primary-text);
}

.drawer-close {
  min-height: 44px;
  min-width: 44px;
  border: 1.5px solid var(--line);
  background: var(--primary-light);
  color: var(--primary-text);
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.drawer-close:hover {
  background: var(--primary);
  color: #fff;
}

.drawer-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 數據卡片列 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--surface-card);
  border: 2px solid var(--line);
  border-top: 4px solid #e11d48;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card:nth-child(4n+2) { border-top-color: #ea580c; }
.stat-card:nth-child(4n+3) { border-top-color: #059669; }
.stat-card:nth-child(4n+4) { border-top-color: #0284c7; }

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-text);
  font-family: var(--font-title);
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 3px;
}

/* 核心指標項目 (四大願景繽紛色條) */
.vision-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vision-card {
  background: var(--surface-card);
  border: 1.5px solid var(--line);
  border-left: 5px solid #e11d48;
  border-radius: 6px 14px 14px 6px;
  padding: 11px 14px;
  box-shadow: var(--shadow);
}

.vision-card:nth-child(4n+2) { border-left-color: #ea580c; }
.vision-card:nth-child(4n+3) { border-left-color: #059669; }
.vision-card:nth-child(4n+4) { border-left-color: #0284c7; }

.vision-role {
  font-weight: 700;
  color: var(--primary-text);
  font-size: 14.5px;
}

.vision-desc {
  font-size: 13px;
  color: var(--ink);
  margin-top: 4px;
  line-height: 1.5;
}

/* 內容重點與清單 */
.points-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.points-list li {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  padding-left: 20px;
  position: relative;
}

.points-list li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--primary-text);
  font-size: 14px;
}

/* 外部連結按鈕 */
.link-btn-block {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #9b214d, #b45309);
  color: #ffffff;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  box-shadow: 0 4px 16px rgba(155, 33, 77, 0.35);
  transition: var(--transition);
}

.link-btn-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(192, 86, 122, 0.4);
}

/* 全域通用彈出視窗 (Modal) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 16px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface-solid);
  border-radius: 24px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content.wide {
  max-width: 720px;
}

/* 新生入學與學區專屬高對比表格樣式 */
.enroll-banner {
  background: var(--primary-light);
  border: 1.5px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.enroll-banner-title {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-text);
  margin-bottom: 4px;
}

.enroll-banner-sub {
  font-size: 13px;
  color: var(--muted);
}

.enroll-section {
  margin-bottom: 20px;
}

.enroll-section-title {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-text);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.enroll-note {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

.enroll-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface-card);
}

.enroll-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  color: var(--ink);
}

.enroll-table thead th {
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  white-space: nowrap;
}

.enroll-table tbody td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  line-height: 1.5;
}

.enroll-table tbody tr:nth-child(even) {
  background: rgba(168, 44, 88, 0.05);
}

html[data-theme="night"] .enroll-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.04);
}

.enroll-table tbody tr.enroll-highlight {
  background: var(--accent-light);
}

.enroll-table tbody tr.enroll-highlight td {
  font-weight: 700;
}

.enroll-date-strong {
  color: var(--primary-text);
  font-weight: 700;
}

.enroll-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.enroll-pill.required {
  background: var(--primary);
  color: #ffffff;
}

.enroll-pill.optional {
  background: var(--badge-bg);
  color: var(--badge-ink);
}

.enroll-village {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary-text);
  border: 1px solid var(--line);
  font-weight: 700;
  white-space: nowrap;
}

.enroll-check-row {
  cursor: pointer;
}

.enroll-check-row.checked td {
  opacity: 0.72;
  text-decoration: line-through;
}

.enroll-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
  vertical-align: middle;
}

.enroll-progress {
  font-family: var(--font-body);
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-ink);
  font-weight: 700;
}

.enroll-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.enroll-drawer-card {
  background: var(--accent-light);
  border: 1.5px solid var(--accent);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.enroll-drawer-card h4 {
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--primary-text);
}

.enroll-drawer-card p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
}

@media (max-width: 480px) {
  .enroll-actions {
    grid-template-columns: 1fr;
  }
  .enroll-table {
    font-size: 12.5px;
  }
  .enroll-table thead th,
  .enroll-table tbody td {
    padding: 8px 8px;
  }
}

@keyframes modalPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-title {
  font-family: var(--font-title);
  font-size: 19px;
  font-weight: bold;
  color: var(--primary-text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
}

/* 背包道具清單 */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.inventory-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.inventory-icon {
  font-size: 28px;
}

.inventory-name {
  font-size: 12px;
  font-weight: bold;
}

.inventory-count {
  font-size: 12px;
  color: var(--accent-text);
  font-weight: 700;
}

/* 漫遊第一人稱 HUD */
#walk-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  pointer-events: none;
  display: none;
}

#walk-hud.active {
  display: block;
}

.walk-tip {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  pointer-events: auto;
  animation: fadeInOut 6s forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  10% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

.walk-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
}

.walk-dpad {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 20px);
  left: 20px;
  width: 120px;
  height: 120px;
  pointer-events: auto;
  display: none;
}

.dpad-btn {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--primary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow);
}

.dpad-up { top: 0; left: 40px; }
.dpad-down { bottom: 0; left: 40px; }
.dpad-left { top: 40px; left: 0; }
.dpad-right { top: 40px; right: 0; }

.walk-exit-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  pointer-events: auto;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 22px;
  background: #ef4444;
  color: #fff;
  border: none;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* 測驗證書容器 */
.certificate-preview {
  background: linear-gradient(135deg, #fefce8, #fff7ed);
  border: 8px double #d97706;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  color: #78350f;
  margin: 16px 0;
  box-shadow: inset 0 0 20px rgba(217, 119, 6, 0.1);
}

.cert-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  color: #b45309;
  margin-bottom: 8px;
}

.cert-seal {
  width: 60px;
  height: 60px;
  margin: 12px auto 0;
  border: 2px dashed #b45309;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 13px;
  transform: rotate(-10deg);
}

/* 網頁左上方標題下方：訪客計數器位置與高對比主題連動 */
.visit-pill {
  position: fixed !important;
  top: 86px !important;
  bottom: auto !important;
  left: 20px !important;
  z-index: 10 !important;
  pointer-events: auto !important;
  border-radius: 20px !important;
  background: var(--glass-bg) !important;
  color: var(--ink) !important;
  border: 2px solid var(--line) !important;
  box-shadow: var(--shadow) !important;
}

/* RWD 平板與手機支援 (768px 與 375px) */
@media (max-width: 768px) {
  .top-header {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 8px;
    max-width: calc(100vw - 20px);
    overflow: hidden;
  }
  .brand-container {
    padding: 6px 10px;
    gap: 8px;
    flex-shrink: 0;
  }
  .brand-info p {
    display: none;
  }
  .top-actions {
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .top-actions::-webkit-scrollbar {
    display: none;
  }
  .btn-pill {
    padding: 6px 10px;
    min-height: 40px;
    min-width: 40px;
  }
  .drawer-panel {
    top: auto;
    bottom: 0;
    width: 100vw;
    height: 75vh;
    border-left: none;
    border-top: 1px solid var(--line);
    border-radius: 24px 24px 0 0;
    transform: translateY(105%);
  }
  .drawer-panel.open {
    transform: translateY(0);
  }
  .bottom-dock {
    bottom: calc(var(--safe-bottom) + 6px);
    padding: 4px 8px;
    gap: 4px;
  }
  .dock-btn {
    font-size: 12px;
    padding: 6px 10px;
  }
  .right-hud {
    top: 70px;
    right: 10px;
  }
  .walk-dpad {
    display: block;
  }
  .visit-pill {
    top: 70px !important;
    bottom: auto !important;
    left: 10px !important;
  }
  .top-enrollment-wrap {
    top: 112px;
    left: 10px;
  }
}

@media (max-width: 480px) {
  .top-header {
    top: 8px;
    left: 6px;
    right: 6px;
    gap: 4px;
    max-width: calc(100vw - 12px);
  }
  .brand-container {
    padding: 4px 7px;
    max-width: 112px;
    gap: 5px;
  }
  .brand-info h1 {
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-mascot {
    width: 24px;
    height: 24px;
    font-size: 14px;
    flex-shrink: 0;
  }
  .top-actions {
    gap: 3px;
    max-width: calc(100vw - 120px);
    overflow-x: auto;
    overflow-y: hidden;
  }
  .top-actions .btn-pill,
  .top-actions .btn-pill.btn-icon {
    width: 33px;
    height: 33px;
    min-width: 33px;
    min-height: 33px;
    padding: 0;
    justify-content: center;
    font-size: 14px;
  }
  .btn-pill {
    padding: 4px 10px;
    min-height: 36px;
    min-width: 36px;
  }
  .btn-pill.btn-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    font-size: 14px;
  }
  .visit-pill {
    top: 50px !important;
    bottom: auto !important;
    left: 8px !important;
  }
  .top-enrollment-wrap {
    position: fixed;
    top: 86px;
    left: 8px;
    margin: 0;
  }
  .top-enrollment-btn {
    min-height: 38px;
    padding: 6px 14px;
    font-size: 13.5px;
  }
  .island-toast {
    top: 98px;
    font-size: 12.5px;
    padding: 7px 14px;
  }
  .right-hud {
    top: 98px;
    right: 8px;
  }
  .btn-pill span.btn-text {
    display: none;
  }
  .dock-btn span.btn-text {
    display: none;
  }
  .dock-btn {
    min-width: 44px;
    justify-content: center;
  }
  .dialogue-bubble {
    max-width: 240px;
  }
}

/* 減少動態 prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

.reduced-motion * {
  animation: none !important;
  transition: none !important;
}
