.game-container {
  position: relative;
}

.game-overlay {
  max-width: 960px;
  width: 100%;
  max-height: 540px;
  height: 100%;
  position: absolute;
  background-color: rgba(0, 0, 0, 0.5);
  background-image: url('../img/interface/overlay/overlay_menu.png');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border-radius: 16px;
  z-index: 10;
}

.fullscreen-canvas {
  width: 100%;
  height: 100vh;
}

.title-sign {
  background-image: url('../img/interface/overlay/titleSign.png');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  width: clamp(120px, 32vw, 274px);
  height: clamp(45px, 10vw, 100px);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  margin: 8px;
}

.game-overlay-btn {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  cursor: pointer;
  border: none;
  background-color: transparent;
}

.game-overlay-btn:hover {
  transform: scale(1.1);
}

.f-screen-btn {
  position: absolute;
  width: clamp(32px, 8vw, 60px);
  aspect-ratio: 1 / 1;
}

.f-screen-game-btn {
  background-image: url('../img/interface/inGameIcons/fullscreenInGame.png');
  width: clamp(18px, 4vw, 36px);
  height: clamp(18px, 4vw, 36px);
  z-index: 1;
}

.game-play-btn {
  width: clamp(18px, 4vw, 36px);
  height: clamp(18px, 4vw, 36px);
  z-index: 1;
}

.play {
  background-image: url('../img/interface/inGameIcons/gamePlay.png');
}

.pause {
  background-image: url('../img/interface/inGameIcons/gameStop.png');
}

.sound-btn {
  width: clamp(18px, 4vw, 36px);
  height: clamp(18px, 4vw, 36px);
  z-index: 1;
}

.play-sound {
  background-image: url('../img/interface/inGameIcons/soundOn.png');
}

.mute-sound {
  background-image: url('../img/interface/inGameIcons/soundMute.png');
}

.game-menu {
  position: absolute;
  top: 2%;
  right: 45%;
  display: flex;
  gap: clamp(6px, 4vw, 16px);
}

.f-screen-menu-btn {
  background-image: url('../img/interface/overlay/fullscreen_btn.png');
  top: 2%;
  right: 1%;
  z-index: 2;
}

.play-btn {
  background-image: url('../img/interface/overlay/play_btn.png');
  position: absolute;
  top: 37%;
  left: 14%;
  height: clamp(68px, 14vw, 140px);
  width: clamp(60px, 12vw, 120px);
  aspect-ratio: 1 / 1;
  z-index: 2;
}

.controls {
  position: absolute;
  left: 1%;
  bottom: 2%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-btn {
  background-image: url('../img/interface/overlay/control_btn.png');
  width: clamp(32px, 8vw, 60px);
  aspect-ratio: 1 / 1;
  z-index: 2;
}

.info-btn {
  background-image: url('../img/interface/overlay/info_btn.png');
  width: clamp(32px, 8vw, 60px);
  aspect-ratio: 1 / 1;
  z-index: 2;
}

.end-title {
  width: clamp(120px, 32vw, 314px);
  height: clamp(45px, 10vw, 114px);
  margin: 0px;
}

.end-title-control {
  position: absolute;
  top: 37%;
  left: 34%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: clamp(8px, 2vw, 16px);
}

.end-control-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: clamp(100px, 24vw, 242px);
  gap: clamp(16px, 4vw, 32px);
}

.repeat-btn {
  background-image: url('../img/interface/overlay/tryAgain_btn.png');
  width: clamp(32px, 8vw, 60px);
  aspect-ratio: 1 / 1;
  z-index: 2;
}

.back-menu-btn {
  background-image: url('../img/interface/overlay/home_btn.png');
  width: clamp(32px, 8vw, 60px);
  aspect-ratio: 1 / 1;
  z-index: 2;
}

.next-btn {
  background-image: url('../img/interface/overlay/play_btn.png');
  height: clamp(28px, 7vw, 68px);
  width: clamp(24px, 6vw, 60px);
  aspect-ratio: 1 / 1;
  z-index: 2;
}

.controls-help {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
}

.controls-space {
  height: 100dvh;
  width: clamp(180px, 50%, 460px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 60%, 16px);
  padding: 1%;
}

.controls-row {
  height: clamp(16px, 7vw, 70px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(8px, 6%, 64px);
}

.mobile-hint {
  width: clamp(50%, 120vw, 188%);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 6%, 12px);
}

.controls-keyCaps {
  display: flex;
  align-items: center;
  gap: clamp(6px, 4vw, 24px);
}

.controls-label {
  color: #65e8ef;
  font-size: clamp(10px, 4vw, 32px);
  font-weight: bold;
  flex: 1 1 0;
  white-space: nowrap;
  margin-right: 0;
}

.control-back-btn {
  position: absolute;
  top: 4%;
  left: 2%;
}

.keyCap {
  position: relative;
  display: inline-block;
  width: clamp(20px, 7vw, 70px);
  height: clamp(20px, 7vw, 70px);
  background: linear-gradient(180deg, #282828 70%, #202020 100%);
  border-radius: clamp(8px, 0vw, 12px);
  box-shadow:
    0 8px 24px 0 rgba(0, 0, 0, 0.45),
    inset -8px 0 12px rgba(0, 0, 0, 0.16),
    inset 0 -8px 14px rgba(0, 0, 0, 0.24),
    0 0 0 2px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  border: 1px solid #000;
}

.keyCap::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 12px;
  background: linear-gradient(90deg, #222 40%, #3d3d3d 100%);
  border-radius: 8px;
  box-shadow:
    -10px -10px 10px rgba(255, 255, 255, 0.16),
    8px 5px 18px rgba(0, 0, 0, 0.21);
  border-left: 1px solid #0004;
  border-bottom: 1px solid #0005;
  border-top: 1px solid #2229;
  z-index: 2;
}

.keyCap-label {
  position: relative;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #65e8ef;
  font-weight: bold;
  font-size: clamp(10px, 4vw, 24px);
  letter-spacing: clamp(1px, 1vw, 4px);
  text-shadow:
    1px 2px 2px rgba(0, 0, 0, 0.65),
    0 0 2px #fff6;
  z-index: 2;
}

.keyCap-space {
  width: clamp(68px, 20vw, 168px);
}

.keyCap-space .keyCap-label {
  font-size: clamp(8px, 2vw, 24px);
}

.tipp-label {
  color: #65e8ef;
  font-weight: bold;
  font-size: clamp(8px, 2vw, 20px);
  letter-spacing: clamp(1px, 1vw, 2px);
  text-shadow: 1px 2px 2px rgba(0, 0, 0, 0.65), 0 0 2px #fff6;
  z-index: 2;
  white-space: nowrap;
}

.info-game {
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-title {
  background-image: url('../img/interface/title/chatPopIn.png');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  width: clamp(96px, 30vw, 540px);
  height: clamp(54px, 28vw, 480px);
}

.content-column {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: column;
}

.story-content {
  max-height: 50dvh;
  overflow-y: auto;
  background: rgba(0, 10, 20, 0.5);
  padding: 1%;
  margin-top: 2%;
  border-radius: 1%;
  width: clamp(240px, 75%, 710px);
  -webkit-overflow-scrolling: touch;
}

.legal-content {
  max-height: 50dvh;
  overflow-y: auto;
  background: rgba(0, 10, 20, 0.5);
  padding: 1%;
  margin-top: 2%;
  border-radius: 1%;
  width: clamp(240px, 75%, 710px);
}

.scrollbox::-webkit-scrollbar {
  width: 8px;
}

.scrollbox::-webkit-scrollbar-thumb {
  background-color: #65e8efaa;
  border-radius: 4px;
}

.legal-text {
  overflow-wrap: break-word;
}

.story-text {
  color: #65e8ef;
  font-size: clamp(8px, 2vw, 16px);
  letter-spacing: clamp(1px, 1vw, 2px);
  text-shadow: 1px 2px 2px rgba(0, 0, 0, 0.65), 0 0 2px rgba(255, 255, 255, 0.45);
  z-index: 2;
  line-height: 1.1;
  white-space: pre-line;
}

.legal-container {
  position: absolute;
  left: 45%;
  bottom: 3%;
  z-index: 2;
}

.legal-link {
  display: inline-block;
  color: #65e8ef;
  font-weight: bold;
  font-size: clamp(8px, 2vw, 20px);
  letter-spacing: clamp(1px, 1vw, 2px);
  text-decoration: none;
  text-shadow: 1px 2px 2px rgba(0, 0, 0, 0.65), 0 0 2px #fff6;
  cursor: pointer;
}

.legal-link:hover {
  transform: scale(1.1);
}

.game-credit {
  font-weight: bold;
  font-size: clamp(8px, 2vw, 16px);
  letter-spacing: clamp(1px, 1vw, 1px);
  margin: clamp(8px, 1vw, 24px);
  z-index: 2;
  padding-bottom: 1%;
}

.volume-container {
  position: absolute;
  right: 3%;
  bottom: 3%;
  z-index: 2;
}

.rotate-container {
  display: none;
  height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.rotate-icon {
  height: 60px;
  width: 60px;
}

.rotate-message {
  color: #65e8ef;
  font-size: clamp(12px, 3vw, 24px);
  letter-spacing: clamp(1px, 1vw, 2px);
  text-shadow: 1px 2px 2px rgba(0, 0, 0, 0.65), 0 0 2px rgba(255, 255, 255, 0.45);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(70px, 22vw, 140px);
  height: clamp(8px, 2vw, 12px);
  background: linear-gradient(to right, #65e8ef, #eec15c);
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  box-shadow: 0 0 6px #65e8ef;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 16px;
  background: transparent;
  border-radius: 6px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: clamp(8px, 10vw, 24px);
  width: clamp(8px, 10vw, 24px);
  background: url('../img/interface/inGameIcons/soundOn.png') no-repeat center center;
  background-size: contain;
  border: none;
  border-radius: 50%;
  margin-top: -4px;
  box-shadow: 0 0 4px #65e8ef;
  transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

@media (orientation: portrait) and (pointer: coarse) {
  .rotate-container {
    display: flex;
  }

  .game-menu,
  .canvas {
    display: none;
  }
}

@media (orientation: landscape) and (pointer: coarse) and (hover: none) {
  .rotate-container {
    display: none;
  }

  .game-menu,
  .canvas {
    display: block;
  }

  .game-container {
    height: 100dvh;
    width: 100lvw;
  }

  .legal-content {
    max-height: 91dvh;
  }

  .story-content {
    max-height: 80dvh;
  }

  .controls-row {
    height: clamp(16px, 5vw, 70px);
  }

  .controls-label {
    font-size: clamp(10px, 4vw, 30px);
  }

  .keyCap {
    width: clamp(20px, 6vw, 70px);
    height: clamp(20px, 6vw, 70px);
  }

  .keyCap-space {
    width: clamp(68px, 20vw, 130px);
  }

  .controls-space {
    justify-content: space-between;
  }
}

@media (orientation: portrait) and (max-width: 960px) {
  .rotate-container {
    display: flex;
  }

  .game-menu,
  .canvas {
    display: none;
  }
}

@media (orientation: landscape) and (pointer: coarse) and (hover: none) and (min-width: 961px) {
  .rotate-container {
    display: none;
  }

  .game-container {
    display: block;
    height: unset;
    width: unset;
  }
}

.bubble-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 30;
}

.bubble-animated {
  position: absolute;
  bottom: -100px;
  width: 148px;
  opacity: 0.6;
  animation: floatUp 6s linear forwards;
}

@keyframes floatUp {
  0% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-300px); opacity: 0.9; }
  100% { transform: translateY(-600px); opacity: 0; }
}
