/* Opening card, floating salvage and in-game visibility. */

#game:not(.is-started) :is(.hud-top, .region, .hud-bottom, .world, .floating-cargo, #hook-line, .salvage-status, .toast) {
  visibility: hidden;
}

/* ---------- start screen ---------- */

.start-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  padding: clamp(16px, 3.2vw, 44px);
  background:
    linear-gradient(90deg, rgba(2, 14, 24, .97) 0%, rgba(2, 18, 29, .93) 27%, rgba(3, 22, 33, .72) 52%, rgba(3, 24, 35, .18) 76%, rgba(3, 24, 35, .06) 100%),
    radial-gradient(70% 90% at 12% 54%, rgba(255, 198, 92, .13), transparent 62%),
    radial-gradient(78% 100% at 84% 50%, rgba(46, 164, 176, .12), transparent 70%);
}

.start-screen::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 26%;
  background: linear-gradient(0deg, rgba(1, 10, 18, .78), transparent);
  pointer-events: none;
}

.start-card {
  position: relative;
  z-index: 2;
  width: min(520px, 55vw);
  animation: card-in .45s cubic-bezier(.2, .8, .25, 1) both;
}

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

.start-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 215, 135, .4);
  border-radius: 99px;
  background: rgba(5, 33, 48, .72);
  box-shadow: 0 4px 14px rgba(0, 8, 18, .26), inset 0 1px rgba(255, 255, 255, .1);
  color: #ffe2a4;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .16em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.start-kicker .mp-icon {
  width: 15px;
  height: 15px;
  color: #ffd27a;
}

.start-screen h1 {
  margin: 14px 0 12px;
  color: #f8fbf6;
  font-size: clamp(38px, 5.6vw, 66px);
  font-weight: 900;
  line-height: .98;
  letter-spacing: .01em;
  text-shadow: 0 4px 22px rgba(0, 10, 20, .6);
}

.start-screen h1 em {
  position: relative;
  color: #ffd27a;
  font-style: normal;
  text-shadow: 0 4px 22px rgba(255, 170, 60, .3);
}

.start-screen h1 em::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 4px;
  bottom: -.1em;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, #ffd27a, rgba(255, 210, 122, .1));
  transform: rotate(-1deg);
}

.start-sub {
  max-width: 370px;
  margin: 0 0 20px;
  color: #c6dfe3;
  font-size: 13px;
  line-height: 1.8;
  text-shadow: 0 1px 6px rgba(0, 12, 20, .5);
}

#start-game {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 196px;
  min-height: 56px;
  padding: 8px 26px 8px 8px;
  border: 1px solid #fff2bd;
  border-radius: 16px;
  background: linear-gradient(160deg, #ffe9a8 0%, #ffca63 48%, #e99b31 100%);
  box-shadow:
    0 5px 0 #9b6422,
    0 14px 30px rgba(255, 168, 55, .26),
    inset 0 1px rgba(255, 255, 255, .8);
  color: #3d2914;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .04em;
  transition: transform .12s ease, box-shadow .12s ease;
}

.start-play {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .36);
  box-shadow: inset 0 1px rgba(255, 255, 255, .7);
}

.start-play .mp-icon {
  width: 22px;
  height: 22px;
  color: #513516;
}

#start-game:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #9b6422, 0 6px 14px rgba(255, 168, 55, .2), inset 0 1px rgba(255, 255, 255, .8);
}

.start-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.start-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(160, 236, 233, .18);
  border-radius: 9px;
  background: rgba(4, 29, 47, .55);
  color: #bcdfe4;
  font-size: 10px;
  letter-spacing: .04em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.start-chip .mp-icon {
  width: 14px;
  height: 14px;
  color: #7ff0e6;
}

/* hero raft on the right */

.start-hero {
  position: absolute;
  z-index: 1;
  right: clamp(10px, 4.5vw, 70px);
  bottom: 6%;
  width: min(38vw, 460px);
  aspect-ratio: 770 / 322;
  transform: rotate(-2deg);
  pointer-events: none;
  filter: drop-shadow(0 22px 26px rgba(0, 8, 16, .5));
}

.start-hero-glow {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 82%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(120, 238, 224, .22), transparent 68%);
  transform: translate(-50%, -50%);
  filter: blur(6px);
}

.start-hero-raft {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.start-hero-sailor {
  position: absolute;
  left: 45.5%;
  bottom: 62%;
  width: 12.5%;
  height: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 4px rgba(0, 10, 18, .5));
  animation: hero-sailor 2.8s ease-in-out infinite alternate;
}

@keyframes hero-sailor {
  from { transform: translate(-50%, 0); }
  to { transform: translate(-50%, -4px); }
}

#game.is-started .start-screen { display: none; }

/* ---------- floating salvage ---------- */

.floating-cargo {
  position: absolute;
  z-index: 12;
  left: 84%;
  top: 58%;
  display: grid;
  place-items: center;
  width: clamp(50px, 6vw, 64px);
  height: clamp(50px, 6vw, 64px);
  padding: 0;
  border: 2px solid rgba(255, 223, 158, .9);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 26%, rgba(255, 255, 255, .3), transparent 36%),
    radial-gradient(circle at 50% 55%, #3f7d72, #164047 66%, #092a34);
  box-shadow:
    0 0 0 6px rgba(255, 215, 130, .1),
    0 12px 22px rgba(0, 15, 25, .42),
    inset 0 1px rgba(255, 255, 255, .28);
  color: #ffe6a6;
  transform: translate(-50%, -50%);
  transition: box-shadow .2s ease, left .3s ease;
}

.floating-cargo:disabled {
  cursor: default;
  opacity: 1;
}

.floating-cargo .mp-icon {
  position: relative;
  z-index: 1;
  width: 27px;
  height: 27px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45));
}

.cargo-water {
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: -12%;
  width: 116%;
  height: 40%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(190, 255, 247, .32), rgba(84, 200, 205, .1) 55%, transparent 72%);
  transform: translateX(-50%);
  pointer-events: none;
}

.floating-cargo[data-material="plastic"] {
  border-color: rgba(169, 255, 240, .92);
  background:
    radial-gradient(circle at 36% 26%, rgba(255, 255, 255, .34), transparent 36%),
    radial-gradient(circle at 50% 55%, #3a8e90, #0c4652 66%, #062b38);
  color: #d5fff7;
}

.floating-cargo[data-phase="cast"] {
  box-shadow:
    0 0 0 8px rgba(255, 220, 150, .13),
    0 0 30px rgba(255, 213, 126, .3),
    0 12px 22px rgba(0, 15, 25, .42),
    inset 0 1px rgba(255, 255, 255, .3);
  animation: cargo-bob 2s ease-in-out infinite;
}

.floating-cargo[data-phase="cast"]::before {
  content: "";
  position: absolute;
  inset: -13px;
  border: 1px solid rgba(255, 225, 160, .6);
  border-radius: 50%;
  animation: cargo-ring 2s ease-out infinite;
}

@keyframes cargo-bob {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, calc(-50% - 6px)); }
}

@keyframes cargo-ring {
  from { opacity: .7; transform: scale(.78); }
  to { opacity: 0; transform: scale(1.34); }
}

.floating-cargo[data-phase="hooked"] {
  left: 74%;
  box-shadow: inset 0 0 0 3px currentColor, 0 10px 20px rgba(0, 15, 25, .4);
  animation: none;
}

.floating-cargo[data-phase="hooked"] .cargo-water { opacity: .5; }

.hook-line {
  position: absolute;
  z-index: 11;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(255, 230, 170, .16), #ffe6a6 72%, #fff6d9);
  box-shadow: 0 0 10px rgba(255, 220, 140, .45);
  transform-origin: left center;
  pointer-events: none;
}

.hook-line::after {
  content: "";
  position: absolute;
  right: -6px;
  top: -5px;
  width: 10px;
  height: 10px;
  border: 2px solid #ffe6a6;
  border-radius: 50%;
  background: rgba(255, 220, 140, .22);
}

/* ---------- short landscape ---------- */

@container raft-stage (max-height: 360px) {
  .start-screen { padding: 12px 18px; }
  .start-card { width: min(470px, 56vw); }
  .start-kicker { padding: 4px 9px; font-size: 9px; }
  .start-screen h1 { font-size: clamp(30px, 8.8cqh, 44px); margin: 9px 0 8px; }
  .start-sub { margin-bottom: 12px; font-size: 11px; line-height: 1.65; }
  #start-game { min-height: 46px; min-width: 176px; font-size: 15px; }
  .start-play { width: 30px; height: 30px; }
  .start-meta { margin-top: 11px; }
}

@container raft-stage (max-height: 290px) {
  .start-kicker, .start-sub, .start-meta { display: none; }
  .start-screen h1 { margin: 0 0 12px; font-size: clamp(28px, 9cqh, 38px); }
  #start-game { min-height: 42px; min-width: 158px; font-size: 14px; }
}

@container raft-stage (max-width: 560px) {
  .start-card { width: min(340px, 62vw); }
  .start-hero { width: 30vw; right: 3%; bottom: 8%; opacity: .95; }
  .start-sub { max-width: 300px; }
}

@container raft-stage (max-width: 440px) {
  .start-hero { display: none; }
  .start-card { width: min(330px, 78vw); }
}
