/* 寻景西大 · 样式（配色沿用官网 Bubble 主题） */
:root {
  --primary: #5e72e4; --primary-dark: #4c5fd5;
  --success: #2dce89; --danger: #f5365c; --warning: #fb6340;
  --text: #32325d; --muted: #8898aa; --line: #e9ecef;
  --bg: #f4f5f7; --card: #fff; --top-h: 52px;
  --shadow: 0 4px 16px rgba(50, 50, 93, .1), 0 1px 3px rgba(0, 0, 0, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
.xj-body {
  font-family: "Open Sans", -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.6; font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.xj-top {
  height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: linear-gradient(87deg, #5e72e4, #825ee4); color: #fff; position: relative; z-index: 1001;
}
.xj-brand { color: #fff; font-weight: 700; white-space: nowrap; }
.xj-brand:hover { text-decoration: none; opacity: .9; }
.xj-top-title { opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xj-top-score { margin-left: auto; font-weight: 700; background: rgba(255,255,255,.18); padding: 2px 12px; border-radius: 99px; white-space: nowrap; }
.xj-admin-bar { background: #fff3cd; color: #856404; padding: 6px 16px; font-size: 13px; }

/* 通用组件 */
.xj-card { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 28px; }
.xj-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 8px;
  padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 6px rgba(50,50,93,.08); transition: transform .12s, box-shadow .12s, background .12s;
}
.xj-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(50,50,93,.14); text-decoration: none; }
.xj-btn:disabled { opacity: .6; cursor: not-allowed; }
.xj-btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.xj-btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.xj-btn-danger { color: var(--danger); }
.xj-btn-lg { padding: 12px 28px; font-size: 16px; }
.xj-btn-sm { padding: 5px 12px; font-size: 13px; }
.xj-link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.xj-inline { display: inline; margin: 0; }
.xj-muted { color: var(--muted); font-size: 13px; }

/* 开始界面 */
.xj-screen { min-height: calc(100vh - var(--top-h)); }
.xj-intro, .xj-final { display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.xj-intro-card, .xj-final-card { width: 100%; max-width: 560px; text-align: center; }
.xj-badge { display: inline-block; background: rgba(245,54,92,.12); color: var(--danger); font-weight: 700; font-size: 13px; padding: 2px 12px; border-radius: 99px; }
.xj-intro h1 { margin: 12px 0 8px; font-size: 32px; }
.xj-lead { color: #525f7f; margin: 0 0 16px; }
.xj-rules { text-align: left; background: var(--bg); border-radius: 10px; padding: 14px 18px 14px 36px; margin: 0 0 16px; }
.xj-rules li + li { margin-top: 4px; }
.xj-time { color: var(--muted); font-size: 14px; }
.xj-notice { background: #fff3cd; color: #856404; border-radius: 8px; padding: 10px 14px; }

/* 答题界面：左图右地图，窄屏上下排列 */
.xj-game { display: grid; grid-template-columns: minmax(280px, 38%) 1fr; height: calc(100vh - var(--top-h)); }
.xj-admin-bar ~ .xj-game { height: calc(100vh - var(--top-h) - 32px); }
.xj-photo-pane { position: relative; background: #1a1f36; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.xj-photo-pane img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.xj-round-label { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.55); color: #fff; padding: 2px 12px; border-radius: 99px; font-weight: 600; font-size: 14px; }
.xj-photo-hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; color: rgba(255,255,255,.7); font-size: 13px; pointer-events: none; }
.xj-map-pane { position: relative; min-height: 0; }
.xj-map { width: 100%; height: 100%; background: #1a1f36; }
.xj-scale { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.xj-map-actions { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 10px; z-index: 1000; }
.xj-map-actions .xj-btn { box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.xj-result-card {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000;
  background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  padding: 16px 22px; text-align: center; width: min(420px, calc(100% - 32px));
}
.xj-result-points { font-size: 28px; font-weight: 800; color: var(--primary); }
.xj-result-detail { color: #525f7f; margin: 4px 0 12px; font-size: 14px; }

/* 地图图钉 */
.xj-pin span {
  display: block; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.4); margin-top: 2px;
}
.xj-pin-blue span { background: var(--primary); }
.xj-pin-green span { background: var(--success); }

/* 结算 */
.xj-final-label { color: var(--muted); }
.xj-final-score { font-size: 64px; font-weight: 800; color: var(--primary); line-height: 1.1; }
.xj-final-score small { font-size: 24px; color: var(--muted); font-weight: 600; }
.xj-final-rank { display: inline-flex; align-items: center; gap: 7px; margin: 10px 0 4px; padding: 6px 12px; border-radius: 999px; background: #e3f9ef; color: #1a7f55; font-size: 13px; }
.xj-final-rank b { font-size: 15px; }
.xj-final-rank b span { font-size: inherit; color: inherit; }
.xj-final-comment { margin: 8px 0 20px; color: #525f7f; }
.xj-final-list { list-style: none; padding: 0; margin: 0 0 24px; text-align: left; }
.xj-final-list li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.xj-final-list img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; }
.xj-final-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.xj-final-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xj-final-info span { color: var(--muted); font-size: 13px; }
.xj-final-pts { font-weight: 700; white-space: nowrap; }
.xj-final-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* 灯箱与提示 */
.xj-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 3000; display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 16px; }
.xj-lightbox img { max-width: 100%; max-height: 100%; }
.xj-toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); background: #32325d; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 4000; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  .xj-game { grid-template-columns: 1fr; grid-template-rows: 34% 1fr; }
  .xj-top-title { display: none; }
  .xj-intro h1 { font-size: 26px; }
  .xj-card { padding: 22px 18px; }
  .xj-final-score { font-size: 52px; }
  .xj-history-list li { grid-template-columns: 1fr 60px; }
  .xj-history-bar { display: none; }
}

/* 昵称与历史成绩 */
.xj-nick { display: flex; flex-direction: column; gap: 4px; text-align: left; font-weight: 600; font-size: 14px; max-width: 320px; margin: 0 auto 14px; }
.xj-history { margin-top: 24px; text-align: left; border-top: 1px solid var(--line); padding-top: 18px; }
.xj-final-card .xj-history { margin: 0 0 24px; }
.xj-history-head { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.xj-history-head div { background: var(--bg); border-radius: 8px; padding: 8px; text-align: center; }
.xj-history-head b { display: block; font-size: 20px; color: var(--primary); }
.xj-history-head span { color: var(--muted); font-size: 12px; }
.xj-history-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.xj-history-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.xj-history-list li { display: grid; grid-template-columns: 150px 1fr 60px; gap: 10px; align-items: center; padding: 5px 0; }
.xj-history-list li + li { border-top: 1px solid var(--line); }
.xj-history-list span:first-child { color: #525f7f; white-space: nowrap; }
.xj-history-list b { text-align: right; }
.xj-history-new span:first-child, .xj-history-new b { color: var(--primary); font-weight: 700; }
.xj-history-bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.xj-history-bar i { display: block; height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; }

/* ---------- 后台 ---------- */
.xj-admin-nav { margin-left: auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.xj-admin-nav a { color: #fff; }
.xj-admin .xj-top { height: auto; min-height: var(--top-h); flex-wrap: wrap; padding: 8px 16px; }
.xj-admin-main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.xj-section { margin-top: 20px; scroll-margin-top: 16px; }
.xj-section h2 { margin: 0 0 16px; font-size: 20px; }
.xj-flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; font-size: 14px; }
.xj-flash-ok { background: #e3f9ef; color: #1a7f55; }
.xj-flash-warn { background: #fff3cd; color: #856404; }
.xj-flash-err { background: #fde8ec; color: #b4153a; }
.xj-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.xj-stats div { background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 14px; text-align: center; }
.xj-stats b { display: block; font-size: 22px; color: var(--primary); }
.xj-stats span { color: var(--muted); font-size: 13px; }
.xj-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.xj-form .xj-wide { grid-column: 1 / -1; }
.xj-form label, .xj-modal-side label, .xj-login label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.xj-form small { color: var(--muted); font-weight: 400; font-size: 12px; }
.xj-body input:not([type=file]):not([type=hidden]), .xj-body textarea {
  font: inherit; font-weight: 400; color: var(--text); border: 1px solid #cad1d7; border-radius: 6px; padding: 8px 10px; width: 100%; background: #fff;
}
.xj-body input:focus, .xj-body textarea:focus { outline: 2px solid rgba(94,114,228,.35); border-color: var(--primary); }
.xj-upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.xj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 16px; }
.xj-tile { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.xj-tile-img { position: relative; height: 140px; background: var(--bg); }
.xj-tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.xj-broken-text { display: none; }
.xj-broken img { display: none; }
.xj-broken .xj-broken-text { display: flex; height: 100%; align-items: center; justify-content: center; color: #b4153a; background: #fde8ec; font-size: 13px; padding: 0 12px; text-align: center; }
.xj-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.xj-tag-link { background: #eef0fd; color: var(--primary); }
.xj-url-form { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.xj-url-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; width: 100%; }
.xj-url-form small { color: var(--muted); font-weight: 400; font-size: 12px; }

/* 数据统计 */
.xj-sub { font-size: 16px; margin: 22px 0 10px; }
.xj-dist { display: flex; flex-direction: column; gap: 4px; max-width: 640px; }
.xj-dist-row { display: grid; grid-template-columns: 64px 1fr 44px; gap: 10px; align-items: center; font-size: 13px; padding: 2px 0; }
.xj-dist-row:hover { background: var(--bg); border-radius: 4px; }
.xj-dist-row span:first-child { color: #525f7f; font-variant-numeric: tabular-nums; }
.xj-dist-row b { text-align: right; font-variant-numeric: tabular-nums; }
.xj-dist-track { height: 14px; }
.xj-dist-track i { display: block; height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; }
.xj-table-wrap { overflow-x: auto; }
.xj-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.xj-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.xj-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.xj-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.xj-table tbody tr:hover { background: var(--bg); }
.xj-stats-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.xj-tile-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.xj-tile-body b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xj-tile-actions { display: flex; gap: 8px; margin-top: auto; }
.xj-tag { font-size: 12px; border-radius: 4px; padding: 1px 8px; align-self: flex-start; }
.xj-tag-ok { background: #e3f9ef; color: #1a7f55; }
.xj-tag-warn { background: #fff3cd; color: #856404; }
.xj-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.xj-login form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.xj-login h1 { margin: 0; font-size: 22px; text-align: center; }

/* 点位编辑弹窗 */
.xj-modal { position: fixed; inset: 0; background: rgba(23,28,48,.6); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.xj-modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 1200px; height: min(820px, 100%); display: flex; flex-direction: column; overflow: hidden; margin: 0; }
.xj-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.xj-modal-head h3 { margin: 0; }
.xj-modal-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px 1fr; }
.xj-modal-side { padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; border-right: 1px solid var(--line); }
.xj-modal-side img { width: 100%; max-height: 220px; object-fit: contain; background: var(--bg); border-radius: 8px; }
.xj-modal-side p { margin: 0; }
.xj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.xj-dot-full { background: var(--success); }
.xj-dot-zero { background: var(--warning); opacity: .6; }
.xj-dot-other { background: var(--muted); }

@media (max-width: 760px) {
  .xj-stats { grid-template-columns: repeat(2, 1fr); }
  .xj-form { grid-template-columns: 1fr; }
  .xj-modal { padding: 0; }
  .xj-modal-box { height: 100%; border-radius: 0; }
  .xj-modal-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .xj-modal-side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 45vh; }
  .xj-modal-side img { max-height: 120px; }
}
