/* =============================================================
   薪跳 SalaryBeat · 手绘水族馆美术层（art.css）
   目标：去掉「AI 默认审美」—— 克制纸张/水彩质感、有限配色、
   不均匀手绘描边、慢速且少量同时触发的动效。
   ============================================================= */

/* ---------- 18 种海洋生物 SVG 的上色规则 ---------- */
.sb-spec { display: block; width: 100%; height: 100%; overflow: visible; }
.sb-spec .sb-a { fill: var(--sb-a); }
.sb-spec .sb-b { fill: var(--sb-b); opacity: .92; }
.sb-spec .sb-c { fill: var(--sb-c); }
.sb-spec .sb-o { fill: none; stroke: var(--sb-c); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: .62; }
.sb-spec .sb-line { fill: none; stroke: var(--sb-c); stroke-width: 1.7; stroke-linecap: round; opacity: .7; }
.sb-spec .sb-stripe { fill: none; stroke: var(--sb-b); stroke-width: 3; opacity: .55; }
.sb-spec .sb-hi { fill: none; stroke: #fff; stroke-width: 2.1; stroke-linecap: round; opacity: .34; }
.sb-spec .sb-eye { fill: #16333c; }
.sb-spec .sb-glint { fill: #fff; opacity: .92; }
.sb-spec .sb-dots circle { fill: var(--sb-c); opacity: .42; }
.sb-spec .sb-lure { fill: #ffd98a; stroke: #c97a3c; stroke-width: 1.2; }

/* ---------- 纸感：克制的大圆角、对称渐变、紫色 ---------- */
.card {
  border-radius: 14px;
  background-image:
    repeating-linear-gradient(94deg, rgba(24, 62, 70, .014) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(2deg, rgba(24, 62, 70, .012) 0 1px, transparent 1px 9px);
  box-shadow: 0 1px 2px rgba(24, 62, 70, .045), 0 8px 22px -18px rgba(24, 62, 70, .4);
}
.card-head { border-bottom: 1px solid rgba(24, 62, 70, .07); padding-bottom: 9px; }
.gm-result-card, .gm-levels-card, .hall-card, .visit-sheet, .admin-panel {
  border-radius: 13px;
  background-image:
    repeating-linear-gradient(96deg, rgba(60, 48, 30, .022) 0 1px, transparent 1px 8px),
    linear-gradient(160deg, #fbf7ec, #f2ece0);
  border: 1px solid rgba(90, 74, 52, .22);
  box-shadow: 0 14px 34px -22px rgba(31, 55, 58, .7), inset 0 1px 0 rgba(255, 255, 255, .8);
}
body[data-theme="purple"] { --accent: #2f7a78; --accent-2: #5aa39a; }

/* ---------- 水体分层（所有层都不吃点击） ---------- */
.sb-tank { position: relative; isolation: isolate; }
.sb-tank > .art-depth, .sb-tank > .art-beams, .sb-tank > .art-caustic,
.sb-tank > .art-grains, .sb-tank > .art-weeds, .sb-tank > .art-fshadow,
.sb-tank > .art-vignette, .sb-tank > .art-glass, .sb-tank > .art-grain-overlay,
.sb-tank > .art-bubbles-mini { position: absolute; pointer-events: none; }

.sb-tank > .art-depth {
  inset: 0; z-index: 0;
  background:
    linear-gradient(180deg, rgba(214, 240, 238, .55) 0%, rgba(96, 165, 168, .18) 28%, rgba(18, 74, 88, .28) 72%, rgba(9, 46, 58, .5) 100%),
    radial-gradient(120% 70% at 50% -10%, rgba(255, 255, 255, .7), transparent 65%);
}
.sb-tank > .art-beams { inset: -10% -20% 0; z-index: 1; overflow: hidden; opacity: .5; }
.sb-tank > .art-beams i {
  position: absolute; top: -30%; height: 150%; width: 13%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, 0) 78%);
  filter: blur(5px);
  transform: skewX(-16deg);
  animation: artBeam 26s ease-in-out infinite alternate;
}
.sb-tank > .art-beams i:nth-child(1) { left: 12%; opacity: .55; }
.sb-tank > .art-beams i:nth-child(2) { left: 42%; width: 8%; opacity: .38; animation-duration: 33s; animation-delay: -9s; }
.sb-tank > .art-beams i:nth-child(3) { left: 74%; width: 10%; opacity: .32; animation-duration: 29s; animation-delay: -17s; }
@keyframes artBeam {
  0%   { transform: skewX(-16deg) translateX(-10px); }
  100% { transform: skewX(-11deg) translateX(26px); }
}

/* 水面折射光带：feTurbulence 在 SVG 内部自己动，CSS 只负责渐隐 */
.sb-tank > .art-caustic, .tk-stage > .tk-caustic {
  z-index: 2; left: 0; right: 0; top: 0; height: 62%;
  background: rgba(255, 255, 255, .35);
  filter: url(#sbCaustic);
  opacity: .38;
  mix-blend-mode: screen;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .95), transparent 96%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .95), transparent 96%);
}
.tk-stage > .tk-caustic { animation: none; }

.sb-tank > .art-grains { inset: auto 0 0; height: 33%; z-index: 3; }
.sb-tank > .art-grains i {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e8d8ae, #b39b6d);
  box-shadow: 0 1px 1px rgba(20, 50, 55, .25);
}
.sb-tank > .art-fshadow {
  z-index: 4; left: 30%; bottom: 12%; width: 40%; height: 13px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(8, 38, 46, .42), transparent 70%);
  filter: blur(3px);
  animation: artShadow 13s cubic-bezier(.37, 0, .63, 1) infinite;
}
@keyframes artShadow {
  0%, 100% { transform: translateX(-22px) scaleX(.85); opacity: .5; }
  48%      { transform: translateX(24px) scaleX(1.05); opacity: .72; }
}

.sb-tank > .art-weeds { inset: auto 0 0; height: 46%; z-index: 6; }
.sb-tank > .art-weeds svg { width: 100%; height: 100%; display: block; }
.sb-tank > .art-weeds-back { filter: url(#sbSoft); opacity: .42; height: 52%; }
.sb-tank > .art-weeds-front { opacity: .8; transform-origin: 50% 100%; animation: artWeed 9s ease-in-out infinite alternate; }
@keyframes artWeed {
  0%   { transform: skewX(-2.2deg); }
  100% { transform: skewX(2.4deg); }
}

.sb-tank > .art-vignette {
  inset: 0; z-index: 8;
  background:
    radial-gradient(110% 90% at 50% 42%, transparent 52%, rgba(6, 38, 48, .3) 100%),
    linear-gradient(90deg, rgba(6, 38, 48, .22), transparent 18%, transparent 82%, rgba(6, 38, 48, .22));
}
.sb-tank > .art-glass {
  inset: 0; z-index: 9;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .92),
    inset 2px 0 0 rgba(255, 255, 255, .28),
    inset -2px 0 0 rgba(255, 255, 255, .18),
    inset 0 -18px 26px -20px rgba(6, 44, 56, .7);
  background: radial-gradient(120% 55% at 50% 0%, rgba(255, 255, 255, .22), transparent 60%);
}
.sb-tank > .art-grain-overlay {
  inset: 0; z-index: 10; opacity: .5;
  background: #7a7a72;
  filter: url(#sbGrain);
  mix-blend-mode: multiply;
}

/* 气泡：大小/速度/漂移全部随机，绝不排队 */
.tk-bubbles i, .art-bubbles-mini i {
  position: absolute; bottom: -14px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .95), rgba(255, 255, 255, .2) 55%, rgba(255, 255, 255, .05) 72%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55), 0 0 4px rgba(255, 255, 255, .35);
  animation: artBubble var(--bd, 11s) linear var(--bdelay, 0s) infinite;
  opacity: 0;
}
@keyframes artBubble {
  0%   { transform: translate3d(0, 0, 0) scale(.55); opacity: 0; }
  10%  { opacity: var(--bop, .6); }
  55%  { transform: translate3d(calc(var(--bdx, 10px) * .45), -52%, 0) scale(1); }
  88%  { opacity: calc(var(--bop, .6) * .7); }
  100% { transform: translate3d(var(--bdx, 10px), -112%, 0) scale(1.18); opacity: 0; }
}
.art-bubbles-mini { inset: 0; z-index: 5; overflow: hidden; }

/* ---------- 鱼缸里的鱼：渐变、鳞片、半透明鳍、慢速非线性游动 ---------- */
/* 渐变由 art.js 在每条鱼自己的 SVG 里注入（行内 style 覆盖 app.css 纯色） */
.fsvg .fs-scales { opacity: .28; mix-blend-mode: overlay; pointer-events: none; }
.fsvg .fs-tail path, .fsvg .fs-fin { opacity: .62; }
.fsvg .fs-belly { fill: var(--fish-3); opacity: .42; }
.fsvg .fs-eye { fill: #17343d; }
.fsvg .fs-glint { fill: #fff; opacity: .95; }
.fsvg .fs-blush { fill: #d2685f; opacity: .24; }
.fsvg .fs-mouth { stroke: var(--fish-2); opacity: .7; }
.fsvg .fs-tail { animation-duration: 2.9s; }
.fsvg .fs-body { animation-duration: 4.2s; }

/* 保留原有的独立合成层设置（桌面端防闪烁），只把节奏放慢、路径改成非线性 */
.tk-fish {
  animation: artSwim 15s cubic-bezier(.37, 0, .63, 1) infinite;
  will-change: transform;
  transform: translateZ(0);
}
@keyframes artSwim {
  0%   { transform: translate(-26px, 3px) rotate(-3deg) scaleX(1); }
  14%  { transform: translate(-18px, -1px) rotate(-1deg) scaleX(1); }
  18%  { transform: translate(-18px, -1px) rotate(-1deg) scaleX(1); }
  38%  { transform: translate(8px, -9px) rotate(2deg) scaleX(1); }
  48%  { transform: translate(27px, -6px) rotate(1deg) scaleX(1); }
  52%  { transform: translate(27px, -6px) rotate(0deg) scaleX(-1); }
  56%  { transform: translate(27px, -6px) rotate(0deg) scaleX(-1); }
  76%  { transform: translate(-2px, 5px) rotate(-2deg) scaleX(-1); }
  92%  { transform: translate(-24px, 3px) rotate(-2deg) scaleX(-1); }
  100% { transform: translate(-26px, 3px) rotate(-3deg) scaleX(1); }
}
.tp-fish { animation: artSwimMini 17s cubic-bezier(.37, 0, .63, 1) infinite; }
@keyframes artSwimMini {
  0%, 12%  { transform: translate(-10px, 1px) scaleX(1); }
  45%      { transform: translate(11px, -4px) scaleX(1); }
  52%      { transform: translate(11px, -4px) scaleX(-1); }
  56%      { transform: translate(11px, -4px) scaleX(-1); }
  90%,100% { transform: translate(-10px, 1px) scaleX(-1); }
}
.tk-decor-item, .tp-decor i {
  filter: drop-shadow(0 6px 4px rgba(9, 45, 55, .4)) drop-shadow(0 1px 0 rgba(255, 255, 255, .35));
  text-shadow: 0 4px 5px rgba(9, 45, 55, .22);
}
.tk-decor-item { animation-duration: 8.5s; }

/* ---------- 小游戏牌面：有厚度的瓷片 / 木片 ---------- */
.gm-tile {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, .95), rgba(240, 232, 213, .96) 55%, rgba(219, 205, 178, .98));
  border: 1px solid rgba(120, 100, 72, .5);
  border-radius: 10px;
  font-size: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -3px 5px rgba(120, 100, 72, .22),
    0 3px 0 rgba(120, 100, 72, .55),
    0 6px 9px -4px rgba(12, 48, 58, .55);
  filter: none;
  animation: artTileIn .42s cubic-bezier(.22, .8, .3, 1) both;
  animation-delay: var(--in-delay, 0s);
}
@keyframes artTileIn {
  0%   { opacity: 0; transform: rotate(var(--rot, 0deg)) scale(.5) translateY(-18px); }
  100% { opacity: 1; transform: rotate(var(--rot, 0deg)) scale(var(--sc, 1)); }
}
.gm-tile .sb-spec { width: 40px; height: 40px; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .8)); }
.gm-tile.locked {
  filter: grayscale(.55) brightness(.9);
  opacity: .62;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 2px 0 rgba(120, 100, 72, .4);
}
.gm-tile.tap {
  transform: rotate(var(--rot, 0deg)) scale(calc(var(--sc, 1) * .86)) translateY(2px) !important;
  box-shadow: inset 0 2px 5px rgba(90, 70, 45, .3), 0 1px 0 rgba(120, 100, 72, .5);
}
.gm-tile.leaving { opacity: 0; transform: rotate(var(--rot, 0deg)) scale(.35) translateY(-22px); }
.gm-tray i.filled { border-radius: 9px; }
.gm-tray i.filled .sb-spec { width: 34px; height: 34px; }
.gm-order-icon .sb-spec { width: 26px; height: 26px; }

/* 消除：涟漪 + 粒子 + 短暂慢镜；失败：水面变暗，不弹灰框 */
.gm-fx { position: absolute; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.art-burst { position: absolute; width: 0; height: 0; }
.art-rip {
  position: absolute; left: -6px; top: -6px; width: 12px; height: 12px;
  border: 2px solid var(--bc, #e8a05f); border-radius: 50%;
  animation: artRip .72s ease-out forwards;
}
@keyframes artRip {
  0%   { transform: scale(.4); opacity: .9; }
  100% { transform: scale(4.6); opacity: 0; }
}
.art-pt {
  position: absolute; left: -2px; top: -2px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--pc, #e8a05f);
  box-shadow: 0 0 5px var(--pc, #e8a05f);
  animation: artPt .72s ease-out var(--pd, 0ms) forwards;
}
@keyframes artPt {
  0%   { transform: translate(0, 0) scale(1); opacity: .95; }
  100% { transform: translate(var(--dx, 20px), var(--dy, 20px)) scale(.15); opacity: 0; }
}
.gm-tiles.slowmo { filter: saturate(1.12) brightness(1.04); }
.gm-tiles.slowmo .gm-tile { transition-duration: .5s; }
#gmPond.dimmed::before { filter: brightness(.5) saturate(.62); transition: filter 1.1s ease; }
#gmPond.dimmed .gm-water { opacity: .1; }
.gm-combo {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  z-index: 22; pointer-events: none;
  padding: 5px 13px; border-radius: 20px;
  background: rgba(24, 62, 70, .82); color: #f7efe0;
  font-size: 12px; letter-spacing: .5px;
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
.gm-combo.on { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.gm-result-card { background-image: repeating-linear-gradient(96deg, rgba(60, 48, 30, .022) 0 1px, transparent 1px 8px), linear-gradient(160deg, #fbf7ec, #f2ece0); }

/* ---------- 宽屏：按比例放大，限制最大宽度，不拉伸 ---------- */
@media (min-width: 760px) {
  .tank-overlay .tk-body { max-width: 720px; margin: 0 auto; }
  .tank-overlay .tk-stage { height: min(48vh, 430px); }
  .tank-overlay .tk-fish { width: 192px; height: 152px; margin: -84px 0 0 -96px; }
  .tp-tank { width: 148px; height: 148px; border-radius: 22px; }
  .tp-fish { width: 96px; height: 76px; margin: -38px 0 0 -48px; }
  .tank-preview .tp-decor i { font-size: 20px; bottom: 12px; }
  .game-overlay .gm-pond { max-width: 720px; margin-left: auto; margin-right: auto; width: 100%; }
  .gm-tiles { max-width: 700px; }
}
@media (min-width: 1100px) {
  .tank-overlay .tk-body { max-width: 820px; }
  .tank-overlay .tk-stage { height: min(52vh, 470px); }
}

/* ---------- 层级：美术层永远垫在既有内容下面 ---------- */
.tk-stage > .tk-water { z-index: 1; }
.tk-stage > .tk-caustic { z-index: 2; }
.tk-stage > .tk-deep { z-index: 3; }
.tk-stage > .tk-bubbles { z-index: 5; }
.tk-stage > .tk-fish { z-index: 7; }
.tk-stage > .tk-word, .tk-stage > .tk-say, .tk-stage > .tk-sleep { z-index: 11; }
.tp-tank > .tp-water { z-index: 1; }
.tp-tank > .tp-decor { z-index: 3; }
.tp-tank > .tp-fish { z-index: 7; }
.tp-tank > .tp-sand { z-index: 4; }
.sb-tank > .art-grain-overlay { opacity: .22; }
.gm-pond .gm-water { z-index: 2; }
.gm-pond .gm-tiles { z-index: 12; }
.gm-pond .gm-fx { z-index: 20; }
.gm-pond .gm-combo { z-index: 22; }
.sb-tank-visit > .art-visit-fish { position: absolute; left: 50%; top: 42%; width: 110px; height: 110px; margin: -55px 0 0 -55px; z-index: 7; }
.sb-tank-visit > .art-visit-fish .sb-spec { width: 100%; height: 100%; }
.sb-spec-lg { filter: drop-shadow(0 4px 5px rgba(9, 45, 55, .35)); }
.mn-fx { position: absolute; width: 0; height: 0; }

/* 系统要求减少动效时，关掉所有非必要动画 */
@media (prefers-reduced-motion: reduce) {
  .tk-fish, .tp-fish, .sb-tank > .art-beams i, .sb-tank > .art-weeds-front,
  .sb-tank > .art-fshadow, .tk-bubbles i, .art-bubbles-mini i,
  .fsvg .fs-tail, .fsvg .fs-body, .gm-tile { animation: none !important; }
  .sb-tank > .art-caustic, .tk-stage > .tk-caustic { opacity: .2; }
}
