:root {
  --ink: #0b2230;
  --paper: #fffdf6;
  --sun: #ffcc33;
  --coral: #ff6b4a;
  --sea: #1aa3b5;
  --good: #3fd17a;
  --warn: #ffb02e;
  --bad: #ff4a4a;
  --glass: rgba(9, 32, 46, 0.62);
  --font: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b3a4d; color: var(--paper);
  font-family: var(--font); user-select: none; -webkit-user-select: none; touch-action: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button { pointer-events: auto; }

/* 上方資訊 */
#top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start;
  padding: max(12px, env(safe-area-inset-top)) 16px 0; gap: 12px; }
#spot, #catchCount { background: var(--glass); border-radius: 14px; padding: 8px 14px; backdrop-filter: blur(6px); }
#spot b { font-size: clamp(16px, 2.4vw, 22px); margin-right: 10px; }
#spot span { font-size: clamp(13px, 1.8vw, 16px); opacity: 0.8; }
#catchCount { font-size: clamp(14px, 2vw, 18px); }
#catchCount b { font-size: 1.3em; color: var(--sun); }

/* 中央大字 */
#msgWrap { position: absolute; left: 0; right: 0; top: 24%; text-align: center; }
#msg { font-size: clamp(40px, 9vw, 92px); font-weight: 900; letter-spacing: 0.04em; color: var(--paper);
  text-shadow: 0 4px 0 rgba(0,0,0,0.25), 0 0 24px rgba(0,0,0,0.35); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
#msg.pop { animation: pop 0.45s cubic-bezier(.2,1.6,.4,1); }
#msg.good { color: var(--sun); }
#msg.bad { color: var(--bad); }
#sub { margin-top: 6px; font-size: clamp(18px, 3.4vw, 30px); font-weight: 700; text-shadow: 0 2px 6px rgba(0,0,0,0.6); }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* 力道條 */
#power { position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%);
  width: min(560px, 78vw); text-align: center; }
.plabel { font-size: 18px; font-weight: 800; margin-bottom: 6px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
#powerBar { position: relative; height: 30px; border-radius: 15px; background: var(--glass); border: 3px solid var(--paper); overflow: hidden; }
#powerFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, #6fe3ff, var(--sun) 70%, var(--coral)); }
#powerSweet { position: absolute; top: -3px; bottom: -3px; left: 88%; width: 8%; border-left: 2px dashed #fff; border-right: 2px dashed #fff; }
#powerDist { margin-top: 6px; font-size: 26px; font-weight: 900; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }

/* 咬餌圈 */
#bite { position: absolute; left: 50%; top: 46%; width: min(240px, 46vw); aspect-ratio: 1; transform: translate(-50%, -50%); }
#bite svg { width: 100%; height: 100%; }
#biteRing { fill: rgba(255, 204, 51, 0.18); stroke: var(--sun); stroke-width: 10; transform-origin: 100px 100px; }
#biteText { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(34px, 7vw, 60px); font-weight: 900;
  color: var(--sun); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; animation: pulse 0.25s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.1); } }

/* 搏魚 */
#fight { position: absolute; inset: 0; }
#tensionBox { position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 54px); left: 50%; transform: translateX(-50%); width: min(640px, 88vw); }
.flabel { display: flex; justify-content: space-between; font-size: clamp(16px, 2.4vw, 20px); font-weight: 800; margin-bottom: 4px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6); }
#tensionWord { color: var(--good); }
#tension { position: relative; height: 34px; border-radius: 17px; border: 3px solid var(--paper); overflow: hidden; background: rgba(0,0,0,0.35); }
.zone { position: absolute; top: 0; bottom: 0; opacity: 0.6; }
.zone.slack { left: 0; width: 15%; background: #8fb8c8; }
.zone.good { left: 15%; width: 63%; background: var(--good); }
.zone.danger { left: 78%; right: 0; background: var(--bad); }
#tensionFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: rgba(255,255,255,0.3); }
#tensionMark { position: absolute; top: -3px; bottom: -3px; width: 10px; margin-left: -5px; border-radius: 3px; border: 2px solid var(--ink); left: 0; background: #fff; box-shadow: 0 0 8px #fff; }
#tension.danger { animation: shake 0.08s infinite; border-color: var(--bad); }
@keyframes shake { 0% { transform: translateX(-2px); } 100% { transform: translateX(2px); } }
#fishBox { position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 128px); left: 50%; transform: translateX(-50%); width: min(420px, 70vw); }
#stamina { height: 16px; border-radius: 8px; border: 2px solid var(--paper); overflow: hidden; background: rgba(0,0,0,0.35); }
#staminaFill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--coral), var(--sun)); }
#dist { color: #bff4ff; }

#rush { position: absolute; top: 40%; left: 0; right: 0; height: 0; }
#rushL { position: absolute; left: 3vw; top: 0; transform: translateY(-50%); }
#rushR { position: absolute; right: 3vw; top: 0; transform: translateY(-50%); }
#rushCall { position: fixed; left: 0; right: 0; bottom: calc(196px + var(--safe-b)); }
#rushL, #rushR { font-size: clamp(44px, 9vw, 96px); font-weight: 900; color: var(--bad); opacity: 0; transition: opacity 0.12s;
  text-shadow: 0 0 18px rgba(255,74,74,0.8); }
#rushL.on, #rushR.on { opacity: 1; animation: pulse 0.18s infinite alternate; }
#rushCall { font-size: clamp(22px, 4.2vw, 40px); font-weight: 900; text-align: center; color: var(--paper);
  -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }

#rodGauge { position: absolute; left: 50%; bottom: calc(160px + var(--safe-b)); transform: translateX(-50%); width: min(520px, 64vw);
  display: flex; align-items: center; gap: 10px; font-size: clamp(13px, 2vw, 17px); font-weight: 800; text-shadow: 0 2px 4px rgba(0,0,0,0.6); }
#rodTrack { position: relative; flex: 1; height: 14px; border-radius: 7px; background: var(--glass); border: 2px solid rgba(255,255,255,0.7); }
#rodKnob { position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  background: var(--sun); border: 3px solid var(--ink); }
#rodTrack.ok #rodKnob { background: var(--good); box-shadow: 0 0 12px var(--good); }
#rodTrack.wrong #rodKnob { background: var(--bad); }

#hint { position: absolute; left: 0; right: 0; bottom: calc(24px + var(--safe-b)); text-align: center; font-size: clamp(14px, 2vw, 18px);
  font-weight: 700; opacity: 0.92; text-shadow: 0 2px 4px rgba(0,0,0,0.7); padding: 0 200px; }

/* 按鈕 */
#controls { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 18px calc(18px + var(--safe-b)); display: flex;
  justify-content: space-between; align-items: flex-end; }
#lr { display: flex; gap: 14px; }
#act { display: flex; flex-direction: row; align-items: flex-end; gap: 12px; }
button { font-family: var(--font); cursor: pointer; touch-action: none; }
.round { width: 84px; height: 84px; border-radius: 50%; border: 4px solid var(--paper); background: var(--glass); color: var(--paper);
  font-size: 34px; font-weight: 900; display: grid; place-items: center; box-shadow: 0 6px 0 rgba(0,0,0,0.35); }
.round.big { width: 124px; height: 124px; background: var(--coral); font-size: 30px; letter-spacing: 0.05em; }
.round.held { transform: translateY(4px) scale(0.96); box-shadow: 0 2px 0 rgba(0,0,0,0.35); filter: brightness(1.15); }
.round.big.reel { background: var(--sea); }
.round.big.strike { background: var(--sun); color: var(--ink); animation: pulse 0.2s infinite alternate; }
.small { white-space: nowrap; padding: 10px 18px; border-radius: 20px; border: 3px solid var(--paper); background: var(--glass); color: var(--paper);
  font-size: 18px; font-weight: 800; }

/* 結果卡 */
#result { position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-end; padding-bottom: calc(90px + var(--safe-b));
  background: linear-gradient(transparent 45%, rgba(0,0,0,0.35)); }
.card { pointer-events: auto; background: var(--paper); color: var(--ink); border-radius: 26px; padding: 22px 34px 26px; text-align: center;
  min-width: min(380px, 86vw); box-shadow: 0 14px 0 rgba(0,0,0,0.25); border: 5px solid var(--ink); animation: pop 0.5s cubic-bezier(.2,1.5,.4,1);
}
.rtag { display: inline-block; background: var(--coral); color: #fff; font-weight: 900; padding: 4px 16px; border-radius: 12px; font-size: 18px; }
#rName { font-size: clamp(44px, 8vw, 64px); font-weight: 900; margin-top: 6px; line-height: 1.1; }
#rJa { font-size: 15px; opacity: 0.6; margin-top: 2px; letter-spacing: 0.08em; }
.rrow { display: flex; justify-content: center; gap: 28px; margin: 14px 0 8px; }
.rrow small { display: block; font-size: 14px; opacity: 0.65; }
.rrow b { font-size: clamp(26px, 5vw, 34px); }
#rStars { font-size: 36px; color: #f0a500; letter-spacing: 0.08em; }
#rLabel { font-size: 22px; font-weight: 900; margin-bottom: 14px; }
.pill { border: none; background: var(--sea); color: #fff; font-size: 22px; font-weight: 900; padding: 14px 34px; border-radius: 30px;
  box-shadow: 0 5px 0 #0d6a77; }

#loading { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; background: linear-gradient(#0b3a4d, #0e6377);
  transition: opacity 0.5s; z-index: 10; }
#loading.done { opacity: 0; pointer-events: none; }
.logo { font-size: clamp(56px, 12vw, 110px); font-weight: 900; color: var(--sun); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  letter-spacing: 0.02em; }
.logo span { display: block; font-size: 0.45em; color: var(--paper); letter-spacing: 0.3em; }
#loadText { margin-top: 18px; font-size: 20px; opacity: 0.85; }

/* 手機直式 */
@media (max-width: 640px) {
  .round { width: 76px; height: 76px; font-size: 30px; }
  .round.big { width: 112px; height: 112px; font-size: 27px; }
  #hint { padding: 0 16px; bottom: calc(136px + var(--safe-b)); }
  #rushL, #rushR { font-size: 40px; }
  #rushCall { font-size: 22px; bottom: calc(238px + var(--safe-b)); }
  #tensionBox { top: calc(max(12px, env(safe-area-inset-top)) + 78px); }
  #fishBox { top: calc(max(12px, env(safe-area-inset-top)) + 146px); }
  #power { bottom: calc(190px + var(--safe-b)); }
  #rodGauge { bottom: calc(200px + var(--safe-b)); width: 84vw; }
  #spot span { display: block; }
  #top { gap: 8px; padding-left: 12px; padding-right: 12px; }
}
/* 觸控裝置以外，按鈕較小也沒關係，但保留讓滑鼠也能點 */
@media (hover: hover) and (pointer: fine) {
  #lr { opacity: 0.55; }
}

/* ---- 右上：計數與說明鈕 ---- */
#topR { display: flex; gap: 10px; align-items: flex-start; }
.helpBtn { pointer-events: auto; width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 24px; }

/* ---- 全畫面頁面（標題、說明、教學完成） ---- */
.screen { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; }
#title { background: linear-gradient(rgba(6, 34, 48, 0.15), rgba(6, 34, 48, 0.72)); align-items: end; padding-bottom: calc(10vh + var(--safe-b)); }
.titleBox { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.titleBox .logo { font-size: clamp(64px, 14vw, 128px); line-height: 0.95; }
.tagline { font-size: clamp(18px, 3vw, 26px); font-weight: 800; text-shadow: 0 2px 8px rgba(0,0,0,0.6); margin-bottom: 8px; }
.tnote { font-size: 16px; opacity: 0.9; text-shadow: 0 2px 4px rgba(0,0,0,0.6); margin-top: -4px; }
.trow { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.pill.big { font-size: 28px; padding: 18px 54px; background: var(--coral); box-shadow: 0 6px 0 #b8432c; }
.pill.ghost { background: rgba(255,255,255,0.14); border: 3px solid var(--paper); box-shadow: none; font-size: 20px; padding: 11px 26px; }
.pill:active { transform: translateY(3px); }

#help { background: rgba(6, 26, 38, 0.72); backdrop-filter: blur(4px); }
.helpCard { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); background: var(--paper); color: var(--ink); border: 5px solid var(--ink); border-radius: 26px; padding: 22px 24px 24px;
  width: min(880px, 100%); box-shadow: 0 12px 0 rgba(0,0,0,0.25); text-align: center; animation: pop 0.35s cubic-bezier(.2,1.5,.4,1); }
.helpHead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.helpHead h2 { margin: 0; font-size: clamp(26px, 4vw, 34px); }
.tabs { display: flex; background: #e7e2d4; border-radius: 16px; padding: 4px; }
.tab { border: none; background: transparent; font-size: 18px; font-weight: 800; padding: 8px 18px; border-radius: 12px; color: var(--ink); }
.tab.on { background: var(--sea); color: #fff; }
.helpGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: left; margin-bottom: 16px;
  overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; min-height: 0; }
#hClose, #dGo { flex-shrink: 0; align-self: center; }
.hItem { position: relative; background: #f1ecdd; border-radius: 16px; padding: 14px 14px 12px 56px; }
.hNum { position: absolute; left: 12px; top: 12px; width: 34px; height: 34px; border-radius: 50%; background: var(--coral); color: #fff;
  display: grid; place-items: center; font-weight: 900; font-size: 20px; }
.hItem h3 { margin: 2px 0 6px; font-size: 22px; }
.hItem p { margin: 0 0 6px; font-size: 18px; line-height: 1.7; }
.hItem small { font-size: 15px; opacity: 0.7; line-height: 1.5; display: block; }
kbd, .tb { display: inline-block; min-width: 30px; padding: 1px 8px; border-radius: 8px; border: 2px solid var(--ink); border-bottom-width: 4px;
  background: #fff; font-family: var(--font); font-weight: 800; font-size: 0.92em; text-align: center; line-height: 1.5; margin: 0 2px; color: var(--ink); }
.tb { border-radius: 50%; min-width: 34px; height: 34px; line-height: 28px; padding: 0; background: #2b4a5a; color: #fff; border-color: #fff; }
.tb.big { border-radius: 18px; width: auto; padding: 0 12px; background: var(--coral); }

#tutDone { background: rgba(6, 26, 38, 0.6); }
.doneCard { width: min(460px, 100%); }
.doneCard h2 { font-size: clamp(28px, 5vw, 38px); margin: 10px 0 8px; }
.doneCard ul { text-align: left; font-size: 19px; line-height: 1.9; margin: 0 auto 18px; padding-left: 1.2em; max-width: 340px; }

/* ---- 教學提示框 ---- */
#tut { position: absolute; left: 0; right: 0; margin: 0 auto; top: calc(max(12px, env(safe-area-inset-top)) + 64px);
  width: min(620px, 92vw); background: var(--paper); pointer-events: none; color: var(--ink); border: 4px solid var(--ink); border-radius: 20px;
  padding: 10px 18px 12px; text-align: center; box-shadow: 0 8px 0 rgba(0,0,0,0.25); }
#tut.fight { top: auto; bottom: calc(250px + var(--safe-b)); }
#tut.pop { animation: pop 0.35s cubic-bezier(.2,1.5,.4,1); }
.tutHead { display: flex; justify-content: center; gap: 10px; align-items: center; font-weight: 800; font-size: 15px; opacity: 0.75; }
.tutTag { background: var(--coral); color: #fff; padding: 1px 10px; border-radius: 10px; }
#tutText { font-size: clamp(20px, 3.2vw, 26px); font-weight: 800; line-height: 1.5; margin-top: 4px; }
#tutText b { color: #d9481f; }
#tutSub { font-size: clamp(15px, 2.2vw, 18px); opacity: 0.75; margin-top: 2px; }
#tutBar { height: 10px; border-radius: 5px; background: #e2dccb; margin-top: 8px; overflow: hidden; }
#tutFill { height: 100%; width: 0%; background: var(--good); transition: width 0.1s; }
.glow { animation: glow 0.8s infinite alternate !important; }
@keyframes glow { from { box-shadow: 0 0 0 0 rgba(255, 204, 51, 0.9); } to { box-shadow: 0 0 0 14px rgba(255, 204, 51, 0); } }
#lr.glow { border-radius: 50px; }

@media (max-width: 640px) {
  .helpGrid { grid-template-columns: 1fr; gap: 8px; }
  .hItem { padding: 10px 12px 10px 52px; }
  .hItem h3 { font-size: 20px; margin: 0 0 2px; }
  .hItem p { font-size: 16px; line-height: 1.6; margin-bottom: 2px; }
  .hItem small { font-size: 14px; }
  .hNum { width: 30px; height: 30px; font-size: 17px; top: 10px; }
  #spot, #catchCount { padding: 6px 10px; }
  #spot b { font-size: 15px; margin-right: 0; white-space: nowrap; }
  #spot span { font-size: 12px; }
  #catchCount { font-size: 13px; white-space: nowrap; }
  .helpBtn { width: 40px; height: 40px; font-size: 20px; }
  .helpCard { padding: 16px 14px 18px; }
  #tut { top: calc(max(12px, env(safe-area-inset-top)) + 84px); }
  #msgWrap { top: 31%; }
  #tut.fight { bottom: calc(282px + var(--safe-b)); }
  .pill.big { font-size: 24px; padding: 16px 44px; }
}
@media (min-width: 641px) and (max-width: 900px) { .helpGrid { grid-template-columns: repeat(2, 1fr); } }

/* ---- 仕掛切換、換釣場 ---- */
.rigBtn { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 6px 14px; }
.rigBtn small { font-size: 12px; opacity: 0.8; }
.rigBtn b { font-size: 18px; }
.rigBtn.egi { background: #8a4fd1; }
.spotBtn { pointer-events: auto; border: none; color: var(--paper); font-family: var(--font); text-align: left; cursor: pointer; }
.spotBtn::after { content: '換釣場 ▾'; display: block; font-size: 12px; opacity: 0.7; margin-top: 2px; }

/* ---- 選擇釣場 ---- */
#spots { background: rgba(6, 26, 38, 0.72); backdrop-filter: blur(4px); }
.spotsCard { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); width: min(1080px, 100%);
  background: var(--paper); color: var(--ink); border: 5px solid var(--ink); border-radius: 26px; padding: 18px 20px 20px;
  box-shadow: 0 12px 0 rgba(0,0,0,0.25); animation: pop 0.35s cubic-bezier(.2,1.5,.4,1); }
.spotsCard h2 { margin: 0; font-size: clamp(26px, 4vw, 34px); }
.backBtn { background: var(--ink); color: #fff; width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 20px; pointer-events: auto; }
.spotGrid { display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: max-content; align-content: start; gap: 12px; overflow-y: auto; touch-action: pan-y; min-height: 0; }
.spotCard { position: relative; text-align: left; border: 4px solid var(--ink); border-radius: 18px; padding: 0; overflow: hidden;
  background: #f1ecdd; font-family: var(--font); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; box-shadow: 0 5px 0 rgba(0,0,0,0.2); }
.spotCard:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,0.2); }
.spotCard.here { outline: 4px solid var(--coral); outline-offset: 2px; }
.spotSky { height: 86px; position: relative; }
.spotSky .sea { position: absolute; left: 0; right: 0; bottom: 0; height: 34%; }
.spotNo { position: absolute; left: 10px; top: 8px; background: rgba(0,0,0,0.45); color: #fff; font-weight: 900; font-size: 14px; padding: 2px 10px; border-radius: 10px; }
.spotHere { position: absolute; right: 8px; top: 8px; background: var(--coral); color: #fff; font-weight: 900; font-size: 13px; padding: 2px 8px; border-radius: 10px; }
.spotBody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.spotName { font-size: 24px; font-weight: 900; line-height: 1.1; }
.spotTime { font-size: 14px; font-weight: 800; opacity: 0.65; }
.spotBlurb { font-size: 14px; line-height: 1.5; opacity: 0.8; }
.spotFish { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.fchip { background: #fff; border: 2px solid #d9d2bf; border-radius: 10px; padding: 1px 7px 2px; font-size: 14px; font-weight: 800; line-height: 1.25; }
.fchip small { display: block; font-size: 10px; font-weight: 600; opacity: 0.55; letter-spacing: 0.04em; }
.fchip.sq { border-color: #b996e6; background: #f4ecff; }
@media (max-width: 1000px) { .spotGrid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .spotGrid { grid-template-columns: 1fr; gap: 10px; }
  .spotCard { flex-direction: row; }
  .spotSky { width: 92px; height: auto; flex-shrink: 0; }
  .spotName { font-size: 21px; }
  .spotBlurb { display: none; }
}

/* ---- 階段 3：金幣、任務、裝備 ---- */
#topL { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.chipBtn { pointer-events: auto; padding: 5px 12px; font-size: 15px; border-width: 2px; }
.chipBtn b { color: var(--sun); }
#coinChip { background: var(--glass); border-radius: 14px; padding: 8px 12px; display: flex; align-items: center; gap: 6px; font-size: clamp(14px, 2vw, 18px); }
.coin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3a8, #f4b400 60%, #b07800);
  border: 2px solid #7a5200; vertical-align: -3px; }
#toasts { position: absolute; left: 0; right: 0; top: calc(max(12px, env(safe-area-inset-top)) + 120px); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 3; }
.toast { background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-radius: 18px; padding: 8px 18px 10px; text-align: center;
  box-shadow: 0 6px 0 rgba(0,0,0,0.25); animation: pop 0.4s cubic-bezier(.2,1.6,.4,1); max-width: 92vw; }
.toast .tt { font-size: 15px; font-weight: 900; color: #d9481f; }
.toast .tb2 { font-size: clamp(18px, 3vw, 24px); font-weight: 900; }
.toast.out { transition: opacity 0.4s, transform 0.4s; opacity: 0; transform: translateY(-10px); }
#rReward { display: flex; flex-direction: column; gap: 4px; align-items: center; margin: -6px 0 12px; }
#rReward .coinsGot { font-size: 22px; font-weight: 900; color: #b07800; }
#rReward .badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
#rReward .badge { background: var(--coral); color: #fff; font-weight: 900; font-size: 15px; padding: 2px 10px; border-radius: 10px; }
#rReward .badge.rec { background: #8a4fd1; }
#rReward .badge.mis { background: #2e9e5b; }
#rReward .unl { font-size: 15px; font-weight: 800; color: #2e9e5b; }

.missionCard { width: min(560px, 100%); }
#mpList { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; touch-action: pan-y; min-height: 0; margin-bottom: 12px; }
.mItem { display: flex; align-items: center; gap: 12px; background: #f1ecdd; border-radius: 14px; padding: 10px 14px; text-align: left; }
.mItem .mStar { font-size: 28px; color: #c9c1ae; width: 32px; text-align: center; }
.mItem.done .mStar { color: #f0a500; }
.mItem.done { background: #e4f3e2; }
.mItem .mText { flex: 1; font-size: 18px; font-weight: 800; }
.mItem .mProg { font-size: 15px; font-weight: 800; opacity: 0.6; white-space: nowrap; }
#mpFoot { font-size: 15px; opacity: 0.75; font-weight: 700; }

.gearMoney { display: flex; gap: 14px; font-size: 20px; font-weight: 800; margin-left: auto; margin-right: 8px; align-items: center; }
.gearMoney b { color: #b07800; }
.gearBtn { font-size: 18px; padding: 8px 20px; margin-right: 8px; background: #8a4fd1; box-shadow: 0 4px 0 #5b2f96; }
.gearCard { width: min(980px, 100%); }
.gearScroll { overflow-y: auto; touch-action: pan-y; min-height: 0; text-align: left; }
.gearScroll h3 { margin: 6px 0 8px; font-size: 22px; }
.gearScroll h3 small { font-size: 14px; opacity: 0.6; margin-left: 6px; }
.gearGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; grid-auto-rows: max-content; }
.gItem { background: #f1ecdd; border: 3px solid transparent; border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.gItem.on { border-color: var(--sea); background: #e2f4f6; }
.gItem.locked { opacity: 0.6; }
.gItem .gName { font-size: 21px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.gItem .gName .swatch { width: 26px; height: 8px; border-radius: 4px; }
.gItem .gDesc { font-size: 14px; opacity: 0.75; line-height: 1.5; }
.gItem .gLike { font-size: 13px; opacity: 0.7; }
.gBar { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; }
.gBar span { width: 64px; }
.gBar i { flex: 1; height: 10px; border-radius: 5px; background: #ddd5c0; position: relative; overflow: hidden; }
.gBar i::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--v); background: var(--coral); }
.gAct { border: none; border-radius: 14px; padding: 8px 12px; font-size: 17px; font-weight: 900; font-family: var(--font); background: var(--sea); color: #fff; cursor: pointer; margin-top: auto; }
.gAct.buy { background: #f0a500; color: var(--ink); }
.gAct:disabled { background: #c9c1ae; color: #fff; cursor: default; }

.spotCard.locked { filter: grayscale(0.75); }
.spotCard.locked .spotBody { opacity: 0.6; }
.spotLock { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.35); color: #fff; font-weight: 900; font-size: 18px; text-align: center; }
.spotStars { font-size: 16px; font-weight: 900; color: #f0a500; letter-spacing: 0.04em; }
@media (max-width: 640px) {
  .gearGrid { grid-template-columns: 1fr; }
  .gearMoney { font-size: 15px; gap: 8px; margin-right: 4px; }
  .gearBtn { font-size: 15px; padding: 6px 12px; margin-right: 4px; }
  #coinChip { padding: 6px 8px; font-size: 13px; }
  .coin { width: 14px; height: 14px; }
  #toasts { top: calc(max(12px, env(safe-area-inset-top)) + 130px); }
  .chipBtn { font-size: 13px; padding: 4px 10px; }
}

/* 橫的畫面：結果卡放右邊，左邊留給魚 */
@media (min-aspect-ratio: 1/1) {
  #result { justify-content: flex-end; align-items: center; padding: 70px 7vw calc(20px + var(--safe-b)) 0; background: linear-gradient(90deg, transparent 50%, rgba(0,0,0,0.3)); }
}

/* ---- 階段 4：主選單、圖鑑、聲音 ---- */
.tmoney { display: flex; gap: 16px; font-size: clamp(16px, 2.4vw, 20px); font-weight: 800; background: var(--glass); padding: 6px 16px; border-radius: 14px; margin-bottom: 4px; }
.tmoney b { color: var(--sun); }
.soundBtn { position: absolute; right: 16px; top: max(14px, env(safe-area-inset-top)); width: 52px; height: 52px; padding: 0; border-radius: 50%; font-size: 24px; pointer-events: auto; }
.soundBtn2 { font-size: 20px; }
.muted { opacity: 0.55; }
@media (min-aspect-ratio: 1/1) {
  #title { align-items: center; justify-items: start; padding-left: 6vw; background: linear-gradient(90deg, rgba(6, 34, 48, 0.42), rgba(6, 34, 48, 0.08) 50%, transparent); }
  .titleBox { align-items: flex-start; text-align: left; }
  .titleBox .logo span { text-align: left; }
  .trow { justify-content: flex-start; }
}
.rBtns { display: flex; gap: 10px; justify-content: center; }
.pill.ghostDark { background: transparent; color: var(--ink); border: 3px solid var(--ink); box-shadow: none; font-size: 18px; padding: 10px 18px; }

#dex { background: rgba(6, 26, 38, 0.78); backdrop-filter: blur(4px); }
.dexCard0 { display: flex; flex-direction: column; width: min(1180px, 100%); height: min(760px, calc(100dvh - 32px)); background: var(--paper); color: var(--ink);
  border: 5px solid var(--ink); border-radius: 26px; padding: 16px 18px 18px; box-shadow: 0 12px 0 rgba(0,0,0,0.25); animation: pop 0.35s cubic-bezier(.2,1.5,.4,1); }
.dexCard0 h2 { margin: 0; font-size: clamp(26px, 4vw, 34px); }
.dexCard0 h2 small { font-size: 0.6em; opacity: 0.6; margin-left: 6px; }
.dexBody { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; }
#dexGrid { overflow-y: auto; touch-action: pan-y; min-height: 0; padding-right: 4px; }
.dexSpot { font-size: 15px; font-weight: 900; opacity: 0.6; margin: 8px 0 6px; }
.dexRow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.dexCard { position: relative; border: 3px solid #d9d2bf; background: #fff; border-radius: 14px; padding: 4px 4px 6px; font-family: var(--font);
  display: flex; flex-direction: column; align-items: center; cursor: pointer; color: var(--ink); }
.dexCard img { width: 100%; aspect-ratio: 8 / 5; object-fit: contain; background: linear-gradient(#e9f6fb, #cfe9f2); border-radius: 9px; }
.dexCard.unknown img { background: linear-gradient(#efe9da, #ddd3bc); }
.dexCard b { font-size: 15px; margin-top: 3px; }
.dexCard small { font-size: 10px; opacity: 0.55; }
.dexCard.on { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(255,107,74,0.35); }
.dexN { position: absolute; right: 6px; top: 6px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 900; padding: 0 6px; border-radius: 8px; }
.dexDetail { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.dexView { position: relative; flex: 1; min-height: 160px; border-radius: 18px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #f4fbff, #c7e4ee); }
#dexCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#dexLoading { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.dexHint { position: absolute; right: 10px; bottom: 8px; font-size: 13px; font-weight: 800; opacity: 0.5; pointer-events: none; }
.dexInfo { text-align: left; }
.dexTag { display: inline-block; background: var(--sea); color: #fff; font-weight: 900; font-size: 14px; padding: 2px 10px; border-radius: 10px; }
#dexName { font-size: clamp(32px, 5vw, 44px); font-weight: 900; line-height: 1.15; margin-top: 4px; }
#dexJa { font-size: 14px; opacity: 0.6; letter-spacing: 0.06em; }
#dexBlurb { font-size: 17px; line-height: 1.6; margin: 8px 0; }
#dexStats { display: flex; gap: 18px; flex-wrap: wrap; }
#dexStats small { display: block; font-size: 13px; opacity: 0.6; }
#dexStats b { font-size: 22px; }
#dexStats b.st { color: #f0a500; }
@media (max-width: 760px) {
  .dexBody { grid-template-columns: 1fr; grid-template-rows: 46% 1fr; }
  .dexDetail { order: -1; flex-direction: row; }
  .dexView { flex: 1.1; }
  .dexInfo { flex: 1; overflow-y: auto; }
  #dexName { font-size: 26px; }
  #dexBlurb { font-size: 14px; }
  #dexStats b { font-size: 17px; }
  .dexRow { grid-template-columns: repeat(3, 1fr); }
}

/* ---- 矮的畫面（手機橫拿）：每樣東西縮小一點，全部塞得下 ---- */
@media (max-height: 520px) {
  #title { padding-top: 10px; padding-bottom: 10px; }
  .titleBox { gap: 6px; }
  .titleBox .logo { font-size: 44px; line-height: 1; }
  .titleBox .logo span { display: inline; font-size: 0.5em; margin-left: 8px; letter-spacing: 0.12em; }
  .tagline { font-size: 15px; margin: 0; }
  .tmoney { font-size: 14px; padding: 4px 10px; gap: 10px; }
  .pill.big { font-size: 20px; padding: 10px 30px; }
  .pill.ghost { font-size: 15px; padding: 6px 14px; }
  .tnote { font-size: 12px; margin-top: -2px; }
  .soundBtn { width: 42px; height: 42px; font-size: 19px; }

  #top { padding-top: 8px; }
  #spot, #catchCount, #coinChip { padding: 5px 10px; }
  #spot b { font-size: 15px; }
  #spot span { font-size: 12px; }
  .spotBtn::after { display: none; }
  .helpBtn { width: 38px; height: 38px; font-size: 18px; }
  .round { width: 62px; height: 62px; font-size: 26px; }
  .round.big { width: 92px; height: 92px; font-size: 23px; }
  #controls { padding-bottom: calc(10px + var(--safe-b)); }
  #msgWrap { top: 20%; }
  #msg { font-size: 40px; }
  #sub { font-size: 17px; }
  #hint { bottom: calc(8px + var(--safe-b)); font-size: 13px; padding: 0 180px; }
  #power { bottom: calc(80px + var(--safe-b)); }
  #powerBar { height: 22px; }
  #powerDist { font-size: 20px; margin-top: 2px; }
  #tensionBox { top: 50px; width: min(560px, 62vw); }
  #tension { height: 24px; }
  .flabel { font-size: 14px; margin-bottom: 2px; }
  #fishBox { top: 102px; }
  #stamina { height: 12px; }
  #rodGauge { bottom: calc(76px + var(--safe-b)); width: min(420px, 50vw); }
  #rushCall { bottom: calc(108px + var(--safe-b)); font-size: 22px; }
  #rushL, #rushR { font-size: 46px; }
  #tut { top: 48px; padding: 6px 14px 8px; }
  #tut.fight { bottom: calc(150px + var(--safe-b)); }
  #tutText { font-size: 17px; }
  #tutSub { font-size: 13px; }
  #toasts { top: 52px; }
  .card { padding: 12px 22px 14px; }
  #rName { font-size: 34px; }
  .rrow { margin: 6px 0 4px; }
  .rrow b { font-size: 22px; }
  #rStars { font-size: 24px; }
  #rLabel { font-size: 17px; margin-bottom: 6px; }
  #rReward { margin: 0 0 8px; }
  #rReward .coinsGot { font-size: 18px; }
  .rBtns .pill { font-size: 17px; padding: 8px 18px; }
  #result { padding-top: 46px; }
  .dexCard0 { height: calc(100dvh - 16px); padding: 10px 14px 12px; }
  .screen { padding: 8px; }
  .dexRow { grid-template-columns: repeat(4, 1fr); }
  #dexName { font-size: 28px; }
  #dexBlurb { font-size: 14px; margin: 4px 0; }
  #dexStats b { font-size: 17px; }
}

/* 手機直拿：右上的東西太多，縮短「今日」並把間距縮小，讓「？」留在畫面內 */
@media (max-width: 640px) {
  .ccLong { display: none; }
  #topR { gap: 6px; }
  #catchCount { padding: 6px 8px; }
  .soundBtn2 { width: 36px; height: 36px; font-size: 16px; }
  .helpBtn { width: 36px; height: 36px; font-size: 18px; }
}

/* 窄手機（寬度 400 以下）：按鈕縮小、拿掉「今日」計數，全部放得下 */
@media (max-width: 400px) {
  #catchCount { display: none; }
  #top { padding-left: 8px; padding-right: 8px; gap: 6px; }
  #spot b { font-size: 14px; }
  #coinChip { padding: 5px 7px; font-size: 12px; gap: 4px; }
  #controls { padding: 0 10px calc(12px + var(--safe-b)); }
  #lr { gap: 8px; }
  #act { gap: 6px; }
  .round { width: 60px; height: 60px; font-size: 24px; }
  .round.big { width: 92px; height: 92px; font-size: 22px; }
  .rigBtn { padding: 4px 8px; }
  .rigBtn b { font-size: 14px; }
  .small { padding: 8px 12px; font-size: 15px; }
  #hint { bottom: calc(118px + var(--safe-b)); }
  #rodGauge { bottom: calc(176px + var(--safe-b)); }
  #rushCall { bottom: calc(214px + var(--safe-b)); font-size: 19px; }
  #power { bottom: calc(166px + var(--safe-b)); }
}

/* ---- 聲音設定 ---- */
.soundCard { width: min(480px, 100%); text-align: left; }
.vrow { display: flex; align-items: center; gap: 12px; margin: 14px 0; font-size: 19px; font-weight: 800; }
.vrow span { width: 130px; }
.vrow input { flex: 1; accent-color: var(--coral); height: 28px; touch-action: manipulation; }
.vrow b { width: 48px; text-align: right; }
.sndBtns { display: flex; gap: 10px; justify-content: center; margin: 16px 0 12px; }
.credits { font-size: 13px; line-height: 1.7; opacity: 0.7; border-top: 2px solid #e2dccb; padding-top: 10px; }

/* ---- 圖鑑詳細介紹（中文為主，英日小字） ---- */
.dexView { flex: 0 0 40%; }
.dexInfo { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; padding-right: 4px; }
.dexTags { display: flex; gap: 6px; flex-wrap: wrap; }
.dexTag.hab { background: #2e9e5b; }
#dexNames { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; opacity: 0.65; letter-spacing: 0.03em; }
#dexSci { font-style: italic; font-size: 13px; opacity: 0.55; margin-top: 2px; }
#dexStats { margin-top: 8px; }
#dexFacts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 4px; font-size: 15px; font-weight: 700; }
#dexFacts small { display: block; font-size: 12px; opacity: 0.55; font-weight: 600; }
#dexBlurb { font-size: 17px; line-height: 1.75; margin: 10px 0 8px; }
#dexBlurb .locked { opacity: 0.6; font-weight: 800; }
.trans { font-size: 12.5px; line-height: 1.6; opacity: 0.62; margin-bottom: 6px; }
.trans b { font-size: 11px; letter-spacing: 0.06em; background: #e7e2d4; padding: 0 6px; border-radius: 6px; opacity: 0.9; }
@media (max-width: 760px) {
  .dexView { flex: 1.1; }
  #dexBlurb { font-size: 14px; line-height: 1.6; }
  #dexFacts { font-size: 13px; }
  .trans { font-size: 11.5px; }
}

/* ---- Logo（圖片）：輕輕浮動 ---- */
.logoImg { display: block; width: min(600px, 44vw); height: auto; user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.28)); animation: logoIn 0.8s cubic-bezier(.2,1.5,.4,1) both, logoFloat 4.2s 0.8s ease-in-out infinite; }
@keyframes logoIn { from { transform: scale(0.5) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes logoFloat { 0%, 100% { transform: translateY(0) rotate(-1.2deg); } 50% { transform: translateY(-10px) rotate(1deg); } }
.titleBox .logoImg { margin-left: -2%; }
.loadLogo { width: min(520px, 80vw); margin: 0 auto; }
@media (max-aspect-ratio: 1/1) { .logoImg { width: min(460px, 88vw); } .titleBox .logoImg { margin: 0 auto; } }
@media (max-height: 520px) { .logoImg { width: min(340px, 40vw); } }
/* 封面截圖模式（?cover）：只留 Logo 與標語 */
body.cover #title .trow, body.cover #tStart, body.cover #tFirst, body.cover #tMoney, body.cover .soundBtn { display: none !important; }
body.cover .logoImg { width: 620px; animation: none; }
body.cover .tagline { font-size: 30px; }
/* 手機直拿：圖鑑改成上（3D）中（介紹）下（列表）三段 */
@media (max-width: 760px) and (min-height: 521px) {
  .dexBody { grid-template-rows: 60% 1fr; }
  .dexDetail { flex-direction: column; gap: 6px; }
  .dexView { flex: 0 0 34%; min-height: 120px; }
  .dexInfo { flex: 1; }
  #dexName { font-size: 26px; }
}
/* 新 Logo 比較高：矮畫面、直畫面縮小一點 */
@media (max-height: 520px) { .logoImg { width: min(230px, 28vw); } .tagline { display: none; } }
@media (max-aspect-ratio: 1/1) { .logoImg { width: min(330px, 74vw); } }

/* 圖鑑：切換動作 */
.dexMotions { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; flex-wrap: wrap; gap: 5px; pointer-events: auto; }
.dexMotions button { border: 2px solid rgba(11,34,48,0.25); background: rgba(255,255,255,0.85); color: var(--ink); font-family: var(--font);
  font-size: 13px; font-weight: 800; padding: 3px 9px; border-radius: 12px; cursor: pointer; }
.dexMotions button.on { background: var(--coral); color: #fff; border-color: var(--coral); }
@media (max-width: 760px) { .dexMotions { top: 6px; left: 6px; right: 6px; gap: 4px; } .dexMotions button { font-size: 11.5px; padding: 2px 7px; } }
