@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/fredoka.woff2') format('woff2');
}

/* Sea Breeze: no boxes, white type with a deep-sea outline floating over the
   water; glass capsules only where a number needs a backing. */
:root {
  --sea: #0b3a55;
  --glass: rgba(11, 58, 85, 0.6);
  --lift: 0 3px 0 rgba(11, 58, 85, 0.55);
  --heart: #f0433a;
  --leaf: #6cc832;
  --meter: #7bd63c;
  --coin: #ffc531;
  --hw: 34px; /* heart width */
  --font: 'Fredoka', 'Trebuchet MS', 'Arial Rounded MT Bold', sans-serif;
  --heart-full: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 20.4l-1.4-1.3C5.4 14.4 2 11.4 2 7.6 2 4.5 4.4 2 7.5 2c1.7 0 3.4.8 4.5 2.1C13.1 2.8 14.8 2 16.5 2 19.6 2 22 4.5 22 7.6c0 3.8-3.4 6.8-8.6 11.5L12 20.4z' fill='%23f0433a' stroke='white' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E");
  --heart-empty: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 22'%3E%3Cpath d='M12 20.4l-1.4-1.3C5.4 14.4 2 11.4 2 7.6 2 4.5 4.4 2 7.5 2c1.7 0 3.4.8 4.5 2.1C13.1 2.8 14.8 2 16.5 2 19.6 2 22 4.5 22 7.6c0 3.8-3.4 6.8-8.6 11.5L12 20.4z' fill='rgba(11,58,85,0.55)' stroke='white' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E");
  --coin-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='14' fill='%23ffc531' stroke='white' stroke-width='2.5'/%3E%3Ccircle cx='16' cy='16' r='8.5' fill='none' stroke='%23d88f00' stroke-width='2.2'/%3E%3Cpath d='M16 11v10M13 13.5h6' stroke='%23d88f00' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  --swirl-small: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -3 62 24'%3E%3Cpath d='M58 12H24c-8 0-12-3-12-7 0-3 2.5-4.5 5-4.5 2.7 0 4.2 2 3.8 4' stroke='%230b3a55' stroke-width='6' fill='none' stroke-linecap='round'/%3E%3Cpath d='M58 12H24c-8 0-12-3-12-7 0-3 2.5-4.5 5-4.5 2.7 0 4.2 2 3.8 4' stroke='white' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  --play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5z' fill='white'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b63b5;
  font-family: var(--font);
  font-weight: 600;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(8, 20, 50, 0.38) 100%);
  transition: box-shadow 0.25s;
}
#vignette.hurt {
  box-shadow: inset 0 0 120px rgba(230, 50, 30, 0.55);
}

.hidden {
  display: none !important;
}

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

#hull {
  position: fixed;
  top: 20px;
  left: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  filter: drop-shadow(var(--lift));
  pointer-events: none;
}
#hearts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  max-width: calc(var(--hw) * 10);
}
#hearts.low {
  animation: beat 0.6s ease-in-out infinite alternate;
  transform-origin: left center;
}
@keyframes beat {
  to {
    transform: scale(1.06);
  }
}
.heart {
  position: relative;
  width: var(--hw);
  height: calc(var(--hw) * 0.92);
  background: var(--heart-empty) center / 100% 100% no-repeat;
}
.heart i {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  background: var(--heart-full) left center / var(--hw) 100% no-repeat;
  transition: width 0.25s ease-out;
}

.buff {
  display: flex;
  align-items: center;
  gap: 8px;
}
.keg {
  width: 26px;
  height: 26px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='3' width='14' height='18' rx='5' fill='%23b5793f' stroke='white' stroke-width='2'/%3E%3Cpath d='M5.5 8.5h13M5.5 15.5h13' stroke='white' stroke-width='2'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.buff-bar {
  width: 170px;
  height: 14px;
  border: 2.5px solid #fff;
  border-radius: 8px;
  background: var(--glass);
  overflow: hidden;
}
#buff-fill {
  height: 100%;
  width: 100%;
  background: var(--meter);
}

#wave {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(var(--lift));
  pointer-events: none;
  white-space: nowrap;
}
#wave-label {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  -webkit-text-stroke: 8px var(--sea);
  paint-order: stroke fill;
}
#wave-sub {
  font-size: 17px;
  -webkit-text-stroke: 5px var(--sea);
  paint-order: stroke fill;
}
.swirls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.swirls::before,
.swirls::after {
  content: '';
  width: 54px;
  height: 21px;
  background: var(--swirl-small) center / contain no-repeat;
}
.swirls::after {
  transform: scaleX(-1);
}
.swirls:empty::before,
.swirls:empty::after {
  display: none;
}

#gold {
  position: fixed;
  left: 24px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 6px 8px;
  border: 3px solid #fff;
  border-radius: 18px;
  background: var(--glass);
  box-shadow: var(--lift);
  pointer-events: none;
}
#gold-count {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 1px;
}
#gold-count.pop {
  animation: pop 0.3s ease-out;
}
@keyframes pop {
  40% {
    transform: scale(1.3);
  }
}
.coin {
  width: 36px;
  height: 36px;
  background: var(--coin-icon) center / contain no-repeat;
}

.round-btn {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--glass);
  color: #fff;
  box-shadow: var(--lift);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  z-index: 20;
}
.round-btn .cross {
  display: none;
}
.round-btn.muted .cross {
  display: block;
}
.round-btn.muted .waves {
  display: none;
}

/* touch: fires again at the current aim, dims while those guns reload */
#fire {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 84px;
  height: 84px;
  padding: 36px 0 0;
  display: none;
  align-items: center;
  justify-content: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background-color: var(--leaf);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M5 18l15-7.5 2.6 5.2L7.6 23.2z' fill='white'/%3E%3Cpath d='M19.6 9.4l2-1 3.6 7.2-2 1z' fill='white'/%3E%3Ccircle cx='10.5' cy='22.5' r='4.2' fill='white' stroke='%23447f22' stroke-width='2'/%3E%3Cpath d='M26.5 7.5l2.2-2.2M28 12h3M23.5 4.5V1.5' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center 10px;
  background-size: 34px;
  box-shadow:
    inset 0 -6px 0 rgba(0, 60, 10, 0.25),
    var(--lift),
    0 10px 24px rgba(5, 25, 50, 0.3);
  color: #fff;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 700;
  -webkit-text-stroke: 4px var(--sea);
  paint-order: stroke fill;
  touch-action: none;
  z-index: 5;
  transition:
    background-color 0.15s,
    transform 0.08s;
}
#fire.loading {
  background-color: var(--glass);
}
#fire:active {
  transform: scale(0.93);
}

/* ---------------------------------------------------------------- world-space labels */

#plates,
#floaters {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.plate {
  position: absolute;
  width: 56px;
  height: 11px;
  margin-left: -28px;
  border: 2px solid #fff;
  border-radius: 6px;
  background: var(--glass);
  box-shadow: 0 2px 0 rgba(11, 58, 85, 0.5);
  overflow: hidden;
}
.plate.boss {
  width: 90px;
  margin-left: -45px;
  height: 14px;
}
.plate > div {
  height: 100%;
  background: var(--heart);
  transition: width 0.2s;
}
.plate.boss > div {
  background: #9b6bff;
}

.floater {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  -webkit-text-stroke: 6px var(--sea);
  paint-order: stroke fill;
  animation: float-up 1s ease-out forwards;
}
.floater.crit {
  font-size: 34px;
  -webkit-text-stroke-color: var(--heart);
}
.floater.gold {
  color: var(--coin);
  font-size: 22px;
}
.floater.heal {
  color: var(--meter);
}
.floater.buff {
  color: #ffae42;
  font-size: 24px;
}
.floater.hurt {
  color: #ff7a6b;
}
@keyframes float-up {
  0% {
    opacity: 0;
    margin-top: 0;
    scale: 0.4;
  }
  15% {
    opacity: 1;
    scale: 1.25;
  }
  30% {
    scale: 1;
  }
  100% {
    opacity: 0;
    margin-top: -60px;
  }
}

/* ---------------------------------------------------------------- banner */

#banner {
  position: fixed;
  top: 26%;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: none;
  filter: drop-shadow(0 5px 0 rgba(11, 58, 85, 0.5));
  animation: banner-in 2.6s ease-out forwards;
}
#banner-title {
  font-size: clamp(44px, 9vw, 86px);
  font-weight: 700;
  line-height: 1.1;
  -webkit-text-stroke: clamp(8px, 1.2vw, 12px) var(--sea);
  paint-order: stroke fill;
  letter-spacing: 1px;
}
#banner-sub {
  font-size: clamp(16px, 3vw, 24px);
  margin-top: 4px;
  -webkit-text-stroke: 6px var(--sea);
  paint-order: stroke fill;
}
@keyframes banner-in {
  0% {
    opacity: 0;
    transform: scale(2.2);
  }
  12% {
    opacity: 1;
    transform: scale(0.92);
  }
  20% {
    transform: scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ---------------------------------------------------------------- overlays */

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  text-align: center;
  background: rgba(6, 34, 52, 0.35);
  z-index: 10;
}

.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 6px 0 rgba(11, 58, 85, 0.5));
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob {
  50% {
    transform: translateY(-6px);
  }
}
.logo-top {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  margin: 0 0 -0.55em 6%;
  font-size: clamp(34px, 6vw, 54px);
  font-weight: 700;
  -webkit-text-stroke: clamp(7px, 1vw, 10px) var(--sea);
  paint-order: stroke fill;
  transform: rotate(-8deg);
}
.logo-main {
  font-size: clamp(80px, 16vw, 148px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 1px;
  -webkit-text-stroke: clamp(9px, 1.5vw, 14px) var(--sea);
  paint-order: stroke fill;
}
.logo .swirl {
  width: clamp(280px, 44vw, 560px);
  aspect-ratio: 620 / 60;
  margin-top: -0.4em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 620 60'%3E%3Cpath d='M14 38C150 38 250 14 390 24S540 52 584 30c14-8 10-26-6-24-12 2-10 18 2 16' stroke='%230b3a55' stroke-width='13' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M14 38C150 38 250 14 390 24S540 52 584 30c14-8 10-26-6-24-12 2-10 18 2 16' stroke='white' stroke-width='5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.tagline {
  max-width: 560px;
  font-size: clamp(16px, 2.4vw, 20px);
  -webkit-text-stroke: 6px var(--sea);
  paint-order: stroke fill;
}

.big-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 8px 36px 8px 8px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: rgba(11, 58, 85, 0.65);
  color: #fff;
  font-family: var(--font);
  font-size: clamp(24px, 3.6vw, 32px);
  font-weight: 700;
  box-shadow:
    var(--lift),
    0 12px 26px rgba(5, 25, 50, 0.3);
  cursor: pointer;
  transition: transform 0.12s;
}
.big-btn .go {
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  background: var(--play) 58% center / 46% no-repeat, var(--leaf);
  box-shadow: inset 0 -4px 0 rgba(0, 60, 10, 0.25);
}
.big-btn:hover {
  transform: translateY(-2px) scale(1.03);
}
.big-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(11, 58, 85, 0.55);
}
.big-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
}

.best {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 1.2em;
  font-size: 17px;
  -webkit-text-stroke: 5px var(--sea);
  paint-order: stroke fill;
}
.best:not(:empty)::before {
  content: '';
  width: 24px;
  height: 24px;
  background: var(--coin-icon) center / contain no-repeat;
}

#title {
  justify-content: flex-start;
  gap: 12px;
  padding-top: max(4vh, 20px);
  background: none;
}
#title .controls {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(3vh, 14px);
}
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 24px;
  font-size: 17px;
  -webkit-text-stroke: 5px var(--sea);
  paint-order: stroke fill;
  filter: drop-shadow(0 2px 0 rgba(11, 58, 85, 0.5));
}
.controls span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border: 2.5px solid #fff;
  border-radius: 999px;
  background: var(--sea);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  -webkit-text-stroke: 0;
}
kbd.wide {
  padding: 0 12px;
  font-size: 14px;
}
kbd.go-key {
  background: var(--leaf);
}
.touch-only {
  display: none;
}
@media (pointer: coarse) {
  .desktop-only {
    display: none;
  }
  .controls.touch-only,
  #fire {
    display: flex;
  }
  /* the left thumb lives bottom-left, so gold joins the sound button */
  #gold {
    left: auto;
    bottom: auto;
    top: 16px;
    right: 16px;
  }
  .round-btn {
    top: 16px;
    right: 16px;
  }
  #hud:not(.hidden) ~ .round-btn {
    top: 76px;
  }
}

.sunk {
  font-size: clamp(64px, 14vw, 130px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--heart);
  -webkit-text-stroke: clamp(9px, 1.4vw, 14px) var(--sea);
  paint-order: stroke fill;
  filter: drop-shadow(0 7px 0 rgba(11, 58, 85, 0.5));
  transform: rotate(-3deg);
}
.sunk.calm {
  color: #fff;
}
.stats {
  display: flex;
  gap: clamp(12px, 4vw, 32px);
}
.stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 18px 12px;
  min-width: 96px;
  border: 3px solid #fff;
  border-radius: 18px;
  background: var(--glass);
  box-shadow: var(--lift);
}
.stats span {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.1;
}
.stats label {
  font-size: 15px;
  opacity: 0.9;
}

/* ---------------------------------------------------------------- touch stick */

#stick {
  position: fixed;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: rgba(11, 58, 85, 0.3);
  pointer-events: none;
}
#stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--sea);
  box-shadow: var(--lift);
}

@media (max-width: 600px) {
  :root {
    --hw: 24px;
  }
  #hull {
    top: 12px;
    left: 12px;
    gap: 8px;
  }
  .buff-bar {
    width: 110px;
  }
  #wave {
    top: auto;
    bottom: 14px;
  }
  #wave-label {
    font-size: 28px;
  }
  #wave .swirls::before,
  #wave .swirls::after {
    display: none;
  }
  #gold {
    left: auto;
    bottom: auto;
    top: 12px;
    right: 12px;
    padding: 4px 12px 4px 6px;
  }
  #gold-count {
    font-size: 24px;
  }
  .coin {
    width: 28px;
    height: 28px;
  }
  .round-btn {
    top: 12px;
    right: 12px;
  }
  #hud:not(.hidden) ~ .round-btn {
    top: 62px;
  }
  #fire {
    width: 76px;
    height: 76px;
    right: 14px;
    bottom: 16px;
    background-position: center 8px;
    background-size: 30px;
    padding-top: 32px;
  }
}

@media (max-height: 500px) {
  :root {
    --hw: 26px;
  }
  #title {
    gap: 6px;
    padding-top: 8px;
  }
  .logo-top {
    font-size: 28px;
  }
  .logo-main {
    font-size: 64px;
    -webkit-text-stroke-width: 8px;
  }
  .logo .swirl {
    width: 260px;
  }
  .tagline {
    font-size: 14px;
  }
  .big-btn {
    font-size: 22px;
    padding: 5px 26px 5px 5px;
  }
  .controls {
    font-size: 13px;
    gap: 6px 16px;
  }
  kbd {
    min-width: 26px;
    height: 26px;
    font-size: 13px;
  }
}
