/* ============================================================
   style.css — 常州亲子街道点亮地图 · 儿童友好卡通化样式
   移动优先，圆润、明亮、大按钮；兼容平板/电脑大屏
   ============================================================ */

:root {
  /* 儿童友好明亮配色 */
  --bg: #fff7e8;            /* 奶油底 */
  --card: #ffffff;
  --ink: #4a3b2a;           /* 暖棕文字 */
  --ink-soft: #8a7a63;
  --primary: #ff8a3d;       /* 橙（主按钮/已点亮） */
  --primary-deep: #f06a1d;
  --pink: #ff6fb0;
  --green: #3fbf6f;
  --yellow: #ffd54a;
  --line: #f0e3cd;
  --shadow: 0 6px 20px rgba(74, 59, 42, 0.10);
  --radius: 20px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

[v-cloak] { display: none; }

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ============ 顶部横幅 ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-bottom: 2px solid var(--line);
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-emoji { font-size: 26px; }
.brand-text { min-width: 0; }
.brand-title { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11px; color: var(--ink-soft); }

.role-switch { display: flex; gap: 6px; flex-shrink: 0; }
.role-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.role-chip.active { color: #fff; box-shadow: var(--shadow); }

/* ============ 统计条 ============ */
.statbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 2px solid var(--line);
  flex-shrink: 0;
  overflow-x: auto;
}
.stat { text-align: center; flex-shrink: 0; min-width: 62px; }
.stat-num { font-size: 20px; font-weight: 900; color: var(--primary-deep); }
.stat-label { font-size: 10px; color: var(--ink-soft); }

.progress-wrap { flex: 1; min-width: 100px; }
.progress-label { font-size: 11px; font-weight: 700; margin-bottom: 4px; }
.progress-bar {
  height: 12px;
  background: #f4e9d5;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow), var(--primary));
  border-radius: 999px;
  transition: width .4s ease;
}

/* ============ 地图 ============ */
.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}
#map { position: absolute; inset: 0; }

/* 无 Key 卡通示意图 */
.fallback-map {
  position: absolute;
  inset: 0;
  background: #eaf4e1;
  display: flex;
  align-items: center;
  justify-content: center;
}
#fallback-svg { width: 100%; height: 100%; }
.fallback-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  background: rgba(255,255,255,.9);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.fallback-hint code { color: var(--primary-deep); font-weight: 700; }

.map-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow);
}
.map-badge.on { color: #2c8c5f; }

.target-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--yellow);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.target-close { margin-left: 6px; font-size: 18px; line-height: 1; }

.confirm-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 12px;
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
}
.confirm-text { flex: 1; min-width: 0; }
.confirm-text strong { display: block; font-size: 15px; }
.confirm-text span { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* ============ 底部操作栏 ============ */
.dock {
  display: flex;
  gap: 4px;
  padding: 8px 6px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 2px solid var(--line);
  flex-shrink: 0;
}
.dock-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.dock-btn:active { background: #fdf1de; }
.dock-emoji { font-size: 22px; }

/* ============ 底部抽屉 ============ */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(74, 59, 42, .35);
  z-index: 50;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: #fff;
  border-radius: 24px 24px 0 0;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .25s ease;
  box-shadow: 0 -8px 30px rgba(0,0,0,.12);
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 40px; height: 5px;
  background: #e6d7be;
  border-radius: 999px;
  margin: 10px auto 4px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px 12px;
  border-bottom: 2px solid var(--line);
}
.sheet-head h2 { font-size: 17px; margin: 0; }
.sheet-close { font-size: 24px; color: var(--ink-soft); line-height: 1; padding: 0 4px; }
.sheet-body { overflow-y: auto; padding: 14px 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

/* 路线卡 */
.route-card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.route-card:active { border-color: var(--primary); }
.route-top { display: flex; justify-content: space-between; align-items: center; }
.route-name { font-size: 15px; font-weight: 800; }
.route-km { font-size: 13px; font-weight: 800; color: var(--primary-deep); }
.route-area { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.route-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 11px;
  font-weight: 700;
  background: #fdf1de;
  color: #a05a1f;
  padding: 3px 8px;
  border-radius: 999px;
}
.route-story {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink);
  background: #fbf6ec;
  border-radius: 12px;
  padding: 10px;
}
.route-toggle { margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--primary-deep); }

/* 徽章网格 */
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge-card {
  background: #fbf6ec;
  border: 2px dashed #e6d7be;
  border-radius: 16px;
  padding: 14px 8px;
  text-align: center;
}
.badge-card.earned {
  background: #fff8e1;
  border: 2px solid var(--yellow);
  box-shadow: var(--shadow);
}
.badge-emoji { font-size: 34px; }
.badge-name { font-size: 13px; font-weight: 800; margin-top: 6px; }
.badge-desc { font-size: 11px; color: var(--ink-soft); margin-top: 3px; }
.badge-state { font-size: 10px; font-weight: 700; margin-top: 6px; color: #c0a97e; }
.badge-card.earned .badge-state { color: #2c8c5f; }

/* 足迹卡片 */
.footprint-card {
  background: linear-gradient(135deg, #fffdf7, #fff3e0);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.fp-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.fp-profile { color: var(--primary-deep); }
.fp-routes { font-size: 14px; font-weight: 800; margin-top: 8px; }
.fp-km { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.fp-photo { width: 100%; border-radius: 12px; margin-top: 8px; max-height: 200px; object-fit: cover; }
.fp-note { font-size: 13px; margin-top: 8px; background: #fff; border-radius: 10px; padding: 8px; }
.fp-edit { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.note-input { flex: 1; font-family: inherit; font-size: 13px; padding: 8px; border: 2px solid var(--line); border-radius: 10px; }
.photo-input { font-size: 12px; }

.empty-tip { text-align: center; color: var(--ink-soft); padding: 30px 10px; font-size: 14px; }

.backup-row { display: flex; gap: 8px; margin-top: 14px; }
.hidden-input { display: none; }

/* ============ 通用按钮 ============ */
.btn {
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.btn-primary:active { background: var(--primary-deep); }
.btn-ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); }
.btn-mini { padding: 7px 12px; font-size: 12px; }

/* ============ 弹窗提示 ============ */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 2px solid var(--yellow);
  border-radius: 20px;
  padding: 20px 26px;
  font-size: 18px;
  font-weight: 800;
  box-shadow: var(--shadow);
  z-index: 100;
  text-align: center;
  animation: pop .3s ease;
}
@keyframes pop {
  0% { transform: translate(-50%, -50%) scale(.6); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ============ 描一条街：悬浮入口 ============ */
.draw-fab {
  position: absolute;
  right: 14px;
  bottom: 16px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 11px 16px;
  border-radius: 20px;
  border: 3px solid #fff;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(240, 106, 29, .38);
}
.draw-fab:active { transform: scale(.96); }
.draw-fab-emoji { font-size: 24px; line-height: 1; }

/* 描街工具条 */
.draw-toolbar {
  position: absolute;
  left: 10px; right: 10px; bottom: 14px;
  z-index: 45;
  background: #fff;
  border: 2px solid var(--pink);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.draw-toolbar-info { flex: 1; min-width: 130px; }
.draw-toolbar-info strong { display: block; font-size: 14px; }
.draw-toolbar-info span { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.draw-toolbar-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.draw-toolbar-btns .btn:disabled { opacity: .45; cursor: not-allowed; }

/* 命名浮层 */
.name-mask {
  position: absolute;
  inset: 0;
  z-index: 70;
  background: rgba(74, 59, 42, .35);
}
.name-panel {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  z-index: 80;
  width: min(92%, 360px);
  max-height: 90%;
  overflow-y: auto;
  background: #fff;
  border: 3px solid var(--yellow);
  border-radius: 24px;
  padding: 20px 18px;
  box-shadow: 0 12px 40px rgba(74, 59, 42, .28);
}
.name-panel-title { font-size: 18px; font-weight: 900; text-align: center; }
.name-panel-km { font-size: 12px; color: var(--ink-soft); text-align: center; margin: 4px 0 14px; }
.name-input {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
}
.name-input:focus { border-color: var(--primary); outline: none; }
.name-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.name-tag {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: #fdf1de;
  color: #a05a1f;
}
.name-tag.active { border-color: var(--primary); background: #fff3e2; color: var(--primary-deep); }
.name-panel-btns { display: flex; gap: 8px; margin-top: 6px; }
.name-panel-btns .btn { flex: 1; }

/* ============ 灵感清单 ============ */
.inspire-hint {
  background: #f0f8ff;
  border: 2px dashed #a9cdf0;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.65;
  color: #3a5a78;
  margin-bottom: 14px;
}
.inspire-hint b { color: #1f4e79; }
.route-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.route-draw {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  padding: 7px 12px;
  border-radius: 999px;
}
.route-draw:active { background: var(--primary-deep); }

/* ============ 我描的街 ============ */
.mine-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
}
.mine-empty-emoji { display: block; font-size: 40px; margin-bottom: 8px; }
.mine-summary { font-size: 13px; font-weight: 800; color: var(--primary-deep); margin-bottom: 12px; }
.mine-card {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fff;
}
.mine-card.lit { border-color: var(--primary); background: #fff8ee; }
.mine-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mine-name { font-size: 15px; font-weight: 800; }
.mine-km { font-size: 13px; font-weight: 800; color: var(--primary-deep); white-space: nowrap; }
.mine-meta { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.mine-state {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f4e9d5;
  color: #a08756;
  margin-top: 8px;
}
.mine-card.lit .mine-state { background: var(--primary); color: #fff; }
.mine-note { font-size: 12px; margin-top: 8px; background: #fbf6ec; border-radius: 10px; padding: 8px; }
.mine-actions { display: flex; gap: 8px; margin-top: 10px; }
.mine-actions .btn-mini { flex: 1; }
.btn-danger { color: #c0392b; }

/* 提示类浮层只展示、不拦截地图点击（否则描街时点不动） */
.toast, .fallback-hint, .map-badge { pointer-events: none; }

/* ============ 无障碍基线 ============ */
button:focus-visible,
input:focus-visible,
.route-card:focus-visible {
  outline: 3px solid var(--primary-deep);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============ 大屏（平板/电脑）============ */
@media (min-width: 768px) {
  .topbar { padding: 14px 24px; }
  .brand-title { font-size: 18px; }
  .statbar { padding: 14px 24px; gap: 20px; }
  .stat-num { font-size: 24px; }
  .dock { gap: 12px; padding: 10px 24px; }
  .dock-btn { font-size: 14px; }
  .dock-emoji { font-size: 26px; }
  .sheet { max-width: 480px; left: 50%; transform: translate(-50%, 100%); }
  .sheet.open { transform: translate(-50%, 0); }
  .badge-grid { grid-template-columns: repeat(3, 1fr); }
}
