/* ============================================================
   万象原野 · 界面样式
   风格：明亮清新的奇幻探索风（浅色玻璃拟态 + 青绿/琥珀点缀）
   ============================================================ */
:root {
  --bg-panel: rgba(255, 255, 255, 0.82);
  --bg-panel-solid: #ffffff;
  --line: rgba(32, 68, 84, 0.14);
  --line-strong: rgba(32, 68, 84, 0.28);
  --text: #1e3240;
  --text-dim: #5c7484;
  --accent: #12897f;
  --accent-soft: #d8f2ee;
  --amber: #d9862b;
  --danger: #c9534a;
  --shadow: 0 10px 30px rgba(24, 58, 74, 0.16);
  --radius: 14px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #cfe3ee;
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#app { position: fixed; inset: 0; }
#game { display: block; width: 100%; height: 100%; }

.hidden { display: none !important; }

/* ==================== 通用面板 ==================== */
.panel {
  position: absolute;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  padding: 12px 14px;
  z-index: 5;
}

/* ==================== 状态面板 ==================== */
.status-panel {
  left: 18px; top: 18px;
  display: flex; gap: 14px; align-items: flex-start;
  min-width: 286px;
}
.avatar { position: relative; width: 58px; height: 58px; flex: 0 0 auto; }
.avatar-inner {
  width: 58px; height: 58px; border-radius: 50%;
  background: linear-gradient(145deg, #1fa89b, #0d6d67);
  color: #fff; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2.5px solid #fff; box-shadow: 0 4px 12px rgba(13, 109, 103, 0.35);
}
.level-badge {
  position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, #ffcf6b, #e3a02c);
  color: #5a3a05; font-size: 11px; font-weight: 800;
  padding: 1px 8px; border-radius: 9px; border: 1.5px solid #fff; white-space: nowrap;
}
.bars { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label { font-size: 11px; color: var(--text-dim); width: 26px; flex: 0 0 auto; letter-spacing: .5px; }
.bar {
  position: relative; flex: 1; height: 15px; border-radius: 8px;
  background: rgba(28, 60, 76, 0.13); overflow: hidden;
  border: 1px solid rgba(255,255,255,.6);
}
.bar.slim { height: 10px; }
.fill {
  position: absolute; inset: 0 auto 0 0; width: 100%;
  border-radius: 8px; transition: width .18s ease-out;
}
.fill.hp { background: linear-gradient(90deg, #ff8a76, #e2493c); }
.fill.sp { background: linear-gradient(90deg, #63e0c8, #12a08f); }
.fill.xp { background: linear-gradient(90deg, #ffd889, #e3a02c); }
.bar-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #17323f; text-shadow: 0 1px 0 rgba(255,255,255,.6);
  letter-spacing: .3px;
}

/* ==================== 小地图 ==================== */
.map-panel { right: 18px; top: 18px; padding: 10px; width: 240px; }
.map-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px 7px; }
#biome-name { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .5px; }
.clock { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.minimap-wrap { position: relative; width: 220px; height: 220px; }
#minimap {
  width: 220px; height: 220px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: #b9d3e2; display: block;
}
.compass { position: absolute; inset: 0; pointer-events: none; }
.compass .c {
  position: absolute; font-size: 10px; font-weight: 800; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.55); letter-spacing: 1px;
}
.compass .n { top: 3px; left: 50%; transform: translateX(-50%); }
.compass .s { bottom: 3px; left: 50%; transform: translateX(-50%); }
.compass .e { right: 4px; top: 50%; transform: translateY(-50%); }
.compass .w { left: 4px; top: 50%; transform: translateY(-50%); }
.map-foot {
  display: flex; justify-content: space-between; padding: 6px 2px 0;
  font-size: 10.5px; color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.zoom-tag { color: var(--accent); font-weight: 700; }

/* ==================== 目标面板 ====================
   从"白色玻璃卡片"改成了"纯文字浮层"：
   · 背景全透明（去掉底色 / 边框 / 投影），不再在画面上压出一块白板
   · 行距、内边距、标题下方留白全部收紧，整块面积比之前小一半以上
   · 标签不再用 flex:1 顶到面板两端，数值紧跟在标签后面
   因为底衬没了，文字统一改成浅色 + 投影，雪原 / 沙滩这类亮地形上也读得清。
*/
.quest-panel {
  left: 14px; bottom: 14px;
  min-width: 0;
  width: 200px;
  max-width: calc(100vw - 28px);
  padding: 2px 4px;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #fff;
  text-shadow: 0 1px 2px rgba(8, 24, 34, .78), 0 0 8px rgba(8, 24, 34, .5);
}
.quest-title {
  font-size: 10.5px; font-weight: 800; color: rgba(255, 255, 255, .94);
  letter-spacing: 1.2px; padding-bottom: 3px; margin-bottom: 3px;
  border-bottom: 1px dashed rgba(255, 255, 255, .4);
}
.quest-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.quest-list li { display: flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1.22; }
/* 数值不再被推到面板右端：给标签一个刚好放得下 4 个字的最小宽度，
   后面的 b 就紧贴着它排，标签↔数值的距离从 ~350px 收到 ~6px。 */
.quest-list li span { flex: 0 0 auto; min-width: 4.4em; color: rgba(255, 255, 255, .88); }
.quest-list li b { font-size: 12.5px; color: #fff; font-variant-numeric: tabular-nums; }
.ico { width: 15px; height: 15px; border-radius: 4px; flex: 0 0 auto; display: inline-block; }
.orb-ico { background: linear-gradient(140deg, #8ff5e8, #16a99b); border-radius: 50%; }
.chest-ico { background: linear-gradient(140deg, #ffd07a, #c8861d); }
/* 和地图上的传送锚点保持一致：菱形 */
.way-ico {
  background: linear-gradient(140deg, #a9e6ff, #3f8fd0);
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
/* 原石：浅蓝白菱形宝石 */
.gem-ico {
  background: linear-gradient(140deg, #eaf7ff, #7fc4e8 55%, #3f8fd0);
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 38%, 50% 100%, 0% 38%);
}
/* 摩拉：金色圆币 */
.mora-ico {
  background: radial-gradient(circle at 34% 30%, #fff2c4, #f0c04a 48%, #b8801a);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .5);
}
.loot-title { margin-top: 6px; }
/* 已探索：和列表一样"标签 + 数值紧挨着"，不再一左一右拉到两端。
   左边补 21px＝图标宽(15) + 行内间距(6)，让这一行的文字和上下的列表项对齐。 */
.travel {
  margin-top: 4px; padding: 4px 0 0 21px;
  border-top: 1px dashed rgba(255, 255, 255, .4);
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: rgba(255, 255, 255, .88);
}
.travel span { min-width: 4.6em; }
.travel b { color: #ffd88a; font-variant-numeric: tabular-nums; }
.region-list { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
/* 生物群系色卡自带浅色底，所以文字投影要关掉，否则小字会糊成一团 */
.region-list span {
  font-size: 9.5px; padding: 1px 5px; border-radius: 6px;
  background: rgba(216, 242, 238, .82); color: #0d6d67; font-weight: 600;
  text-shadow: none;
}

/* ==================== 交互提示 ==================== */
.interact {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: rgba(255,255,255,.92); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 8px 18px 8px 8px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow);
  z-index: 6; animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateX(-50%) scale(.9); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.interact .key {
  width: 26px; height: 26px; border-radius: 7px; background: var(--text); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
}

/* ==================== 状态标签 ==================== */
.state-tag {
  position: absolute; left: 50%; bottom: 56px; transform: translateX(-50%);
  font-size: 12px; font-weight: 700; letter-spacing: 1px; color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,.4); opacity: 0; transition: opacity .25s; z-index: 4;
}
.state-tag.on { opacity: .95; }

/* ==================== 准星 ==================== */
.crosshair {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 14px; height: 14px; z-index: 4; opacity: .55; pointer-events: none;
}
.crosshair i {
  position: absolute; inset: 5px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1.5px rgba(0,0,0,.35);
}

/* ==================== 提示气泡 ==================== */
.toasts {
  position: absolute; right: 18px; top: 292px; display: flex; flex-direction: column;
  gap: 8px; align-items: flex-end; z-index: 7; pointer-events: none;
}
.toast {
  background: rgba(255,255,255,.93); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 9px 14px; font-size: 12.5px; font-weight: 600;
  box-shadow: var(--shadow); animation: slideIn .28s cubic-bezier(.2,.9,.3,1.2);
  max-width: 300px;
}
.toast.amber { border-left-color: var(--amber); }
.toast.gold { border-left-color: #e3a02c; }
.toast b { color: var(--accent); }
/* 开箱提示的第二行：累计拥有量 */
.toast-sub { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 600; color: var(--text-dim); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.out { animation: fadeOut .35s forwards; }
@keyframes fadeOut { to { transform: translateX(20px); opacity: 0; } }

.hint-bar {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  background: rgba(30,50,64,.82); color: #fff; font-size: 12.5px;
  padding: 7px 16px; border-radius: 999px; z-index: 6;
  opacity: 0; transition: opacity .3s; backdrop-filter: blur(6px);
}
.hint-bar.on { opacity: 1; }

/* ==================== 遮罩与菜单 ==================== */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, rgba(233, 245, 250, .86), rgba(178, 208, 224, .95));
  backdrop-filter: blur(7px);
}
.overlay.hidden { display: none; }

.menu-card {
  background: var(--bg-panel-solid);
  border: 1px solid var(--line);
  border-radius: 20px; padding: 26px 28px;
  box-shadow: 0 24px 60px rgba(20, 52, 68, .28);
  width: 380px; max-width: 92vw; max-height: 92vh; overflow-y: auto;
  animation: cardIn .3s cubic-bezier(.2,.9,.3,1.1);
}
.menu-card.wide { width: 560px; }
@keyframes cardIn { from { transform: translateY(14px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

.logo {
  font-size: 40px; font-weight: 900; letter-spacing: 8px;
  background: linear-gradient(120deg, #0f7d75, #1fa89b 40%, #d9862b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-align: center; line-height: 1.15;
}
.logo-sub {
  text-align: center; font-size: 11px; letter-spacing: 4px;
  color: var(--text-dim); margin-top: 4px; font-weight: 700;
}
.tagline {
  text-align: center; font-size: 12.5px; color: var(--text-dim);
  margin: 16px 4px 20px; line-height: 1.75;
}
.menu-card h2 { font-size: 19px; margin-bottom: 16px; letter-spacing: 2px; }

.menu-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 18px; }
.btn {
  font-family: var(--font); font-size: 14px; font-weight: 700; letter-spacing: .6px;
  padding: 11px 16px; border-radius: 11px; cursor: pointer;
  background: #f2f7f9; color: var(--text); border: 1px solid var(--line);
  transition: transform .12s, background .18s, box-shadow .18s;
}
.btn:hover { background: #e6f1f4; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(24,58,74,.12); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(120deg, #17a595, #0e7d76); color: #fff; border-color: transparent;
  box-shadow: 0 8px 20px rgba(14, 125, 118, .32);
}
.btn.primary:hover { background: linear-gradient(120deg, #1cb5a3, #0d726c); }
.btn.danger { color: var(--danger); border-color: rgba(201,83,74,.35); background: #fdf2f1; }
.btn.small { padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.save-info { text-align: center; font-size: 11px; color: var(--text-dim); margin-top: 14px; min-height: 14px; }
/* 「开启新旅程」的覆盖确认：把要丢掉的东西一条条列清楚，别只写"确定吗？" */
.confirm-text {
  font-size: 12.5px; line-height: 1.85; color: var(--text-dim);
  background: #fbf4f3; border: 1px solid rgba(201, 83, 74, .22);
  border-radius: 12px; padding: 12px 14px;
}
.confirm-text b { color: var(--danger); font-variant-numeric: tabular-nums; }

/* ==================== 设置控件 ==================== */
.setting-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-of-type { border-bottom: none; }
.setting-row label:first-child { flex: 0 0 96px; font-size: 12.5px; color: var(--text-dim); }
.setting-row input[type=range] {
  flex: 1; -webkit-appearance: none; appearance: none; height: 5px; border-radius: 4px;
  background: linear-gradient(90deg, #17a595, #cfe6e3); outline: none;
}
.setting-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--accent); cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.setting-row span { font-size: 11.5px; color: var(--text-dim); width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.seg { display: flex; gap: 5px; flex: 1; }
.seg button {
  flex: 1; padding: 7px 0; font-size: 12px; font-weight: 700; cursor: pointer;
  border-radius: 8px; border: 1px solid var(--line); background: #f5f9fa; color: var(--text-dim);
  font-family: var(--font);
}
.seg button.on { background: var(--accent); color: #fff; border-color: transparent; }

.switch { position: relative; width: 44px; height: 24px; flex: 0 0 auto; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; background: #cdd9df; border-radius: 999px; transition: .2s;
}
.switch i::after {
  content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }

/* ==================== 帮助 ==================== */
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.help-col h3 {
  font-size: 12px; color: var(--accent); letter-spacing: 2px; margin-bottom: 9px;
  padding-bottom: 5px; border-bottom: 1px solid var(--line);
}
.help-col p { font-size: 12.5px; color: var(--text-dim); line-height: 2.1; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
kbd {
  display: inline-block; min-width: 20px; text-align: center;
  font-family: var(--font); font-size: 11px; font-weight: 700; color: var(--text);
  background: #eef4f6; border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; margin-right: 2px;
}
.tip-box {
  margin-top: 18px; padding: 12px 14px; border-radius: 11px;
  background: linear-gradient(120deg, #e9f7f5, #fdf4e6);
  border: 1px solid var(--line); display: flex; flex-direction: column; gap: 5px;
}
.tip-box b { font-size: 12px; color: var(--accent); letter-spacing: 1px; }
.tip-box span { font-size: 12px; color: var(--text-dim); line-height: 1.8; }

/* ==================== 世界地图 ==================== */
.map-overlay { background: radial-gradient(circle at 50% 40%, rgba(233,245,250,.9), rgba(170,202,220,.96)); }
.map-card {
  background: var(--bg-panel-solid); border-radius: 18px; padding: 14px 16px 10px;
  box-shadow: 0 24px 60px rgba(20,52,68,.3); max-width: 97vw; max-height: 97vh;
  display: flex; flex-direction: column; gap: 9px;
}
.map-card-head { display: flex; align-items: center; gap: 14px; }
.map-card-head h2 { font-size: 17px; letter-spacing: 2px; white-space: nowrap; }
#map-hint { flex: 1; font-size: 11.5px; color: var(--text-dim); }
/* 地图尽量铺满视口：
   要减掉的东西 = 卡片上下 padding(24) + 标题行(~30) + 两处 gap(18) + 图例(~20)，
   再留一点余量。宽度方向同理减掉左右 padding(32)。 */
#bigmap {
  width: min(calc(100vh - 126px), calc(97vw - 36px), 980px);
  height: min(calc(100vh - 126px), calc(97vw - 36px), 980px);
  aspect-ratio: 1 / 1; flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line-strong); background: #a9c9dc; cursor: crosshair; display: block;
}
/* 视口很矮的时候（比如笔记本 + 浏览器工具栏），图例收窄成一行更小的字，把高度让给地图 */
@media (max-height: 700px) {
  .map-card { padding: 10px 12px 8px; gap: 7px; }
  .map-card-head h2 { font-size: 15px; }
  #map-hint { font-size: 10.5px; }
  #bigmap { width: min(calc(100vh - 104px), calc(97vw - 28px), 980px); height: min(calc(100vh - 104px), calc(97vw - 28px), 980px); }
  .map-legend { font-size: 10.5px; gap: 12px; }
}
.map-legend { display: flex; gap: 16px; justify-content: center; font-size: 11.5px; color: var(--text-dim); flex-wrap: wrap; }
.map-legend span { display: flex; align-items: center; gap: 6px; }
.lg { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }

/* ⚠️ 图例的形状必须和 renderBigMap 里 canvas 实际画的形状一一对应，
   否则玩家会按图例去找一个根本不存在的图标（之前"当前位置"画的是三角、
   图例却是个圆点，就是这么来的）。 */
.lg.orb { background: #16a99b; border-radius: 50%; }                     /* 地图：圆形 */
.lg.chest { background: #d9862b; border-radius: 2px; }                   /* 地图：方形 */
.lg.way {                                                                /* 地图：蓝色实心菱形 */
  background: #3f8fd0;
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.lg.way-off {                                                            /* 地图：暗色空心菱形 */
  background: #8ea6b6;
  border: 2px solid rgba(24, 30, 38, .62);
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.lg.you {                                                                /* 地图：红色三角（朝向角色面向） */
  background: #e2493c;
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

/* ==================== 加载页 ==================== */
.loading { background: radial-gradient(circle at 50% 45%, #f0f8fb, #b8d6e6); }
.load-box { text-align: center; width: 380px; max-width: 88vw; }
.load-track {
  height: 8px; border-radius: 6px; background: rgba(28,60,76,.14);
  overflow: hidden; margin: 24px 0 10px; border: 1px solid rgba(255,255,255,.7);
}
.load-track i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #1fa89b, #63e0c8); transition: width .25s;
}
.load-text { font-size: 12.5px; color: var(--text-dim); letter-spacing: 1px; }

/* ==================== 移动端 ==================== */
.touch-controls { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.stick-base {
  position: absolute; left: 26px; bottom: 34px; width: 118px; height: 118px;
  border-radius: 50%; background: rgba(255,255,255,.28);
  border: 2px solid rgba(255,255,255,.6); pointer-events: auto;
}
.stick-knob {
  position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px 0 0 -25px;
  border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 3px 10px rgba(0,0,0,.25);
}
.touch-btns { position: absolute; right: 22px; bottom: 30px; display: grid; grid-template-columns: repeat(2, auto); gap: 10px; pointer-events: auto; }
.tbtn {
  width: 72px; height: 72px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.45); color: #16323f; font-size: 13px; font-weight: 800;
  font-family: var(--font); backdrop-filter: blur(6px); cursor: pointer;
}
.tbtn.big { width: 84px; height: 84px; font-size: 14px; }
.tbtn:active { background: rgba(255,255,255,.8); }

/* 小屏适配 */
@media (max-width: 720px) {
  .map-panel { width: 158px; padding: 8px; }
  .minimap-wrap, #minimap { width: 142px; height: 142px; }
  .status-panel { min-width: 210px; padding: 9px; }
  .quest-panel { width: 176px; padding: 2px 4px; }
  .quest-list li span { display: none; }
  .toasts { top: auto; bottom: 150px; }
  .help-grid { grid-template-columns: 1fr; }
}
