/* ============================================================
 * 我的世界模拟器 · 样式（手机优先，兼容电脑）
 * 深夜矿洞配色：石灰绿 + 钻石青 + 岩浆橙
 * ============================================================ */
:root {
  --bg: #111614;
  --panel: #1b2320;
  --panel2: #222c28;
  --line: #33403a;
  --grass: #6aa84f;
  --grass-dim: #4a7c37;
  --diamond: #45d9c8;
  --gold: #e0b13c;
  --danger: #d1493f;
  --nether: #c2603a;
  --end: #a86fe0;
  --text: #e8f0ea;
  --text-dim: #8fa39a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* ---------- 自定义滑动条（日志区 / 弹窗 / 各类滚动容器） ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, .28); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: #3b4a43; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4e6157; }
.log-box, .review-log, .mask-box, .about-body, .lb-body, .hl-list {
  scrollbar-width: thin;
  scrollbar-color: #3b4a43 rgba(0, 0, 0, .28);
}
.log-box::-webkit-scrollbar { width: 5px; }
.log-box::-webkit-scrollbar-thumb { background: #45564d; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100%; overflow-x: hidden; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; }

.view {
  min-height: 100vh;
  padding: 18px 14px calc(22px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.page-view { gap: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  border-radius: 4px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: transform .06s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-big { font-size: 16px; padding: 12px 14px; width: 100%; }
.btn-primary {
  background: linear-gradient(180deg, var(--grass), var(--grass-dim));
  border-color: #7fc05e;
  color: #0d1a0b;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-danger { border-color: #8a3b34; color: #ffb3ad; }
.btn-follow {
  border-color: #5a6f8a;
  background: #1d2733;
  color: #bcd4ef;
  font-size: 13px;
}
.ach-btn-tip {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 400;
}

/* ---------- 首页 ---------- */
.home-hero { text-align: center; padding: 26px 0 6px; }
.home-title {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--grass);
  text-shadow: 0 2px 0 #23301c, 0 0 18px rgba(106, 168, 79, .35);
  white-space: nowrap;
}
.home-sub { margin-top: 8px; font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.home-count {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 0 2px;
}
.home-count b { color: var(--diamond); }
.bg-title { white-space: nowrap; }

.home-lv { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }
.lv-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.lv-name { color: var(--text-dim); }
.lv-lv { color: var(--gold); font-weight: 700; }
.lv-bonus { margin-left: auto; font-size: 11px; color: var(--diamond); }
.lv-bar { height: 6px; background: #0d1210; border-radius: 3px; margin: 8px 0 4px; overflow: hidden; }
.lv-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--grass-dim), var(--grass)); }
.lv-exp-line { font-size: 11px; color: var(--text-dim); text-align: right; }

.home-btns { margin-top: 4px; }
.home-ach-row { display: flex; gap: 8px; }
.home-ach-row .btn { flex: 1; }
.home-link-btns { display: flex; gap: 8px; }
.home-link-btns .btn { flex: 1; }

.qr-area { width: 100%; text-align: center; margin-top: 10px; }
.qr-text { color: var(--text-dim); font-size: 12.5px; margin-bottom: 6px; }
.qr-img { width: 132px; height: 132px; border-radius: 4px; background: #fff; padding: 5px; }

/* ---------- 探险页 ---------- */
/* 顶栏：回合标题绝对居中，暂停按钮固定右上（居中不把按钮算进去） */
.game-top { position: relative; display: flex; align-items: center; min-height: 38px; }
.game-title {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 96px);
  font-size: 15px; font-weight: 700;
  white-space: nowrap; overflow: hidden;
  text-align: center;
}
.btn-pause {
  margin-left: auto;
  appearance: none; border: 2px solid var(--line); background: var(--panel2);
  color: var(--text); border-radius: 4px; width: 38px; height: 38px; font-size: 16px; cursor: pointer;
  flex: 0 0 auto;
}

.attr-grid { display: grid; gap: 6px; }
.attr-grid4 { grid-template-columns: repeat(4, 1fr); }
.attr-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 7px 4px;
  text-align: center;
  min-width: 0;
}
.attr-name { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.attr-val { font-size: 17px; font-weight: 700; color: var(--diamond); white-space: nowrap; }
.attr-val.danger { color: var(--danger); }

/* 末影龙血条 */
.end-box {
  background: linear-gradient(180deg, #241a2e, #1a1421);
  border: 1px solid #4a3566;
  border-radius: 4px;
  padding: 8px 10px;
}
.end-head { display: flex; align-items: baseline; font-size: 13px; }
.end-name { color: var(--end); font-weight: 700; }
.end-hp { margin-left: auto; color: #e8d5ff; font-variant-numeric: tabular-nums; }
.end-bar { height: 9px; background: #0d0913; border-radius: 4px; margin: 6px 0 4px; overflow: hidden; }
.end-bar-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #6b2fa0, #b46ae8); transition: width .2s; }
.end-crystal { font-size: 11px; color: #b79ad6; }

/* 装备栏 / 背包：各自占满一行，装备横排换行 */
.panel2 { display: flex; flex-direction: column; gap: 8px; }
.p2-col { flex: 0 0 auto; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px; }
.p2-title { font-size: 11px; color: var(--text-dim); margin-bottom: 6px; letter-spacing: 1px; }
.gear-list { display: flex; flex-wrap: wrap; gap: 5px; }
.item-list { display: flex; flex-direction: column; gap: 3px; }
.gear-chip {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 2px 7px;
  background: #26302b;
  white-space: nowrap;
  color: #cfe0d5;
}
/* 装备档位配色：由低到高 = 绿 → 蓝 → 紫 → 金 → 红 */
.gear-chip.t0 { color: #6b7a72; }
.gear-chip.t1 { color: #74c94f; border-color: #35592a; }
.gear-chip.t2 { color: #55a8f0; border-color: #2b4a6b; }
.gear-chip.t3 { color: #b482f0; border-color: #4a3566; }
.gear-chip.t4 { color: #f0c040; border-color: #6b5320; }
.gear-chip.t5 { color: #f0604f; border-color: #6b2f28; }

.item-row { display: flex; align-items: baseline; gap: 4px; font-size: 12px; }
.item-row .item-key { flex: 1 1 auto; white-space: nowrap; }
.item-row .item-n { flex: 0 0 auto; color: var(--gold); font-size: 11px; }
.item-row.big .item-key { color: var(--diamond); }
.item-row.big.done .item-n { color: var(--grass); font-weight: 700; }
.food-chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.food-chip {
  font-size: 11px;
  background: #26302b;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  color: #cfe0d5;
  white-space: nowrap;
}
.food-empty { font-size: 11px; color: #6b7a72; }

.manual-tip { font-size: 12px; color: var(--gold); text-align: center; }

.log-box {
  flex: 1 1 auto;
  min-height: 140px;
  overflow-y: auto;
  background: #0d1210;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.log-item { color: #9db0a6; word-break: break-word; }
.log-item.gear { color: var(--diamond); }
.log-item.food { color: #9ad07a; }
.log-item.drop { color: #b9a06a; }
.log-item.hurt { color: #e08b7f; }
.log-item.nether { color: var(--nether); font-weight: 700; }
.log-item.end { color: var(--end); }
.log-item.dragon { color: #d78bd8; }
.log-item.rare { color: var(--gold); font-weight: 700; }
.log-item.win { color: #7df0a0; font-weight: 700; }
.log-item.dead { color: var(--danger); font-weight: 700; }
.log-item.dim { color: #6b7a72; }
/* 里程碑：穿越 / 点亮地狱传送门 / 点亮末地传送门 / 进入末地传送门 */
.log-item.rainbow {
  font-weight: 700;
  color: #e0b13c;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .log-item.rainbow {
    background-image: linear-gradient(90deg, #ff5f6d, #ffc371, #7df0a0, #55a8f0, #b482f0, #ff5f6d);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: logRainbow 4s linear infinite;
  }
}
@keyframes logRainbow {
  from { background-position: 0 0; }
  to { background-position: 200% 0; }
}

/* ---------- 结算 ---------- */
.settle-box { display: flex; flex-direction: column; gap: 10px; padding-top: 24px; }
.settle-title { text-align: center; font-size: 26px; font-weight: 800; color: var(--grass); }
.settle-title.lose { color: var(--danger); }
.settle-sub { text-align: center; font-size: 13px; color: var(--text-dim); }
.settle-rows { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; }
.s-row { display: flex; align-items: baseline; padding: 7px 0; border-bottom: 1px solid #26302b; font-size: 13px; }
.s-row:last-child { border-bottom: 0; }
.s-row span { color: var(--text-dim); }
.s-row b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.settle-note { font-size: 12px; color: var(--text-dim); text-align: center; }
.settle-rank { text-align: center; font-size: 13px; color: var(--gold); }
/* 结算按钮：两列网格（再来一局 / 回顾 | 关注作者 / 返回首页） */
.settle-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 2px; }
.settle-btns .btn-big { padding: 11px 6px; font-size: 15px; border-radius: 4px; white-space: nowrap; }

/* ---------- 二级页 ---------- */
.page-head { position: relative; display: flex; align-items: center; height: 40px; }
.page-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  margin: 0; font-size: 17px; font-weight: 700; white-space: nowrap;
}
.btn-close {
  margin-left: auto;
  appearance: none; border: 1px solid var(--line); background: var(--panel2);
  color: var(--text); border-radius: 50%; width: 32px; height: 32px;
  font-size: 14px; cursor: pointer; z-index: 1;
}

.tabs { display: flex; gap: 6px; }
.tab {
  flex: 1;
  appearance: none; border: 1px solid var(--line); background: var(--panel);
  color: var(--text-dim); border-radius: 4px; padding: 7px 4px;
  font-size: 12px; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--grass-dim); border-color: var(--grass); color: #eafff0; font-weight: 700; }
.tabs-small .tab { padding: 5px 4px; font-size: 12px; }

.lb-note { font-size: 12px; color: var(--text-dim); text-align: center; }
.rank-fate-note { font-size: 12px; color: var(--diamond); text-align: center; }
.lb-body { display: flex; flex-direction: column; gap: 4px; }
.lb-tip { text-align: center; font-size: 12px; color: var(--text-dim); padding: 24px 0; }
.lb-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 7px 10px; font-size: 13px;
}
.lb-row.me { border-color: var(--grass); }
.lb-rank { flex: 0 0 26px; text-align: center; color: var(--text-dim); font-size: 12px; }
.lb-rank.top { font-weight: 800; color: #0d1210; background: var(--text-dim); border-radius: 3px; padding: 1px 0; }
.lb-rank.top.r1 { background: var(--gold); }
.lb-rank.top.r2 { background: #c3ccd1; }
.lb-rank.top.r3 { background: #c98a53; }
.lb-user { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
.lb-avatar { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto; background: #2a342f; }
.lb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-score { flex: 0 0 auto; color: var(--diamond); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-time { flex: 0 0 auto; font-size: 11px; color: var(--text-dim); white-space: nowrap; }

.ach-total { text-align: center; font-size: 13px; color: var(--gold); }
.ach-list { display: flex; flex-direction: column; gap: 6px; }
.ach-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 9px 12px;
}
.ach-row.done { border-color: var(--grass); background: #1a2620; }
.ach-ico { flex: 0 0 auto; font-size: 16px; }
.ach-main { flex: 1 1 auto; min-width: 0; }
.ach-name { font-size: 14px; font-weight: 700; }
.ach-desc { font-size: 11px; color: var(--text-dim); }
.ach-bonus { flex: 0 0 auto; font-size: 12px; color: var(--gold); }

.settings-body { display: flex; flex-direction: column; gap: 10px; }
.set-card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px; }
.set-row { display: flex; align-items: center; }
.set-label { font-size: 14px; }
.set-switch { margin-left: auto; position: relative; width: 46px; height: 26px; }
.set-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; z-index: 2; }
.set-switch .track {
  position: absolute; inset: 0; background: #2b3730; border: 1px solid var(--line);
  border-radius: 13px; transition: background .15s;
}
.set-switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  background: #8fa39a; border-radius: 50%; transition: transform .15s, background .15s;
}
.set-switch input:checked + .track { background: var(--grass-dim); }
.set-switch input:checked + .track::after { transform: translateX(20px); background: #d8f0c8; }
.set-tip { font-size: 11px; color: var(--text-dim); margin-top: 8px; }
.speed-label { display: flex; font-size: 14px; margin-bottom: 10px; }
.speed-label b { margin-left: auto; color: var(--diamond); }
.speed-range { width: 100%; accent-color: var(--grass); }

.set-label2 { font-size: 14px; margin-bottom: 10px; }
.set-select {
  width: 100%;
  appearance: none;
  background: #0d1210;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 10px;
  font-size: 14px;
  font-family: inherit;
}
.set-min-row { margin-top: 10px; }
.set-min-wrap { margin-left: auto; }
.set-select-inline { width: 82px; padding: 6px 8px; }

/* ---------- 高光 ---------- */
.hl-note { font-size: 12px; color: var(--text-dim); text-align: center; }
.hl-list { display: flex; flex-direction: column; gap: 6px; }
.hl-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 9px 12px; cursor: pointer;
}
.hl-row.win { border-color: var(--grass); background: #1a2620; }
.hl-row-head { display: flex; align-items: baseline; font-size: 14px; font-weight: 700; }
.hl-row-head .hl-tag { color: var(--danger); }
.hl-row.win .hl-row-head .hl-tag { color: var(--grass); }
.hl-row-head .hl-when { margin-left: auto; font-size: 11px; font-weight: 400; color: var(--text-dim); }
.hl-row-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
/* 预览框不滚动：整张卡缩放到一屏内，按钮永远在图片下方可见，
   不会再出现"点关闭之前先冒出一根滑动条" */
.hl-img-box {
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.hl-img {
  max-width: 100%; max-height: 72vh; width: auto; height: auto;
  object-fit: contain; border-radius: 6px;
  border: 1px solid var(--line); background: #0d1210;
}
.hl-btns { display: flex; gap: 8px; width: 100%; }
.hl-btns .btn { flex: 1; }
.hl-toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  z-index: 95; background: #1b2620; border: 1px solid var(--grass);
  color: #eafff0; border-radius: 4px; padding: 8px 16px; font-size: 13px;
}

.about-body { flex: 1 1 auto; }
.about-text { font-size: 13px; line-height: 1.9; color: #c3d2c9; }
.about-text b { color: var(--diamond); }

/* ---------- 遮罩弹窗 ---------- */
.mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(6, 10, 8, .78);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.mask-box {
  width: 100%; max-width: 400px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 6px;
  padding: 18px 16px; display: flex; flex-direction: column; gap: 10px;
  max-height: 82vh; overflow-y: auto;
}
.mask-title { font-size: 17px; font-weight: 700; text-align: center; color: var(--grass); }
.mask-info { font-size: 13px; color: #c3d2c9; line-height: 1.7; }
.mask-info b { color: var(--diamond); }
.review-log {
  font-size: 12px; color: #9db0a6; max-height: 52vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  background: #0d1210; border: 1px solid var(--line); border-radius: 4px; padding: 8px;
}
.follow-rows { display: flex; flex-direction: column; gap: 6px; }
.follow-action { display: flex; align-items: center; font-size: 13px; }
.fb-state { margin-left: auto; font-size: 11px; }
.fb-state.done { color: var(--grass); }
.fb-state.todo { color: var(--text-dim); }
.fb-total { text-align: center; color: var(--gold); }
.decision-opts { display: flex; flex-direction: column; gap: 8px; }
.decision-opt { width: 100%; }
.decision-opt.opt-fight { border-color: #7fc05e; color: #d8f0c8; background: #22321c; }
.decision-opt.opt-flee { border-color: #55605a; color: #b6c2bb; }
.revive-box .btn { width: 100%; }

/* 成就提示 */
.ach-toast {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%);
  z-index: 90; max-width: 420px;
  background: linear-gradient(180deg, #2a3a24, #1b2620);
  border: 2px solid var(--grass); border-radius: 5px;
  padding: 9px 16px; font-size: 13px; color: #eafff0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
}
