/* ============ BUAA GeoGuessr 全局样式 ============ */
:root {
  --primary: #1a56db;
  --primary-dark: #1e429f;
  --primary-light: #e8effc;
  --accent: #0e9f6e;
  --danger: #e02424;
  --warn: #dd900c;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1f2937;
  --text-2: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font-family: inherit; }

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 1000;
  background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  height: 60px; display: flex; align-items: center; gap: 24px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 18px; color: var(--text); cursor: pointer;
}
.nav-logo:hover { text-decoration: none; }
.nav-logo .logo-badge {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #1a56db, #3b82f6);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; letter-spacing: -.5px;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 8px 14px; border-radius: 8px; color: var(--text-2);
  font-size: 15px; font-weight: 500;
}
.nav-link:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-user .score-chip {
  background: #fff7e6; color: #b45309; border: 1px solid #fde68a;
  padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.nav-user .uid { font-weight: 600; font-size: 14px; }

/* ---------- 通用布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 60px; }
.page-title { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--text-2); font-size: 14px; margin-bottom: 20px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 9px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s;
  background: #fff; color: var(--text);
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { border-color: var(--border); background: #fff; }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-success { background: var(--accent); color: #fff; }
.btn-success:hover:not(:disabled) { filter: brightness(.92); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.form-label .req { color: var(--danger); }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 9px; font-size: 14px; font-family: inherit;
  background: #fff; color: var(--text); outline: none; transition: border .15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26, 86, 219, .12);
}
.form-textarea { resize: vertical; min-height: 88px; }
.form-hint { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.input-group { display: flex; gap: 8px; }
.input-group .form-input { flex: 1; }
.input-code { font-family: "SF Mono", Consolas, monospace; letter-spacing: 1px; }

/* ---------- 公告条 ---------- */
.announce-banner {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, #eef4ff, #f5f8ff);
  border: 1px solid #c7d9f8; border-radius: var(--radius);
  padding: 12px 18px; margin-bottom: 20px; cursor: pointer;
}
.announce-banner .tag {
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; white-space: nowrap;
}
.announce-banner .txt {
  flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 14px; color: var(--text);
}
.announce-banner .txt b { font-weight: 700; }

/* ---------- 帖子卡片网格 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
  padding: 7px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: #fff; border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.post-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}
.post-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: all .15s; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.post-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.post-thumb {
  aspect-ratio: 4/3; background: #e5e7eb center/cover no-repeat; position: relative;
}
.post-thumb .badge {
  position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; color: #fff;
  background: rgba(26, 86, 219, .92); backdrop-filter: blur(2px);
}
.post-thumb .badge.status-pending { background: rgba(221, 144, 12, .95); }
.post-thumb .badge.status-rejected { background: rgba(224, 36, 36, .95); }
.post-thumb .badge.guessed { top: 8px; right: 8px; left: auto; background: rgba(14, 159, 110, .95); }
.post-body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.post-desc {
  font-size: 14px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.9em;
}
.post-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); margin-top: auto; }
.post-meta .spacer { flex: 1; }

/* ---------- 标签 ---------- */
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.chip-blue { background: var(--primary-light); color: var(--primary); }
.chip-green { background: #def7ec; color: #046c4e; }
.chip-red { background: #fde8e8; color: var(--danger); }
.chip-yellow { background: #fdf6b2; color: #8e4b10; }
.chip-gray { background: #f3f4f6; color: var(--text-2); }

/* ---------- 出题/竞猜 双栏 ---------- */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .duo { grid-template-columns: 1fr; } }

.upload-zone {
  border: 2px dashed #c3d3f0; border-radius: var(--radius); background: #f8faff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px 20px; cursor: pointer; transition: all .15s; text-align: center;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--primary); background: var(--primary-light); }
.upload-zone .icon { font-size: 40px; margin-bottom: 8px; }
.upload-zone .main { font-size: 15px; font-weight: 600; }
.upload-zone .sub { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }

.img-preview { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); position: relative; }
.img-preview img { display: block; width: 100%; }
.img-preview .remove {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px;
  border-radius: 50%; background: rgba(17, 24, 39, .65); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 16px; border: none;
}

.map-wrap {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  position: relative; background: #dfe7f3;
}
.map-wrap .leaflet-container { height: 480px; width: 100%; background: #dfe7f3; }
.map-hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(17, 24, 39, .78); color: #fff; font-size: 12.5px;
  padding: 5px 14px; border-radius: 999px; z-index: 500; pointer-events: none;
  white-space: nowrap;
}

/* 地图标记 */
.marker-dot {
  width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.4);
}
.marker-guess { background: #2563eb; }
.marker-answer { background: #0e9f6e; }
.marker-pin { background: #dc2626; }

/* 竞猜结果 */
.result-panel {
  border-radius: var(--radius); padding: 20px; text-align: center;
  background: linear-gradient(135deg, #eef4ff, #f0fdf6);
  border: 1px solid #c7d9f8;
}
.result-panel .dist { font-size: 32px; font-weight: 800; color: var(--primary); }
.result-panel .pts { font-size: 22px; font-weight: 800; color: var(--accent); }
.result-grid { display: flex; justify-content: center; gap: 32px; margin: 10px 0; }
.result-grid .cell .num { font-size: 26px; font-weight: 800; }
.result-grid .cell .lbl { font-size: 12.5px; color: var(--text-2); }

/* ---------- 迷你地图点 ---------- */
.mapdot {
  position: relative; width: 160px; height: 160px; border-radius: 10px;
  background-image: url('/assets/map.jpg'); background-size: cover;
  border: 1px solid var(--border); overflow: hidden;
}
.mapdot i {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  background: #dc2626; border: 2px solid #fff; transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 10px 12px; color: var(--text-2); font-weight: 600;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: #f8fafc; }
.table .rank-num { font-weight: 800; color: var(--text-2); }
.table tr.me td { background: #eef4ff; }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .55);
  z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 86vh; overflow: auto; box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
.modal.wide { max-width: 720px; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  border: none; background: none; font-size: 20px; color: var(--text-2);
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.modal-close:hover { background: #f3f4f6; }
.modal-body { padding: 20px; }

/* 用户码展示 */
.usercode-box {
  background: #0f172a; color: #7dd3fc; border-radius: 10px;
  padding: 14px; font-family: "SF Mono", Consolas, monospace;
  font-size: 13px; word-break: break-all; line-height: 1.7;
  margin: 12px 0;
}
.instruction { font-size: 13.5px; color: var(--text); }
.instruction ol { margin: 8px 0 0 20px; display: grid; gap: 4px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 76px; right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 18px; border-radius: 10px; font-size: 14px; font-weight: 500;
  color: #fff; box-shadow: var(--shadow-lg); animation: slideIn .2s ease;
  max-width: 340px;
}
.toast.ok { background: #046c4e; }
.toast.err { background: var(--danger); }
.toast.info { background: #1f2937; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; padding: 60px 20px; color: var(--text-2);
}
.empty .icon { font-size: 44px; margin-bottom: 10px; }

/* ---------- 管理后台 ---------- */
.admin-layout { display: grid; grid-template-columns: 190px 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-side {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; position: sticky; top: 84px;
}
.admin-side .item {
  display: block; padding: 10px 14px; border-radius: 8px; font-size: 14px;
  font-weight: 500; color: var(--text-2); cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
}
.admin-side .item:hover { background: var(--primary-light); color: var(--primary); }
.admin-side .item.active { background: var(--primary); color: #fff; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card .num { font-size: 26px; font-weight: 800; }
.stat-card .lbl { font-size: 12.5px; color: var(--text-2); }
.warn-box {
  background: #fff7e6; border: 1px solid #fde68a; color: #92400e;
  border-radius: var(--radius); padding: 12px 16px; font-size: 13.5px; margin-bottom: 16px;
}

.review-item {
  display: flex; gap: 16px; padding: 16px; border-bottom: 1px solid var(--border);
}
.review-item:last-child { border-bottom: none; }
.review-item .img {
  width: 180px; height: 135px; border-radius: 10px; object-fit: cover; cursor: zoom-in;
  border: 1px solid var(--border); flex-shrink: 0;
}

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center;
  padding: 30px 20px;
  background:
    radial-gradient(1000px 500px at 10% -10%, #dbe7fb 0%, transparent 60%),
    radial-gradient(800px 400px at 110% 110%, #d5f3e7 0%, transparent 55%);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--border); }
.auth-tab {
  flex: 1; padding: 14px; text-align: center; font-weight: 600; font-size: 15px;
  color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; border-top: none; border-left: none; border-right: none;
}
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- 排行 ---------- */
.rank-podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.podium-card {
  border-radius: var(--radius); padding: 18px; text-align: center;
  border: 1px solid var(--border); background: var(--card);
}
.podium-card.first { background: linear-gradient(135deg, #fff7e0, #fff); border-color: #f3d68a; }
.podium-card .medal { font-size: 30px; }
.podium-card .uid { font-weight: 800; font-size: 16px; margin: 6px 0 2px; }
.podium-card .pts { color: var(--primary); font-weight: 700; }

/* ---------- 页脚 ---------- */
.footer {
  text-align: center; padding: 26px 20px 34px; color: var(--text-2); font-size: 12.5px;
}

/* 图片查看大图 */
.viewer-img { display: block; max-width: 100%; max-height: 78vh; margin: 0 auto; border-radius: 8px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 17px; font-weight: 700; }

.desc-full { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; color: var(--text); }
