:root {
  --ink: #17363a;
  --muted: #5f7a7d;
  --paper: #fff9ec;
  --panel: rgba(255, 255, 255, 0.86);
  --accent: #ff8a5b;
  --teal: #39a8a4;
  --gold: #ffc857;
  --danger: #e55d6a;
  --shadow: 0 18px 48px rgba(23, 54, 58, 0.18);
  font-family: ui-rounded, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #b8ece7;
  color: var(--ink);
}

body {
  min-height: 100svh;
  overflow: hidden;
}

button {
  border: 0;
  font: inherit;
  touch-action: manipulation;
}

.app-shell {
  position: relative;
  width: min(100vw, 460px);
  height: 100svh;
  min-height: 620px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
}

.screen.is-active {
  display: flex;
}

.start-screen {
  align-items: end;
  justify-content: center;
  padding: 24px;
}

.ocean-stage,
.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transition: background 600ms ease;
  background-size: cover;
  background-position: center;
}

.start-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 28px 22px calc(26px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 8px;
  color: #287c82;
  font-size: 13px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 48px;
  line-height: 1;
}

h2 {
  font-size: 30px;
}

.start-copy,
.report-summary {
  margin: 14px 0 22px;
  color: var(--muted);
  line-height: 1.55;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-btn {
  background: linear-gradient(135deg, #ff8a5b, #ffbf55);
  color: #2f1808;
  box-shadow: 0 12px 24px rgba(255, 138, 91, 0.28);
}

.secondary-btn {
  background: #17363a;
  color: #fff;
}

.ghost-btn {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.66);
  color: #24555b;
}

.ghost-btn.small {
  width: 64px;
  min-height: 46px;
  margin: 0;
  flex: 0 0 64px;
}

.game-screen {
  flex-direction: column;
  background: #d6f6f2;
}

.hud {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: calc(12px + env(safe-area-inset-top)) 12px 8px;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(12px);
}

.hud > div {
  min-width: 0;
  padding: 8px 6px;
  text-align: center;
  background: rgba(255, 255, 255, 0.58);
  border-radius: 8px;
}

.hud-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.hud strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene {
  position: relative;
  flex: 1;
  min-height: 320px;
}

.scene.spring,
.ocean-stage.spring {
  background-image:
    url("../assets/backgrounds/spring.png"),
    radial-gradient(circle at 18% 20%, rgba(255, 172, 203, 0.75) 0 42px, transparent 44px),
    linear-gradient(#71df84 0%, #cfffba 36%, #29b589 60%, #ffe1a3 61%, #ffc979 100%);
}

.scene.summer,
.ocean-stage.summer {
  background-image:
    url("../assets/backgrounds/summer.png"),
    radial-gradient(circle at 78% 18%, rgba(255, 249, 150, 0.95) 0 54px, transparent 56px),
    linear-gradient(#1fa7ff 0%, #9ee8ff 36%, #017ec3 60%, #ffe097 61%, #ffc15d 100%);
}

.scene.autumn,
.ocean-stage.autumn {
  background-image:
    url("../assets/backgrounds/autumn.png"),
    radial-gradient(circle at 74% 24%, rgba(255, 170, 64, 0.82) 0 48px, transparent 50px),
    linear-gradient(#ffd23f 0%, #ffe589 34%, #d0a03a 60%, #f4b35f 61%, #d98938 100%);
}

.scene.winter,
.ocean-stage.winter {
  background-image:
    url("../assets/backgrounds/winter.png"),
    radial-gradient(circle at 72% 20%, rgba(255, 255, 255, 0.96) 0 46px, transparent 48px),
    linear-gradient(#f8fdff 0%, #eaf8ff 36%, #b7d9eb 60%, #fffaf0 61%, #e6f3f8 100%);
}

.sky-glow {
  position: absolute;
  top: 9%;
  right: 13%;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(255, 245, 180, 0.78);
  filter: blur(1px);
}

.sun-moon {
  position: absolute;
  top: 13%;
  right: 18%;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff4a8;
  box-shadow: 0 0 30px rgba(255, 245, 157, 0.72);
}

.wave {
  position: absolute;
  left: -20%;
  width: 140%;
  height: 72px;
  opacity: 0.28;
  background: radial-gradient(ellipse at 24px 18px, rgba(255,255,255,0.78) 0 12px, transparent 13px) 0 0 / 72px 38px repeat-x;
  animation: drift 5s linear infinite;
}

.wave-a {
  top: 47%;
}

.wave-b {
  top: 53%;
  opacity: 0.18;
  animation-duration: 7s;
  animation-direction: reverse;
}

.sand {
  position: absolute;
  inset: 60% 0 0;
  background:
    radial-gradient(circle at 18% 28%, rgba(167, 111, 55, 0.16) 0 3px, transparent 4px),
    radial-gradient(circle at 68% 18%, rgba(167, 111, 55, 0.14) 0 2px, transparent 3px);
  opacity: 0.45;
  pointer-events: none;
}

.season-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.season-particles i,
.season-particles::before,
.season-particles::after {
  position: absolute;
  content: "";
  inset: -30% 0 0;
  display: block;
  opacity: 0.9;
  will-change: transform;
}

.spring .season-particles::before,
.spring .season-particles::after,
.spring .season-particles i {
  opacity: 0.62;
  background-image:
    radial-gradient(ellipse 8px 5px at 18px 20px, rgba(255, 126, 178, 0.95) 0 62%, transparent 66%),
    radial-gradient(ellipse 10px 6px at 54px 48px, rgba(255, 184, 211, 0.85) 0 62%, transparent 66%);
  background-size: 96px 126px, 142px 168px;
  background-position: 12px 0, 54px 36px;
  animation: petalDrift 9s linear infinite;
}

.summer .season-particles::before,
.summer .season-particles::after,
.summer .season-particles i {
  inset: auto;
  top: -90px;
  width: 3px;
  height: 88px;
  border-radius: 999px;
  opacity: 0.72;
  background: linear-gradient(to bottom, transparent, rgba(100, 205, 255, 0.86), rgba(255, 255, 255, 0.92), transparent);
  transform: rotate(9deg);
  animation: summerRain 1.1s linear infinite;
}

.summer .season-particles::before {
  left: 13%;
}

.summer .season-particles::after {
  left: 82%;
}

.summer .season-particles i:nth-child(1) {
  left: 30%;
}

.summer .season-particles i:nth-child(2) {
  left: 51%;
}

.summer .season-particles i:nth-child(3) {
  left: 68%;
}

.autumn .season-particles::before,
.autumn .season-particles::after,
.autumn .season-particles i {
  opacity: 0.7;
  background-image:
    radial-gradient(ellipse 9px 5px at 24px 22px, rgba(231, 107, 36, 0.95) 0 62%, transparent 66%),
    radial-gradient(ellipse 10px 6px at 62px 54px, rgba(255, 190, 60, 0.9) 0 62%, transparent 66%);
  background-size: 104px 136px, 150px 174px;
  background-position: 8px 0, 74px 40px;
  animation: leafDrift 7.8s linear infinite;
}

.winter .season-particles::before,
.winter .season-particles::after,
.winter .season-particles i {
  opacity: 0.72;
  background-image:
    radial-gradient(circle 4px at 20px 18px, rgba(255, 255, 255, 0.98) 0 62%, transparent 66%),
    radial-gradient(circle 3px at 58px 48px, rgba(213, 240, 255, 0.9) 0 62%, transparent 66%);
  background-size: 70px 86px, 104px 124px;
  background-position: 12px 0, 48px 32px;
  animation: snowFall 8.6s linear infinite;
}

.season-particles::before {
  animation-delay: -1.8s;
  transform: translateX(-18px);
}

.season-particles::after {
  animation-delay: -3.6s;
  transform: translateX(28px);
}

.season-particles i:nth-child(1) {
  animation-delay: -0.8s;
}

.season-particles i:nth-child(2) {
  animation-delay: -2.7s;
  opacity: 0.68;
}

.season-particles i:nth-child(3) {
  animation-delay: -4.2s;
  opacity: 0.52;
}

.net {
  position: absolute;
  z-index: 3;
  top: 42%;
  left: 50%;
  width: 100px;
  height: 70px;
  border: 3px solid rgba(50, 106, 116, 0.72);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-18deg) scale(0.6);
  background:
    linear-gradient(45deg, transparent 45%, rgba(50, 106, 116, 0.32) 46% 54%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, rgba(50, 106, 116, 0.32) 46% 54%, transparent 55%);
  background-size: 18px 18px;
}

.net.is-casting {
  animation: castNet 1s ease-out;
}

.shell-field {
  position: absolute;
  z-index: 4;
  inset: 58% 10px 4px;
}

.shell-card {
  position: absolute;
  width: 76px;
  height: 88px;
  padding: 0;
  background: transparent;
  transform: translate(-50%, -50%);
}

.shell-card:disabled {
  opacity: 0.72;
}

.shell-bubble {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 3px solid transparent;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  filter: drop-shadow(0 10px 12px rgba(92, 62, 35, 0.2));
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.shell-card.is-selected .shell-bubble {
  border-color: #fff57a;
  background: rgba(255, 255, 255, 0.72);
  transform: translateY(-8px) scale(1.06);
}

.shell-card.is-opened .shell-bubble {
  animation: popOpen 420ms ease both;
}

.shell-card.is-skipped .shell-bubble {
  opacity: 0.42;
  transform: translateY(5px) scale(0.9);
  filter: grayscale(0.75) drop-shadow(0 6px 8px rgba(92, 62, 35, 0.12));
}

.shell-card svg {
  width: 68px;
  height: 68px;
}

.shell-sprite {
  display: block;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background-image: url("../assets/shells/shell-sheet.png");
  background-size: 500% 400%;
  background-color: #fff7ec;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.shell-preview {
  position: absolute;
  z-index: 7;
  top: 27%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 190px;
  height: 210px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.82);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.shell-preview.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.preview-bubble {
  display: grid;
  place-items: center;
  width: 188px;
  height: 188px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.96), rgba(255, 251, 224, 0.78));
  box-shadow: 0 24px 48px rgba(50, 35, 20, 0.24);
}

.preview-bubble .shell-sprite {
  width: 152px;
  height: 152px;
}

.preview-bubble .preview-name {
  position: absolute;
  bottom: 2px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #31565d;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 14px rgba(50, 35, 20, 0.12);
}

.shell-result {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 28px;
  transform: translate(-50%, -40%) scale(0.8);
  animation: resultRise 420ms ease both;
  pointer-events: none;
}

.shell-result.pearl {
  filter: drop-shadow(0 0 10px rgba(255, 229, 92, 0.9));
}

.pearl-core {
  width: 20px;
  height: 20px;
  border: 3px solid #e9bf3c;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #ffffff 0 3px, transparent 4px),
    radial-gradient(circle at 50% 50%, #fffcec, #f7e7a1 68%, #d9a91f 100%);
}

.shell-result.sand {
  align-items: end;
}

.sand-pile {
  width: 30px;
  height: 18px;
  border: 2px solid rgba(118, 79, 42, 0.45);
  border-radius: 50% 50% 42% 42%;
  background: linear-gradient(#d9aa72, #9a6a42);
}

.sand-grain {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #7d5639;
}

.grain-a {
  left: 7px;
  bottom: 9px;
}

.grain-b {
  left: 16px;
  bottom: 12px;
}

.grain-c {
  right: 7px;
  bottom: 8px;
}

.shell-name {
  display: block;
  margin-top: 2px;
  color: #3f4e49;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.85);
}

.result-mark {
  position: absolute;
  top: -7px;
  right: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 900;
  background: #fff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16);
}

.result-mark.pearl {
  color: #c99000;
}

.result-mark.sand {
  color: #8d6e63;
}

.toast {
  position: absolute;
  z-index: 8;
  top: 16px;
  left: 50%;
  width: min(86%, 330px);
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-weight: 900;
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.status-panel {
  position: relative;
  z-index: 6;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.86);
}

.round-line,
.confidence {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.confidence {
  margin-top: 8px;
}

.confidence-track {
  flex: 1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #d9ece9;
}

#confidenceFill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #39a8a4, #ffbf55);
  transition: width 240ms ease;
}

.hint-line {
  min-height: 22px;
  margin: 8px 0 0;
  color: #315e63;
  font-size: 13px;
  font-weight: 800;
}

.controls {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  min-height: 112px;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff9ec;
}

.image-action {
  position: relative;
  display: grid;
  place-items: center;
  grid-template-rows: 1fr auto;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #43220e;
  font-weight: 950;
  font-size: 13px;
  letter-spacing: 0;
  box-shadow: 0 12px 20px rgba(111, 74, 42, 0.18);
  transform: translateY(0);
  transition: transform 140ms ease, opacity 140ms ease, filter 140ms ease;
  overflow: hidden;
}

.image-action::before {
  position: absolute;
  inset: 0;
  content: "";
  border-radius: inherit;
  border: 2px solid rgba(255, 255, 255, 0.72);
  pointer-events: none;
}

.image-action img {
  position: relative;
  z-index: 1;
  object-fit: contain;
  filter: drop-shadow(0 7px 8px rgba(92, 55, 22, 0.24));
}

.image-action span {
  position: relative;
  z-index: 1;
  text-align: center;
  line-height: 1;
}

.image-action:active {
  transform: translateY(2px) scale(0.985);
}

.cast-action {
  width: 96px;
  height: 96px;
  padding: 7px 8px 10px;
  background: linear-gradient(135deg, #ff9168, #ffd166);
}

.cast-action img {
  width: 68px;
  height: 68px;
}

.open-action {
  width: 76px;
  height: 76px;
  padding: 7px 7px 9px;
  font-size: 12px;
  background: linear-gradient(135deg, #80dfd1, #ffe8a3);
}

.open-action img {
  width: 50px;
  height: 50px;
}

.image-action:disabled {
  opacity: 0.52;
  filter: grayscale(0.4);
  box-shadow: none;
}

.controls button:disabled {
  pointer-events: none;
}

.report-screen {
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: linear-gradient(#bff0dc, #fff1cb);
}

.report-card {
  width: 100%;
  max-height: calc(100svh - 36px);
  padding: 22px;
  overflow: auto;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric {
  min-height: 78px;
  padding: 12px;
  border-radius: 8px;
  background: #f3fbf8;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.report-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(72px); }
}

@keyframes petalDrift {
  0% { transform: translate3d(18px, -90px, 0) rotate(0deg); }
  50% { transform: translate3d(-32px, 260px, 0) rotate(150deg); }
  100% { transform: translate3d(26px, 640px, 0) rotate(320deg); }
}

@keyframes summerRain {
  0% { transform: translate3d(22px, -120px, 0) rotate(9deg); }
  100% { transform: translate3d(-18px, 620px, 0) rotate(9deg); }
}

@keyframes leafDrift {
  0% { transform: translate3d(-32px, -110px, 0) rotate(-8deg); }
  45% { transform: translate3d(34px, 220px, 0) rotate(130deg); }
  100% { transform: translate3d(-18px, 650px, 0) rotate(300deg); }
}

@keyframes snowFall {
  0% { transform: translate3d(8px, -100px, 0); }
  50% { transform: translate3d(-18px, 230px, 0); }
  100% { transform: translate3d(10px, 630px, 0); }
}

@keyframes castNet {
  0% { opacity: 0; transform: translate(-110%, -120%) rotate(-36deg) scale(0.35); }
  35% { opacity: 1; transform: translate(-50%, -52%) rotate(8deg) scale(1); }
  70% { opacity: 1; transform: translate(-50%, 2%) rotate(-12deg) scale(0.92); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-18deg) scale(0.62); }
}

@keyframes popOpen {
  0% { transform: scale(1); }
  45% { transform: scale(1.16) rotate(-4deg); }
  100% { transform: scale(1.02); }
}

@keyframes resultRise {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%) scale(0.45);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -54%) scale(1);
  }
}

@media (max-width: 340px) {
  .shell-card {
    width: 66px;
  }

  .shell-bubble {
    width: 66px;
    height: 66px;
  }

  .shell-card svg {
    width: 58px;
    height: 58px;
  }

  h1 {
    font-size: 42px;
  }
}
