* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 18%, #0e3d61 0%, #061d30 48%, #03121f 100%);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

[hidden] {
  display: none !important;
}

.game {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #0b3553;
  isolation: isolate;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  pointer-events: none;
  -webkit-user-drag: none;
}

.shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.shade-top {
  background: linear-gradient(
    180deg,
    rgba(2, 19, 36, 0.64) 0%,
    rgba(2, 19, 36, 0.28) 12%,
    rgba(2, 19, 36, 0) 30%
  );
}

.shade-bottom {
  background: linear-gradient(
    180deg,
    rgba(2, 18, 34, 0) 48%,
    rgba(2, 18, 34, 0.12) 62%,
    rgba(2, 18, 34, 0.58) 82%,
    rgba(2, 17, 32, 0.9) 100%
  );
}

.flash {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    circle at 52% 57%,
    rgba(255, 175, 70, 0.36) 0%,
    rgba(255, 120, 40, 0.12) 24%,
    rgba(255, 100, 30, 0) 48%
  );
}

.flash.on {
  animation: flash-pulse 0.55s ease-out;
}

@keyframes flash-pulse {
  0% { opacity: 0; }
  28% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- bobber effects ---------- */

.bobber-fx {
  position: absolute;
  z-index: 4;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.bobber-fx.on {
  opacity: 1;
}

.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: ripple 2.6s ease-out infinite;
}

.ring-b {
  animation-delay: 1.3s;
}

.bobber-fx.bite .ring {
  border-color: rgba(255, 186, 92, 0.95);
  border-width: 2.5px;
  animation-duration: 0.95s;
}

.bobber-fx.bite .ring-b {
  animation-delay: 0.42s;
}

@keyframes ripple {
  0% { transform: scale(0.2); opacity: 0.8; }
  70% { opacity: 0.25; }
  100% { transform: scale(1.55); opacity: 0; }
}

.bite-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #ffb14f 0%, #ff6b1c 100%);
  box-shadow: 0 6px 18px rgba(163, 52, 0, 0.42), 0 0 0 6px rgba(255, 160, 70, 0.16);
  opacity: 0;
  transform: translateY(10px) scale(0.3);
  transition: opacity 0.16s ease, transform 0.22s cubic-bezier(0.2, 1.5, 0.4, 1);
}

.bite-mark .mp-icon {
  width: 22px;
  height: 22px;
}

.bobber-fx.bite .bite-mark {
  opacity: 1;
  transform: translateY(-44px) scale(1);
  animation: bite-bob 0.62s ease-in-out infinite alternate;
}

@keyframes bite-bob {
  from { transform: translateY(-46px) scale(1); }
  to { transform: translateY(-51px) scale(1.06); }
}

.splash-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border: 3px solid rgba(255, 220, 150, 0.95);
  border-radius: 50%;
  animation: splash 0.72s ease-out forwards;
}

@keyframes splash {
  0% { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(4.6); opacity: 0; }
}

.tap-ring {
  position: absolute;
  z-index: 10;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  pointer-events: none;
  animation: tap-ring 0.55s ease-out forwards;
}

@keyframes tap-ring {
  0% { transform: scale(0.35); opacity: 0.9; }
  100% { transform: scale(2.7); opacity: 0; }
}

/* ---------- top hud ---------- */

.hud {
  position: absolute;
  z-index: 8;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 0;
  pointer-events: none;
}

.score-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 16px 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(13, 54, 86, 0.86), rgba(4, 30, 51, 0.84));
  box-shadow: 0 6px 18px rgba(0, 13, 27, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  color: #fff;
}

.score-pill .mp-icon {
  width: 23px;
  height: 23px;
  color: #ffa24c;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.28));
}

#score {
  display: inline-block;
  min-width: 12px;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.4px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#score.bump {
  animation: score-bump 0.34s cubic-bezier(0.2, 1.5, 0.4, 1);
}

@keyframes score-bump {
  0% { transform: scale(1); color: #fff; }
  45% { transform: scale(1.32); color: #ffc46b; }
  100% { transform: scale(1); color: #fff; }
}

.score-pill small {
  margin-left: -2px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.68;
}

.best-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(3, 26, 46, 0.44);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.68);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.best-pill b {
  color: #ffd08a;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, rgba(13, 54, 86, 0.84), rgba(4, 30, 51, 0.82));
  box-shadow: 0 6px 16px rgba(0, 13, 27, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease;
}

.icon-btn .mp-icon {
  width: 21px;
  height: 21px;
}

.icon-btn:active {
  transform: scale(0.92);
  background: rgba(255, 138, 61, 0.85);
}

.combo-badge {
  position: absolute;
  z-index: 9;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  left: 50%;
  padding: 6px 14px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffb15d 0%, #ff7a1a 100%);
  box-shadow: 0 7px 20px rgba(255, 110, 20, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-shadow: 0 1px 3px rgba(126, 45, 0, 0.32);
  animation: combo-pop 0.3s cubic-bezier(0.2, 1.5, 0.4, 1);
  pointer-events: none;
}

@keyframes combo-pop {
  0% { opacity: 0; transform: translateX(-50%) scale(0.6); }
  100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ---------- catch card ---------- */

.catch-card {
  position: absolute;
  z-index: 12;
  top: 21%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 214px;
  max-width: calc(100% - 44px);
  padding: 9px 16px 9px 9px;
  border: 1.5px solid rgba(255, 206, 142, 0.72);
  border-radius: 19px;
  background: linear-gradient(135deg, rgba(10, 45, 72, 0.96), rgba(4, 26, 44, 0.96));
  box-shadow: 0 18px 44px rgba(0, 10, 20, 0.48), 0 0 26px rgba(255, 154, 60, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
  pointer-events: none;
}

.catch-card.show {
  animation: catch-in 0.38s cubic-bezier(0.2, 1.45, 0.4, 1);
}

@keyframes catch-in {
  0% { opacity: 0; transform: translateX(-50%) translateY(14px) scale(0.84); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.catch-icon {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffb258 0%, #f4771b 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 5px 12px rgba(180, 69, 0, 0.3);
  color: #fff;
}

.catch-icon .mp-icon {
  width: 27px;
  height: 27px;
}

.catch-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.catch-copy b {
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.3px;
}

.catch-copy em {
  margin-top: 3px;
  overflow: hidden;
  color: rgba(255, 225, 188, 0.68);
  font-size: 10px;
  font-style: normal;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.catch-pts {
  flex: 0 0 auto;
  padding-left: 2px;
  color: #ffc46b;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.4px;
  text-shadow: 0 2px 9px rgba(255, 139, 38, 0.38);
  font-variant-numeric: tabular-nums;
}

/* ---------- bottom action ---------- */

.bottom {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
  pointer-events: none;
}

.hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  margin: 0 0 10px;
  padding: 5px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(2, 24, 42, 0.46);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  color: #f5fbff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15px;
  text-align: center;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.44);
}

.action-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  height: 76px;
  padding: 0 18px 0 13px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 38px;
  color: #fff;
  background: linear-gradient(180deg, #ffa556 0%, #ff8a3d 44%, #f26d0c 100%);
  box-shadow: 0 13px 30px rgba(157, 56, 0, 0.42), 0 3px 8px rgba(90, 30, 0, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.36), inset 0 -3px 0 rgba(173, 65, 0, 0.22);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.09s ease, box-shadow 0.2s ease, background 0.22s ease;
  -webkit-appearance: none;
  appearance: none;
}

.action-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0) 29%,
    rgba(255, 255, 255, 0.22) 44%,
    rgba(255, 255, 255, 0) 59%
  );
  transform: translateX(-130%);
  animation: sheen 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sheen {
  0%, 58% { transform: translateX(-130%); }
  86%, 100% { transform: translateX(130%); }
}

.action-btn:active {
  transform: translateY(2px) scale(0.986);
  box-shadow: 0 7px 18px rgba(157, 56, 0, 0.36), inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.action-btn.wait {
  animation: button-breathe 2.8s ease-in-out infinite;
}

@keyframes button-breathe {
  0%, 100% { box-shadow: 0 13px 30px rgba(157, 56, 0, 0.4), 0 0 0 0 rgba(255, 145, 62, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.36); }
  50% { box-shadow: 0 15px 34px rgba(157, 56, 0, 0.46), 0 0 0 9px rgba(255, 145, 62, 0), inset 0 2px 0 rgba(255, 255, 255, 0.36); }
}

.action-btn.bite {
  background: linear-gradient(180deg, #ff8a62 0%, #f2542f 48%, #d93414 100%);
  box-shadow: 0 15px 36px rgba(170, 28, 0, 0.5), 0 0 0 4px rgba(255, 255, 255, 0.14),
    inset 0 2px 0 rgba(255, 255, 255, 0.36);
  animation: bite-shake 0.46s ease-in-out infinite;
}

@keyframes bite-shake {
  0%, 100% { transform: translateX(0) scale(1); }
  25% { transform: translateX(-2px) scale(1.006); }
  75% { transform: translateX(2px) scale(1.006); }
}

.action-btn.bite::after {
  animation-duration: 1.1s;
}

.action-btn.caught {
  background: linear-gradient(180deg, #74dda4 0%, #35b978 52%, #1e935b 100%);
  box-shadow: 0 13px 30px rgba(14, 100, 58, 0.42), 0 0 0 4px rgba(255, 255, 255, 0.12),
    inset 0 2px 0 rgba(255, 255, 255, 0.36);
}

.action-btn.miss {
  background: linear-gradient(180deg, #849cb0 0%, #577188 52%, #3f586d 100%);
  box-shadow: 0 12px 26px rgba(0, 20, 36, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.action-icon {
  display: grid;
  place-items: center;
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.action-icon .mp-icon {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 3px rgba(90, 30, 0, 0.24));
}

.action-btn.bite .action-icon {
  background: rgba(255, 255, 255, 0.28);
  animation: icon-pulse 0.62s ease-in-out infinite alternate;
}

@keyframes icon-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

.action-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
}

.action-copy b {
  max-width: 100%;
  overflow: hidden;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 5px rgba(110, 40, 0, 0.25);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.action-copy em {
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.84);
  font-size: 11px;
  font-style: normal;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.action-btn.bite .action-copy b {
  font-size: 21px;
}

/* ---------- pause ---------- */

.pause-mask {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 17, 30, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: mask-in 0.2s ease-out;
}

@keyframes mask-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.pause-card {
  width: 100%;
  max-width: 318px;
  padding: 26px 22px 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 27px;
  background: linear-gradient(180deg, rgba(11, 49, 78, 0.98) 0%, rgba(5, 27, 46, 0.98) 100%);
  box-shadow: 0 30px 70px rgba(0, 8, 18, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  text-align: center;
  animation: card-in 0.3s cubic-bezier(0.2, 1.3, 0.4, 1);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.pause-fish {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 13px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  background: linear-gradient(180deg, #ffa95a, #f0741b);
  box-shadow: 0 9px 22px rgba(255, 120, 30, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.36);
  color: #fff;
}

.pause-fish .mp-icon {
  width: 31px;
  height: 31px;
}

.pause-card h2 {
  margin: 0;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
}

.pause-card > p {
  margin: 7px 0 17px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12.5px;
  letter-spacing: 0.3px;
}

.pause-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.065);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12.5px;
}

.pause-stats b {
  color: #ffc46b;
  font-size: 21px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.primary-btn {
  display: block;
  width: 100%;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 25px;
  color: #fff;
  background: linear-gradient(180deg, #ffa556, #ff7a1a);
  box-shadow: 0 9px 22px rgba(172, 59, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.34);
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.primary-btn:active {
  transform: translateY(1px) scale(0.99);
}

.ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 44px;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.075);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.ghost-btn:active {
  background: rgba(255, 255, 255, 0.14);
}

.ghost-btn .mp-icon {
  width: 19px;
  height: 19px;
}

/* ---------- small screens / reduced motion ---------- */

@media (max-height: 640px) {
  .bottom {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  }

  .hint {
    margin-bottom: 7px;
    min-height: 23px;
    font-size: 11px;
  }

  .action-btn {
    height: 66px;
    max-width: 336px;
  }

  .action-icon {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }

  .action-copy b {
    font-size: 18px;
  }

  .catch-card {
    top: 16%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .action-btn,
  .action-btn::after,
  .action-btn.bite,
  .action-btn.bite .action-icon,
  .action-btn.wait,
  .bobber-fx .ring,
  .bite-mark {
    animation: none !important;
  }
}
