/* style.css - 萬安政策島 WAN-AN ISLAND 視覺樣式表 */
:root {
  --primary: #2563eb;
  --primary-dark: #1e3a8a;
  --bg-sky: #bae6fd;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
}

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

body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-sky);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  user-select: none;
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* 頂部 HUD 標題 */
.top-hud {
  position: absolute;
  top: 16px;
  left: 20px;
  z-index: 10;
  pointer-events: none;
}

.brand-badge {
  display: inline-block;
  background: var(--primary-dark);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.top-hud h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  color: var(--primary-dark);
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-hud p {
  margin: 4px 0 0;
  font-size: 13px;
  color: #1e293b;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
}

/* 頂部右上功能鈕 */
.top-actions {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 10;
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.2s;
}

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

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

/* 底部浮動導航列 (Dock) */
.dock {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  padding: 6px 10px;
  border-radius: 40px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.85);
  max-width: 95vw;
  overflow-x: auto;
}

.dock-btn {
  background: transparent;
  border: none;
  padding: 8px 14px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.dock-btn:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.dock-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* 3D 場景上的島嶼飄浮標籤 (CSS2D) */
.island-tag {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: transform 0.2s, background 0.2s;
  white-space: nowrap;
}

.island-tag:hover {
  transform: scale(1.12);
  background: var(--primary);
}

/* Q版Ｘ萬安市長頭頂標籤與對話框 */
.mayor-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  cursor: pointer;
}

.mayor-bubble {
  background: #ffffff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 12px;
  border: 2px solid #2563eb;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  margin-bottom: 3px;
  white-space: nowrap;
  animation: pulseBubble 2s infinite ease-in-out;
}

.mayor-name {
  background: #dc2626;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

/* 路人頭頂小狀態泡泡 */
.citizen-bubble {
  background: rgba(255, 255, 255, 0.9);
  color: #334155;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
  pointer-events: none;
}

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

/* 底部彈出抽屜 (Bottom Sheet) */
.sheet {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 105%);
  width: 100%;
  max-width: 540px;
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
  z-index: 20;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px 24px 32px;
}

.sheet.open {
  transform: translate(-50%, 0%);
}

.sheet-handle {
  width: 44px;
  height: 5px;
  background: #cbd5e1;
  border-radius: 4px;
  margin: 0 auto 16px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.sheet-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  color: var(--primary);
  background: #eff6ff;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}

.close-btn {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  font-weight: bold;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.sheet-body {
  font-size: 14px;
  line-height: 1.65;
  color: #334155;
  margin-bottom: 18px;
}

.sheet-body blockquote {
  margin: 10px 0;
  padding: 10px 14px;
  background: #f8fafc;
  border-left: 4px solid var(--accent-yellow);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  font-size: 13px;
  color: #475569;
}

.sheet-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.sfx-trigger-btn {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

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

/* 操作指引提示 */
.hint {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 5;
  opacity: 0.9;
  white-space: nowrap;
}

/* 行動端優化 */
@media (max-width: 640px) {
  .top-hud h1 {
    font-size: 19px;
  }
  .dock {
    bottom: 14px;
    gap: 4px;
    padding: 4px 6px;
  }
  .dock-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  .sheet {
    padding: 16px 20px 24px;
  }
}
