* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; margin: 0; overflow: hidden;
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  background: #000; color: #333;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; border: none; }
input { font: inherit; }

/* ========== 全屏容器 ========== */
.phone {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  background: #f5f5f5;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ========== 顶栏 ========== */
.topbar {
  display: flex; align-items: center;
  padding: 10px 12px 8px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  z-index: 10;
}
.topbar .back {
  width: 32px; height: 32px;
  background: none; color: #333; font-size: 24px; font-weight: 300;
}
.topbar .title {
  flex: 1; text-align: center;
  font-size: 15px; font-weight: 600; color: #333;
}
.topbar-right { display: flex; gap: 4px; }
.icon-btn {
  width: 32px; height: 32px;
  background: none; font-size: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ========== 步骤提示条 ========== */
.step-bar { z-index: 9; }
.step-current {
  padding: 8px 16px;
  font-size: 14px; font-weight: 600; color: #333;
  background: #f0f0f0;
  text-align: center;
  border-bottom: 1px solid #e0e0e0;
}
.step-nav {
  padding: 10px 16px;
  font-size: 15px; font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #43a047, #66bb6a);
  text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.step-nav-arrow {
  font-size: 22px; font-weight: 700;
  animation: arrowBounce 1s ease-in-out infinite;
}
@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ========== AR 主区域 ========== */
.ar-main {
  flex: 1; position: relative;
  background: #1a1a2e; overflow: hidden;
}
#arVideo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; z-index: 0;
}

/* 模拟医院走廊背景 */
.ar-placeholder {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, #c8bfb0 0%, #b0a898 30%, #a09080 60%, #8a8070 100%);
  overflow: hidden;
}
.ar-placeholder.hidden { display: none; }
.ar-bg-pattern {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 60px 60px;
}
.ar-floor-grid {
  position: absolute; bottom: 0; left: 0; right: 0; height: 55%;
  background: linear-gradient(180deg, rgba(180,170,155,0) 0%, rgba(160,148,130,0.6) 100%);
  transform: perspective(400px) rotateX(10deg);
  transform-origin: bottom center;
}

/* 左侧工具栏 */
.side-tools {
  position: absolute; left: 8px; top: 8px; z-index: 5;
  display: flex; flex-direction: column; gap: 5px;
}
.floor-tag {
  background: rgba(0,0,0,0.65);
  color: #fff; font-size: 16px; font-weight: 800;
  padding: 6px 12px; border-radius: 8px; text-align: center;
  letter-spacing: 1px;
}
.coord-debug {
  background: rgba(0,0,0,0.5);
  color: #aaa; font-size: 8px;
  padding: 3px 6px; border-radius: 4px;
  font-family: ui-monospace, 'Courier New', monospace;
  word-break: break-all; max-width: 90px;
  line-height: 1.3;
}
.side-btn {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 10px;
  padding: 8px 10px; border-radius: 10px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 1px solid rgba(255,255,255,0.15);
}
.side-btn.active {
  background: rgba(76,175,80,0.65);
  border-color: rgba(76,175,80,0.8);
}
.side-icon { font-size: 16px; }

/* AR 导航按钮(右侧) */
.ar-nav-btn {
  position: absolute; right: 10px; bottom: 10px; z-index: 5;
  width: 50px; height: 50px;
  background: linear-gradient(135deg, #e91e63, #f06292);
  color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(233,30,99,0.4);
  line-height: 1.2; text-align: center;
}

/* 距离信息浮层 */
.ar-info {
  position: absolute; right: 10px; top: 10px; z-index: 5;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  padding: 8px 12px;
  border-radius: 10px;
  color: #fff; font-size: 11px;
  text-align: right;
  line-height: 1.5;
}
.ar-info-floor { font-weight: 600; color: #81c784; }
.ar-info-dist { color: #fff; }
.ar-info-eta { color: #bbb; font-size: 10px; }

/* ===== AR 箭头(3 个雪佛龙) ===== */
.ar-arrows {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -30%) perspective(600px) rotateX(55deg);
  z-index: 3;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  filter: drop-shadow(0 8px 24px rgba(0,200,180,0.5));
  will-change: transform;
  transition: filter 0.3s;
}
.ar-chev {
  width: 0; height: 0;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 30px solid rgba(0,200,180,0.9);
  filter: drop-shadow(0 2px 4px rgba(0,200,180,0.3));
}
.ar-chev.c1 { animation: chevPulse 1.6s ease-in-out infinite; }
.ar-chev.c2 { animation: chevPulse 1.6s ease-in-out 0.25s infinite; border-bottom-color: rgba(0,200,180,0.7); }
.ar-chev.c3 { animation: chevPulse 1.6s ease-in-out 0.5s infinite; border-bottom-color: rgba(0,200,180,0.5); }
@keyframes chevPulse {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(-5px); }
}

/* POI 标记 */
.ar-poi {
  position: absolute; right: 25%; top: 25%; z-index: 4;
  display: flex; flex-direction: column; align-items: center;
  animation: poiFloat 2s ease-in-out infinite;
}
.ar-poi.hidden { display: none; }
.poi-pin {
  width: 3px; height: 20px;
  background: linear-gradient(180deg, #e91e63, transparent);
}
.poi-label {
  display: inline-block;
  background: #e91e63;
  color: #fff;
  font-size: 15px; font-weight: 700;
  padding: 6px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(233,30,99,0.4);
  letter-spacing: 0.5px;
}
@keyframes poiFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ===== 地图覆盖 ===== */
.map-overlay {
  position: absolute; inset: 0;
  background: #f2ede6; z-index: 8;
  display: flex; flex-direction: column;
}
.map-overlay.hidden { display: none; }
.map-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: #fff; border-bottom: 1px solid #e0d8d0;
}
.floor-sel {
  background: #f5f0ea; color: #333;
  border: 1px solid #d0c8c0;
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
}
.map-close {
  background: #f0ebe4;
  color: #666; width: 34px; height: 34px;
  border-radius: 50%; font-size: 16px;
}
#mapCanvas { flex: 1; width: 100%; display: block; }

/* ========== 底部流程条 ========== */
.flow-bar {
  display: flex; align-items: center;
  background: #fff;
  border-top: 1px solid #eee;
  padding: 10px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 9;
  min-height: 58px;
  gap: 2px;
}
.flow-bar::-webkit-scrollbar { display: none; }

.flow-arrow { color: #ccc; font-size: 16px; flex-shrink: 0; margin: 0 2px; }

.pill {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 14px;
  border-radius: 22px;
  font-size: 12px; white-space: nowrap;
  border: 1.5px solid transparent;
  flex-shrink: 0;
  transition: all 0.3s;
}
.pill.done {
  background: #e8f5e9; color: #2e7d32;
  border-color: #c8e6c9;
}
.pill.active {
  background: #fce4ec; color: #c62828;
  border-color: #f48fb1;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(233,30,99,0.15);
}
.pill.todo {
  background: #fafafa; color: #aaa;
  border-color: #e0e0e0;
}
.pill-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; font-size: 11px;
}
.pill.done .pill-dot {
  background: #4caf50; color: #fff;
  border-radius: 50%; font-size: 10px;
  width: 18px; height: 18px;
}
.pill.active .pill-dot {
  width: 10px; height: 10px;
  background: #e91e63; border-radius: 50%;
  animation: dotBlink 1.2s infinite;
}
@keyframes dotBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ========== AI 输入条 ========== */
.ai-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: #fff;
  border-top: 1px solid #eee;
  z-index: 9;
}
.ai-input-wrap {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  background: #f5f5f5;
  border-radius: 22px;
  padding: 10px 14px;
  border: 1px solid #e8e8e8;
}
.ai-icon { font-size: 14px; color: #999; }
.ai-input-wrap input {
  flex: 1; background: none; border: none; outline: none;
  color: #333; font-size: 13px;
}
.ai-input-wrap input::placeholder { color: #aaa; }
.ai-ask-btn {
  background: linear-gradient(135deg, #e91e63, #f06292);
  color: #fff;
  padding: 10px 20px;
  border-radius: 22px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(233,30,99,0.3);
}

/* ========== 对话面板 ========== */
.chat-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 55%;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
  z-index: 20;
}
.chat-panel.hidden { display: none; }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
  font-weight: 600; font-size: 15px;
}
.chat-close {
  background: #f5f5f5; width: 32px; height: 32px;
  border-radius: 50%; font-size: 14px; color: #666;
}
.chat-list {
  flex: 1; overflow-y: auto;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px; line-height: 1.5;
}
.chat-msg.ai {
  background: #f5f5f5; color: #333;
  border-top-left-radius: 4px;
  align-self: flex-start;
}
.chat-msg.me {
  background: linear-gradient(135deg, #43a047, #66bb6a);
  color: #fff;
  border-top-right-radius: 4px;
  align-self: flex-end;
}
.chat-msg .go-link {
  display: inline-block; margin-top: 6px;
  padding: 4px 12px;
  background: rgba(76,175,80,0.12);
  color: #2e7d32; border-radius: 10px; font-size: 12px;
  cursor: pointer; font-weight: 600;
}
.chat-sugg {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 16px;
}
.chat-sugg button {
  background: #fff; color: #666;
  border: 1px solid #e0e0e0;
  border-radius: 18px; padding: 6px 14px; font-size: 12px;
}
.chat-input-row {
  display: flex; gap: 8px;
  padding: 10px 14px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-top: 1px solid #f0f0f0;
}
.chat-input-row input {
  flex: 1; background: #f5f5f5; border: 1px solid #e8e8e8;
  border-radius: 22px; padding: 10px 16px; font-size: 13px;
  outline: none; color: #333;
}
.chat-input-row button {
  background: linear-gradient(135deg, #43a047, #66bb6a);
  color: #fff;
  border-radius: 22px; padding: 0 18px; font-size: 13px; font-weight: 600;
}

/* ========== 弹窗 ========== */
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 30;
}
.modal-mask.hidden { display: none; }
.modal-box {
  background: #fff;
  border-radius: 20px;
  padding: 30px 28px 24px;
  width: 290px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-icon { font-size: 36px; margin-bottom: 12px; }
.modal-title {
  font-size: 18px; font-weight: 700; color: #333;
  margin-bottom: 10px;
}
.modal-msg {
  font-size: 14px; color: #666;
  margin-bottom: 22px;
  line-height: 1.6;
}
.modal-btn {
  background: none;
  color: #43a047;
  font-size: 16px; font-weight: 700;
  padding: 10px 36px;
  border-radius: 24px;
  border: 2px solid #43a047;
  transition: all 0.2s;
}
.modal-btn:active {
  background: #43a047; color: #fff;
}

/* ========== 演示入口 ========== */
.demo-entry {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.6) 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 25;
}
.demo-entry.hidden { display: none; }
.demo-card {
  background: #fff;
  border-radius: 24px;
  padding: 36px 32px 28px;
  width: 320px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
}
.demo-logo { font-size: 48px; margin-bottom: 8px; }
.demo-hospital { font-size: 13px; color: #888; margin-bottom: 4px; }
.demo-title { font-size: 22px; font-weight: 700; color: #333; margin-bottom: 4px; }
.demo-subtitle { font-size: 14px; color: #666; margin-bottom: 16px; }
.demo-features {
  display: flex; justify-content: center; gap: 12px;
  font-size: 11px; color: #888;
  margin-bottom: 24px;
}
.demo-btn {
  display: block; width: 100%;
  padding: 13px;
  border-radius: 26px;
  font-size: 15px; font-weight: 600;
  margin-bottom: 10px;
  transition: all 0.2s;
}
.demo-btn.primary {
  background: linear-gradient(135deg, #43a047, #66bb6a);
  color: #fff;
  box-shadow: 0 4px 16px rgba(76,175,80,0.3);
}
.demo-btn.secondary {
  background: #f5f5f5; color: #666;
}

/* ========== 工具类 ========== */
.hidden { display: none !important; }
