@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700;900&family=Space+Grotesk:wght@500;600&display=swap");

:root {
  color-scheme: dark;
  font-family: "Noto Sans SC", sans-serif;
  background: #031b2b;
  color: #f3fbf7;
  --mint: #74f3c3;
  --coral: #ff826f;
  --ink: #031b2b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: #031b2b;
}

button,
kbd {
  font: inherit;
}

.game-shell,
#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game {
  display: block;
  touch-action: none;
}

.hud {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px 34px;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(116, 243, 195, 0.55);
  border-radius: 50%;
  color: var(--mint);
  font-size: 30px;
  line-height: 1;
  transform: rotate(12deg);
}

.eyebrow,
.brand h1 {
  margin: 0;
}

.eyebrow {
  color: rgba(179, 235, 221, 0.62);
  font-family: "Space Grotesk", sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.brand h1 {
  margin-top: 2px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.stats {
  display: flex;
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(176, 230, 219, 0.15);
  border-radius: 12px;
  background: rgba(1, 25, 39, 0.38);
  backdrop-filter: blur(14px);
}

.hud-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  pointer-events: auto;
}

.music-toggle {
  width: 43px;
  border: 1px solid rgba(176, 230, 219, 0.15);
  border-radius: 12px;
  background: rgba(3, 35, 51, 0.65);
  color: var(--mint);
  cursor: pointer;
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  backdrop-filter: blur(14px);
  transition: border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.music-toggle:hover {
  border-color: rgba(116, 243, 195, 0.5);
}

.music-toggle.muted {
  color: rgba(203, 235, 229, 0.45);
  opacity: 0.65;
}

.music-toggle.muted span {
  text-decoration: line-through;
}

.stat {
  display: flex;
  min-width: 94px;
  flex-direction: column;
  padding: 10px 16px;
  background: rgba(3, 35, 51, 0.55);
}

.stat span {
  color: rgba(203, 235, 229, 0.55);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.stat strong {
  color: var(--mint);
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
  line-height: 1.25;
}

.depth-meter {
  position: fixed;
  z-index: 4;
  top: 50%;
  right: 24px;
  display: flex;
  height: 210px;
  align-items: center;
  flex-direction: column;
  gap: 9px;
  color: rgba(211, 239, 232, 0.4);
  font-size: 9px;
  letter-spacing: 0.1em;
  pointer-events: none;
  transform: translateY(-50%);
}

.depth-line {
  position: relative;
  width: 1px;
  flex: 1;
  background: linear-gradient(rgba(116, 243, 195, 0.5), rgba(116, 243, 195, 0.03));
}

.depth-line i {
  position: absolute;
  top: 20%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 10px var(--mint);
  transform: translate(-50%, -50%);
  transition: top 0.2s linear;
}

.legend {
  position: fixed;
  z-index: 4;
  bottom: 24px;
  left: 50%;
  display: flex;
  gap: 22px;
  padding: 8px 14px;
  border: 1px solid rgba(176, 230, 219, 0.11);
  border-radius: 999px;
  background: rgba(1, 25, 39, 0.45);
  color: rgba(219, 240, 236, 0.56);
  font-size: 10px;
  letter-spacing: 0.08em;
  pointer-events: none;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.touch-ui {
  position: fixed;
  z-index: 6;
  inset: 0;
  pointer-events: none;
}

.touch-joystick {
  position: absolute;
  display: grid;
  width: 124px;
  height: 124px;
  place-items: center;
  border: 1px solid rgba(184, 255, 228, 0.34);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(116, 243, 195, 0.11), rgba(1, 25, 39, 0.2));
  box-shadow: inset 0 0 25px rgba(116, 243, 195, 0.08), 0 8px 30px rgba(0, 8, 16, 0.22);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.82);
  transition: opacity 0.14s ease, transform 0.14s ease;
  backdrop-filter: blur(4px);
}

.touch-joystick.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.touch-joystick i {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(220, 255, 245, 0.72);
  border-radius: 50%;
  background: rgba(116, 243, 195, 0.48);
  box-shadow: 0 0 22px rgba(116, 243, 195, 0.28);
  transition: transform 0.03s linear;
}

.touch-hint {
  position: absolute;
  bottom: max(26px, env(safe-area-inset-bottom));
  left: 50%;
  display: none;
  padding: 8px 14px;
  border: 1px solid rgba(176, 230, 219, 0.12);
  border-radius: 999px;
  background: rgba(1, 25, 39, 0.5);
  color: rgba(219, 240, 236, 0.62);
  font-size: 10px;
  letter-spacing: 0.08em;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot.edible {
  background: var(--mint);
  box-shadow: 0 0 7px var(--mint);
}

.dot.danger {
  background: var(--coral);
  box-shadow: 0 0 7px var(--coral);
}

.shark-warning {
  position: fixed;
  z-index: 8;
  top: 50%;
  left: 50%;
  display: flex;
  visibility: hidden;
  align-items: center;
  flex-direction: column;
  gap: 7px;
  color: white;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.35);
}

.shark-warning::before {
  position: fixed;
  z-index: -1;
  inset: -100vh -100vw;
  background: radial-gradient(circle, rgba(94, 6, 15, 0.08), rgba(68, 0, 8, 0.38));
  content: "";
}

.shark-warning span {
  color: rgba(255, 206, 198, 0.72);
  font-family: "Space Grotesk", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5em;
}

.shark-warning strong {
  font-size: clamp(45px, 8vw, 88px);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-shadow: 0 0 24px rgba(255, 75, 63, 0.65), 0 10px 35px rgba(0, 0, 0, 0.5);
}

.shark-warning.visible {
  visibility: visible;
  animation: shark-alert 0.58s ease-in-out infinite alternate;
}

@keyframes shark-alert {
  from {
    opacity: 0.58;
    transform: translate(-50%, -50%) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }
}

.overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  visibility: hidden;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at center, rgba(2, 37, 53, 0.3), rgba(1, 16, 28, 0.78));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s;
}

.overlay.visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.panel {
  position: relative;
  width: min(590px, 100%);
  padding: 46px 54px 36px;
  border: 1px solid rgba(129, 226, 202, 0.23);
  border-radius: 2px 38px 2px 38px;
  background:
    linear-gradient(135deg, rgba(10, 60, 71, 0.84), rgba(2, 28, 43, 0.93)),
    radial-gradient(circle at top right, rgba(116, 243, 195, 0.15), transparent 50%);
  box-shadow: 0 30px 90px rgba(0, 8, 16, 0.55);
  text-align: center;
  backdrop-filter: blur(18px);
}

.panel::before,
.panel::after {
  position: absolute;
  width: 30px;
  height: 30px;
  content: "";
}

.panel::before {
  top: -7px;
  left: -7px;
  border-top: 1px solid var(--mint);
  border-left: 1px solid var(--mint);
}

.panel::after {
  right: -7px;
  bottom: -7px;
  border-right: 1px solid var(--mint);
  border-bottom: 1px solid var(--mint);
}

.panel-kicker {
  margin: 0 0 15px;
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.32em;
}

.panel h2 {
  margin: 0;
  font-size: clamp(35px, 5vw, 58px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.panel-copy {
  max-width: 430px;
  margin: 22px auto 28px;
  color: rgba(220, 241, 236, 0.68);
  font-size: 14px;
  line-height: 1.9;
}

.panel button {
  min-width: 190px;
  padding: 14px 25px;
  border: 0;
  border-radius: 2px 15px 2px 15px;
  background: var(--mint);
  box-shadow: 0 8px 30px rgba(116, 243, 195, 0.18);
  color: #042d35;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.12em;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.panel button:hover {
  box-shadow: 0 11px 35px rgba(116, 243, 195, 0.3);
  transform: translateY(-2px);
}

.panel button span {
  display: inline-block;
  margin-left: 18px;
  font-size: 18px;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin-top: 27px;
  color: rgba(213, 238, 231, 0.42);
  font-size: 10px;
}

kbd {
  padding: 2px 5px;
  border: 1px solid rgba(209, 240, 232, 0.21);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(230, 248, 244, 0.73);
  font-size: 9px;
}

.panel.compact {
  width: min(520px, 100%);
}

.panel.compact h2 {
  font-size: clamp(31px, 4.5vw, 48px);
}

.result {
  display: flex;
  justify-content: center;
  gap: 55px;
  margin: 28px 0;
}

.result div {
  display: flex;
  flex-direction: column;
}

.result span {
  color: rgba(217, 239, 234, 0.45);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.result strong {
  color: var(--mint);
  font-family: "Space Grotesk", sans-serif;
  font-size: 27px;
}

@media (hover: none), (pointer: coarse) {
  .touch-hint {
    display: block;
  }

  .legend {
    bottom: max(68px, calc(env(safe-area-inset-bottom) + 54px));
  }
}

@media (max-width: 640px) {
  .hud {
    padding: 16px;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
    font-size: 24px;
  }

  .brand h1 {
    font-size: 14px;
  }

  .eyebrow {
    font-size: 7px;
  }

  .stat {
    min-width: 56px;
    padding: 7px;
  }

  .hud-actions {
    gap: 5px;
  }

  .music-toggle {
    width: 34px;
    border-radius: 9px;
    font-size: 15px;
  }

  .stat span {
    font-size: 8px;
  }

  .stat strong {
    font-size: 15px;
  }

  .depth-meter {
    right: 10px;
    height: 160px;
  }

  .legend {
    bottom: max(68px, calc(env(safe-area-inset-bottom) + 54px));
  }

  .panel {
    padding: 36px 23px 28px;
    border-radius: 2px 25px 2px 25px;
  }

  .panel-copy {
    font-size: 12px;
  }

  .controls {
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .brand > div {
    display: none;
  }
}
