html, body {
  margin: 0;
  overflow: hidden;
  background: #a3e5ff;
  font-family: Georgia, "Palatino Linotype", serif;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

canvas.webgl {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 1;
  image-rendering: auto;
}

.game-title-branding {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 6;
  transition: opacity 0.8s ease;
}

.game-title-branding.hidden { opacity: 0; }

.main-title,
.sub-title {
  font-family: "Arial Black", Impact, sans-serif;
  margin: 0;
  letter-spacing: 4px;
}

.main-title {
  font-size: 64px;
  color: #ffcc00;
  -webkit-text-stroke: 4px #000;
  text-shadow: 6px 6px 0 #b00000;
}

.sub-title {
  font-size: 28px;
  color: #ffffff;
  letter-spacing: 6px;
  -webkit-text-stroke: 2px #000;
  text-shadow: 4px 4px 0 #0055aa;
}

#toon-hud {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  user-select: none;
}

.gauge-frame {
  position: relative;
  width: 84px;
  height: 84px;
  background: #fbf9f0;
  border: 4px solid #151515;
  border-radius: 50%;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-vector {
  position: absolute;
  width: 86%;
  height: 86%;
  transform: rotate(-90deg);
}

.track-bg { fill: none; stroke: #eadeb8; stroke-width: 14; }

.status-fill {
  fill: none;
  stroke: #d85333;
  stroke-width: 14;
  stroke-dasharray: 263.89;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.center-glyph {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 32px;
  color: #151515;
  text-shadow: 1px 1px 0 #fff;
}

.coin-counter {
  background: #151515;
  color: #fbf9f0;
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 18px;
  padding: 4px 12px;
  border-radius: 12px;
  width: fit-content;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.coin-icon { color: #ffd700; font-size: 20px; }

#backpack-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 10;
  font-size: 32px;
  background: #fbf9f0;
  border: 4px solid #151515;
  border-radius: 12px;
  padding: 6px 12px;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 3px 3px 0 #151515;
}

#backpack-menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  width: 320px;
  background: #fbf9f0;
  border: 5px solid #151515;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.2);
}

#backpack-menu.hidden { display: none; }

#backpack-menu h3 {
  margin: 0 0 12px;
  font-family: Impact, "Arial Black", sans-serif;
  letter-spacing: 1px;
  color: #151515;
  border-bottom: 3px solid #151515;
  padding-bottom: 6px;
}

#inventory-grid-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.inventory-slot {
  width: 64px;
  height: 64px;
  background: #eadeb8;
  border: 3px solid #151515;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  position: relative;
  cursor: pointer;
}

.item-count-badge {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 12px;
  font-family: monospace;
  font-weight: bold;
  background: #151515;
  color: #fff;
  padding: 1px 4px;
  border-radius: 4px;
}

#joystick-boundary {
  position: absolute;
  bottom: 40px;
  left: 40px;
  z-index: 15;
  width: 120px;
  height: 120px;
  background: rgba(251, 249, 240, 0.4);
  border: 4px solid #151515;
  border-radius: 50%;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

#joystick-boundary.hidden { display: none !important; }

#joystick-thumb {
  width: 50px;
  height: 50px;
  background: #d85333;
  border: 4px solid #151515;
  border-radius: 50%;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
}

.wind {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px solid #e7c56a;
  background: #163a66;
  position: relative;
}

.wind i {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 22px;
  margin-left: -2px;
  background: #f4efe4;
  transform-origin: center 19px;
  animation: swing 4s ease-in-out infinite;
}

@keyframes swing {
  50% { transform: rotate(28deg); }
}

#hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  margin: 0;
  color: #f7f3ea;
  background: rgba(16, 36, 58, 0.72);
  padding: 8px 16px;
  border-radius: 999px;
  z-index: 5;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 13px;
  letter-spacing: 0.4px;
}

body::before,
body::after {
  content: "";
  position: fixed;
  left: 0;
  width: 100%;
  height: 10vh;
  background: #000;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

body::before { top: 0; }
body::after { bottom: 0; }

body.cinematic-widescreen::before,
body.cinematic-widescreen::after {
  opacity: 1;
}

body.landing {
  overflow: auto;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 120%, #1a75ff 0%, #43b4ff 42%, #dceffa 78%);
}

.harbor {
  width: min(640px, calc(100% - 40px));
  margin: 10vh auto;
  padding: 36px 32px 28px;
  background: #fbf9f0;
  border: 5px solid #151515;
  border-radius: 28px;
  box-shadow: 8px 8px 0 rgba(21, 21, 21, 0.18);
  text-align: center;
}

.harbor-mark {
  margin: 0 0 12px;
  font-family: "Courier New", monospace;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #151515;
}

.harbor h1 {
  margin: 0;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: clamp(40px, 8vw, 68px);
  letter-spacing: 3px;
  color: #ffcc00;
  -webkit-text-stroke: 4px #000;
  text-shadow: 6px 6px 0 #b00000;
}

.harbor-sub {
  margin: 6px 0 18px;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 6px;
  color: #ffffff;
  -webkit-text-stroke: 2px #000;
  text-shadow: 4px 4px 0 #0055aa;
}

.harbor-copy {
  margin: 0 auto 24px;
  max-width: 46ch;
  font-size: 18px;
  line-height: 1.45;
  color: #151515;
}

.harbor-play {
  display: inline-block;
  background: #d85333;
  color: #fbf9f0;
  text-decoration: none;
  font-family: "Arial Black", Impact, sans-serif;
  letter-spacing: 1px;
  font-size: 22px;
  padding: 12px 36px;
  border: 4px solid #151515;
  border-radius: 999px;
  box-shadow: 4px 4px 0 #151515;
}

.harbor-note {
  margin: 22px 0 0;
  font-family: "Courier New", monospace;
  font-size: 14px;
  color: #3a3428;
}
