/* =========================================================
   RUC MindMap · 采集端样式（移动端优先，微信内置浏览器可用）
   ========================================================= */
:root {
  --bg: #070b13;
  --bg2: #0a111e;
  --card: #0f1828;
  --card2: #142034;
  --line: #22314b;
  --line2: #2e405f;
  --text: #e9eff9;
  --muted: #93a3bd;
  --muted2: #64748b;
  --gold: #f5b544;
  --gold2: #d97706;
  --red: #e11d48;
  --red2: #a6192e;
  --green: #34d399;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(166, 25, 46, .22), transparent 60%),
    radial-gradient(700px 420px at 0% 0%, rgba(37, 99, 235, .12), transparent 55%),
    var(--bg);
}

.app {
  max-width: 760px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px calc(112px + env(safe-area-inset-bottom));
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 10px;
  background: linear-gradient(to bottom, rgba(7, 11, 19, .96) 60%, rgba(7, 11, 19, 0));
  backdrop-filter: blur(6px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .3px;
  color: var(--text);
  white-space: nowrap;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(225, 29, 72, .18);
}
.progress {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: #182337;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--red2), var(--red) 55%, var(--gold));
  transition: width .35s ease;
}
.step-label {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- 步骤 ---------- */
main { flex: 1; }
.step { display: none; animation: fade .35s ease; }
.step.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 10px;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid rgba(225, 29, 72, .35);
  background: rgba(225, 29, 72, .08);
  color: #fda4af;
  font-size: 12px;
  font-weight: 600;
}

h1 {
  font-size: 30px;
  line-height: 1.25;
  margin: 6px 0 12px;
  letter-spacing: -.5px;
}
h1 .accent {
  background: linear-gradient(120deg, #fda4af, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 {
  font-size: 21px;
  line-height: 1.35;
  margin: 4px 0 8px;
  letter-spacing: -.2px;
}
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 12px; color: #c3cfe2; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.center { text-align: center; }

.card {
  background: linear-gradient(180deg, rgba(20, 32, 52, .9), rgba(15, 24, 40, .92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 10px 0;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; background: var(--card); }

.hero {
  padding: 18px 4px 2px;
}
.hero-sub { font-size: 15px; color: var(--muted); }
.meta-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 99px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  font-size: 12px; color: #cbd5e1;
}

.modules { display: grid; gap: 10px; margin-top: 14px; }
.module {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.02);
}
.module .num {
  flex: none;
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--red2), var(--red));
}
.module .t { font-weight: 700; font-size: 14px; margin-bottom: 1px; }
.module .d { font-size: 12.5px; color: var(--muted); line-height: 1.55; }

.consent {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--line2);
  background: rgba(245, 181, 68, .04);
  font-size: 12.5px; color: #cbd5e1;
}
.consent input {
  width: 18px; height: 18px; margin-top: 2px; flex: none;
  accent-color: var(--red);
}

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field > label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #b8c6dd;
  margin-bottom: 7px;
}
.field .hint { font-weight: 400; color: var(--muted2); }
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: #0a1322;
  border: 1px solid var(--line);
}
.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  padding: 9px 4px;
  border-radius: 9px;
  cursor: pointer;
  transition: all .18s ease;
}
.seg button.on {
  background: linear-gradient(180deg, #22304a, #1a2740);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
  font-weight: 700;
}
.seg.three button { font-size: 12.5px; }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: 0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  border-radius: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: transform .12s ease, filter .2s ease, opacity .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
}
.btn:active { transform: scale(.985); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--red2), var(--red) 60%, #f43f5e);
  box-shadow: 0 10px 26px -10px rgba(225, 29, 72, .8);
}
.btn-primary:disabled {
  opacity: .38;
  filter: grayscale(.4);
  box-shadow: none;
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  color: #b8c6dd;
  border: 1px solid var(--line2);
}
.btn-soft {
  background: rgba(245, 181, 68, .12);
  color: var(--gold);
  border: 1px solid rgba(245, 181, 68, .3);
}
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 13px; border-radius: 11px; }
.btn-block { width: 100%; }

/* ---------- 底部操作条 ---------- */
.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(7, 11, 19, .98) 55%, rgba(7, 11, 19, .6));
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(34, 49, 75, .6);
}
.dock-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
}
.dock .btn { flex: 1; }
.dock .btn-ghost { flex: 0 0 auto; min-width: 92px; }

/* ---------- 地图 ---------- */
.map-shell {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(600px 300px at 70% 20%, rgba(37, 99, 235, .1), transparent 60%),
    linear-gradient(180deg, #0b1322, #08101c);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .5);
}
.map-shell::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, .05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, .05) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 50% 45%, #000, transparent 85%);
}
svg.campus { display: block; width: 100%; height: auto; touch-action: manipulation; }
svg.campus .ground { fill: rgba(15, 23, 42, .55); stroke: rgba(148, 163, 184, .18); stroke-width: 2; }
svg.campus .roads path { fill: none; stroke: #1c2a42; stroke-width: 26; stroke-linecap: round; }
svg.campus .roads path.thin { stroke-width: 3; stroke-dasharray: 10 12; opacity: .55; }
svg.campus .greens ellipse { fill: rgba(45, 212, 191, .07); stroke: rgba(45, 212, 191, .18); stroke-width: 1.5; }

svg.campus .place { cursor: pointer; outline: none; }
svg.campus .place rect,
svg.campus .place path,
svg.campus .place ellipse {
  fill: var(--c);
  fill-opacity: .16;
  stroke: var(--c);
  stroke-opacity: .55;
  stroke-width: 2;
  transition: fill-opacity .18s ease, stroke-width .18s ease, filter .2s ease;
}
svg.campus .place:hover rect,
svg.campus .place:hover path,
svg.campus .place:hover ellipse,
svg.campus .place:focus-visible rect,
svg.campus .place:focus-visible path,
svg.campus .place:focus-visible ellipse {
  fill-opacity: .3;
  stroke-opacity: .95;
  stroke-width: 2.5;
}
svg.campus .place.is-on rect,
svg.campus .place.is-on path,
svg.campus .place.is-on ellipse {
  fill-opacity: .34;
  stroke: var(--gold);
  stroke-opacity: 1;
  stroke-width: 3;
  filter: drop-shadow(0 0 10px rgba(245, 181, 68, .45));
}
svg.campus .place.is-sel rect,
svg.campus .place.is-sel path,
svg.campus .place.is-sel ellipse {
  fill-opacity: .42;
  stroke: var(--gold);
  stroke-width: 3.5;
}
svg.campus .place text {
  fill: #eaf1fd;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(6, 10, 18, .75);
  stroke-width: 3px;
  stroke-linejoin: round;
}
svg.campus.no-label .place text { display: none; }
svg.campus .track-in { fill: none; stroke: rgba(52, 211, 153, .4); stroke-width: 2; stroke-dasharray: 8 10; }
svg.campus .badge circle { fill: var(--gold); }
svg.campus .badge text {
  fill: #1a1205; font-size: 15px; font-weight: 800;
  text-anchor: middle; dominant-baseline: middle;
}
svg.campus .gate rect { fill: #e11d48; opacity: .85; }
svg.campus .gate text {
  fill: #fda4af; font-size: 17px; font-weight: 700;
  letter-spacing: 2px; dominant-baseline: middle;
}
svg.campus .compass path { fill: rgba(148, 163, 184, .4); }
svg.campus .compass text { fill: rgba(148, 163, 184, .55); font-size: 16px; font-weight: 700; }

.map-hint {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 8px 2px 0;
  font-size: 12px; color: var(--muted);
}

/* ---------- 地点快捷列表 ---------- */
.places-list {
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 10px;
}
.places-list.show { display: grid; }
.places-list button {
  font-family: inherit;
  text-align: left;
  font-size: 12.5px;
  color: #cbd5e1;
  background: #0d1727;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
}
.places-list button.on {
  border-color: var(--gold);
  color: #fff;
  background: rgba(245, 181, 68, .1);
}

/* ---------- 情绪选择 ---------- */
.sheet {
  margin-top: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 14px;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.sheet-head .name { font-weight: 800; font-size: 16px; }
.emotion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.emo {
  font-family: inherit;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0b1524;
  color: #cbd5e1;
  padding: 10px 4px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: all .16s ease;
}
.emo .e { font-size: 22px; line-height: 1.2; }
.emo .n { font-size: 12px; font-weight: 600; }
.emo.on {
  border-color: var(--gold);
  background: rgba(245, 181, 68, .12);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(245, 181, 68, .12);
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: #0b1524;
  color: #b8c6dd;
}
.chip.on {
  border-color: rgba(96, 165, 250, .7);
  background: rgba(96, 165, 250, .14);
  color: #fff;
}

textarea, input[type="text"], input[type="password"], select {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #0a1422;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  resize: vertical;
  outline: none;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%),
    linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
button { font-family: inherit; }
textarea:focus, input:focus { border-color: var(--line2); box-shadow: 0 0 0 3px rgba(96, 165, 250, .1); }
textarea { min-height: 74px; }

/* ---------- 记录列表 ---------- */
.log { display: grid; gap: 8px; margin-top: 12px; }
.log-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0c1626;
  border: 1px solid var(--line);
  font-size: 12.5px;
}
.log-item .idx {
  flex: none; width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center;
  background: rgba(245, 181, 68, .15);
  color: var(--gold); font-weight: 800; font-size: 11px;
}
.log-item .txt { flex: 1; color: #cbd5e1; }
.log-item .txt b { color: #fff; }
.log-item button {
  background: none; border: 0; color: var(--muted2); cursor: pointer;
  font-size: 15px; padding: 2px 4px;
}

/* ---------- 拖拽规划 ---------- */
.plan-wrap { display: grid; gap: 12px; }
#mapPlan { position: relative; }
#planSvg svg { cursor: crosshair; }
.plan-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.plan-layer .placement { pointer-events: auto; }
.palette { display: flex; flex-wrap: wrap; gap: 7px; }
.palette button {
  font-family: inherit;
  font-size: 12.5px;
  padding: 8px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: #0b1524;
  color: #cbd5e1;
  cursor: pointer;
}
.palette button.on {
  border-color: var(--gold);
  background: rgba(245, 181, 68, .14);
  color: #fff;
}
.plan-canvas { position: relative; touch-action: none; }
.plan-layer .placement {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 5px 9px;
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 700;
  color: #08111d;
  background: var(--gold);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
  cursor: grab;
  user-select: none;
  white-space: nowrap;
}
.plan-layer .placement[data-type="dorm"] { background: #c4b5fd; }
.plan-layer .placement[data-type="food"] { background: #fcd34d; }
.plan-layer .placement[data-type="sport"] { background: #6ee7b7; }
.plan-layer .placement[data-type="green"] { background: #5eead4; }
.plan-layer .placement[data-type="study"] { background: #93c5fd; }
.plan-layer .placement[data-type="life"] { background: #fdba74; }
.plan-layer .placement .del {
  position: absolute; top: -8px; right: -8px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ef4444; color: #fff;
  font-size: 11px; line-height: 18px; text-align: center;
  border: 2px solid #0a111e;
}
.plan-layer .placement.dragging { cursor: grabbing; opacity: .9; transform: translate(-50%, -50%) scale(1.06); }

/* ---------- 结果 ---------- */
.done-ico {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  margin: 8px auto 14px;
  font-size: 30px;
  background: radial-gradient(circle at 30% 25%, rgba(52, 211, 153, .28), rgba(52, 211, 153, .05));
  border: 1px solid rgba(52, 211, 153, .45);
}
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  text-align: center;
  padding: 12px 6px;
  border-radius: 12px;
  background: #0b1524;
  border: 1px solid var(--line);
}
.stat .v { font-size: 22px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat .k { font-size: 11px; color: var(--muted); }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 62px 1fr 34px; gap: 8px; align-items: center; font-size: 12px; }
.bar-row .t { color: #cbd5e1; }
.bar-row .track { height: 8px; border-radius: 99px; background: #0a1422; overflow: hidden; }
.bar-row .track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--red2), var(--red)); }
.bar-row .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%; top: 18px;
  transform: translate(-50%, -16px);
  z-index: 60;
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(15, 24, 40, .98);
  border: 1px solid var(--line2);
  color: #e2e8f0;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(248, 113, 113, .6); color: #fecaca; }

.notice {
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 12px;
  border: 1px solid rgba(245, 181, 68, .3);
  background: rgba(245, 181, 68, .07);
  color: #fcd9a0;
}
.notice.blue {
  border-color: rgba(96, 165, 250, .3);
  background: rgba(96, 165, 250, .07);
  color: #bfdbfe;
}

.foot {
  text-align: center;
  font-size: 11px;
  color: var(--muted2);
  padding: 18px 0 8px;
  line-height: 1.8;
}
.foot a { color: var(--muted); }

/* ---------- 桌面 ---------- */
@media (min-width: 860px) {
  .app { max-width: 980px; padding-left: 24px; padding-right: 24px; }
  h1 { font-size: 38px; }
  .map-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 16px;
    align-items: start;
  }
  .map-layout .sheet { margin-top: 0; position: sticky; top: 64px; }
}
