:root {
  --ocean-deep: #041423;
  --ocean-mid: #0a3558;
  --ocean-top: #166188;
  --bitcoin-orange: #f7931a;
  --text-main: #f4faff;
  --text-muted: #b6d4e9;
  --panel: rgba(5, 22, 40, 0.9);
  --panel-border: rgba(247, 147, 26, 0.7);
  --boat-bob-duration: 3.4s;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Courier New", "Lucida Console", monospace;
  color: var(--text-main);
  background:
    radial-gradient(circle at 15% 10%, rgba(247, 147, 26, 0.16), transparent 30%),
    radial-gradient(circle at 85% 18%, rgba(44, 144, 201, 0.2), transparent 36%),
    linear-gradient(180deg, #081729 0%, #05203a 42%, #041423 100%);
  display: grid;
  place-items: center;
  padding: 24px;
}

.app-shell {
  width: min(760px, 100%);
}

.app-header {
  text-align: center;
  margin-bottom: 16px;
}

.app-header h1 {
  margin: 0;
  color: var(--bitcoin-orange);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: clamp(1.5rem, 2.7vw, 2.2rem);
  text-shadow: 0 0 16px rgba(247, 147, 26, 0.35);
}

.refresh-note {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.tracker-card {
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 32px rgba(2, 7, 14, 0.45);
}

.scene-frame {
  position: relative;
  height: 280px;
  overflow: hidden;
  border-bottom: 2px solid rgba(247, 147, 26, 0.32);
  background: linear-gradient(180deg, rgba(22, 97, 136, 0.6) 0%, rgba(10, 53, 88, 0.28) 70%);
}

.storm-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  background:
    linear-gradient(180deg, rgba(11, 16, 22, 0.62), rgba(4, 12, 20, 0.18)),
    repeating-linear-gradient(
      -15deg,
      rgba(255, 255, 255, 0.07),
      rgba(255, 255, 255, 0.07) 2px,
      transparent 2px,
      transparent 14px
    );
}

.storm-layer::after {
  content: "";
  position: absolute;
  top: 0;
  left: 45%;
  width: 3px;
  height: 0;
  background: #fefefe;
  box-shadow: 0 0 20px #fff;
  opacity: 0;
}

body.storm-mode .storm-layer {
  opacity: 1;
}

body.storm-mode .storm-layer::after {
  animation: lightning 2.8s infinite;
}

.boat-wrapper {
  position: absolute;
  left: 50%;
  bottom: 38px;
  transform: translateX(-50%);
  transition: transform 0.85s ease;
}

.boat-wrapper.direction-up {
  transform: translateX(calc(-50% + 28px));
}

.boat-wrapper.direction-down {
  transform: translateX(calc(-50% - 28px));
}

.boat-wrapper.direction-flat {
  transform: translateX(-50%);
}

.boat-media {
  width: 250px;
  height: 150px;
  display: grid;
  place-items: center;
  animation: bob var(--boat-bob-duration) ease-in-out infinite;
  transition: transform 0.75s ease, filter 0.75s ease;
}

#boatImage {
  width: 210px;
  height: 130px;
  object-fit: contain;
  image-rendering: pixelated;
}

#boatImage[data-fallback="true"] {
  display: none;
}

#boatImage[data-fallback="false"] {
  display: block;
}

.boat-emoji {
  display: none;
  font-size: clamp(3.6rem, 10vw, 5.4rem);
  line-height: 1;
  text-shadow: 0 8px 12px rgba(0, 0, 0, 0.3);
}

#boatImage[data-fallback="true"] + .boat-emoji {
  display: block;
}

#tracker[data-boat="shipwreck"] .boat-media {
  transform: scale(0.83) rotate(-10deg);
  filter: saturate(0.7) brightness(0.86);
}

#tracker[data-boat="submarine"] .boat-media {
  transform: translateY(12px) scale(0.92);
  filter: saturate(0.88);
}

#tracker[data-boat="sailboat"] .boat-media {
  transform: scale(1);
}

#tracker[data-boat="speedboat"] .boat-media {
  transform: scale(1.16);
  filter: drop-shadow(0 0 10px rgba(247, 147, 26, 0.36));
}

#tracker[data-boat="yacht"] .boat-media {
  transform: scale(1.3);
  filter: drop-shadow(0 0 14px rgba(247, 147, 26, 0.5));
}

.price {
  margin: 20px 0 8px;
  text-align: center;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
}

.status-label {
  margin: 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-message {
  margin: 10px 18px 12px;
  text-align: center;
  font-size: clamp(1rem, 2.7vw, 1.3rem);
  color: var(--bitcoin-orange);
  min-height: 1.4em;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px 18px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ocean {
  position: relative;
  height: 140px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(14, 69, 112, 0.45), rgba(5, 34, 60, 0.9));
  border-radius: 0 0 14px 14px;
}

.wave {
  position: absolute;
  left: -25%;
  width: 150%;
  border-radius: 100% 100% 0 0;
}

.wave-back {
  bottom: -44px;
  height: 140px;
  background: rgba(62, 154, 208, 0.38);
  animation: waveShift 11s linear infinite;
}

.wave-front {
  bottom: -52px;
  height: 150px;
  background: rgba(17, 102, 152, 0.7);
  animation: waveShift 7s linear infinite reverse;
}

body.storm-mode .wave-back {
  animation-duration: 5s;
  background: rgba(80, 134, 164, 0.5);
}

body.storm-mode .wave-front {
  animation-duration: 3.2s;
  background: rgba(30, 78, 108, 0.82);
}

@keyframes bob {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -10px;
  }
}

@keyframes waveShift {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(16%);
  }
}

@keyframes lightning {
  0%,
  74%,
  100% {
    opacity: 0;
    height: 0;
  }
  76% {
    opacity: 1;
    height: 64%;
  }
  79% {
    opacity: 0;
    height: 64%;
  }
  81% {
    opacity: 0.7;
    height: 56%;
  }
  84% {
    opacity: 0;
    height: 56%;
  }
}

@media (max-width: 640px) {
  body {
    padding: 12px;
  }

  .scene-frame {
    height: 240px;
  }

  .boat-media {
    width: 205px;
    height: 130px;
  }

  #boatImage {
    width: 185px;
    height: 108px;
  }

  .meta-row {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
  }
}
