:root {
  --bg: #070c14;
  --panel: #0a1320;
  --card: #0f1c2e;
  --card2: #0c1726;
  --line: #1b2c44;
  --text: #e3ecf7;
  --dim: #7b8ea6;
  --gold: #ffc857;
  --up: #ff5b6e;
  --down: #2fd18b;
  --blue: #3b82f6;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: #05090f;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

body { display: flex; justify-content: center; align-items: stretch; }

.app {
  width: 100%;
  max-width: 560px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
@media (min-width: 620px) {
  body { background: radial-gradient(circle at 50% 0%, #0d1929, #05090f 70%); }
  .app {
    height: min(100dvh, 940px);
    margin: auto;
    border: 1px solid #16263c;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0,0,0,.6);
  }
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; gap: 7px; align-items: center;
  padding: 10px 10px 8px;
  background: linear-gradient(#0a1320, #080e18);
  border-bottom: 1px solid #101d2f;
  flex: 0 0 auto;
}
.stat {
  display: flex; align-items: center; gap: 5px;
  background: #0c1726;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 5px 9px;
  font-size: 12.5px;
  min-width: 0;
}
.stat:first-child { flex: 1.25; }
.stat:nth-child(2), .stat:nth-child(3) { flex: 1; }
.stat .ico { font-size: 13px; line-height: 1; opacity: .95; }
.stat b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.stat:nth-child(2) b { color: #cfe2f5; }
.stat:nth-child(3) b { color: #9fc8ff; }
.icon-btn {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 8px;
  background: #142843;
  border: 1px solid #26456e;
  color: #a9ceff;
  font-size: 14px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: .15s;
}
.icon-btn:active { transform: scale(.94); background: #1b3556; }

/* ---------- 场景 ---------- */
.stage {
  position: relative;
  margin: 8px 10px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #1a2a42;
  background: #08111c;
  aspect-ratio: 2 / 1;
  flex: 0 0 auto;
  touch-action: none;
  cursor: pointer;
}
.stage canvas {
  width: 100%; height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.badge {
  position: absolute; top: 9px; left: 9px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-family: ui-monospace, monospace;
  color: #dbeaf8;
  background: rgba(6,12,22,.62);
  border: 1px solid rgba(130,180,225,.22);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  letter-spacing: .3px;
  pointer-events: none;
}

/* 收线：线温条 */
.reel {
  position: absolute;
  top: 34px; left: 50%; transform: translateX(-50%) translateY(-6px);
  width: 68%;
  opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
  text-align: center;
}
.reel.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.reel .heat {
  position: relative;
  height: 20px;
  border: 1px solid rgba(120,170,225,.32);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
  transition: border-color .15s, box-shadow .15s;
  /* 整条固定色阶：绿 → 黄 → 红，未填充部分保持低透明度作为刻度 */
  background: linear-gradient(90deg,
    rgba(47,209,139,.28) 0%, rgba(159,216,74,.28) 38%,
    rgba(255,200,87,.26) 62%, rgba(255,138,76,.26) 82%,
    rgba(255,77,94,.26) 100%);
}
.reel .heat-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  background: linear-gradient(90deg,
    #2fd18b 0%, #9fd84a 38%, #ffc857 62%, #ff8a4c 82%, #ff4d5e 100%);
  clip-path: inset(0 100% 0 0);
  transition: clip-path .07s linear;
}
.reel .heat-limit {
  position: absolute; top: 0; bottom: 0; left: 32%;
  width: 0; border-left: 1.5px dashed rgba(255,255,255,.55);
  filter: drop-shadow(0 0 2px rgba(0,0,0,.6));
}
.reel .heat-tip {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 9px;
  font-size: 11px;
  color: #cfe0f2;
  background: rgba(6,12,22,.6);
  border-radius: 999px;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  letter-spacing: .3px;
}
.reel.over .heat {
  border-color: rgba(255,90,100,.85);
  box-shadow: 0 0 14px rgba(255,80,90,.55);
  animation: heatPulse .6s ease-in-out infinite;
}
.reel.over .heat-tip { color: #ff8b96; font-weight: 600; }
@keyframes heatPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255,80,90,.35); }
  50% { box-shadow: 0 0 20px rgba(255,80,90,.8); }
}

/* 上鱼提示 */
.catch {
  position: absolute; left: 50%; bottom: 12px;
  transform: translateX(-50%) translateY(14px);
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 10px;
  background: rgba(9,18,30,.92);
  border: 1px solid rgba(255,200,87,.45);
  border-radius: 12px;
  opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s;
  box-shadow: 0 8px 26px rgba(0,0,0,.5);
  white-space: nowrap;
}
.catch.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.catch .cimg img { width: 52px; display: block; image-rendering: pixelated; }
.catch .cnm { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.catch .cnm span {
  font-size: 10px; font-weight: 500; color: var(--dim);
  border: 1px solid rgba(255,255,255,.14); border-radius: 4px; padding: 1px 4px;
}
.catch .csub { font-size: 11px; color: var(--dim); margin-top: 2px; }

/* ---------- 状态栏 ---------- */
.status {
  padding: 8px 12px 6px;
  flex: 0 0 auto;
}
.progress {
  height: 7px;
  background: #0d1a29;
  border: 1px solid #16273c;
  border-radius: 999px;
  overflow: hidden;
}
.progress i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #2f6fd0, #5bb6ff);
  border-radius: 999px;
  transition: width .08s linear, background .2s;
}
.progress i.danger { background: linear-gradient(90deg, #c93a4d, #ff6b7d); }
.hint {
  margin-top: 7px;
  font-size: 12px;
  color: var(--dim);
  text-align: center;
  line-height: 1.5;
  min-height: 17px;
  transition: color .2s;
}
.hint.hot { color: var(--gold); font-weight: 700; }
.hint.warn { color: #a9ceff; }

/* ---------- 标签栏 ---------- */
.tabs {
  display: flex;
  flex: 0 0 auto;
  border-top: 1px solid #101d2f;
  border-bottom: 1px solid #101d2f;
  background: #080f19;
}
.tabs button {
  flex: 1;
  position: relative;
  padding: 11px 0 10px;
  background: none; border: 0;
  color: var(--dim);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s;
}
.tabs button.active { color: #eaf3ff; font-weight: 600; }
.tabs button.active::after {
  content: '';
  position: absolute; left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: 56%; height: 2.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, #4b9bff, #7fc4ff);
  box-shadow: 0 0 10px rgba(90,170,255,.6);
}

/* ---------- 面板 ---------- */
.panel {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px 24px;
  scrollbar-width: thin;
  scrollbar-color: #24384f transparent;
  -webkit-overflow-scrolling: touch;
}
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: #22344a; border-radius: 4px; }

/* 鱼饵条 */
.baitbar { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
.baitbar::-webkit-scrollbar { height: 0; }
.chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 11px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  color: #cfdcec;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.chip:active { transform: scale(.97); }
.chip.active { border-color: rgba(255,200,87,.7); color: var(--gold); background: rgba(255,200,87,.09); }
.chip.disabled { opacity: .4; }
.chip .ico { font-size: 13px; }
.chip i { font-style: normal; font-size: 10.5px; color: var(--dim); }
.chip .active i { color: var(--gold); }

.wide {
  width: 100%;
  margin-top: 9px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: .15s;
}
.wide.primary {
  background: linear-gradient(180deg, #3b82f6, #2a63c4);
  border-color: #4f95ff;
  color: #fff;
  box-shadow: 0 4px 16px rgba(50,120,230,.28);
}
.wide.ghost { background: var(--card); border-color: var(--line); color: var(--dim); }
.wide:active { transform: translateY(1px); }
.wide:disabled { opacity: .55; }

/* 鱼篓列表 */
.list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.row {
  display: grid;
  grid-template-columns: 42px 1fr auto 40px;
  gap: 9px;
  align-items: center;
  padding: 7px 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.row .thumb img { width: 40px; display: block; image-rendering: pixelated; }
.row .nm { font-size: 13.5px; font-weight: 700; }
.row .sub { font-size: 11px; color: var(--dim); margin-top: 1px; }
.row .pr { text-align: right; }
.row .idx { font-size: 10.5px; font-family: ui-monospace, monospace; }
.row .val {
  font-size: 13px; font-weight: 700; color: var(--gold);
  font-family: ui-monospace, monospace;
  margin-top: 1px;
}
.row .val i { font-style: normal; font-size: 9px; margin-left: 2px; }
.sell {
  width: 38px; height: 30px;
  border-radius: 8px;
  background: rgba(59,130,246,.14);
  border: 1px solid rgba(59,130,246,.42);
  color: #9fc8ff;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.sell:active { background: rgba(59,130,246,.3); }

.empty { text-align: center; padding: 34px 0 10px; }
.empty .big { font-size: 42px; opacity: .35; }
.empty p { margin: 8px 0 2px; color: #97a9bd; font-size: 13.5px; }
.empty small { color: #566a82; font-size: 11.5px; }

/* 鱼塘 */
.pondhead {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ptxt { font-size: 12px; color: var(--dim); }
.ptxt b { color: var(--gold); font-family: ui-monospace, monospace; font-size: 15px; }
.btn {
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 14px;
  cursor: pointer;
  transition: .15s;
}
.btn:active { transform: scale(.97); }
.btn.small { padding: 7px 12px; font-size: 12.5px; }
.btn.primary { background: linear-gradient(180deg, #3b82f6, #2a63c4); border-color: #4f95ff; color: #fff; }
.btn.dark { background: #16233a; }
.btn.ghost { background: transparent; color: var(--dim); }
.btn:disabled { opacity: .5; }
.btn i { font-style: normal; font-size: 11px; opacity: .9; }

.pondgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.slot {
  position: relative;
  aspect-ratio: 1 / 1.06;
  border-radius: 10px;
  background: var(--card2);
  border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  padding: 6px;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: .15s;
}
.slot.filled { border-color: var(--rc, var(--line)); background: linear-gradient(180deg, rgba(255,255,255,.05), transparent), var(--card); }
.slot.filled::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 20%, color-mix(in srgb, var(--rc) 18%, transparent), transparent 70%);
  pointer-events: none;
}
.slot .sp img { width: 44px; display: block; image-rendering: pixelated; }
.slot .nm { font-size: 12px; font-weight: 700; }
.slot .lv { font-size: 10px; color: var(--dim); }
.slot .rt { font-size: 10.5px; color: var(--gold); font-family: ui-monospace, monospace; }
.slot.empty { border-style: dashed; border-color: #23364d; color: #40556e; font-size: 11.5px; }
.slot.empty:active { background: #101d2e; }

.tip { font-size: 11.5px; color: #5d718a; line-height: 1.65; margin: 12px 2px 0; }

/* 鱼市 */
.feat {
  background: linear-gradient(180deg, rgba(255,255,255,.035), transparent), var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px 12px;
}
.fhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.fname {
  font-size: 19px; font-weight: 800;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  line-height: 1.25;
}
.fname small { font-size: 10.5px; color: var(--dim); font-weight: 400; }
.fname .mult { font-size: 13px; color: #b7c7d9; font-family: ui-monospace, monospace; }
.tag {
  font-size: 10px; font-weight: 400;
  padding: 2px 6px; border-radius: 5px;
  border: 1px solid rgba(120,170,225,.3);
  color: #9fc8ff;
  transform: translateY(-1px);
}
.tag.hot { border-color: rgba(255,91,110,.5); color: var(--up); }
.tag.cold { border-color: rgba(47,209,139,.45); color: var(--down); }
.ftrend { font-size: 12.5px; font-weight: 700; white-space: nowrap; font-family: ui-monospace, monospace; }

.frow {
  display: grid;
  grid-template-columns: 66px 1fr 1fr;
  align-items: center;
  gap: 10px;
  margin: 8px 0 6px;
}
.bigthumb img { width: 62px; display: block; image-rendering: pixelated; }
.fp .k { font-size: 10.5px; color: var(--dim); }
.fp .v { font-size: 15.5px; font-weight: 700; font-family: ui-monospace, monospace; }
.fp .v i { font-style: normal; font-size: 10px; color: var(--dim); margin-left: 2px; }

.chartwrap {
  background: #091220;
  border: 1px solid #16263c;
  border-radius: 8px;
  padding: 3px 4px;
}
.chartwrap canvas { width: 100%; display: block; }
.xaxis {
  display: flex; justify-content: space-between;
  font-size: 10px; color: #4d6076; margin-top: 3px;
}
.acts { display: flex; gap: 8px; margin-top: 9px; }
.acts .btn { flex: 1; padding: 11px 8px; font-weight: 700; font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chips .chip i { font-family: ui-monospace, monospace; }

/* 商店 */
.sect {
  font-size: 11.5px;
  color: #6a7f97;
  margin: 14px 2px 7px;
  display: flex; align-items: center; gap: 7px;
}
.sect::before {
  content: ''; width: 3px; height: 11px; border-radius: 2px;
  background: linear-gradient(#5bb6ff, #2f6fd0);
}
.sect:first-child { margin-top: 2px; }
.card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}
.card .ca { flex: 1; min-width: 0; }
.card .ct { font-size: 13.5px; font-weight: 600; }
.card .cd { font-size: 11.5px; color: var(--dim); margin-top: 2px; line-height: 1.4; }
.card .btn { padding: 8px 12px; font-size: 12px; text-align: center; line-height: 1.35; }
.card .max { font-size: 12px; color: var(--gold); font-weight: 700; }

/* 图鉴 */
.dexhead {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11.5px; color: var(--dim); margin: 2px 2px 9px;
}
.dexhead b { font-size: 13.5px; color: var(--text); }
.dexgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dexcard {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 4px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-align: center;
  transition: .15s;
}
.dexcard:not(.unknown) {
  border-color: color-mix(in srgb, var(--rc) 45%, var(--line));
  box-shadow: inset 0 0 22px color-mix(in srgb, var(--rc) 10%, transparent);
}
.dexcard .sp img { width: 50px; display: block; image-rendering: pixelated; }
.dexcard .nm { font-size: 12px; font-weight: 700; }
.dexcard .sub { font-size: 9.5px; color: var(--dim); font-family: ui-monospace, monospace; }
.dexcard .rate { font-size: 10.5px; font-weight: 700; font-family: ui-monospace, monospace; }
.dexcard.unknown { opacity: .75; cursor: pointer; }

/* ---------- 弹窗 ---------- */
#modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(3,7,14,.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}
#modal[hidden] { display: none; }
#modal.show { opacity: 1; }
#modal .sheet {
  width: 100%; max-width: 520px;
  background: #0c1726;
  border: 1px solid #1e3048;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(24px);
  transition: transform .22s cubic-bezier(.2,.9,.3,1);
  max-height: 86vh;
  overflow-y: auto;
}
#modal.show .sheet { transform: translateY(0); }
#modal h3 { margin: 0 0 6px; font-size: 16px; }
.mdesc { font-size: 12px; color: var(--dim); line-height: 1.6; margin: 0 0 10px; }
.modalbtns { display: flex; gap: 8px; margin: 10px 0; }
.modalbtns .btn { flex: 1; padding: 12px 8px; line-height: 1.4; }
.codebox { display: flex; gap: 8px; margin: 12px 0 4px; }
.codebox input {
  flex: 1;
  background: #091220;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 15px;
  letter-spacing: 3px;
  text-transform: uppercase;
  outline: none;
}
.codebox input:focus { border-color: #35618f; }
.mnote { font-size: 11.5px; color: #62788f; line-height: 1.5; margin: 6px 0 4px; }
#modal .wide { margin-top: 4px; }

/* 选鱼列表 */
.picklist {
  list-style: none; padding: 0; margin: 6px 0 10px;
  max-height: 42vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}
.pick {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center; gap: 8px;
  padding: 6px 10px 6px 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.pick:active { background: #14243a; }
.pick .thumb img { width: 36px; display: block; image-rendering: pixelated; }
.pick .nm { font-size: 13px; font-weight: 700; }
.pick .sub { font-size: 10.5px; color: var(--dim); font-family: ui-monospace, monospace; }

/* ---------- Toast ---------- */
#toasts {
  position: fixed; left: 50%; bottom: 84px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  z-index: 60; pointer-events: none;
  width: max-content; max-width: 88vw;
}
.toast {
  background: rgba(14,26,42,.96);
  border: 1px solid #24384f;
  color: #d7e5f4;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
  animation: tin .22s ease-out;
  white-space: nowrap;
}
.toast.gold { border-color: rgba(255,200,87,.55); color: var(--gold); }
.toast.warn { border-color: rgba(255,91,110,.5); color: #ff98a6; }
.toast.info { border-color: rgba(91,182,255,.5); color: #9fc8ff; }
.toast.out { opacity: 0; transform: translateY(-6px); transition: .3s; }
@keyframes tin { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }

@media (max-height: 720px) {
  .stage { aspect-ratio: 2.15 / 1; }
  .status { padding: 6px 12px 4px; }
  .hint { font-size: 11.5px; }
}

@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn.spinning { animation: spin 1s linear infinite; color: #7fc4ff; border-color: #3f6fa8; }
