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

html, body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif;
  overflow: hidden;
  background: #0f172a;
}

#map {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, #030712 0%, #0a1428 52%, #132240 100%);
  transition: background 0.4s ease;
}

body.day-mode #map {
  background: linear-gradient(180deg, #7cc0fa 0%, #c8e3f8 60%, #e5eef5 100%);
}

/* ==========================================
   方案 A：3D 透視飛空艇側邊 YouTube LED 巨幕層
   ========================================== */
#airship-screen-stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.airship-billboard {
  position: absolute;
  left: 0;
  top: 0;
  width: 960px;
  height: 540px;
  transform-origin: 0 0;
  will-change: transform, opacity;
  background: #020617;
  border: 4px solid rgba(232, 85, 31, 0.95);
  border-radius: 6px;
  box-shadow:
    0 0 42px rgba(232, 85, 31, 0.72),
    0 0 90px rgba(251, 146, 60, 0.28),
    inset 0 0 16px rgba(232, 85, 31, 0.38);
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  backface-visibility: visible;
}

.airship-billboard.interactive {
  pointer-events: auto;
  border-color: #f97316;
  box-shadow: 0 0 32px rgba(249, 115, 22, 0.65);
}

.billboard-header {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(2, 6, 23, 0.72);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.live-pill {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.6px;
}

.billboard-title {
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 600;
}

.billboard-frame {
  position: relative;
  width: 100%;
  height: 100%;
}

.billboard-frame iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  pointer-events: none;
}

.airship-billboard.interactive .billboard-frame iframe {
  pointer-events: auto;
}

/* 輕微 LED 像素掃描線質感，讓巨幕更融入 3D 飛空艇 */
.billboard-scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02) 0px,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 3px
  );
}

.maplibregl-ctrl-bottom-right {
  bottom: 112px !important;
  right: 12px !important;
  z-index: 25;
}

.maplibregl-ctrl-bottom-left {
  bottom: 112px !important;
  left: 12px !important;
  z-index: 25;
}

.hud-card {
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.36);
}

.top-left {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 30;
  padding: 14px 16px;
  width: 280px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}

.title-row h1 {
  font-size: 15px;
  font-weight: 700;
}

.badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.4);
  white-space: nowrap;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f59e0b;
  display: inline-block;
  flex-shrink: 0;
}

.live-dot.online {
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
  animation: pulseDot 1.8s infinite;
}

.live-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.counter-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.counter-label {
  font-size: 12px;
  color: #cbd5e1;
}

.counter-value {
  font-size: 30px;
  font-weight: 800;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.counter-unit {
  font-size: 13px;
  color: #cbd5e1;
}

.meta-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
  gap: 8px;
}

.fps-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.14);
  padding: 1px 6px;
  border-radius: 5px;
  flex-shrink: 0;
}

.zone-breakdown {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
}

.zone-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
}

.zone-name {
  width: 108px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.zone-bar-bg {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
  overflow: hidden;
}

.zone-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #f97316);
  border-radius: 99px;
  transition: width 0.35s ease;
}

.zone-num {
  width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #94a3b8;
  flex-shrink: 0;
}

.top-right {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: flex-end;
  max-width: min(460px, 55vw);
}

.btn-group {
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.btn-group button,
.sim-buttons button {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn-group button:hover,
.sim-buttons button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.btn-group button:active,
.sim-buttons button:active {
  transform: scale(0.96);
}

.btn-group button.active,
.sim-buttons button.active {
  background: rgba(14, 165, 233, 0.35);
  border-color: #38bdf8;
  color: #e0f2fe;
}

.airship-panel,
.sim-panel {
  padding: 10px 12px;
  width: 100%;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.stream-badge {
  font-size: 10px;
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.18);
  padding: 1px 7px;
  border-radius: 99px;
}

.sim-panel.hidden,
.stream-form.hidden,
.theater-modal.hidden {
  display: none;
}

.sim-title {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 6px;
  letter-spacing: 0.4px;
}

.panel-header .sim-title {
  margin-bottom: 0;
}

.sim-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.sim-buttons button.highlight {
  background: rgba(249, 115, 22, 0.28);
  border-color: rgba(251, 146, 60, 0.6);
  color: #ffedd5;
  font-weight: 700;
}

.sim-buttons button.highlight:hover {
  background: rgba(249, 115, 22, 0.48);
}

.sim-buttons button.danger {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

.sim-buttons button.danger:hover {
  background: rgba(239, 68, 68, 0.42);
}

.stream-form {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}

.stream-form input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 6px 9px;
  color: #fff;
  font-size: 12px;
  outline: none;
}

.stream-form input:focus {
  border-color: #38bdf8;
}

.stream-form button {
  background: #0ea5e9;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.stream-form button:hover {
  background: #0284c7;
}

.bottom-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 11px 14px;
  width: min(94vw, 600px);
}

.speak-form {
  display: flex;
  gap: 8px;
}

.speak-form input {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  padding: 8px 11px;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.speak-form input::placeholder {
  color: #94a3b8;
}

.speak-form input:focus {
  border-color: #38bdf8;
  background: rgba(255, 255, 255, 0.15);
}

#input-name {
  width: 122px;
  flex-shrink: 0;
}

#input-msg {
  flex: 1;
  min-width: 0;
}

.speak-form button {
  background: #0ea5e9;
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.speak-form button:hover {
  background: #0284c7;
}

.hint-text {
  margin-top: 6px;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

/* 劇院放大視窗 */
.theater-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.theater-box {
  width: min(92vw, 960px);
  padding: 14px;
}

.theater-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 15px;
}

.theater-head button {
  background: rgba(239, 68, 68, 0.25);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-weight: 600;
}

.theater-video-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}

.theater-video-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* 前景小人與舉牌 */
.person-marker-root {
  pointer-events: none;
  will-change: transform;
}

.person-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.person-svg {
  width: 34px;
  height: 44px;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
  animation: gentleBounce 1.8s ease-in-out infinite;
}

.self-ring {
  position: absolute;
  bottom: -4px;
  width: 28px;
  height: 11px;
  border-radius: 50%;
  border: 2.5px solid #22c55e;
  background: rgba(34, 197, 94, 0.28);
  animation: ringPulse 1.8s infinite;
  z-index: -1;
}

.self-tag {
  position: absolute;
  top: 100%;
  margin-top: 3px;
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.person-bubble {
  position: absolute;
  bottom: 100%;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.97);
  color: #0f172a;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(15, 23, 42, 0.14);
}

.person-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.97) transparent transparent transparent;
}

.speak-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.speak-pin .person-bubble {
  position: relative;
  bottom: auto;
  margin-bottom: 3px;
  font-size: 11.5px;
}

.speak-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}

.landmark-label {
  background: rgba(15, 23, 42, 0.86);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

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

@keyframes ringPulse {
  0% { transform: scale(0.95); opacity: 0.9; }
  70% { transform: scale(1.48); opacity: 0.2; }
  100% { transform: scale(0.95); opacity: 0.9; }
}

@media (max-width: 720px) {
  .top-left {
    top: 10px;
    left: 10px;
    width: 195px;
    padding: 10px 12px;
  }
  .zone-breakdown {
    display: none;
  }
  .counter-value {
    font-size: 24px;
  }
  .top-right {
    top: 10px;
    right: 10px;
    max-width: 48vw;
  }
  #input-name {
    width: 84px;
  }
  .maplibregl-ctrl-bottom-right,
  .maplibregl-ctrl-bottom-left {
    bottom: 126px !important;
  }
}


/* ==========================================
   3D 空中煙火粒子畫布與爆開浮空留言文字
   ========================================== */
#fireworks-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 14;
  pointer-events: none;
}

#fireworks-text-stage {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  overflow: hidden;
}

.fw-sky-msg {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform, opacity;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.88) 0%, rgba(15, 23, 42, 0.70) 100%);
  border: 1.5px solid var(--fw-color, #fb923c);
  color: #ffffff;
  white-space: nowrap;
  box-shadow:
    0 0 18px var(--fw-glow, rgba(251, 146, 60, 0.8)),
    0 0 42px var(--fw-glow-soft, rgba(251, 146, 60, 0.42)),
    inset 0 0 12px rgba(255, 255, 255, 0.14);
  text-shadow:
    0 0 10px var(--fw-glow, rgba(251, 146, 60, 0.9)),
    0 2px 6px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

.fw-sky-icon {
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--fw-color, #fb923c));
}

.fw-sky-name {
  font-size: 13px;
  font-weight: 800;
  color: #fef08a;
  letter-spacing: 0.4px;
}

.fw-sky-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #ffffff;
}

body.day-mode .fw-sky-msg {
  background: rgba(15, 23, 42, 0.86);
}

.sim-buttons button.fw-btn {
  background: rgba(236, 72, 153, 0.28);
  border-color: rgba(244, 114, 182, 0.65);
  color: #fce7f3;
  font-weight: 700;
}

.sim-buttons button.fw-btn:hover {
  background: rgba(236, 72, 153, 0.48);
}
