:root {
  --bg-night: #10151f;
  --bg-night-soft: #17202e;
  --panel-bg: rgba(22, 30, 44, 0.88);
  --panel-border: rgba(154, 174, 206, 0.18);
  --text-main: #ede6d6;
  --text-muted: #98a8be;
  --warm-gold: #f0c274;
  --warm-gold-bright: #ffd98e;
  --warm-gold-dim: rgba(240, 194, 116, 0.24);
  --cool-slate: #2b384d;
  --cool-slate-hover: #35455e;
  --map-ratio: 896 / 1200;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 38% 35%, #1b2434 0%, var(--bg-night) 72%);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 桌面横屏布局：地图尽量占满可用高度，右侧放置极简控制区 */
.app-shell {
  min-height: 100dvh;
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.4vw, 34px);
  padding: clamp(10px, 1.8vh, 20px) clamp(14px, 2.4vw, 32px);
  overflow: hidden;
}

.stage-area {
  flex: 0 1 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.map-frame {
  position: relative;
  height: 100%;
  max-height: calc(100dvh - clamp(20px, 3.6vh, 40px));
  aspect-ratio: var(--map-ratio);
  max-width: calc(100vw - 290px);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(176, 194, 222, 0.14);
  background: #141a24;
  user-select: none;
  touch-action: manipulation;
}

.map-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.map-overlay,
.character-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.character-layer {
  pointer-events: none;
}

/* SVG 房间热区、门牌点亮与虚线路线样式 */
.room-zone {
  fill: rgba(240, 194, 116, 0);
  stroke: transparent;
  cursor: pointer;
  outline: none;
  transition: fill 0.2s ease, stroke 0.2s ease;
}

.room-zone:focus-visible {
  stroke: rgba(255, 224, 152, 0.72);
  stroke-width: 2.5;
}

.room-zone:hover {
  fill: rgba(255, 224, 160, 0.08);
  stroke: rgba(240, 194, 116, 0.26);
  stroke-width: 2;
}

.room-zone.is-selected {
  fill: rgba(255, 214, 134, 0.09);
}

.plaque-hit {
  fill: transparent;
  stroke: transparent;
  cursor: pointer;
  transition: stroke 0.2s ease, fill 0.2s ease;
}

.plaque-hit:hover {
  stroke: rgba(255, 222, 148, 0.65);
  stroke-width: 2.5;
  fill: rgba(255, 222, 148, 0.08);
}

.plaque-lit {
  fill: rgba(255, 216, 128, 0.16);
  stroke: #ffdf96;
  stroke-width: 4;
  filter: url(#plaque-glow);
  pointer-events: none;
  animation: plaquePulse 2s ease-in-out infinite;
}

@keyframes plaquePulse {
  0%, 100% {
    opacity: 0.88;
    stroke-width: 3.6;
  }
  50% {
    opacity: 1;
    stroke-width: 4.8;
  }
}

.route-path-glow {
  fill: none;
  stroke: rgba(255, 215, 132, 0.28);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.route-path {
  fill: none;
  stroke: #ffe3a3;
  stroke-width: 3.2;
  stroke-dasharray: 8 8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  animation: dashFlow 0.75s linear infinite;
}

@keyframes dashFlow {
  from {
    stroke-dashoffset: 16;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.route-target-dot {
  fill: #ffe3a3;
  pointer-events: none;
}

.route-target-ring {
  fill: none;
  stroke: #ffd57e;
  stroke-width: 2.5;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: targetRipple 1.6s ease-out infinite;
}

@keyframes targetRipple {
  0% {
    transform: scale(0.75);
    opacity: 0.95;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

.arrival-badge {
  pointer-events: none;
  animation: badgePop 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes badgePop {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 右侧极简控制栏 */
.control-panel {
  width: clamp(220px, 21vw, 272px);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.status-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.status-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.status-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(152, 168, 190, 0.14);
  color: #c5d1e2;
  transition: background 0.2s ease, color 0.2s ease;
}

.status-pill.is-walking {
  background: rgba(240, 194, 116, 0.18);
  color: var(--warm-gold-bright);
}

.status-pill.is-arrived {
  background: rgba(126, 206, 162, 0.18);
  color: #9de2bc;
}

.status-pill.is-demo {
  background: rgba(240, 194, 116, 0.26);
  color: #ffe3a3;
}

.status-room-zh {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-main);
  letter-spacing: 0.03em;
}

.status-room-mn {
  margin-top: 4px;
  font-size: 13px;
  color: var(--warm-gold);
  opacity: 0.88;
  letter-spacing: 0.01em;
}

.demo-progress {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(154, 174, 206, 0.14);
}

.demo-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.demo-step {
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.demo-step.is-active {
  color: #161b24;
  background: var(--warm-gold);
  font-weight: 600;
}

.demo-step.is-done {
  color: #9de2bc;
}

.demo-arrow {
  opacity: 0.45;
}

.action-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.btn-primary {
  background: linear-gradient(180deg, #efc47a 0%, #d49f50 100%);
  color: #1a1610;
  box-shadow: 0 8px 22px rgba(212, 159, 80, 0.26);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #f6cf8c 0%, #dfa95a 100%);
}

.btn-primary.is-running {
  background: linear-gradient(180deg, #32435c 0%, #243145 100%);
  color: var(--warm-gold-bright);
  border-color: rgba(240, 194, 116, 0.45);
  box-shadow: none;
}

.btn-secondary {
  background: var(--cool-slate);
  color: var(--text-main);
  border-color: rgba(154, 174, 206, 0.22);
}

.btn-secondary:hover {
  background: var(--cool-slate-hover);
}

.btn-icon {
  font-size: 14px;
  line-height: 1;
}

.hint-text {
  margin: 0;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* 手机竖屏 / 窄屏：地图按宽度等比缩放，控制栏放在地图下方 */
@media (max-width: 820px), (orientation: portrait) and (max-width: 1024px) {
  .app-shell {
    height: auto;
    min-height: 100dvh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 10px 10px calc(18px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
  }

  .stage-area {
    width: 100%;
    height: auto;
  }

  .map-frame {
    width: 100%;
    max-width: 560px;
    height: auto;
    max-height: none;
    border-radius: 12px;
  }

  .control-panel {
    width: 100%;
    max-width: 560px;
    gap: 10px;
  }

  .panel-card {
    padding: 13px 15px;
  }

  .status-room-zh {
    font-size: 20px;
  }

  .action-group {
    flex-direction: row;
    gap: 10px;
  }

  .btn-primary {
    flex: 1.45;
  }

  .btn-secondary {
    flex: 1;
  }

  .hint-text {
    text-align: center;
  }
}

/* 极矮横屏（如 1280x720 投影仪）：控制区紧凑保证地图吃满高度 */
@media (min-width: 821px) and (max-height: 760px) {
  .app-shell {
    padding: 8px 18px;
    gap: 18px;
  }

  .map-frame {
    max-height: calc(100dvh - 16px);
  }

  .panel-card {
    padding: 14px 16px;
  }

  .status-room-zh {
    font-size: 21px;
  }

  .btn {
    padding: 11px 14px;
    font-size: 14px;
  }
}
