html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0793c7;
  touch-action: none;
  user-select: none;
}

body {
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

.hud {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  top: max(12px, env(safe-area-inset-top));
  width: min(310px, calc(100vw - 28px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(4, 61, 91, 0.58);
  box-shadow: 0 10px 28px rgba(0, 45, 85, 0.2);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.fish-title,
.stat-row,
.target-line,
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.fish-title strong {
  overflow: hidden;
  font-size: 17px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fish-title span,
.stat-row,
.target-line,
.toast {
  font-size: 13px;
  line-height: 1.25;
}

.stat-row {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
}

.bar {
  width: 100%;
  height: 8px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  transition: width 180ms ease-out;
}

.hp-bar span {
  background: linear-gradient(90deg, #ff6f61, #ffd166);
}

.exp-bar span {
  background: linear-gradient(90deg, #44d7b6, #f8f06a);
}

.target-line {
  margin-top: 8px;
  color: #f8f06a;
  font-weight: 700;
}

.toast {
  min-height: 17px;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.86);
}

.restart-button {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 156px;
  height: 50px;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.fish-picker {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  width: min(360px, calc(100vw - 28px));
  max-height: 92px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(4, 61, 91, 0.5);
  box-shadow: 0 10px 28px rgba(0, 45, 85, 0.18);
  backdrop-filter: blur(10px);
  z-index: 6;
  overflow: hidden;
}

.fish-picker-title {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
}

.fish-picker-list {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.fish-choice {
  display: grid;
  flex: 0 0 62px;
  gap: 4px;
  place-items: center;
  min-width: 62px;
  height: 56px;
  padding: 6px 5px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.fish-choice img {
  width: 46px;
  height: 34px;
  object-fit: contain;
  pointer-events: none;
}

.fish-choice.is-selected {
  border-color: #fff1a8;
  color: #075172;
  background: rgba(255, 241, 168, 0.94);
}

.controls {
  position: fixed;
  left: max(22px, env(safe-area-inset-left));
  right: max(22px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.joystick {
  position: relative;
  width: 124px;
  height: 124px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.18), 0 12px 28px rgba(0, 45, 85, 0.18);
  pointer-events: auto;
  touch-action: none;
}

.joystick::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  border: 1px dashed rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(0, 45, 85, 0.24);
  transform: translate(-50%, -50%);
  transition: transform 80ms ease-out;
}

.action-pad {
  display: grid;
  grid-template-columns: 64px 70px 82px;
  gap: 10px;
  align-items: end;
  pointer-events: auto;
}

button {
  border: 0;
  color: #075172;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(0, 45, 85, 0.2);
  font-size: 18px;
  font-weight: 800;
  pointer-events: auto;
}

button:active {
  transform: translateY(1px) scale(0.98);
}

button:disabled {
  color: rgba(7, 81, 114, 0.52);
  background: rgba(255, 255, 255, 0.58);
}

.skill-button {
  width: 70px;
  height: 48px;
  border-radius: 8px;
  font-size: 16px;
}

.debug-button {
  width: 64px;
  height: 42px;
  border-radius: 8px;
  font-size: 15px;
}

.debug-button.is-active {
  color: #073c52;
  background: #fff1a8;
}

.eat-button {
  width: 82px;
  height: 72px;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(160deg, #ff7a59, #ffb347);
}

@media (max-width: 760px) and (orientation: portrait) {
  .hud {
    width: min(280px, calc(100vw - 28px));
  }

  .fish-picker {
    left: max(14px, env(safe-area-inset-left));
    right: auto;
    top: auto;
    bottom: max(136px, calc(env(safe-area-inset-bottom) + 136px));
    width: min(360px, calc(100vw - 28px));
    height: 84px;
  }

  .joystick {
    width: 108px;
    height: 108px;
  }

  .action-pad {
    grid-template-columns: 58px 64px 76px;
  }

  .debug-button {
    width: 58px;
    font-size: 14px;
  }

  .skill-button {
    width: 64px;
  }

  .eat-button {
    width: 76px;
    height: 68px;
  }
}


.fullscreen-button {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 74px;
  height: 44px;
  transform: translateX(-50%);
  z-index: 10;
  border-radius: 8px;
  font-size: 15px;
}

:fullscreen .fullscreen-button,
.standalone .fullscreen-button {
  display: none;
}

@media (orientation: portrait) {
  .fullscreen-button {
    display: none;
  }
}

:fullscreen,
.standalone {
  background: #0793c7;
}
