:root {
  --bg1: #1b2a4a;
  --bg2: #2d1b3d;
  --warm: #ffb703;
  --warm2: #fb8500;
  --card: #fffaf2;
  --ink: #3a2f25;
  --soft: #8a7a6a;
  --green: #2a9d8f;
  --blue: #4c9be8;
  --line: #ecdfce;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; color: var(--ink); }
body { background: radial-gradient(120% 120% at 30% 10%, #2a3a63 0%, #1b2a4a 45%, #2d1b3d 100%); }

#topbar {
  position: fixed; top: 0; left: 0; right: 0; min-height: 54px; z-index: 20;
  display: flex; align-items: center; gap: 10px; padding: 6px 14px; flex-wrap: wrap;
  background: rgba(20, 24, 40, 0.55); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: 1px; }
#btnRotate { font-size: 12px; padding: 6px 10px; }
#userbox, #guestbox { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#userbox { position: relative; }
#userbox .pts { color: var(--warm); font-weight: 700; }
#userbox .uname { color: #fff; font-size: 13px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#btnMenu { display: none; }
#menuLinks { display: contents; } /* 桌面端：包裹层透明，按钮布局与原先一致 */
button { cursor: pointer; border: none; border-radius: 12px; font-size: 14px; font-weight: 700; padding: 8px 14px; transition: transform .08s, filter .15s; }
button:active { transform: scale(0.96); }
.primary { background: linear-gradient(135deg, var(--warm), var(--warm2)); color: #4a2c00; }
.primary.block { width: 100%; padding: 12px; margin-top: 6px; }
.ghost { background: rgba(255,255,255,0.1); color: #fff; padding: 6px 10px; font-size: 13px; }
.ghost:hover { background: rgba(255,255,255,0.2); }

#globe-wrap { position: absolute; inset: 0; }
#cesiumContainer { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Cesium 内部画布铺满容器（不要强制 canvas 像素尺寸，交给 Cesium 自身 resize 控制比例）*/
#cesiumContainer .cesium-widget { width: 100%; height: 100%; }
#cesiumContainer .cesium-widget canvas { display: block; }
#cesiumContainer .cesium-viewer-bottom { display: none; } /* 隐藏默认署名条（已在底图 credit 中） */
#hint { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: rgba(255,255,255,0.7); font-size: 13px; background: rgba(0,0,0,0.25); padding: 6px 14px; border-radius: 20px; pointer-events: none; }
#loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); color: #fff; font-size: 16px; }
/* 视角高度指示：滚轮缩放时的可见反馈 */
#altTip { position: absolute; right: 14px; bottom: 14px; color: rgba(255,255,255,0.78); font-size: 12px; background: rgba(0,0,0,0.35); padding: 4px 10px; border-radius: 10px; pointer-events: none; font-variant-numeric: tabular-nums; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(10,12,24,0.6); backdrop-filter: blur(4px); }
.card { background: var(--card); border-radius: 22px; padding: 26px 24px; width: min(90vw, 360px); box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
.card h2 { margin: 0 0 6px; font-size: 22px; }
.card .sub { color: var(--soft); font-size: 13px; margin: 0 0 16px; line-height: 1.5; }
.card input { width: 100%; padding: 12px 14px; margin-bottom: 10px; border: 2px solid var(--line); border-radius: 12px; font-size: 15px; outline: none; }
.card input:focus { border-color: var(--warm); }
.hl { color: var(--warm2); }
.err { color: #d64545; font-size: 13px; min-height: 18px; margin-top: 4px; }

/* 底部抽屉 / 侧栏 */
.sheet { position: fixed; z-index: 30; background: var(--card); border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,0.35); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.bp-title { font-size: 17px; font-weight: 800; }
.bp-sub { font-size: 12px; color: var(--soft); margin-top: 2px; }
.x { background: #f0e6d8; color: var(--ink); width: 32px; height: 32px; border-radius: 50%; font-size: 18px; line-height: 1; }
.sheet-body { padding: 16px 18px 28px; overflow-y: auto; }

/* 移动端：底部抽屉 */
@media (max-width: 760px) {
  .sheet { left: 0; right: 0; bottom: 0; max-height: 78vh; }
  /* 顶栏功能按钮收进 ☰ 下拉菜单（🔔/💎/用户名保持常驻） */
  #btnMenu { display: inline-block; padding: 6px 12px; }
  #menuLinks { display: none; position: absolute; top: calc(100% + 10px); right: 0; z-index: 60;
    flex-direction: column; gap: 6px; min-width: 136px; padding: 10px;
    background: var(--card); border-radius: 16px; box-shadow: 0 14px 44px rgba(0,0,0,0.45); }
  #menuLinks.open { display: flex; }
  #menuLinks .ghost { width: 100%; text-align: left; padding: 10px 12px; font-size: 14px; background: rgba(0,0,0,0.06); color: var(--ink); }
  #menuLinks .ghost:hover { background: rgba(0,0,0,0.12); }
}
/* PC：右侧抽屉 */
@media (min-width: 761px) {
  .sheet { right: 0; top: 54px; bottom: 0; width: 380px; border-radius: 0; max-height: none; }
  .sheet-head { border-radius: 0; }
}

.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv b { color: var(--ink); }
.tag { display: inline-block; background: #fff1d6; color: #a9650a; border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 700; margin-left: 6px; }
.tag.legend { background: linear-gradient(135deg,#ffe08a,#ffb703); color: #5a3a00; }
.row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.row button { flex: 1; min-width: 120px; }
.field { margin-top: 12px; }
.field label { font-size: 13px; color: var(--soft); display: block; margin-bottom: 5px; }
.field input[type=text], .field textarea, .field input[type=number] { width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; font-size: 14px; outline: none; font-family: inherit; }
.field textarea { resize: vertical; min-height: 56px; }
/* 经纬度定位：双输入一行 + 热门地点 chips */
.lc-inputs { display: flex; gap: 10px; }
.lc-inputs .field { flex: 1; margin-top: 12px; }
.lc-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { background: #f0e6d8; color: var(--ink); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; border: 1px solid var(--line); }
.chip:hover { background: #ffe9c7; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch.sel { box-shadow: 0 0 0 3px var(--warm2); }
/* 公会图标 */
.gicon { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: #fff; flex: none; }
.gicon.xs { width: 18px; height: 18px; border-radius: 5px; vertical-align: -4px; margin-right: 4px; }
.gicon-preview { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; border: 2px solid var(--line); background: #fff; }
.icon-upload { margin-top: 6px; }
.icon-upload-btns { display: flex; gap: 8px; margin-top: 8px; }
.guild-badge { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.msg { background: #fbf4e9; border-radius: 12px; padding: 9px 12px; margin-top: 8px; font-size: 13px; }
.msg .who { font-weight: 700; color: var(--warm2); }
.msg .when { color: var(--soft); font-size: 11px; float: right; }
.msg.offer { background: #e8f6f2; }
.msg.offer .who { color: var(--green); }
.section-title { font-weight: 800; margin: 16px 0 6px; font-size: 14px; color: var(--ink); }
.muted { color: var(--soft); font-size: 13px; }
.empty { color: var(--soft); text-align: center; padding: 24px; font-size: 14px; }
.mk-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.mk-item .top { display: flex; align-items: center; gap: 10px; }
.dot { width: 18px; height: 18px; border-radius: 5px; flex: none; border: 1px solid var(--line); }
.rk-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.rk-tabs button { flex: 1; background: #f0e6d8; color: var(--ink); }
.rk-tabs button.on { background: linear-gradient(135deg,var(--warm),var(--warm2)); color:#4a2c00; }
.hidden { display: none !important; }
#hoverTip { position: fixed; z-index: 16; pointer-events: none; background: rgba(20,24,40,0.88); color: #fff; padding: 4px 10px; border-radius: 10px; font-size: 12px; transform: translate(-50%, calc(-100% - 14px)); white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,0.4); }
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: rgba(20,24,40,0.92); color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 14px; z-index: 50; animation: pop .3s; }
@keyframes pop { from { opacity:0; transform: translate(-50%,10px);} to {opacity:1;} }

/* 用户名按钮（点开我的领地） */
.uname.as-btn { background: rgba(255,255,255,0.12); border: none; color: #fff; font-size: 13px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 10px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.uname.as-btn:hover { background: rgba(255,255,255,0.22); }

/* 任务红点 */
.dot-badge { display: inline-block; width: 8px; height: 8px; background: #ff5d5d; border-radius: 50%; margin-left: 4px; vertical-align: top; box-shadow: 0 0 6px #ff5d5d; }
.dot-badge.hidden { display: none !important; }

/* 任务项 */
.task-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.task-item .top { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.task-item.ready { border-color: var(--warm2); box-shadow: 0 0 0 2px rgba(251,133,0,0.25); }
.task-item .row { margin-top: 8px; }
.progress { height: 8px; background: #f0e6d8; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--warm), var(--warm2)); border-radius: 6px; transition: width .3s; }

/* 我的领地 */
.mine-item { cursor: pointer; transition: transform .1s, box-shadow .15s; }
.mine-item:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.08); border-color: var(--warm); }

/* 首占引导层 + 积分飘字 */
#guideOverlay { position: absolute; inset: 0; z-index: 15; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 90px; pointer-events: none; }
#guideOverlay.hidden { display: none !important; }
.guide-card { pointer-events: auto; background: rgba(20,24,40,0.92); color: #fff; border-radius: 18px; padding: 18px 26px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.5); animation: guideFloat 2s ease-in-out infinite; }
.guide-emoji { font-size: 34px; animation: guideBounce 1.2s ease-in-out infinite; }
.guide-title { font-size: 17px; font-weight: 800; margin-top: 4px; }
.guide-sub { font-size: 13px; color: rgba(255,255,255,0.75); margin: 6px 0 10px; }
@keyframes guideFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes guideBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(10px); } }
.float-pts { position: fixed; z-index: 60; transform: translate(-50%,-50%); color: #ffd166; font-size: 26px; font-weight: 800; text-shadow: 0 2px 12px rgba(0,0,0,0.6); pointer-events: none; animation: floatUp 1.5s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%,-30%) scale(0.6); } 20% { opacity: 1; transform: translate(-50%,-60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%,-160%) scale(1); } }

/* 进度条（加高版） */
.progress.tall { height: 14px; border-radius: 8px; }
.task-item.unlocked { opacity: 0.75; border-color: var(--green); }

/* 周拍横幅 */
.week-banner { background: linear-gradient(135deg,#ff8a00,#ffb703); color: #4a2c00; border-radius: 14px; padding: 14px; margin-bottom: 12px; font-weight: 700; }
.week-banner .muted { color: rgba(74,44,0,0.75); }
.week-item { border-color: var(--warm2); box-shadow: 0 0 0 2px rgba(251,133,0,0.25); }

/* 分享卡片 */
.share-card { width: min(92vw, 420px); max-height: 92vh; overflow-y: auto; }
.share-card .row { justify-content: center; }
.share-img { width: 100%; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); display: block; }
