:root {
  --bg-deep: #050810;
  --bg-panel: rgba(8, 18, 32, 0.82);
  --border: rgba(0, 212, 255, 0.22);
  --accent: #00d4ff;
  --accent-dim: rgba(0, 212, 255, 0.45);
  --accent-warm: #ff6b35;
  --text: #e8f4fc;
  --text-muted: #7a9bb8;
  --glow: 0 0 24px rgba(0, 212, 255, 0.15);
  --font-display: "Orbitron", sans-serif;
  --font-body: "Noto Sans SC", sans-serif;
  --panel-width: 320px;
}

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

html {
  height: 100%;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 70% 20%, rgba(0, 100, 180, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(0, 212, 255, 0.06), transparent);
  pointer-events: none;
  z-index: 0;
}

.app {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  z-index: 1;
}

/* 左侧控制面板列（折叠钮在列外侧，不占面板内容宽度） */
.panel-column {
  position: relative;
  width: var(--panel-width);
  flex-shrink: 0;
  min-height: 0;
  overflow: visible;
  transition: width 0.22s ease;
}

.app.panel-collapsed .panel-column {
  width: 0;
  min-width: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  padding: 0;
  background: var(--bg-panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--glow);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: opacity 0.18s ease, border-color 0.22s ease;
}

.app.panel-collapsed .panel {
  border-right-color: transparent;
  opacity: 0;
  pointer-events: none;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
}

.panel-header {
  flex-shrink: 0;
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(
    165deg,
    rgba(0, 212, 255, 0.14) 0%,
    rgba(0, 100, 160, 0.06) 45%,
    transparent 100%
  );
  box-shadow: inset 0 -1px 0 rgba(0, 212, 255, 0.1);
}

.panel-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.4;
  color: #f2fbff;
  text-shadow:
    0 0 14px rgba(0, 212, 255, 0.65),
    0 0 32px rgba(0, 212, 255, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.45);
}

.panel-title-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.22em;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0.1em;
  vertical-align: -0.02em;
  text-shadow:
    0 0 18px rgba(0, 212, 255, 0.95),
    0 0 36px rgba(0, 212, 255, 0.45);
}

.section-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin: 0 0 8px;
  opacity: 0.9;
}

.section-label-sub {
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 400;
}

/* 控制面板各功能模块分隔框 */
.panel-body > .control-group {
  margin: 0 10px;
  padding: 10px 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 20, 40, 0.5);
}

.panel-body > .control-group[hidden] {
  display: none;
}

.app.panel-collapsed .panel-body {
  display: none;
}

.panel-toggle-btn {
  position: absolute;
  left: 100%;
  top: 50%;
  z-index: 20;
  transform: translateY(-50%);
  box-sizing: border-box;
  width: 28px;
  height: 52px;
  padding: 0;
  margin: 0;
  font-size: 13px;
  line-height: 1;
  border-radius: 0 8px 8px 0;
  border: 1px solid var(--border);
  border-left: none;
  background: rgba(8, 18, 32, 0.95);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.35);
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.panel-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.12);
  box-shadow: 4px 0 20px rgba(0, 212, 255, 0.2);
}

.panel-toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.subtitle {
  margin: 8px 0 16px;
  color: var(--text-muted);
  line-height: 1.5;
}

.slider-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px 10px;
}

.slider-row-playback {
  grid-template-columns: auto 1fr auto;
}

.slider-row-date {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  width: 100%;
}

.slider-row-date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.slider-row-date-header .slider-label {
  flex: 0 0 auto;
  text-align: left;
}

.slider-row-date-header .slider-val {
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 6.5em;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-align: right;
}

.slider-row-date input[type="range"] {
  width: 100%;
}

.slider-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.slider-val {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--accent);
  white-space: nowrap;
  text-align: right;
  min-width: 2.8em;
}

.panel-select {
  width: 100%;
  padding: 6px 32px 6px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 40, 70, 0.5);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.82rem;
  line-height: 1.25;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2300d4ff' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.panel-select:hover,
.panel-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.15);
}

.panel-select option {
  background: #0a1828;
  color: var(--text);
}

.panel-select-inline {
  grid-column: 2 / -1;
  width: 100%;
  min-width: 0;
}

.panel-select-compact {
  width: auto !important;
  min-width: 3.6em;
  max-width: 5.2em;
  padding: 4px 24px 4px 7px !important;
  font-size: 0.74rem;
  line-height: 1.2;
}

.panel-range-full {
  width: 100%;
}

.control-group-layers .layer-checkboxes > label,
.control-group-layers .layer-check-meridian-cb,
.ref-point-check-label,
.preset-cities-checkboxes > label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.control-group input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  transform: translateY(1px);
}

.control-group-layers .layer-earth-skin {
  margin-bottom: 8px;
}

.control-group-layers .layer-earth-skin select {
  width: 100%;
}

.control-group-layers .layer-checkboxes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px 10px;
  margin-top: 0;
}

.control-group-layers .layer-checkboxes > label {
  min-width: 0;
}

.control-group-layers .layer-checkboxes > label.layer-check-full {
  grid-column: 1 / -1;
}

.control-group-layers .layer-check-meridian-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.control-group-layers .layer-check-meridian-cb {
  min-width: 0;
}

.meridian-count-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* [hidden] 默认的 display:none 会被上面的 flex 覆盖，必须显式隐藏 */
#meridianCountWrap[hidden],
.meridian-count-wrap[hidden],
#showEquatorMountainWrap[hidden],
#showDateLineWrap[hidden],
#coriolisMotionDirWrap[hidden],
#targetLatWrap[hidden] {
  display: none !important;
}

.date-line-label {
  max-width: 11em;
  font-size: 0.68rem;
  line-height: 1.3;
  text-align: center;
  color: #ffe8c8;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.95), 0 0 10px rgba(255, 180, 100, 0.35);
}

.date-line-arrow-label {
  max-width: 5em;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff6d8;
  pointer-events: none;
}

.date-line-title-label {
  max-width: none;
  font-size: 0.68rem;
  line-height: 1.5;
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: nowrap;
  text-align: center;
  pointer-events: none;
  /* transform 由 JS 按球面经线方向每帧设置 */
  transform: none;
}

.meridian-label.date-line-zone-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.45;
  white-space: normal;
  text-align: center;
  pointer-events: none;
}

.date-line-zone-new {
  color: #ffe8e8;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.95), 0 0 12px rgba(220, 60, 60, 0.55);
}

.date-line-zone-old {
  color: #fff8d8;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.95), 0 0 12px rgba(220, 180, 40, 0.5);
}

.date-line-zone-date {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.date-line-zone-pct {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.92;
}

.control-group-layers .layer-coriolis-motion-row {
  margin-bottom: 8px;
  grid-template-columns: auto 1fr;
}

.control-group-layers .layer-checkboxes input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
}

.meridian-count-label {
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.panel-body select:not(.panel-select):not(.panel-select-inline):not(.panel-select-compact),
.panel-body input[type="range"]:not(.target-lat-range),
.panel-body button {
  width: 100%;
}

.panel-body button:not(.ref-point-add-btn):not(.ref-point-settings-btn):not(.ref-point-delete-btn):not(
    .copyright-text-btn
  ):not(.play-pause-btn):not(.collapsible-head-btn) {
  padding: 5px 7px;
  font-size: 0.75rem;
  line-height: 1.25;
  font-family: var(--font-body);
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(0, 30, 50, 0.5);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.panel-body button:not(.ref-point-add-btn):not(.ref-point-settings-btn):not(.ref-point-delete-btn):not(
    .copyright-text-btn
  ):not(.play-pause-btn):not(.collapsible-head-btn):hover {
  border-color: var(--accent-warm);
  color: var(--accent-warm);
  background: rgba(255, 107, 53, 0.12);
}

input[type="range"] {
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(0, 212, 255, 0.2);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  cursor: pointer;
}

.slider-row input[type="range"],
.target-lat-row-wrap input[type="range"],
.panel-range-full {
  width: 100%;
  min-width: 0;
}

/* 左侧参数区：按钮更矮；网格行内不对齐拉伸（避免一行里被拉成同一高度） */
.panel-body .row,
.panel-body .row-views-three,
.panel-body .season-presets {
  align-items: start;
}

.panel-body .preset-season-btn {
  padding: 5px 6px;
  font-size: 0.75rem;
  line-height: 1.25;
}

.panel-body .preset-season-btn.preset-season-active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.1);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.12);
}

.panel-body .play-pause-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 40, 70, 0.5);
  color: var(--text);
}

.panel-body .play-pause-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.1);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.row-views-three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.row-views-three button {
  width: 100%;
  padding: 3px 4px;
  font-size: 0.7rem;
  line-height: 1.22;
}

.control-group-layers .target-lat-row-wrap {
  margin-bottom: 8px;
}

.season-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

/* —— 动画区域（视口 HUD、浮层卡片、标签） —— */

.knowledge-box,
.stage-panel-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(5, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: var(--glow);
}

.info-card {
  margin-top: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.stage-live-data.info-card {
  margin-top: 0;
}

.info-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.info-card p,
.info-card li {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.info-card ul {
  margin: 0;
  padding-left: 18px;
}

.stage-live-data .collapsible-content li span {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.ref-point-times-wrap {
  list-style: none;
  margin-top: 6px;
  padding-top: 4px;
}

.ref-point-times-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}

.ref-point-times-nested {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
}

.ref-point-times-nested li {
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* grid 第二列：允许收缩，否则侧栏展开/收起后主区域宽度计算异常，画布与地球视觉不居中 */
main.stage-wrap {
  min-width: 0;
  min-height: 0;
}

.stage-wrap {
  position: relative;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  background: #182638;
}

#stage {
  flex: 1 1 auto;
  min-height: 200px;
  width: 100%;
  position: relative;
  z-index: 0;
}

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

.stage-tool-btn {
  position: fixed;
  top: 14px;
  z-index: 20;
  font-family: var(--font-body);
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: rgba(5, 15, 28, 0.88);
  border: 1px solid var(--border);
  border-radius: 6px;
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.stage-tool-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.12);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.15);
}

.stage-tool-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.stage-reset-btn {
  right: 126px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

/* 语音「全屏显示」：系统全屏不可用时的页面铺满视口方案 */
html.app-page-fullscreen,
html.app-page-fullscreen body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #182638;
}

html.app-page-fullscreen .app {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr !important;
  grid-template-rows: minmax(0, 1fr) !important;
}

html.app-page-fullscreen .panel-column {
  display: none !important;
}

html.app-page-fullscreen .panel-toggle-btn {
  display: none;
}

html.app-page-fullscreen .stage-wrap {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
}

html.app-page-fullscreen #stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.stage-fullscreen-btn {
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 6px 12px;
  font-size: 0.72rem;
}

.meridian-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.meridian-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.95), 0 1px 3px rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  pointer-events: none;
}

.local-time-hour-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #ffd966;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.95), 0 0 10px rgba(255, 200, 60, 0.35);
}

.cardinal-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff6c8;
  text-shadow: 0 0 8px rgba(0, 0, 0, 1), 0 0 12px rgba(255, 220, 120, 0.4);
}

.polaris-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffe98a;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(0, 0, 0, 1), 0 0 12px rgba(255, 200, 80, 0.55);
}

.equator-mountain-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-warm);
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(0, 0, 0, 1), 0 0 10px rgba(255, 107, 53, 0.45);
  pointer-events: none;
}

.stage-corner-stack {
  position: absolute;
  right: 16px;
  bottom: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  max-width: min(92vw, 400px);
  pointer-events: auto;
}

/* 锚定在右侧动画区域 main.stage-wrap 内，而非整页视口 */
.stage-gesture-dock.stage-bottom-left {
  position: absolute;
  left: 16px;
  bottom: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: auto;
}

.stage-live-data .collapsible-content ul {
  margin: 0;
  padding-left: 18px;
}

.hint-bar {
  align-self: flex-end;
  padding: 8px 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(5, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.stage-gesture-check {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(5, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  user-select: none;
}

.stage-gesture-check:hover {
  border-color: var(--accent);
  color: var(--text);
}

.stage-gesture-check:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.1);
}

.stage-gesture-check input {
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--accent);
}

.gesture-status {
  align-self: flex-start;
  max-width: min(92vw, 280px);
  margin: 0;
  padding: 0 4px;
  font-size: 0.68rem;
  line-height: 1.4;
  text-align: left;
  color: var(--accent-dim);
}

.voice-help {
  align-self: flex-start;
  max-width: min(92vw, 260px);
  margin: 0;
  padding: 6px 10px;
  font-size: 0.65rem;
  line-height: 1.45;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(5, 15, 28, 0.65);
}

.stage-gesture-check:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

.gesture-preview-wrap {
  position: relative;
  width: 168px;
  height: 126px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(5, 15, 28, 0.92);
  box-shadow: var(--glow);
  pointer-events: none;
}

.gesture-preview-video,
.gesture-preview-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.gesture-preview-overlay {
  pointer-events: none;
}

.stage-text-stack {
  position: absolute;
  left: 16px;
  top: 14px;
  max-width: min(70vw, 860px);
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.collapsible-box {
  max-width: 100%;
  padding: 10px 12px;
}

.collapsible-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.collapsible-box:not(.collapsed) .collapsible-head {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.collapsible-head-title {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.collapsible-head-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0, 40, 70, 0.5);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.collapsible-head-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.1);
}

.collapsible-head-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.collapsible-box.collapsed .collapsible-content {
  display: none;
}

.collapsible-box.collapsed .collapsible-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.knowledge-explain-panel {
  max-height: min(42vh, 320px);
}

.knowledge-explain-panel .collapsible-content {
  max-height: min(38vh, 280px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
}

.knowledge-explain-body {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.75;
  color: var(--text);
  font-family: var(--font-body);
  white-space: pre-line;
}

.layer-check-ref-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.ref-point-block {
  grid-column: 1 / -1;
}

.preset-cities-block {
  margin-top: 8px;
}

.preset-cities-title {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 6px;
  opacity: 0.9;
}

.preset-cities-checkboxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}

.preset-cities-checkboxes > label {
  margin: 0;
}

.preset-cities-checkboxes input[type="checkbox"] {
  width: auto;
  margin: 0 6px 0 0;
  transform: translateY(1px);
}

.preset-cities-checkboxes > label input[type="checkbox"] {
  margin-right: 0;
}

.ref-point-check-label {
  flex: 1;
  min-width: 0;
}

.ref-point-add-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0, 40, 70, 0.5);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.ref-point-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.1);
}

.ref-point-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ref-point-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 20, 40, 0.5);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  min-width: 0;
}

.ref-point-list-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.ref-point-list-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.ref-point-list-actions button {
  width: auto;
}

.ref-point-settings-btn {
  flex: 0 0 auto;
  padding: 3px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0, 40, 70, 0.5);
  color: var(--text);
  white-space: nowrap;
}

.ref-point-settings-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.1);
}

.ref-point-delete-btn {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid #6a3030;
  background: #2a1212;
  color: #ffaaaa;
}

.ref-point-delete-btn:hover {
  background: #3d1a1a;
  border-color: #8a4040;
}

.ref-point-label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: #7affc8;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.95), 0 0 10px rgba(0, 229, 160, 0.35);
}

.movement-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.movement-row {
  display: flex;
  gap: 6px;
}

.movement-controls button {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copyright-entry {
  flex-shrink: 0;
  margin-top: auto;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(0, 212, 255, 0.35);
  background: linear-gradient(
    180deg,
    rgba(0, 212, 255, 0.06) 0%,
    rgba(0, 50, 90, 0.28) 100%
  );
  box-shadow: inset 0 1px 0 rgba(0, 212, 255, 0.12);
}

.app.panel-collapsed .copyright-entry {
  display: none;
}

.copyright-text-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #e8fcff;
  background: linear-gradient(
    135deg,
    rgba(0, 212, 255, 0.22) 0%,
    rgba(0, 100, 170, 0.32) 55%,
    rgba(0, 60, 110, 0.38) 100%
  );
  border: 1px solid rgba(0, 212, 255, 0.5);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-shadow: 0 0 14px rgba(0, 212, 255, 0.45);
  box-shadow:
    0 0 18px rgba(0, 212, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    box-shadow 0.2s,
    transform 0.15s;
}

.copyright-text-btn:hover {
  color: #fff;
  border-color: var(--accent);
  background: linear-gradient(
    135deg,
    rgba(0, 212, 255, 0.35) 0%,
    rgba(0, 120, 190, 0.42) 100%
  );
  box-shadow:
    0 0 28px rgba(0, 212, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.copyright-text-btn:active {
  transform: scale(0.98);
}

.copyright-text-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.copyright-modal {
  max-width: 440px;
}

.copyright-modal .modal-title {
  text-align: center;
}

.copyright-modal .modal-actions {
  justify-content: center;
}

.copyright-qr-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 14px 16px;
  margin-bottom: 14px;
}

.copyright-qr-item {
  margin: 0;
  flex: 1 1 150px;
  max-width: 200px;
  min-width: 0;
  text-align: center;
}

.copyright-qr-caption {
  margin: 8px 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--text-muted);
}

.copyright-qr-image {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.copyright-note {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text);
  text-align: center;
  font-family: var(--font-body);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  box-sizing: border-box;
  font-family: var(--font-body);
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-dialog {
  width: 100%;
  max-width: 380px;
  padding: 18px 16px;
  border-radius: 8px;
  background: rgba(8, 18, 32, 0.98);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  color: var(--text);
}

.modal-title {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  color: var(--accent);
}

.modal-field {
  margin-bottom: 12px;
}

.modal-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0, 40, 70, 0.5);
  color: var(--text);
  font-size: 0.84rem;
  font-family: var(--font-body);
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.15);
}

.modal-field input[type="range"] {
  width: 100%;
}

.modal-range-val {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
}

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

.modal-btn {
  padding: 8px 18px;
  font-size: 0.84rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(0, 40, 70, 0.6);
  color: var(--text);
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.modal-btn:hover {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.12);
}

.modal-btn-primary {
  border-color: var(--accent);
  color: var(--accent);
}

.stage-movement-controls {
  position: fixed;
  right: 16px;
  top: 58px;
  z-index: 20;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(5, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: var(--glow);
}

.stage-movement-controls .movement-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.stage-movement-controls .movement-controls .movement-row {
  display: flex;
  gap: 4px;
}

.stage-movement-controls .movement-controls button {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text-muted);
  background: rgba(0, 40, 70, 0.5);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.stage-movement-controls .movement-controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 212, 255, 0.1);
}

@media (max-width: 1000px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .panel-column {
    width: 100%;
    max-width: none;
  }

  .app.panel-collapsed .panel-column {
    width: 100%;
    max-height: 0;
    overflow: visible;
  }

  .panel {
    max-height: 48vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .app.panel-collapsed .panel {
    max-height: 0;
    opacity: 0;
  }

  .panel-toggle-btn {
    left: auto;
    right: 12px;
    top: auto;
    bottom: 12px;
    transform: none;
    border-radius: 8px;
    border-left: 1px solid var(--border);
    width: 36px;
    height: 36px;
  }
}
