/* ═══════════ BUBBLE AQUARIUM — UI ═══════════ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  /* palette extracted from the user's reference image */
  --navy: rgba(5, 29, 61, 0.82);
  --navy-solid: #0a2246;
  --panel: rgba(15, 44, 84, 0.82);
  --panel-2: rgba(24, 58, 104, 0.9);
  --line: rgba(140, 200, 255, 0.22);
  --line-strong: rgba(140, 200, 255, 0.42);
  --txt: #f2f6ff;
  --txt-dim: #a8c4de;
  --gold: #e8c766;
  --orange: #e8a040;
  --orange-d: #c06020;
  --green: #3ed982;
  --pink: #f7719f;
  --blue: #4f8fd8;
  --radius: 20px;
  --glow: 0 8px 28px rgba(1, 10, 24, 0.55);
  --paint: inset 0 1px 0 rgba(255,255,255,.08), inset 0 -6px 14px rgba(15, 44, 84, .25);
}

html, body { height: 100%; overflow: hidden; }

/* ── Puka Fish title / resume screen ─────── */
.start-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; overflow: hidden; padding: 24px; color: #fff; font-family: "Prompt", sans-serif; background: #12a9d0 url("assets/ui/title-screen-landscape-v3.png") center/cover no-repeat; }
.start-screen.hidden { display: none; }
.start-screen-shade { position: absolute; inset: 0; background: linear-gradient(180deg,rgba(3,93,143,.02),rgba(1,45,95,.12)); pointer-events: none; }
.start-screen-card { position: absolute; z-index: 3; left: 50%; bottom: clamp(20px,4vh,42px); width: min(350px, calc(100vw - 32px)); padding: 0; border: 0; text-align: center; background: none; box-shadow: none; transform: translateX(-50%); }
.title-team { position: absolute; z-index: 1; left: 50%; top: 45%; width: clamp(650px,57vw,920px); aspect-ratio: 1672 / 941; pointer-events: none; transform: translate(-50%,-50%); }
.title-team-fish { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 70%; filter: drop-shadow(0 24px 30px rgba(0,48,90,.35)); animation: titleMascotFloat 5.2s ease-in-out infinite; will-change: transform; }
.title-team-logo { position: absolute; left: 27%; bottom: -16%; width: 50%; height: auto; filter: drop-shadow(0 12px 22px rgba(0,45,90,.42)); animation: titleLogoFloat 4.2s ease-in-out infinite; will-change: transform; }
.title-kicker { color: #85f4e7; font-size: 11px; font-weight: 700; letter-spacing: .24em; }
.start-screen-card h1 { margin: 5px 0 4px; font-size: clamp(25px,3.3vw,39px); line-height: 1.18; text-shadow: 0 3px 12px rgba(0,20,54,.5); }
.start-screen-card > p { margin: 0 auto 20px; max-width: 420px; color: #d7eff9; font-size: 13px; line-height: 1.6; }
.title-primary, .title-secondary { width: min(330px,100%); min-height: 52px; border-radius: 18px; font: 700 16px "Prompt",sans-serif; cursor: pointer; transition: transform .2s ease,filter .2s ease,box-shadow .2s ease; }
.title-primary { border: 1px solid #fff0aa; color: #183451; background: linear-gradient(180deg,#ffe781,#f5ae39); box-shadow: 0 12px 30px rgba(255,178,53,.38), inset 0 1px #fffad0; }
.title-primary::after { content: "  ›"; font-size: 22px; line-height: 0; }
.title-primary:hover { transform: translateY(-3px); filter: brightness(1.06); box-shadow: 0 16px 34px rgba(255,178,53,.5); }
.title-primary:disabled { cursor: wait; opacity: .72; transform: none; }
.title-secondary { display: block; min-height: 38px; margin: 9px auto 0; border: 1px solid rgba(200,239,250,.3); color: #d9eef6; background: rgba(4,31,70,.44); font-size: 12px; }
.title-secondary.hidden { display: none; }
.title-secondary:hover { border-color: rgba(255,211,115,.7); color: #fff2c2; }
.title-tip { display: block; margin-top: 15px; color: #a8cbd9; font-size: 10px; }
.title-error { margin-top: 12px; color: #ffd0c7; font-size: 11px; }
.title-error.hidden { display: none; }
.start-screen-bubbles { position: absolute; inset: 0; pointer-events: none; }
.start-screen-bubbles i { position: absolute; bottom: -32px; width: 13px; height: 13px; border: 1px solid rgba(215,253,255,.72); border-radius: 50%; box-shadow: inset 2px 2px rgba(255,255,255,.2); animation: titleBubble 12s linear infinite; }
.start-screen-bubbles i:nth-child(1){left:8%;animation-delay:-4s}.start-screen-bubbles i:nth-child(2){left:27%;width:8px;height:8px;animation-delay:-9s}.start-screen-bubbles i:nth-child(3){left:64%;width:18px;height:18px;animation-delay:-2s}.start-screen-bubbles i:nth-child(4){left:83%;animation-delay:-7s}.start-screen-bubbles i:nth-child(5){left:94%;width:7px;height:7px;animation-delay:-5s}
@keyframes titleBubble { 0%{transform:translate3d(0,0,0);opacity:0} 10%{opacity:.75} 100%{transform:translate3d(18px,-110vh,0);opacity:0} }
@keyframes titleLogoFloat { 0%,100%{transform:translate3d(0,0,0) rotate(-.6deg)} 50%{transform:translate3d(0,-7px,0) rotate(.8deg)} }
@keyframes titleMascotFloat { 0%,100%{transform:translate3d(0,0,0) rotate(-1.5deg)} 50%{transform:translate3d(0,-13px,0) rotate(1.5deg)} }
@keyframes titleTeamFloatMobile { 0%,100%{transform:translate3d(-50%,0,0) rotate(-.7deg)} 50%{transform:translate3d(-50%,-8px,0) rotate(.7deg)} }
.start-confirm { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(1,14,38,.72); backdrop-filter: blur(8px); }
.start-confirm.hidden { display: none; }
.start-confirm > div { width: min(390px,100%); padding: 27px; border: 1px solid rgba(255,204,99,.5); border-radius: 25px; text-align: center; background: linear-gradient(155deg,#123d6d,#081f4a); box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.start-confirm > div > span { font-size: 38px; }.start-confirm h2 { margin: 4px 0; }.start-confirm p { margin: 3px 0 18px; color: #c4dae8; font-size: 12px; }
.start-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }.start-confirm-actions button { min-height: 42px; border-radius: 13px; border: 1px solid rgba(190,230,245,.3); color: #fff; background: #174b77; font: 600 12px "Prompt",sans-serif; cursor: pointer; }.start-confirm-actions button:last-child { border-color: #ffbc74; background: linear-gradient(135deg,#f09038,#d85527); }
@media (orientation: portrait) { .start-screen { background-image: url("assets/ui/title-screen-portrait-v3.png"); } }
@media (max-width: 1050px) { .title-team { width: clamp(560px,76vw,760px); }.title-team-logo { bottom: -18%; } }
@media (max-height: 700px) and (orientation: landscape) { .title-team { top: 42%; width: min(720px,67vw); }.title-team-logo { bottom: -17%; }.start-screen-card { bottom: 14px; } }
@media (max-width: 700px) { .start-screen { padding: 15px; }.start-screen-card { bottom: max(24px,env(safe-area-inset-bottom)); width: min(330px,calc(100vw - 30px)); }.title-team { top: 37%; width: min(440px,112vw); }.title-team-logo { bottom: -22%; width: 54%; left: 23%; }.title-primary { min-height: 50px; }.title-secondary { min-height: 42px; background: rgba(5,54,99,.86); backdrop-filter: blur(4px); } }
@media (max-width: 380px) { .title-team { top: 35%; width: 108vw; }.title-team-logo { bottom: -23%; }.start-screen-card { width: calc(100vw - 28px); } }
@media (prefers-reduced-motion: reduce) { .title-team-fish, .title-team-logo { animation: none; } }
body {
  font-family: "Prompt", "Segoe UI", "Noto Sans Thai", system-ui, sans-serif;
  background: #071228;
  color: var(--txt);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* Safari spends a surprising amount of GPU time recompositing blurred HUD
   layers above a continuously animated canvas. Keep their translucent paint
   but remove only the live backdrop blur on iOS. */
.ios-mobile .pill,
.ios-mobile .bb-btn,
.ios-mobile #bottomBar,
.ios-mobile .overlay,
.ios-mobile #fishInfo {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

#tank, #iosPixiTank { position: fixed; inset: 0; display: block; }
#tank { cursor: crosshair; }
#iosPixiTank { pointer-events: none; }
#tank.ios-canvas-fallback { opacity: 0; }

/* ── pills & buttons ─────────────────────── */
.pill {
  display: flex; align-items: center; gap: 7px;
  background: var(--navy);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--glow);
  font-weight: 500;
  white-space: nowrap;
}
.pill img { width: 22px; height: 22px; border-radius: 50%; }

.cur {
  font-weight: 700; font-size: 15px;
  border-color: rgba(255, 209, 102, 0.55);
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  box-shadow: 0 6px 24px rgba(0,0,0,.45), inset 0 0 18px rgba(255,209,102,.07);
}
#gemPill { border-color: rgba(247, 37, 133, 0.5); }
.cur-food { border-color: rgba(244, 162, 97, 0.5); }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--navy); border: 1px solid var(--line);
  color: var(--txt); display: grid; place-items: center;
  cursor: pointer; backdrop-filter: blur(8px); box-shadow: var(--glow);
  transition: transform .12s ease, background .2s;
}
.icon-btn:hover { background: var(--panel-2); transform: scale(1.06); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.off { opacity: .45; }

/* ── HUD ─────────────────────────────────── */
#hud { position: fixed; top: 0; left: 0; right: 0; pointer-events: none; z-index: 20; }
.hud-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 12px 14px; gap: 10px; flex-wrap: wrap;
}
.hud-left { pointer-events: auto; padding: 8px 16px 8px 10px; }
.logo-img { width: 58px; height: 44px; object-fit: contain; filter: drop-shadow(0 3px 7px rgba(25,190,230,.48)); }
.hud-left-txt { display: flex; flex-direction: column; }
.game-title { font-size: 10px; letter-spacing: .18em; color: var(--txt-dim); font-weight: 600; }
.hud-level { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; }
.level-xp {
  width: 46px; height: 8px; border-radius: 99px; background: rgba(255,255,255,.14);
  overflow: hidden; display: inline-block;
}
.level-xp i, .bar i, .strip-bar i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #4cc9f0, #7dffd4, #4cc9f0);
  background-size: 200% 100%;
  transition: width .4s ease;
  animation: shimmer 3s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.hud-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; pointer-events: auto; }

/* compact main menu: infrequent actions stay out of the permanent HUD */
.main-menu-wrap { position: relative; }
.main-menu {
  position: absolute; top: 50px; right: 0; width: 286px; padding: 10px;
  border: 1px solid var(--line-strong); border-radius: 18px;
  background: rgba(7, 28, 62, .97); box-shadow: 0 18px 46px rgba(0,0,0,.58);
  transform-origin: top right; animation: menuIn .14s ease-out;
}
.main-menu.hidden { display: none; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-5px) scale(.97); } }
.main-menu-title { padding: 3px 8px 8px; color: #8deee2; font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.menu-row {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px;
  border: 0; border-radius: 13px; background: transparent; color: var(--txt);
  font: inherit; text-align: left; cursor: pointer; transition: background .15s;
}
.menu-row:hover { background: rgba(95,177,235,.13); }
.menu-row + .menu-row { border-top: 1px solid rgba(140,200,255,.1); }
.menu-row-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 11px; background: rgba(76,201,240,.13); font-size: 18px; }
.menu-row > span:last-child { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.menu-row b { font-size: 13px; }
.menu-row small { color: var(--txt-dim); font-size: 9.5px; font-weight: 400; }
.menu-row.danger b { color: #ff9a9a; }
.menu-collection-bar { height: 5px; margin: 4px 0; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.menu-collection-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#4cc9f0,#7dffd4); }

/* next unfinished campaign objective */
#progressStrip {
  position: fixed; top: 74px; left: 50%; transform: translateX(-50%);
  z-index: 19; gap: 5px; padding: 4px 8px; color: var(--txt);
  border: 1px solid rgba(125,232,174,.42); cursor: pointer; font-family: inherit; pointer-events: auto;
  transition: transform .15s, border-color .2s;
}
#progressStrip:hover { transform: translateX(-50%) translateY(-2px); border-color: rgba(125,232,174,.8); }
.objective-icon { font-size: 15px; }
.objective-copy { display: flex; flex-direction: column; align-items: flex-start; min-width: 92px; line-height: 1.15; }
.objective-copy small { color: #7fe8ae; font-size: 7.5px; font-weight: 600; letter-spacing: .03em; }
.objective-copy b { max-width: 130px; overflow: hidden; text-overflow: ellipsis; font-size: 9.5px; }
.objectiveNum { min-width: 28px; color: #bcefe1; font-size: 9px; font-weight: 700; text-align: right; }
.strip-bar { width: 56px; height: 5px; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }

/* ── bottom bar ──────────────────────────── */
#bottomBar {
  position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%);
  display: flex; align-items: stretch; gap: 10px;
  width: min(1080px, calc(100% - 20px));
  z-index: 21;
}
.bb-left { display: flex; gap: 8px; }
.bb-btn {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 12px;
  cursor: pointer; backdrop-filter: blur(8px); box-shadow: var(--glow);
  transition: transform .12s, background .2s; text-align: left;
}
.bb-btn:hover { background: var(--panel-2); transform: translateY(-2px); }
.bb-btn:active { transform: scale(.96); }
.bb-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(76,201,240,.25), rgba(31,109,199,.25)); color: #7fe0ff; }
.bb-txt { display: flex; flex-direction: column; font-size: 12px; line-height: 1.25; }
.bb-txt b { font-size: 13px; }
.bb-txt span { color: var(--txt-dim); font-size: 11px; }
#autoFeedBtn.on .bb-icon { color: #ffd166; background: linear-gradient(135deg, rgba(255,209,102,.25), rgba(245,95,46,.25)); }
#autoFeedBtn.on .bb-icon svg { animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.bb-center {
  flex: 1; min-width: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px;
  display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden;
  backdrop-filter: blur(8px); box-shadow: var(--glow);
  scrollbar-width: none; cursor: grab; touch-action: pan-x;
}
.bb-center.dragging { cursor: grabbing; scroll-behavior: auto; }
.bb-center.dragging .dock-slot { pointer-events: none; }
.bb-center::-webkit-scrollbar { display: none; }
.dock-hint { margin: auto; color: var(--txt-dim); font-size: 13px; padding: 4px 10px; }

.dock-slot {
  flex: 0 0 auto; width: 64px; height: 64px; position: relative;
  border-radius: 50%; border: 2px solid var(--line);
  background: radial-gradient(circle at 35% 28%, rgba(120, 214, 250, 0.32), rgba(14, 34, 70, 0.88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -5px 12px rgba(20,60,120,.25), var(--glow);
  cursor: pointer; transition: transform .12s, border-color .2s, box-shadow .2s;
  display: grid; place-items: center; overflow: visible;
}
.dock-slot:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.dock-slot.sel { border-color: var(--gold); box-shadow: 0 0 18px rgba(255,209,102,.6), inset 0 0 16px rgba(255,209,102,.15); }
.dock-slot img { width: 48px; height: 36px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.55)); }
.dock-slot img.dock-face-left { transform: scaleX(-1); }
.dock-lv {
  position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--orange), var(--orange-d));
  color: #fff; font-size: 10px; font-weight: 700; padding: 1px 7px;
  border-radius: 99px; border: 1px solid rgba(255,255,255,.4); box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.dock-hunger {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 5px;
  pointer-events: none;
}
.dh-tube {
  width: 100%; height: 100%;
  border-radius: 99px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
  position: relative; overflow: hidden;
}
.dh-tube .dh-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 100%;
  border-radius: 99px; background: #7fe8ae;
}
.dock-count {
  position: absolute; top: -4px; right: -2px; font-size: 10px; font-weight: 700;
  background: var(--navy-solid); border: 1px solid var(--line-strong); color: var(--gold);
  border-radius: 99px; padding: 0 6px;
}

.bb-right { display: flex; align-items: center; gap: 8px; }
.shop-btn {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #f0a050, #c06020);
  color: #fff; font-weight: 700; font-size: 15px;
  border: 1px solid rgba(255, 214, 140, 0.5);
  border-radius: var(--radius); padding: 16px 22px;
  cursor: pointer; box-shadow: 0 6px 20px rgba(192, 96, 32, 0.45);
  transition: transform .12s, box-shadow .2s;
}
.shop-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(192, 96, 32, 0.55); }
.shop-btn:active { transform: scale(.96); }
.shop-btn.wide { width: 100%; justify-content: center; margin-top: 14px; }
.decor-open-btn { background: linear-gradient(135deg, #23b89a, #167a83); border-color: rgba(150,255,225,.45); box-shadow: 0 6px 20px rgba(22,122,131,.42); }
.decor-open-btn:hover { box-shadow: 0 10px 26px rgba(22,122,131,.55); }
.decor-btn-icon { font-size: 21px; line-height: 1; font-style: normal; }

.decor-mode-bar {
  position: fixed; left: 50%; bottom: 106px; transform: translateX(-50%); z-index: 55;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 24px);
  padding: 10px 12px 10px 18px; border-radius: 999px;
  color: #fff; font-size: 14px; font-weight: 600;
  background: rgba(8, 34, 54, .92); border: 1px solid rgba(125, 255, 214, .62);
  box-shadow: 0 10px 34px rgba(0,0,0,.42), 0 0 20px rgba(75,226,190,.2);
}
.decor-mode-bar.hidden { display: none; }
.decor-mode-bar button { border: 0; border-radius: 999px; padding: 7px 12px; cursor: pointer; font: inherit; color: #fff; background: #d63031; }

/* feed hint */
.hint-pill {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(8,22,48,.85); border: 1px solid var(--line-strong);
  color: #fff; padding: 12px 22px; border-radius: 999px; font-size: 15px;
  box-shadow: var(--glow); z-index: 30; animation: floatHint 2.4s ease-in-out infinite;
  pointer-events: none;
}
.hint-pill.hidden { display: none; }
@keyframes floatHint { 0%,100% { transform: translate(-50%,-52%); } 50% { transform: translate(-50%,-46%); } }

/* fish conversations — one lightweight DOM bubble shared by every fish */
.fish-dialogue {
  position: fixed; left: 0; top: 0; z-index: 28; width: max-content; max-width: min(210px, 45vw);
  padding: 6px 9px 7px; border: 1px solid rgba(142,238,231,.65); border-radius: 12px;
  color: #fff; background: rgba(7,30,61,.94); box-shadow: 0 6px 18px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.08);
  pointer-events: none; will-change: transform;
  transition: transform .11s linear, opacity .16s ease;
}
.fish-dialogue.hidden { display: none; }
.fish-dialogue-speaker { color: #8deee2; font-size: 8.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fish-dialogue-text { margin-top: 1px; font-size: 10.5px; font-weight: 500; line-height: 1.35; }
.fish-dialogue > i { position: absolute; left: 50%; bottom: -6px; width: 11px; height: 11px; transform: translateX(-50%) rotate(45deg); border-right: 1px solid rgba(142,238,231,.65); border-bottom: 1px solid rgba(142,238,231,.65); background: rgba(7,30,61,.94); }
.fish-dialogue.below > i { top: -6px; bottom: auto; border: 0; border-left: 1px solid rgba(142,238,231,.65); border-top: 1px solid rgba(142,238,231,.65); }
.ios-mobile .fish-dialogue { box-shadow: 0 4px 12px rgba(0,0,0,.34); transform-style: preserve-3d; }

/* ── toasts ──────────────────────────────── */
#toasts { position: fixed; top: 128px; left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line-strong);
  color: #fff; font-size: 14px; font-weight: 600; padding: 10px 20px;
  border-radius: 999px; box-shadow: var(--glow);
  animation: toastIn .3s ease, toastOut .4s ease 2.4s forwards;
}
.toast.gold { border-color: rgba(255,209,102,.6); color: var(--gold); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ── overlays & modal ────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 12, 30, 0.72); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 14px;
}
.overlay.hidden { display: none; }
.modal {
  background:
    radial-gradient(120% 90% at 18% 0%, rgba(96, 168, 232, 0.22), transparent 55%),
    radial-gradient(130% 100% at 100% 100%, rgba(247, 113, 159, 0.12), transparent 55%),
    linear-gradient(180deg, #16305f, #0c1e42);
  border: 1px solid var(--line-strong); border-radius: 26px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08);
  padding: 18px; width: min(860px, 100%); max-height: 92vh;
  display: flex; flex-direction: column;
  animation: modalIn .25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.92) translateY(10px); } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.modal-kicker { font-size: 10px; letter-spacing: .2em; color: var(--txt-dim); font-weight: 600; }
.modal-title { font-size: 24px; font-weight: 700; }
.close-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: #d63031; color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(214,48,49,.4); transition: transform .12s;
}
.close-btn:hover { transform: scale(1.08); }
.close-btn.small { width: 28px; height: 28px; font-size: 12px; }
.modal-balance { display: flex; gap: 10px; margin: 12px 0 14px; }
.shop-main-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.tank-tabs { grid-template-columns: repeat(3, 1fr); }
.shop-main-tabs button {
  border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px;
  cursor: pointer; font: inherit; font-weight: 700; font-size: 15px;
  color: var(--txt-dim); background: rgba(255,255,255,.06);
  transition: border-color .15s, background .15s, transform .12s;
}
.shop-main-tabs button:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.shop-main-tabs button.active { color: #fff; border-color: rgba(125,205,255,.62); background: linear-gradient(135deg, rgba(45,126,210,.55), rgba(23,94,155,.45)); }
#fishShopPanel.hidden, #decorShopPanel.hidden, #equipmentShopPanel.hidden, #inventoryShopPanel.hidden { display: none; }
#fishShopPanel, #decorShopPanel, #equipmentShopPanel, #inventoryShopPanel { min-height: 0; overflow: hidden; flex: 1; flex-direction: column; }
#fishShopPanel:not(.hidden), #decorShopPanel:not(.hidden), #equipmentShopPanel:not(.hidden), #inventoryShopPanel:not(.hidden) { display: flex; }
#fishShopPanel .shop-grid, #decorShopPanel .shop-grid, #equipmentShopPanel .shop-grid, #inventoryShopPanel .shop-grid { flex: 1; min-height: 0; }
.decor-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.decor-tabs button { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; cursor: pointer; font: inherit; font-weight: 700; color: var(--txt-dim); background: rgba(255,255,255,.06); }
.decor-tabs button.active { color: #fff; border-color: rgba(125,255,214,.55); background: linear-gradient(135deg, rgba(35,184,154,.42), rgba(22,122,131,.35)); }
.decor-card .decor-art { height: 130px; }
.decor-card .decor-art img { width: 138px; height: 138px; }
.decor-card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }
.decor-card-actions .release-btn { margin: 0; padding: 9px; }
.decor-empty { grid-column: 1 / -1; text-align: center; color: var(--txt-dim); padding: 50px 20px; border: 1px dashed var(--line); border-radius: 18px; }
.inventory-heading { grid-column: 1 / -1; color: #8ff3df; font-size: 13px; letter-spacing: .08em; margin: 5px 2px -3px; }
.equipment-modal { width: min(470px, 100%); }
.equipment-summary { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 16px; margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(4,17,42,.42); }
.equipment-summary img { width: 150px; height: 150px; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(0,0,0,.45)); }
.equipment-summary div { display: flex; flex-direction: column; gap: 6px; }
.equipment-summary b { color: var(--gold); font-size: 22px; }
.equipment-summary span { color: #a5f3dc; font-weight: 700; }
.equipment-summary small { color: var(--txt-dim); }
.equipment-modal > .decor-card-actions { margin-top: 10px; gap: 10px; }
.equipment-modal > #equipmentUpgrade { min-height: 42px; }
.equipment-modal > .decor-card-actions > button { min-height: 42px; }
@media (max-width: 620px) {
  .shop-main-tabs { grid-template-columns: repeat(2, 1fr); }
  .tank-tabs { grid-template-columns: repeat(3, 1fr); }
  .shop-main-tabs button { padding: 8px 6px; font-size: 12px; }
  .equipment-summary { grid-template-columns: 105px 1fr; }
  .equipment-summary img { width: 105px; height: 105px; }
}

/* shop grid */
.shop-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px; overflow-y: auto; padding: 4px 4px 8px;
}
.shop-grid::-webkit-scrollbar { width: 8px; }
.shop-grid::-webkit-scrollbar-thumb { background: rgba(125,205,255,.3); border-radius: 99px; }
.shop-card {
  background:
    radial-gradient(120% 80% at 30% 0%, rgba(90, 160, 226, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(24, 50, 98, 0.92), rgba(12, 28, 62, 0.92));
  border: 1px solid var(--line); border-radius: 22px;
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--paint);
  transition: transform .15s, border-color .2s; position: relative;
}
.shop-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.shop-card.legendary { border-color: rgba(255,209,102,.7); box-shadow: 0 0 22px rgba(255,209,102,.18); }
.shop-card .rarity {
  position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 700;
  padding: 2px 9px; border-radius: 99px;
}
.rarity.common { background: rgba(125,205,255,.2); color: #9fe0ff; }
.rarity.special { background: rgba(46,204,113,.2); color: #7fe8ae; }
.rarity.epic { background: rgba(167,139,250,.22); color: #c4b5fd; }
.rarity.legendary { background: rgba(255,209,102,.22); color: var(--gold); }
.shop-card .fish-art { height: 74px; display: grid; place-items: center; }
.shop-card .fish-art img { width: 112px; height: 84px; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(0,0,0,.55)); }
.shop-card .fish-art img.shop-face-left { transform: scaleX(-1); }
.shop-card.legendary .fish-art img { filter: drop-shadow(0 0 16px rgba(255,209,102,.5)); }
.shop-card.owned .fish-art img { opacity: .85; }
.shop-card .sc-name { font-size: 16px; font-weight: 700; text-align: center; }
.shop-card .sc-meta { font-size: 11.5px; color: var(--txt-dim); text-align: center; line-height: 1.5; }
.shop-card .sc-meta b { color: var(--gold); }
.shop-card .sc-income { display: block; margin-top: 5px; color: #b9f7dc; font-weight: 700; }
.shop-card .sc-income.utility { color: #82e9f5; }
.shop-card .sc-income-coin { width: 14px; height: 14px; vertical-align: -2px; margin-left: 2px; }
.buy-btn {
  margin-top: auto; border: none; border-radius: 12px; padding: 10px; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--orange-d));
  display: flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 4px 12px rgba(241,95,46,.35); transition: transform .12s, filter .2s;
}
.buy-btn:hover { transform: translateY(-2px); }
.buy-btn:disabled { filter: grayscale(.7) brightness(.75); cursor: not-allowed; transform: none; }
.buy-btn.gem-btn { background: linear-gradient(135deg, #ff7eb3, #c9184a); box-shadow: 0 4px 12px rgba(201,24,74,.35); }
.buy-btn.purchase-ok, .buy-btn.gem-btn.purchase-ok { color: #eafff3; background: linear-gradient(135deg,#35cc78,#188e56); box-shadow: 0 4px 14px rgba(37,196,112,.38); filter: none; }
.buy-btn.owned-btn { background: linear-gradient(135deg, #2ecc71, #1d9e4b); box-shadow: 0 4px 12px rgba(46,204,113,.3); }
.buy-btn img { width: 17px; height: 17px; }

/* ── fish info popup ─────────────────────── */
.fish-info {
  position: fixed; z-index: 45; width: 240px;
  background:
    radial-gradient(120% 80% at 25% 0%, rgba(96, 168, 232, 0.2), transparent 60%),
    var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: 22px; padding: 12px; box-shadow: var(--glow), var(--paint);
  backdrop-filter: blur(10px);
  animation: modalIn .18s ease;
}
.fish-info.hidden { display: none; }
.fi-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.fi-head img { width: 60px; height: 46px; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)); }
.fi-name { font-weight: 700; font-size: 15px; }
.fi-sub { font-size: 11px; color: var(--txt-dim); }
.fi-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 4px 0; color: var(--txt-dim); }
.fi-row b { color: var(--txt); font-weight: 600; }
.bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; margin: 4px 0; }
.release-btn {
  width: 100%; margin-top: 10px; padding: 9px; border-radius: 12px;
  border: 1px solid rgba(214,48,49,.6); background: rgba(214,48,49,.15);
  color: #ff9a9a; font-family: inherit; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.release-btn:hover { background: rgba(214,48,49,.3); }

/* ── quest / stage modal ─────────────────── */
.quest-modal { width: min(560px, 100%); }
/* campaign progress dots */
.stage-dots { display: flex; gap: 7px; align-items: center; margin: 10px 0 2px; }
.stage-dots .dot {
  width: 18px; height: 6px; border-radius: 99px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.08);
  transition: all .3s;
}
.stage-dots .dot.done { background: linear-gradient(90deg, #2ecc71, #7fe8ae); }
.stage-dots .dot.cur {
  background: linear-gradient(90deg, #4cc9f0, #7dffd4);
  box-shadow: 0 0 10px rgba(77,201,240,.7); width: 30px;
}
.quest-desc { color: var(--txt-dim); font-size: 13px; margin: 2px 0 12px; }
.quest-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 2px; }
.quest-item {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(24, 50, 98, 0.85), rgba(12, 28, 62, 0.85));
  border: 1px solid var(--line); border-radius: 16px; padding: 9px 12px;
  transition: border-color .25s, transform .15s;
}
.quest-item:hover { transform: translateY(-1px); }
.quest-item.done { border-color: rgba(46,204,113,.55); background: linear-gradient(180deg, rgba(20,60,40,.55), rgba(12,40,30,.55)); }
.quest-item .q-icon { font-size: 20px; text-align: center; }
.quest-item .q-icon.chip {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 18px;
}
.quest-item .q-body { flex: 1; min-width: 0; }
.quest-item .q-title { font-size: 13.5px; font-weight: 600; }
.quest-item .q-sub { font-size: 11px; color: var(--txt-dim); margin-top: 2px; }
.quest-item .q-bar { height: 7px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; margin-top: 5px; }
.quest-item .q-bar i { display: block; height: 100%; background: linear-gradient(90deg, #4cc9f0, #7dffd4); border-radius: 99px; transition: width .35s; }
.quest-item .q-num { font-size: 11px; color: var(--txt-dim); min-width: 52px; text-align: right; font-weight: 600; }
.quest-item.done .q-num { color: #7fe8ae; }
.quest-item .q-check { font-size: 15px; min-width: 18px; text-align: center; }
.quest-reward {
  position: relative; overflow: hidden; margin-top: 12px; padding: 13px; border-radius: 17px;
  border: 1px solid rgba(255,209,102,.58);
  background: radial-gradient(circle at 85% 20%,rgba(255,209,102,.2),transparent 34%), linear-gradient(135deg,rgba(76,55,23,.55),rgba(15,35,73,.9));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.09), 0 8px 24px rgba(0,0,0,.2);
  color: var(--gold); text-align: left;
}
.reward-heading { display: flex; align-items: center; gap: 9px; }
.reward-heading > span { font-size: 25px; filter: drop-shadow(0 0 9px rgba(255,209,102,.5)); }
.reward-heading div { display: flex; flex-direction: column; line-height: 1.15; }
.reward-heading small { color: #d9c993; font-size: 9px; }
.reward-heading b { color: #fff1ae; font-size: 15px; }
.reward-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.reward-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; background: rgba(4,18,42,.48); color: #fff; font-size: 10.5px; font-weight: 600; }
.reward-chip img { width: 17px; height: 17px; }
.reward-fish { position: relative; display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px 12px; overflow: hidden; border: 1px solid rgba(125,232,174,.38); border-radius: 14px; background: rgba(7,29,55,.62); }
.reward-fish-glow { position: absolute; left: 13px; width: 62px; height: 62px; border-radius: 50%; background: rgba(125,232,174,.26); filter: blur(12px); }
.reward-fish > img { position: relative; width: 82px; height: 58px; object-fit: contain; filter: drop-shadow(0 5px 8px rgba(0,0,0,.5)); }
.reward-fish > span { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.reward-fish small { color: #8deee2; font-size: 9px; }
.reward-fish b { color: #fff; font-size: 13px; }
.reward-fish p { margin-top: 3px; color: #bdd0e4; font-size: 9.5px; line-height: 1.4; }
.reward-fish-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.reward-fish em { width: max-content; padding: 2px 7px; border-radius: 99px; background: rgba(255,209,102,.16); color: var(--gold); font-size: 8.5px; font-style: normal; }
.reward-fish em.income { background: rgba(125,232,174,.12); color: #9cebc9; }
.quest-btn { position: relative; }
.quest-btn.has-new::after {
  content: ""; position: absolute; top: -2px; right: -2px; width: 9px; height: 9px;
  border-radius: 50%; background: #ffd166; box-shadow: 0 0 8px rgba(255,209,102,.8);
}

/* ── game-over modal ─────────────────────── */
.gameover-modal { width: min(360px, 100%); text-align: center; padding: 30px 24px; }
.gameover-icon {
  font-size: 56px; line-height: 1; margin-bottom: 10px;
  animation: gameoverShake 1.6s ease infinite;
}
@keyframes gameoverShake {
  0%, 100% { transform: rotate(0) scale(1); }
  25% { transform: rotate(-8deg) scale(1.08); }
  75% { transform: rotate(8deg) scale(1.08); }
}
.gameover-title {
  font-size: 30px; font-weight: 900; letter-spacing: 2px;
  background: linear-gradient(90deg, #ff5f6d, #ffc371);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 26px rgba(255,95,109,.35);
}
.gameover-desc { color: var(--txt-dim); font-size: 13.5px; margin: 10px 0 20px; line-height: 1.6; }
.gameover-modal .shop-btn { margin-top: 10px; }
.shop-btn.ghost {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
}
.shop-btn.ghost:hover { background: rgba(255,255,255,.16); }
.shop-btn:disabled {
  opacity: .45; cursor: not-allowed;
  filter: saturate(.4);
}
.shop-btn:disabled:hover { transform: none; }

/* ── confirm (restart) modal ─────────────── */
.confirm-modal { width: min(340px, 100%); text-align: center; padding: 26px 22px; }
.confirm-icon {
  font-size: 44px; line-height: 1; margin-bottom: 8px;
  animation: confirmPop .35s ease;
}
@keyframes confirmPop { from { transform: scale(.5) rotate(-14deg); opacity: 0; } }
.confirm-title { font-size: 20px; font-weight: 700; }
.confirm-desc { color: var(--txt-dim); font-size: 13px; margin: 6px 0 18px; }
.confirm-btns { display: flex; gap: 10px; }
.confirm-btn {
  flex: 1; padding: 12px; border-radius: 14px; border: none; cursor: pointer;
  font-family: inherit; font-weight: 700; font-size: 14px; color: #fff;
  transition: transform .12s, filter .2s;
}
.confirm-btn:hover { transform: translateY(-2px); }
.confirm-btn.cancel {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
}
.confirm-btn.ok {
  background: linear-gradient(135deg, var(--orange), var(--orange-d));
  box-shadow: 0 4px 14px rgba(241,95,46,.35);
}

/* ── start / help modal ──────────────────── */
.help-modal { width: min(520px, 100%); }
.start-modal { padding: 26px 22px 20px; }
.start-hero { text-align: center; margin-bottom: 14px; }
.start-logo {
  width: min(300px, 78vw); height: auto; object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(14,110,190,.5)); animation: bob 3s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.start-title {
  font-size: 30px; font-weight: 700; letter-spacing: .06em; margin-top: 8px;
  background: linear-gradient(180deg, #fff 20%, #9fe8ff 55%, #4cc9f0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 8px rgba(76,201,240,.45));
}
.start-sub { color: var(--txt-dim); font-size: 14px; margin-top: 2px; }
.help-body { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.help-item { display: flex; gap: 12px; align-items: flex-start; }
.help-num {
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #4cc9f0, #3a86ff); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.help-item p { font-size: 14px; color: #d7e7f7; line-height: 1.6; }

/* ── level-up banner ─────────────────────── */
#lvBanner {
  position: fixed; inset: 0; z-index: 55; display: grid; place-items: center;
  pointer-events: none;
}
#lvBanner.hidden { display: none; }
.lv-banner-card {
  text-align: center; padding: 18px 40px 22px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(24,52,105,.95), rgba(12,28,62,.95));
  border: 2px solid rgba(255,209,102,.7);
  box-shadow: 0 0 60px rgba(255,209,102,.35), 0 18px 50px rgba(0,0,0,.6);
  animation: bannerPop .4s cubic-bezier(.2,1.4,.4,1);
}
@keyframes bannerPop { from { transform: scale(.5); opacity: 0; } }
.lv-banner-card img { width: 110px; height: 84px; object-fit: contain; margin: 6px 0 2px;
  filter: drop-shadow(0 0 18px rgba(255,209,102,.8)); }
.lv-kicker { font-size: 12px; letter-spacing: .2em; color: var(--gold); font-weight: 600; }
.lv-name { font-size: 20px; font-weight: 700; }
.lv-level { font-size: 26px; font-weight: 700; color: var(--gold);
  text-shadow: 0 0 18px rgba(255,209,102,.6); }

/* ── loading screen ──────────────────────── */
#loading {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: linear-gradient(180deg, #0e3f86, #0b2f6e);
  transition: opacity .4s;
}
#loading.hidden { display: none; }
#loading[style*="display: none"] { opacity: 0; }
.loading-inner {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  font-size: 30px;
}
.loading-inner span { font-size: 14px; color: #cfe9ff; font-weight: 500; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }

/* ── Ocean Journey / Story Mode ─────────── */
.adventure-root { position: fixed; inset: 0; z-index: 120; color: #fff; font-family: "Prompt", sans-serif; }
.adventure-root.hidden { display: none; }
.mode-select-screen { position: relative; isolation: isolate; min-height: 100%; display: grid; place-items: center; padding: 22px; overflow: auto; background: radial-gradient(circle at 50% 5%, rgba(69,224,238,.48), transparent 34%), radial-gradient(circle at 8% 84%, rgba(37,131,188,.32), transparent 28%), radial-gradient(circle at 92% 78%, rgba(105,72,204,.33), transparent 30%), linear-gradient(160deg, #092d5a, #06162f 66%, #130d39); }
.mode-select-screen::before, .mode-select-screen::after { content: ""; position: fixed; z-index: -1; pointer-events: none; }
.mode-select-screen::before { inset: auto -8% -17% -8%; height: 42%; opacity: .58; background: radial-gradient(ellipse at 15% 100%, #174e78 0 25%, transparent 26%), radial-gradient(ellipse at 82% 100%, #214a87 0 24%, transparent 25%), linear-gradient(0deg, rgba(2,13,35,.92), transparent); }
.mode-select-screen::after { width: 480px; height: 480px; right: -190px; top: -190px; border: 1px solid rgba(145,244,238,.12); border-radius: 50%; box-shadow: 0 0 0 70px rgba(122,229,237,.025), 0 0 0 145px rgba(122,229,237,.02); }
.mode-rays { position: fixed; z-index: -1; inset: -30% 5% 20%; opacity: .32; pointer-events: none; background: conic-gradient(from 154deg at 50% 0%, transparent 0 8deg, rgba(158,244,255,.32) 9deg 14deg, transparent 15deg 28deg, rgba(158,244,255,.18) 29deg 35deg, transparent 36deg 52deg, rgba(158,244,255,.24) 53deg 58deg, transparent 59deg); mask-image: linear-gradient(#000, transparent 88%); }
.mode-select-shell { position: relative; z-index: 2; width: min(920px, 100%); }
.mode-title { text-align: center; margin-bottom: 24px; }
.mode-logo { display: block; width: clamp(210px, 27vw, 330px); height: auto; margin: 0 auto 6px; filter: drop-shadow(0 10px 22px rgba(0,0,0,.38)); }
.mode-title small, .adventure-topbar small, .battle-head small, .adventure-panel-head small { color: #8deee2; letter-spacing: .18em; font-weight: 700; }
.mode-title h1 { font-size: clamp(28px, 4vw, 46px); margin: 4px 0; }
.mode-title p { color: #bcd1e8; }
.mode-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.mode-card { position: relative; isolation: isolate; overflow: hidden; min-height: 245px; padding: 28px; border: 1px solid rgba(151,219,255,.35); border-radius: 28px; color: #fff; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 22px; transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease; box-shadow: inset 0 1px rgba(255,255,255,.13), 0 22px 50px rgba(0,0,0,.32); }
.mode-card:hover { transform: translateY(-6px); border-color: #8deee2; }
.aquarium-mode { background: linear-gradient(145deg, rgba(18,101,142,.96), rgba(11,49,94,.96)); }
.story-mode { background: linear-gradient(145deg, rgba(81,55,157,.96), rgba(22,45,105,.96)); }
.mode-card-glow { position: absolute; z-index: -1; width: 220px; height: 220px; right: -80px; top: -90px; border-radius: 50%; opacity: .34; background: radial-gradient(circle, rgba(116,246,231,.9), transparent 68%); transition: transform .35s ease, opacity .35s ease; }
.story-mode .mode-card-glow { background: radial-gradient(circle, rgba(193,142,255,.9), transparent 68%); }
.mode-card:hover .mode-card-glow { opacity: .55; transform: scale(1.16); }
.mode-card-icon { font-size: 68px; filter: drop-shadow(0 8px 15px rgba(0,0,0,.35)); }
.mode-card span:last-child { display: flex; flex-direction: column; }
.mode-card b { color: #8deee2; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.mode-card strong { font-size: 25px; margin: 2px 0 8px; }
.mode-card small { color: #d0e0f2; font-size: 13px; line-height: 1.6; }
.mode-card em { align-self: flex-start; margin-top: 18px; padding: 7px 13px; border-radius: 99px; color: #eaffff; background: rgba(3,25,58,.38); border: 1px solid rgba(184,246,245,.2); font-size: 11px; font-style: normal; font-weight: 700; }
.mode-card em i { display: inline-block; margin-left: 4px; font-size: 17px; font-style: normal; line-height: 0; transition: transform .2s ease; }
.mode-card:hover em i { transform: translateX(4px); }
.mode-foot { width: fit-content; margin: 18px auto 0; padding: 7px 14px; border-radius: 99px; color: #9db9d3; background: rgba(2,18,45,.42); border: 1px solid rgba(141,238,226,.12); font-size: 11px; text-align: center; }
.mode-bubbles { position: fixed; z-index: 0; inset: 0; overflow: hidden; pointer-events: none; }
.mode-bubbles i { position: absolute; bottom: -45px; width: 13px; height: 13px; border: 1px solid rgba(178,247,255,.58); border-radius: 50%; box-shadow: inset 2px 2px rgba(255,255,255,.17); animation: modeBubble 11s linear infinite; }
.mode-bubbles i:nth-child(1) { left: 7%; animation-delay: -3s; }
.mode-bubbles i:nth-child(2) { left: 21%; width: 7px; height: 7px; animation-delay: -7s; animation-duration: 9s; }
.mode-bubbles i:nth-child(3) { left: 39%; width: 19px; height: 19px; animation-delay: -1s; animation-duration: 14s; }
.mode-bubbles i:nth-child(4) { left: 64%; width: 9px; height: 9px; animation-delay: -9s; }
.mode-bubbles i:nth-child(5) { left: 81%; width: 16px; height: 16px; animation-delay: -5s; animation-duration: 13s; }
.mode-bubbles i:nth-child(6) { left: 94%; width: 6px; height: 6px; animation-delay: -2s; animation-duration: 8s; }
@keyframes modeBubble { from { transform: translate3d(0,0,0); opacity: 0; } 12% { opacity: .72; } to { transform: translate3d(24px,-110vh,0); opacity: 0; } }
.world-map-screen { background: #071b3b; }
.adventure-topbar, .battle-head { height: 68px; padding: 9px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: rgba(5,25,57,.94); border-bottom: 1px solid rgba(141,238,226,.3); }
.adventure-topbar button, .battle-head button, .adventure-panel-head button { border: 1px solid rgba(141,238,226,.35); background: rgba(17,61,103,.8); color: #fff; border-radius: 13px; padding: 9px 13px; cursor: pointer; }
.adventure-topbar div, .battle-head div { display: flex; flex-direction: column; text-align: center; }
.adventure-topbar > span, .battle-head > span { color: #ffd166; font-size: 12px; font-weight: 700; }
.world-map { position: absolute; inset: 68px 0 0; overflow: hidden; background: #073258; }
.world-map::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(5,21,48,.08), rgba(4,15,40,.18)); }
.world-map-art { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); }
.world-map-art > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-route { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.map-route path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.map-route-shadow { stroke: rgba(3,22,49,.46); stroke-width: 9px; }
.map-route-dots { stroke: #fff2c4; stroke-width: 6px; stroke-dasharray: 1 15; filter: drop-shadow(0 2px 2px rgba(0,0,0,.48)); }
.map-node { position: absolute; z-index: 2; transform: translate(-50%,-50%); min-width: 55px; border: 0; background: none; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; filter: drop-shadow(0 6px 8px rgba(0,0,0,.5)); }
.map-node > span { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(#ffde75,#ef8d28); border: 4px solid #fff2ba; box-shadow: 0 0 0 4px rgba(10,41,83,.58), 0 0 24px rgba(255,209,102,.8); font-size: 13px; font-weight: 800; }
.map-node small { margin-top: 7px; padding: 3px 8px; border-radius: 10px; white-space: nowrap; background: rgba(4,24,54,.86); font-weight: 600; }
.map-node.locked { opacity: .74; cursor: not-allowed; }
.map-node.locked > span { background: #536680; box-shadow: 0 0 0 4px rgba(10,41,83,.58); }
.map-node.cleared > span { background: linear-gradient(#83efc3,#20aa70); }
.map-node.open { animation: mapPulse 2s ease-in-out infinite; }
@keyframes mapPulse { 50% { filter: drop-shadow(0 6px 12px rgba(255,220,92,.9)); } }
.map-hint { position: absolute; z-index: 2; left: 18px; bottom: 18px; padding: 12px 16px; border-radius: 16px; display: flex; flex-direction: column; background: rgba(4,24,54,.88); border: 1px solid rgba(141,238,226,.35); }
.map-hint span { color: #bcd1e8; font-size: 12px; }
.team-select-screen { display: grid; place-items: center; padding: 18px; background: linear-gradient(rgba(4,20,46,.78), rgba(4,14,38,.94)), url("assets/adventure/world-map-v1.png") center/cover; }
.adventure-panel { width: min(930px, 100%); max-height: calc(100vh - 36px); padding: 18px; border-radius: 25px; background: rgba(8,31,70,.96); border: 1px solid rgba(141,238,226,.35); box-shadow: 0 28px 70px rgba(0,0,0,.5); display: flex; flex-direction: column; }
.adventure-panel-head { display: grid; grid-template-columns: 110px 1fr 70px; align-items: center; text-align: center; gap: 10px; }
.adventure-panel-head h2 { margin: 1px 0; }
.adventure-panel-head > span { color: #ffd166; font-size: 20px; font-weight: 700; }
.team-summary { margin: 12px 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.team-summary span { padding: 6px 11px; border-radius: 12px; background: rgba(54,95,151,.45); font-size: 12px; }
.team-summary b { color: #ffd166; }
.adventure-roster { min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; padding: 5px; }
.adventure-fish-card { min-width: 0; padding: 9px; color: #fff; border: 1px solid rgba(142,177,221,.28); border-radius: 16px; background: rgba(23,54,105,.72); cursor: pointer; display: grid; grid-template-columns: 58px 1fr; align-items: center; text-align: left; gap: 7px; }
.adventure-fish-card.selected { border-color: #71efc6; background: rgba(21,114,112,.52); box-shadow: inset 0 0 0 2px rgba(113,239,198,.24); }
.adventure-fish-card img { width: 58px; height: 48px; object-fit: contain; }
.adventure-fish-card span { min-width: 0; display: flex; flex-direction: column; }
.adventure-fish-card b, .adventure-fish-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adventure-fish-card small { color: #a9c3df; font-size: 10px; }
.adventure-fish-card em { grid-column: 1/-1; color: #ffd166; font-size: 11px; font-style: normal; text-align: center; }
.adventure-primary { margin: 14px auto 0; min-width: 230px; padding: 12px 20px; border: 0; border-radius: 15px; color: #fff; font: 700 15px "Prompt", sans-serif; cursor: pointer; background: linear-gradient(135deg,#f29b38,#df5a20); box-shadow: 0 8px 20px rgba(224,91,34,.35); }
.adventure-primary:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.empty-team { grid-column: 1/-1; text-align: center; color: #bcd1e8; }
.battle-screen { background: #08254a; }
.battle-arena { position: absolute; inset: 0; background-size: cover; background-position: center; overflow: hidden; }
.battle-head { position: absolute; z-index: 4; inset: 0 0 auto; }
.battle-message { position: absolute; z-index: 4; top: 82px; left: 50%; transform: translateX(-50%); padding: 9px 17px; border-radius: 14px; background: rgba(5,27,59,.9); border: 1px solid rgba(255,209,102,.5); font-weight: 700; white-space: nowrap; }
.battle-allies { position: absolute; left: 7%; top: 28%; bottom: 9%; width: 42%; display: flex; align-items: center; justify-content: space-around; gap: 10px; }
.battle-unit { width: 135px; padding: 9px; border-radius: 16px; text-align: center; background: rgba(5,31,68,.82); border: 1px solid rgba(141,238,226,.42); transition: .2s; }
.battle-unit img { width: 110px; height: 78px; object-fit: contain; }
.battle-unit b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; }
.battle-unit small { color: #d1e3f4; font-size: 10px; }
.battle-unit.enemy { position: absolute; right: 12%; top: 42%; width: 170px; border-color: rgba(255,109,107,.65); }
.battle-unit.enemy img { width: 145px; transform: scaleX(-1); filter: hue-rotate(145deg) saturate(1.35) brightness(.72); }
.battle-hp { display: block; height: 7px; margin-top: 5px; overflow: hidden; border-radius: 7px; background: rgba(0,0,0,.45); }
.battle-hp i { display: block; height: 100%; background: linear-gradient(90deg,#28c67a,#8df0bf); transition: width .35s; }
.enemy-hp i { background: linear-gradient(90deg,#ff625f,#ffad68); }
.battle-unit.attacking { animation: battleLunge .35s ease; }
.battle-unit.ko { opacity: .34; filter: grayscale(1); transform: translateY(18px) rotate(-6deg); }
@keyframes battleLunge { 50% { transform: translateX(18px) scale(1.08); filter: brightness(1.35); } }
.adventure-active #tank, .adventure-active #hud, .adventure-active #bottomBar { visibility: hidden; }
.interactive-battle { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M7 31 25 13l-4-4 13-4-4 13-4-4L8 32Z' fill='%23f8fbff' stroke='%23062247' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M10 28 28 10' stroke='%23ffd56a' stroke-width='2'/%3E%3Cpath d='m5 28 7 7M7 25l8 8' stroke='%23f4a62a' stroke-width='4' stroke-linecap='round'/%3E%3Ccircle cx='11' cy='29' r='2.5' fill='%235de4ff' stroke='%23062247' stroke-width='1.5'/%3E%3C/svg%3E") 7 32, crosshair; touch-action: none; }
.interactive-battle .battle-unit { position: absolute; z-index: 2; transform: translate(-50%,-50%); margin: 0; will-change: left, top, transform; pointer-events: none; }
.interactive-battle .battle-unit, .interactive-battle .battle-unit.ally, .interactive-battle .battle-unit.enemy { padding: 0; border: 0; background: transparent; box-shadow: none; }
.interactive-battle .battle-unit.ally { width: 112px; }
.interactive-battle .battle-unit b { width: fit-content; max-width: 120px; margin: -2px auto 3px; padding: 2px 8px; border-radius: 99px; color: #fff; background: rgba(5,27,59,.78); text-shadow: 0 1px 3px #00142e; }
.interactive-battle .battle-unit small { display: block; width: fit-content; margin: 2px auto 0; padding: 1px 6px; border-radius: 99px; color: #eaf7ff; background: rgba(5,27,59,.72); }
.interactive-battle .battle-hp { width: 92px; margin: 0 auto; border: 1px solid rgba(255,255,255,.62); box-shadow: 0 2px 6px rgba(0,0,0,.48); }
.battle-fish-canvas { display: block; width: 110px; height: 72px; margin: -5px auto -4px; }
.battle-fish-canvas.enemy-canvas { width: 132px; height: 82px; }
.interactive-battle .battle-unit.enemy { right: auto; width: 170px; pointer-events: auto; cursor: inherit; }
.interactive-battle .battle-unit.enemy canvas { pointer-events: none; }
.interactive-battle .battle-unit.attacking { animation: battleStrike .3s ease; }
.interactive-battle .battle-unit.hit { animation: battleHit .28s ease; }
.interactive-battle .battle-unit.moving .battle-fish-canvas { animation: battleSwim .48s ease-in-out infinite alternate; }
.battle-command-marker { position: absolute; z-index: 5; transform: translate(-50%,-50%) scale(.45); opacity: 0; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: rgba(13,58,99,.88); border: 2px solid #ffd166; box-shadow: 0 0 22px rgba(255,209,102,.65); font-size: 21px; pointer-events: none; }
.battle-command-marker.show { animation: battleCommand .58s ease-out; }
@keyframes battleStrike { 50% { transform: translate(-34%,-50%) scale(1.08); filter: brightness(1.35); } }
@keyframes battleHit { 30% { transform: translate(-50%,-50%) translateX(-7px); filter: brightness(1.5) saturate(.5); } 65% { transform: translate(-50%,-50%) translateX(5px); } }
@keyframes battleSwim { to { margin-top: -3px; } }
@keyframes battleCommand { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.35); } 28% { opacity: 1; transform: translate(-50%,-50%) scale(1.08); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.45); } }
.battle-fx { position: absolute; z-index: 6; width: 92px; height: 92px; transform: translate(-50%,-50%); pointer-events: none; }
.battle-tracer { position: absolute; z-index: 6; width: 1px; height: 1px; pointer-events: none; }
.battle-tracer .tracer-beam { position: absolute; left: 0; top: -2px; width: var(--beam-length); height: 4px; border-radius: 99px; transform: rotate(var(--beam-angle)) scaleX(0); transform-origin: left center; background: linear-gradient(90deg,rgba(77,222,255,.15),#77ecff 46%,#fff7ae 82%,transparent); box-shadow: 0 0 9px #5de5ff; animation: tracerBeam .42s ease-out forwards; }
.battle-tracer .tracer-orb { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%,#fff,#8df5ff 34%,#31bde9 67%,transparent 70%); box-shadow: 0 0 15px #55e4ff, 0 0 28px rgba(255,209,102,.72); animation: tracerTravel .42s cubic-bezier(.2,.72,.25,1) forwards; }
.battle-tracer.impact .tracer-beam { background: linear-gradient(90deg,rgba(255,112,88,.15),#ff745f 50%,#ffd0a4 82%,transparent); box-shadow: 0 0 10px #ff604c; }
.battle-tracer.impact .tracer-orb { background: radial-gradient(circle at 35% 30%,#fff,#ffb074 34%,#ff5146 67%,transparent 70%); box-shadow: 0 0 16px #ff584d, 0 0 28px rgba(255,76,65,.58); }
.battle-fx .fx-ring { position: absolute; inset: 11px; border: 3px solid #7ff4ff; border-radius: 50%; box-shadow: 0 0 17px rgba(88,232,255,.8), inset 0 0 12px rgba(88,232,255,.38); animation: fxRing .55s ease-out forwards; }
.battle-fx .fx-slash { position: absolute; left: 8px; top: 43px; width: 78px; height: 8px; border-radius: 99px; transform: rotate(-34deg) scaleX(.15); transform-origin: center; background: linear-gradient(90deg,transparent,#fff 18%,#65eaff 52%,#ffd166 82%,transparent); box-shadow: 0 0 14px #52dfff; animation: fxSlash .42s cubic-bezier(.2,.85,.25,1) forwards; }
.battle-fx b { position: absolute; left: 50%; top: 0; color: #fff2a8; font-size: 19px; text-shadow: 0 2px 3px #061a39, 0 0 10px #ff9f32; animation: fxDamage .68s ease-out forwards; }
.battle-fx .fx-spark { position: absolute; left: 45px; top: 45px; width: 7px; height: 7px; border-radius: 50%; background: #fff5a8; box-shadow: 0 0 10px #ffd166; animation: fxSpark .52s ease-out forwards; }
.battle-fx .fx-spark.s1 { --fx-x: 34px; --fx-y: -25px; }
.battle-fx .fx-spark.s2 { --fx-x: -38px; --fx-y: -11px; animation-delay: .03s; }
.battle-fx .fx-spark.s3 { --fx-x: 19px; --fx-y: 32px; animation-delay: .06s; }
.battle-fx.impact .fx-ring { border-color: #ff846f; box-shadow: 0 0 18px rgba(255,87,74,.75); }
.battle-fx.impact .fx-slash { transform: rotate(28deg) scaleX(.15); background: linear-gradient(90deg,transparent,#fff,#ff765f,transparent); box-shadow: 0 0 15px #ff604c; }
.battle-fx.impact b { color: #ffb09e; text-shadow: 0 2px 3px #31101b, 0 0 10px #ff493f; }
.battle-arena.battle-shake { animation: battleShake .25s ease-out; }
@keyframes fxRing { from { opacity: .95; transform: scale(.22); } to { opacity: 0; transform: scale(1.25); } }
@keyframes tracerBeam { 0% { opacity: 0; transform: rotate(var(--beam-angle)) scaleX(0); } 25% { opacity: .9; transform: rotate(var(--beam-angle)) scaleX(.42); } 75% { opacity: .85; transform: rotate(var(--beam-angle)) scaleX(1); } 100% { opacity: 0; transform: rotate(var(--beam-angle)) scaleX(1); } }
@keyframes tracerTravel { 0% { opacity: 0; transform: translate3d(0,0,0) scale(.45); } 18% { opacity: 1; transform: translate3d(0,0,0) scale(1.15); } 100% { opacity: 0; transform: translate3d(var(--travel-x),var(--travel-y),0) scale(.75); } }
@keyframes fxSlash { 35% { opacity: 1; transform: rotate(-34deg) scaleX(1.08); } 100% { opacity: 0; transform: rotate(-34deg) translateX(18px) scaleX(.7); } }
@keyframes fxDamage { from { opacity: 0; transform: translate(-50%,12px) scale(.7); } 28% { opacity: 1; transform: translate(-50%,-5px) scale(1.12); } to { opacity: 0; transform: translate(-50%,-34px) scale(.95); } }
@keyframes fxSpark { to { opacity: 0; transform: translate(var(--fx-x),var(--fx-y)) scale(.2); } }
@keyframes battleShake { 25% { background-position: calc(50% + 3px) center; } 55% { background-position: calc(50% - 3px) center; } }
.adventure-result { width: min(440px, calc(100% - 28px)); position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); padding: 30px; border-radius: 26px; text-align: center; background: linear-gradient(160deg,rgba(17,65,111,.98),rgba(8,30,68,.98)); border: 2px solid #ffd166; box-shadow: 0 26px 80px rgba(0,0,0,.58); }
.adventure-result .result-icon { font-size: 70px; }
.adventure-result h2 { font-size: 30px; margin: 3px 0; }
.adventure-result p { color: #c5d8ec; }
.result-rewards { display: flex; justify-content: center; gap: 10px; margin: 18px 0 4px; }
.result-rewards span { padding: 8px 15px; border-radius: 13px; color: #ffd166; background: rgba(255,209,102,.13); font-weight: 700; }

@media (max-width: 700px) {
  .mode-select-screen { align-items: start; padding: 16px 14px; }
  .mode-select-shell { margin: auto 0; }
  .mode-title { margin-bottom: 14px; }
  .mode-logo { width: min(230px, 66vw); }
  .mode-title h1 { font-size: 27px; }
  .mode-title p { max-width: 330px; margin: 5px auto 0; font-size: 12px; }
  .mode-cards { grid-template-columns: 1fr; }
  .mode-card { min-height: 142px; padding: 16px 18px; gap: 16px; border-radius: 22px; }
  .mode-card-icon { font-size: 47px; }
  .mode-card strong { font-size: 20px; }
  .mode-card small { font-size: 11px; line-height: 1.45; }
  .mode-card em { margin-top: 9px; padding: 5px 10px; }
  .mode-foot { margin-top: 12px; font-size: 9px; }
  .adventure-topbar { height: 58px; padding: 6px 9px; }
  .world-map { top: 58px; }
  .adventure-topbar > span { display: none; }
  .map-node small { font-size: 9px; }
  .adventure-roster { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .adventure-panel { max-height: calc(100vh - 16px); padding: 11px; }
  .team-summary { margin: 7px 0; }
  .battle-allies { left: 2%; width: 55%; flex-direction: column; justify-content: center; }
  .battle-unit { width: 105px; padding: 5px; }
  .battle-unit img { width: 80px; height: 50px; }
  .battle-unit.enemy { right: 5%; width: 118px; }
  .interactive-battle .battle-unit.enemy { right: auto; }
  .battle-unit.enemy img { width: 95px; height: 65px; }
  .battle-message { top: 68px; font-size: 11px; }
}

.ios-mobile .mode-rays { opacity: .18; }
.ios-mobile .mode-bubbles i:nth-child(n+4) { display: none; }
@media (prefers-reduced-motion: reduce) { .mode-bubbles i { animation: none; } .mode-card, .mode-card-glow, .mode-card em i { transition: none; } }

/* ── gacha box ───────────────────────────── */
.gacha-overlay { z-index: 90; }
.gacha-modal { width: min(460px, 100%); text-align: center; }
.gacha-box-zone { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 16px 0 6px; }
.gacha-box { position: relative; width: 128px; height: 118px; }
.gacha-lid {
  position: absolute; top: 4px; left: 8px; right: 8px; height: 30px; border-radius: 10px;
  background: linear-gradient(180deg, #ff8a5c, #e64a2e);
  box-shadow: 0 4px 14px rgba(230, 74, 46, .45), inset 0 2px 0 rgba(255, 255, 255, .3);
}
.gacha-body {
  position: absolute; top: 28px; left: 12px; right: 12px; bottom: 4px; border-radius: 10px;
  background: linear-gradient(180deg, #ffb35c, #f06a2b); display: grid; place-items: center;
  font-size: 44px; box-shadow: 0 8px 20px rgba(240, 106, 43, .4), inset 0 2px 0 rgba(255, 255, 255, .35);
}
.gacha-box.shaking { animation: gachaShake .55s ease-in-out; }
@keyframes gachaShake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(-9deg) translateX(-4px); }
  30% { transform: rotate(8deg) translateX(4px); }
  45% { transform: rotate(-6deg); }
  60% { transform: rotate(5deg); }
  75% { transform: rotate(-3deg); }
}
.gacha-shine {
  position: absolute; top: 0; left: 0; width: 42%; height: 100%; pointer-events: none;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .5), transparent);
  transform: skewX(-20deg); animation: gachaShine 2.2s ease-in-out infinite;
}
@keyframes gachaShine { 0%, 55% { left: -45%; } 100% { left: 110%; } }
.gacha-spark {
  position: absolute; width: 7px; height: 7px; border-radius: 50%; pointer-events: none;
  background: #ffe28a; box-shadow: 0 0 10px #ffd166; animation: gachaSpark 1.6s ease-in-out infinite;
}
.gacha-spark.s1 { top: 6px; right: 4px; animation-delay: .2s; }
.gacha-spark.s2 { bottom: 12px; left: -2px; animation-delay: .7s; }
.gacha-spark.s3 { top: 42%; right: -6px; animation-delay: 1.1s; }
@keyframes gachaSpark { 0%, 100% { transform: scale(.6); opacity: .4; } 50% { transform: scale(1.3); opacity: 1; } }
.gacha-tip { font-size: 12px; color: var(--txt-dim); }
.gacha-pool { display: flex; gap: 10px; justify-content: center; margin: 14px 0 4px; }
.gacha-pool-card {
  flex: 1; max-width: 130px; border-radius: 16px; padding: 10px 6px 8px;
  background: linear-gradient(180deg, rgba(24, 50, 98, .92), rgba(12, 28, 62, .92));
  border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.gacha-pool-card img { width: 72px; height: 56px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .55)); }
.gacha-pool-card .gpc-name { font-size: 12.5px; font-weight: 700; }
.gacha-pool-card .gpc-odds { font-size: 11px; color: var(--txt-dim); }
.gacha-pool-card .rarity { font-size: 9.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.gacha-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 12px; }
.roll-btn { font-size: 17px; padding: 13px 36px; }
.roll-btn:disabled { filter: grayscale(.7) brightness(.75); cursor: not-allowed; transform: none; }
.gacha-rolls { font-size: 12px; color: var(--txt-dim); }
.gacha-skip { background: none; border: none; color: var(--txt-dim); font-family: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 10px; }
.gacha-skip:hover { color: #fff; }

/* result card */
.gacha-result { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; }
.gacha-result.hidden { display: none; }
.gacha-result-card {
  width: min(330px, 90vw); border-radius: 24px; padding: 24px 20px; text-align: center; position: relative;
  background: linear-gradient(180deg, #16305f, #0c1e42); border: 2px solid var(--line-strong);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .65); overflow: hidden;
}
.gacha-result-card .grc-glow { position: absolute; inset: 0; opacity: .4; pointer-events: none; }
.gacha-result-card .grc-rarity { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 14px; border-radius: 99px; position: relative; }
.gacha-result-card img.grc-img { width: 168px; height: 126px; object-fit: contain; margin: 8px auto 4px; display: block; position: relative; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .65)); }
.gacha-result-card .grc-name { font-size: 23px; font-weight: 700; position: relative; }
.gacha-result-card .grc-desc { font-size: 12.5px; color: var(--txt-dim); margin: 6px 0 14px; line-height: 1.5; position: relative; }
.gacha-result-card.pop { animation: gachaPop .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes gachaPop { from { transform: scale(.3) rotate(-5deg); opacity: 0; } }
.gacha-result-card.glow-common .grc-glow { background: radial-gradient(85% 85% at 50% 28%, rgba(125, 205, 255, .85), transparent 72%); }
.gacha-result-card.glow-special .grc-glow { background: radial-gradient(85% 85% at 50% 28%, rgba(46, 204, 113, .85), transparent 72%); }
.gacha-result-card.glow-epic .grc-glow { background: radial-gradient(85% 85% at 50% 28%, rgba(167, 139, 250, .95), transparent 72%); }
.gacha-result-card.glow-legendary .grc-glow { background: radial-gradient(85% 85% at 50% 28%, rgba(255, 209, 102, .95), transparent 72%); }

/* ── multiple aquariums ─────────────────── */
.tank-open-btn { background: linear-gradient(135deg, #28a6a0, #17677f); border-color: rgba(142,255,241,.38); box-shadow: 0 6px 20px rgba(10,92,104,.42); }
.tank-btn-icon { font-size: 20px; line-height: 1; }
.tank-modal { width: min(860px, 100%); }
.tank-panel { min-height: 250px; overflow-y: auto; padding: 2px; }
.tank-panel.hidden { display: none; }
.tank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tank-card, .scene-card {
  background: linear-gradient(180deg, rgba(25,58,105,.95), rgba(10,28,62,.95));
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden; color: var(--txt);
  box-shadow: var(--paint); transition: transform .15s, border-color .2s;
}
.tank-card.active, .scene-card.active { border-color: var(--gold); box-shadow: inset 0 0 22px rgba(255,209,102,.1), 0 0 16px rgba(255,209,102,.16); }
.tank-preview, .scene-preview { height: 112px; background: linear-gradient(135deg,#123f70,#176a89); background-size: cover; background-position: center; position: relative; }
.tank-preview span { position: absolute; left: 10px; bottom: 8px; padding: 3px 9px; border-radius: 99px; background: rgba(5,22,49,.78); font-size: 10px; }
.tank-card-body { display: flex; gap: 10px; align-items: center; padding: 11px; }
.tank-card-body > div { flex: 1; min-width: 0; }
.tank-card b, .scene-card b { display: block; font-size: 14px; }
.tank-card small, .scene-card small, .fish-move-name small { display: block; color: var(--txt-dim); font-size: 10.5px; margin-top: 2px; }
.tank-card .buy-btn, .scene-card .buy-btn, .fish-move-row .buy-btn { width: auto; padding: 8px 11px; font-size: 11px; white-space: nowrap; }
.tank-buy-card { min-height: 166px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; border-style: dashed; font-family: inherit; }
.tank-buy-card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.tank-buy-card strong { font-size: 16px; color: #8deee2; }
.tank-buy-card span { color: var(--txt-dim); font-size: 11px; }
.scene-info { min-height: 72px; padding: 10px 11px 5px; }
.scene-card .scene-action { margin: 5px 11px 11px; width: calc(100% - 22px); justify-content: center; }
.fish-move-list { display: flex; flex-direction: column; gap: 14px; }
.fish-tank-group { border: 1px solid var(--line); border-radius: 16px; padding: 10px; background: rgba(8,27,60,.55); }
.fish-tank-group h3 { font-size: 13px; color: #8deee2; margin-bottom: 7px; }
.fish-move-row { display: grid; grid-template-columns: 54px minmax(100px,1fr) minmax(105px,145px) auto; gap: 8px; align-items: center; padding: 7px; border-radius: 12px; }
.fish-move-row + .fish-move-row { border-top: 1px solid rgba(140,200,255,.1); }
.fish-move-row img { width: 50px; height: 38px; object-fit: contain; }
.fish-move-name { min-width: 0; }
.fish-move-row select { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--navy-solid); color: var(--txt); font-family: inherit; font-size: 11px; }
.tank-empty { color: var(--txt-dim); font-size: 12px; padding: 12px; text-align: center; }

/* responsive */
@media (max-width: 720px) {
  .bb-btn .bb-txt { display: none; }
  .bb-btn { padding: 10px; }
  .shop-btn span { display: none; }
  .shop-btn { padding: 14px; }
  .hud-left .game-title { display: none; }
  #progressStrip { top: 66px; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .decor-mode-bar { bottom: 92px; font-size: 12px; }
  .decor-card .decor-art { height: 108px; }
  .tank-open-btn { padding: 14px; }
  .tank-open-btn .tank-btn-icon { display: inline; }
  .tank-open-btn #tankBtnText { display: none; }
  .tank-modal { padding: 16px 12px; }
  .tank-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
  .tank-tabs button { min-width: 0; padding: 9px 4px; font-size: 11px; }
  .tank-grid { grid-template-columns: 1fr; }
  .tank-preview, .scene-preview { height: 96px; }
  .fish-move-row { grid-template-columns: 44px minmax(80px,1fr) auto; }
  .fish-move-row img { width: 42px; height: 34px; }
  .fish-move-row select { grid-column: 2 / 3; }
  .fish-move-row .buy-btn { grid-column: 3 / 4; grid-row: 1 / 3; }
}

/* Portrait phones: the top controls can wrap to two rows. Keep collection
   progress in the HUD flow so it always sits below their real height. */
@media (max-width: 720px) and (orientation: portrait) {
  #hud {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .hud-top {
    padding: max(8px, env(safe-area-inset-top)) 8px 0;
    gap: 5px;
  }
  .hud-left {
    padding: 5px 8px 5px 6px;
  }
  .logo-img {
    width: 46px;
    height: 34px;
  }
  .hud-level {
    gap: 4px;
    font-size: 12px;
  }
  .level-xp {
    width: 34px;
    height: 6px;
  }
  .hud-right {
    flex: 1;
    justify-content: flex-end;
    gap: 4px;
  }
  .cur {
    gap: 4px;
    padding: 5px 7px;
    font-size: 12px;
  }
  .cur img {
    width: 18px;
    height: 18px;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
  }
  .icon-btn svg {
    width: 17px;
    height: 17px;
  }
  #progressStrip {
    position: static;
    align-self: center;
    transform: none;
    margin-top: 4px;
    padding: 3px 6px;
    gap: 4px;
    font-size: 10px;
  }
  #progressStrip:hover { transform: none; }
  .objective-icon { font-size: 14px; }
  .objective-copy { min-width: 74px; }
  .objective-copy b { max-width: 100px; font-size: 8.5px; }
  .objective-copy small { display: none; }
  .objectiveNum { min-width: 24px; font-size: 8px; }
  .strip-bar {
    width: 36px;
    height: 4px;
  }
  .main-menu { top: 42px; right: -2px; width: min(286px, calc(100vw - 16px)); }
}

/* Phone landscape: reclaim water area without changing desktop sizing. */
@media (max-height: 540px) and (orientation: landscape) and (pointer: coarse) {
  #bottomBar { bottom: max(5px, env(safe-area-inset-bottom)); gap: 6px; width: min(920px, calc(100% - 12px)); }
  .bb-left, .bb-right { gap: 5px; }
  .bb-btn { padding: 5px; border-radius: 14px; }
  .bb-icon { width: 31px; height: 31px; border-radius: 9px; }
  .bb-icon svg { width: 18px; height: 18px; }
  .bb-center { gap: 5px; padding: 5px; border-radius: 15px; }
  .dock-slot { width: 50px; height: 50px; border-width: 1px; }
  .dock-slot img { width: 39px; height: 29px; }
  .dock-lv { bottom: -3px; padding: 0 5px; font-size: 8px; }
  .dock-hunger { top: 1px; width: 18px; height: 4px; }
  .shop-btn { padding: 10px 12px; border-radius: 15px; }
  .shop-btn svg { width: 19px; height: 19px; }
  .decor-mode-bar { bottom: 72px; }
}

/* `iosTest` runs on a desktop pointer, so key the same compact layout from
   the runtime iOS class as well. This also makes the rule explicit for Safari. */
@media (max-height: 540px) and (orientation: landscape) {
  .ios-mobile #bottomBar { bottom: max(5px, env(safe-area-inset-bottom)); gap: 6px; width: min(920px, calc(100% - 12px)); }
  .ios-mobile .bb-left, .ios-mobile .bb-right { gap: 5px; }
  .ios-mobile .bb-btn { padding: 5px; border-radius: 14px; }
  .ios-mobile .bb-icon { width: 31px; height: 31px; border-radius: 9px; }
  .ios-mobile .bb-icon svg { width: 18px; height: 18px; }
  .ios-mobile .bb-center { gap: 5px; padding: 5px; border-radius: 15px; }
  .ios-mobile .dock-slot { width: 50px; height: 50px; border-width: 1px; }
  .ios-mobile .dock-slot img { width: 39px; height: 29px; }
  .ios-mobile .dock-lv { bottom: -3px; padding: 0 5px; font-size: 8px; }
  .ios-mobile .dock-hunger { top: 1px; width: 18px; height: 4px; }
  .ios-mobile .shop-btn { padding: 10px 12px; border-radius: 15px; }
  .ios-mobile .shop-btn svg { width: 19px; height: 19px; }
  .ios-mobile .decor-mode-bar { bottom: 72px; }
  .ios-mobile .start-modal { max-height: calc(100vh - 16px); overflow-y: auto; padding: 14px 18px; }
  .ios-mobile .start-hero { margin-bottom: 5px; }
  .ios-mobile .start-logo { width: min(240px, 70vw); height: auto; }
  .ios-mobile .help-body { gap: 6px; margin-top: 7px; }
  .ios-mobile .help-item p { font-size: 11px; line-height: 1.35; }
}
