/* ============================================================
 * 疯狂水世界模拟器 · 深海主题
 * 色调：深海底蓝 + 荧光青 + 珊瑚橙
 * ============================================================ */
:root {
  --bg-deep: #04141f;
  --bg: #061a26;
  --bg-card: #0a2433;
  --bg-card2: #0d2c3d;
  --line: rgba(120, 200, 230, 0.16);
  --line-2: rgba(120, 200, 230, 0.3);
  --tx: #d8eef5;
  --tx-dim: #8fb3c4;
  --tx-mute: #5f8296;
  --cy: #4fd8e8;
  --cy-dim: #2a9fb8;
  --teal: #22d3c5;
  --gold: #ffd24d;
  --coral: #ff8a4c;
  --red: #ff6b6b;
  --green: #5ce08a;
  --purple: #b07cf0;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100%;
  overscroll-behavior: none;
}
body {
  background:
    radial-gradient(ellipse 120% 60% at 50% -10%, rgba(79, 216, 232, 0.12), transparent 60%),
    linear-gradient(180deg, #061a26 0%, #04141f 100%);
  background-attachment: scroll;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; }
.view { padding: 16px 14px 28px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--bg-card2), var(--bg-card));
  color: var(--tx);
  font-size: 15px; font-family: inherit;
  cursor: pointer;
  transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #1d8fa8, #12667d);
  border-color: rgba(79, 216, 232, .55);
  color: #eafcff; font-weight: 600;
  box-shadow: 0 4px 18px rgba(79, 216, 232, .18);
}
.btn-big { width: 100%; padding: 14px 16px; font-size: 16px; }
.btn-danger { border-color: rgba(255, 107, 107, .4); color: #ffb3b3; }

/* ---------- 首页 ---------- */
.home-hero { text-align: center; padding: 26px 0 18px; }
.home-title {
  margin: 0; font-size: 30px; font-weight: 800; letter-spacing: 1px;
  white-space: nowrap;
  background: linear-gradient(180deg, #eafcff 10%, var(--cy) 55%, var(--teal) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 12px rgba(79, 216, 232, .28));
}
.home-sub { margin-top: 10px; font-size: 12.5px; color: var(--tx-mute); letter-spacing: .5px; }

.home-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin: 16px 0 14px;
}
.hs-item {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 3px; text-align: center;
}
.hs-item b { display: block; font-size: 15px; color: var(--cy); font-variant-numeric: tabular-nums; }
.hs-item span { display: block; font-size: 10px; color: var(--tx-mute); margin-top: 2px; }

.home-lv { background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.lv-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lv-name { color: var(--tx-dim); }
.lv-lv { color: var(--cy); margin-left: auto; }
.lv-bonus { color: var(--gold); font-size: 11.5px; }
.lv-bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,.07); margin: 8px 0 5px; overflow: hidden; }
.lv-bar-fill { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--cy-dim), var(--cy)); transition: width .3s; }
.lv-exp-line { font-size: 11px; color: var(--tx-mute); text-align: right; font-variant-numeric: tabular-nums; }

.home-btns { margin-bottom: 10px; }
.home-ach-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.home-link-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.home-ach-row .btn, .home-link-btns .btn { flex-direction: column; gap: 2px; font-size: 14px; padding: 11px 6px; }
.ach-btn-tip { font-size: 10px; color: var(--gold); }
.btn-follow { margin-top: 12px; border-color: rgba(255, 210, 77, .4); color: var(--gold); }

.qr-area { margin-top: 14px; text-align: center; }
.qr-text { font-size: 12px; color: var(--tx-mute); margin-bottom: 8px; }
.qr-img { width: 150px; height: 150px; background: #fff; border-radius: 10px; padding: 6px; }

/* ---------- 道具品质色（打捞日志） ---------- */
.q-F, .q-E, .q-D, .q-C, .q-B { color: #93a6b2; }
.q-A  { color: #5ce08a; }
.q-S  { color: #4fa8f0; }
.q-SS { color: #b07cf0; }
.q-SSS{ color: #ffd24d; }
.q-EX { color: #ff5a5a; font-weight: 700; text-shadow: 0 0 8px rgba(255,90,90,.5); }
.q-EX\+ { color: #ffe14d; font-weight: 700; text-shadow: 0 0 9px rgba(255,225,77,.65); }

/* ---------- 游戏页 ---------- */
.game-top { position: relative; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; min-height: 38px; }
.game-title { font-size: 16px; font-weight: 700; color: var(--cy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; max-width: calc(100% - 88px); }
.btn-pause {
  position: absolute; right: 0; top: 0;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--bg-card); color: var(--tx);
  font-size: 16px; cursor: pointer;
}

.attr-panel { background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.attr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 7px; }
.attr-grid:last-child { margin-bottom: 0; }
.attr-card { background: rgba(255,255,255,.03); border-radius: 9px; padding: 7px 8px; min-width: 0; }
.attr-name { font-size: 10.5px; color: var(--tx-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attr-name .attr-rank { color: var(--cy); }
.attr-val { font-size: 14px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.card-seq .attr-val { color: var(--gold); }

.wave-line {
  margin-top: 8px; padding: 8px 10px; border-radius: 9px;
  background: linear-gradient(90deg, rgba(255,107,107,.14), rgba(255,107,107,.04));
  border: 1px solid rgba(255,107,107,.24);
  font-size: 12px; color: #ffc0c0;
}

/* 游戏页撑满一屏：日志框吃掉剩余高度，避免底部空出一大截 */
#view-game { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.log-box {
  flex: 1 1 auto; min-height: 190px; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 7px;
}
.log-item {
  font-size: 12.5px; line-height: 1.6; color: var(--tx-dim);
  padding: 7px 9px; border-radius: 8px; background: rgba(255,255,255,.03);
  border-left: 3px solid rgba(255,255,255,.12);
  animation: logIn .22s ease;
}
@keyframes logIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.log-item.prod { border-left-color: var(--cy-dim); color: #bfe6f0; }
.log-item.boom { border-left-color: var(--gold); color: var(--gold); background: rgba(255,210,77,.09); }
.log-item.dig { border-left-color: #7fb4c9; color: #cfe6ef; }
.log-item.rare { border-left-color: var(--gold); color: var(--gold); background: rgba(255,210,77,.12); font-weight: 600; }
.log-item.seek { border-left-color: var(--green); color: #c4f0d4; }
.log-item.build { border-left-color: var(--purple); color: #e0d0f8; }
.log-item.wave { border-left-color: var(--coral); color: #ffd0b0; background: rgba(255,138,76,.08); }
.log-item.dead { border-left-color: var(--red); color: #ffb3b3; background: rgba(255,107,107,.13); font-weight: 600; }
.log-item.year { border-left-color: var(--red); color: #ff8f8f; background: rgba(255,107,107,.08); }
.log-item.explus { border-left-color: #ffe14d; color: #ffe14d; background: rgba(255,225,77,.14); font-weight: 700; box-shadow: 0 0 12px rgba(255,225,77,.22) inset; }

.act-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 12px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--bg-card2), var(--bg-card));
  color: var(--tx); font-family: inherit; text-align: left;
  transition: transform .08s, filter .15s;
}
.act-btn b { font-size: 14.5px; font-weight: 600; }
.act-btn span { font-size: 10.5px; color: var(--tx-mute); }
.act-btn:active { transform: scale(.97); }
.act-btn:disabled { opacity: .35; cursor: not-allowed; }
#act-prod { border-color: rgba(79,216,232,.4); }
#act-dig { border-color: rgba(255,210,77,.35); }
#act-seek { border-color: rgba(92,224,138,.3); }
.act-build { border-color: rgba(176,124,240,.4); background: linear-gradient(180deg, #2a1d40, #1a1230); }

/* ---------- 结算 ---------- */
.settle-box { padding: 6px 0; }
.settle-title { font-size: 24px; font-weight: 800; text-align: center; color: var(--cy); margin-bottom: 6px; text-shadow: 0 2px 14px rgba(79,216,232,.3); }
.settle-path { text-align: center; font-size: 12.5px; color: var(--tx-mute); margin-bottom: 14px; }

.chart-wrap { background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 4px 4px; margin-bottom: 12px; }
.settle-chart { width: 100%; }
.chart-empty { text-align: center; font-size: 12px; color: var(--tx-mute); padding: 40px 0; }
.chart-legend { display: flex; gap: 14px; justify-content: center; font-size: 11px; color: var(--tx-mute); padding: 2px 0 4px; }
.lg-my { color: var(--cy); }
.lg-en { color: var(--red); }

.settle-rows { background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 14px; margin-bottom: 12px; }
.s-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.s-row:last-child { border-bottom: none; }
.s-row span { color: var(--tx-dim); }
.s-row b { color: var(--tx); font-variant-numeric: tabular-nums; }

.settle-legend { font-size: 12.5px; line-height: 1.7; color: var(--tx-dim); background: rgba(255,107,107,.07); border: 1px solid rgba(255,107,107,.2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.settle-rank { text-align: center; font-size: 13px; color: var(--gold); margin-bottom: 10px; }
.settle-btns { display: flex; flex-direction: column; gap: 8px; }

/* ---------- 页面通用 ---------- */
.page-head { display: flex; align-items: center; justify-content: center; position: relative; margin-bottom: 14px; padding-top: 4px; }
.page-title { margin: 0; font-size: 18px; font-weight: 700; text-align: center; }
.btn-close {
  position: absolute; right: 0; top: 0;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--bg-card); color: var(--tx);
  font-size: 15px; cursor: pointer;
}

/* ---------- 排行榜 ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab {
  flex: 1 1 0; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 8px 6px; border-radius: 9px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-card); color: var(--tx-dim); font-family: inherit;
}
.tab.active { border-color: var(--cy-dim); color: var(--cy); background: rgba(79,216,232,.12); }
.tabs-small .tab { padding: 5px 10px; font-size: 12px; }
/* 排行榜的排名加成小字（样式对齐成就页的 ach-total） */
.rank-bonus { text-align: center; font-size: 13px; color: var(--gold); margin-bottom: 10px; }
.lb-note { font-size: 12px; color: var(--tx-mute); margin-bottom: 8px; }
.lb-body { padding: 2px 0 20px; }
.lb-tip { text-align: center; color: var(--tx-mute); padding: 30px 0; font-size: 14px; }
.lb-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; margin-bottom: 6px;
}
.lb-row.me { box-shadow: 0 0 0 2px var(--gold) inset; background: rgba(255,210,77,.12); }
.lb-rank {
  flex: none; width: 26px; height: 26px;
  border-radius: 50%; background: rgba(255,255,255,.07);
  color: var(--tx-mute); font-size: 13px; font-weight: 700;
  text-align: center; line-height: 26px;
  font-variant-numeric: tabular-nums;
}
.lb-rank.top { background: #f08a1e; color: #fff; }
.lb-rank.top.r1 { background: #ff3b30; }
.lb-rank.top.r2 { background: #ff9500; }
.lb-rank.top.r3 { background: #ffcc00; }
.lb-user { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.lb-avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover; background: rgba(255,255,255,.08); }
.lb-name { font-size: 14px; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-size: 15px; font-weight: 700; color: var(--gold); flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-time { font-size: 11px; color: var(--tx-mute); flex: none; }

/* ---------- 成就 ---------- */
.ach-total { text-align: center; font-size: 13px; color: var(--gold); margin-bottom: 12px; }
.ach-list { display: flex; flex-direction: column; gap: 7px; }
.ach-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 13px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--line); font-size: 13.5px; }
.ach-item.done { border-color: rgba(255,210,77,.35); background: rgba(255,210,77,.07); }
.ach-item.done .ach-name { color: var(--gold); }
.ach-item.todo { opacity: .6; }
.ach-name { color: var(--tx-dim); }
.ach-bonus { font-size: 12px; color: var(--tx-mute); white-space: nowrap; }

.ach-toast {
  position: fixed; left: 50%; top: 76px; transform: translateX(-50%) translateY(-14px);
  background: linear-gradient(180deg, #2a1d40, #1a1230);
  border: 1px solid rgba(255,210,77,.5); color: var(--gold);
  padding: 11px 20px; border-radius: 12px; font-size: 14px; font-weight: 600;
  z-index: 900; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.ach-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 设置 / 说明 ---------- */
.settings-body, .about-body { display: flex; flex-direction: column; gap: 10px; }
.set-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.set-row { display: flex; align-items: center; justify-content: space-between; }
.set-label { font-size: 14px; }
.set-tip { font-size: 12px; color: var(--tx-mute); line-height: 1.7; }
.set-tip b { color: var(--cy); }
.speed-label { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-bottom: 9px; }
.speed-label b { color: var(--cy); font-variant-numeric: tabular-nums; }
.speed-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px; outline: none;
  /* 已走过的一段是蓝色渐变，右侧未到的是灰色；--pct 由 JS 实时更新 */
  background: linear-gradient(90deg,
    var(--cy-dim) 0%,
    var(--cy) var(--pct, 22%),
    rgba(255,255,255,.14) var(--pct, 22%),
    rgba(255,255,255,.14) 100%);
}
.speed-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #eafcff; border: 2px solid var(--cy); cursor: pointer;
  box-shadow: 0 2px 8px rgba(79,216,232,.5);
}
.speed-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #eafcff; border: 2px solid var(--cy); cursor: pointer;
}
.set-switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.set-switch input { opacity: 0; width: 0; height: 0; }
.set-switch .track { position: absolute; inset: 0; background: rgba(255,255,255,.12); border-radius: 13px; transition: .2s; }
.set-switch .track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.set-switch input:checked + .track { background: var(--cy-dim); }
.set-switch input:checked + .track::after { transform: translateX(20px); }
.about-text { font-size: 13.5px; line-height: 2; color: var(--tx-dim); }
.about-text b { color: var(--cy); }

/* ---------- 高光 ---------- */
.hl-note { font-size: 12px; color: var(--tx-mute); margin-bottom: 10px; }
.hl-list { display: flex; flex-direction: column; gap: 9px; }
.hl-row { background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.hl-title { font-size: 13px; color: var(--cy); margin-bottom: 5px; }
.hl-sub { font-size: 12px; color: var(--tx-dim); line-height: 1.7; }
.hl-sub b { color: var(--gold); }
.hl-export { margin-top: 9px; width: 100%; padding: 9px; font-size: 13px; }
.hl-empty { text-align: center; padding: 40px 14px; color: var(--tx-mute); font-size: 13px; }
.hl-img-box { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.hl-img { max-width: 88vw; border-radius: 12px; }
.hl-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- 遮罩 / 弹窗（禁用原生 alert/confirm） ---------- */
.mask {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(2, 10, 16, .78);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .18s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.mask-box {
  width: 100%; max-width: 340px;
  background: linear-gradient(180deg, var(--bg-card2), var(--bg-card));
  border: 1px solid var(--line-2); border-radius: 16px;
  padding: 20px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.mask-title { font-size: 17px; font-weight: 700; text-align: center; color: var(--cy); margin-bottom: 12px; }
.mask-info { font-size: 13px; color: var(--tx-dim); line-height: 1.8; margin-bottom: 12px; text-align: center; }
.mask-box .btn { width: 100%; margin-bottom: 8px; }
.mask-box .btn:last-child { margin-bottom: 0; }

.follow-rows { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.follow-action { justify-content: space-between; font-size: 13.5px; }
.fb-state { font-size: 11.5px; color: var(--tx-mute); }
.fb-state.done { color: var(--green); }
.fb-total { color: var(--gold); }

.confirm-btns { display: flex; gap: 8px; }
.confirm-btns .btn { margin-bottom: 0; }

.review-box { max-width: 400px; max-height: 78vh; display: flex; flex-direction: column; }
.review-log { flex: 1; overflow-y: auto; font-size: 12.5px; line-height: 1.75; padding-right: 4px; margin-bottom: 12px; }
.review-log > div { padding: 6px 9px; border-radius: 7px; margin-bottom: 5px; background: rgba(255,255,255,.03); border-left: 3px solid rgba(255,255,255,.12); }
.rv-prod { border-left-color: var(--cy-dim) !important; }
.rv-boom, .rv-rare { border-left-color: var(--gold) !important; color: var(--gold); }
.rv-seek { border-left-color: var(--green) !important; }
.rv-build { border-left-color: var(--purple) !important; }
.rv-wave { border-left-color: var(--coral) !important; }
.rv-dead { border-left-color: var(--red) !important; color: #ffb3b3; }
.rv-year { color: var(--tx-mute); font-style: italic; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(79,216,232,.28); border-radius: 3px; }

/* ---------- 电脑端 ---------- */
@media (min-width: 520px) {
  #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100vh; }
}
