@font-face {
  font-family: "Luckiest-Guy-Regular";
  src: url("font/Luckiest_Guy/LuckiestGuy-Regular.ttf") format("truetype");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-image: url("img/7.BackgroundAsset/sharkie_koralle_background.png");
  background-position: center;
  background-size: cover;
  font-family: "Luckiest-Guy-Regular", sans-serif;
}

button,
a {
  font-family: inherit;
}

button {
  cursor: pointer;
}

.game-wrapper {
  position: relative;
  width: min(1100px, calc(100vw - 32px));
  aspect-ratio: 820 / 400;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  background: #071934;
  box-shadow: 0 18px 50px rgba(0, 20, 70, 0.45);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  background-color: #071934;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}

.start-screen {
  z-index: 30;
  background-image:
    linear-gradient(rgba(0, 72, 176, 0.12), rgba(0, 32, 112, 0.15)),
    url("img/7.BackgroundAsset/sharkie_koralle_background.png");
  background-position: center;
  background-size: cover;
}

.start-menu {
  width: min(430px, 90%);
  height: 96%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.game-title {
  z-index: 2;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  font-size: clamp(48px, 7vw, 82px);
  line-height: 0.75;
  text-align: center;
  text-transform: uppercase;
  -webkit-text-stroke: 2px #071934;
  text-shadow:
    0 5px 0 #16477e,
    0 9px 0 #071934,
    0 14px 18px rgba(0, 0, 0, 0.45);
  transform: rotate(-2deg);
}

.menu-buttons {
  width: min(330px, 90%);
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.menu-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  color: white;
  font-size: 22px;
  letter-spacing: 0;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.18),
    0 5px 0 rgba(5, 33, 86, 0.55);
  transition:
    transform 120ms ease,
    filter 120ms ease;
}

.menu-button:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.menu-button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.18),
    0 2px 0 rgba(5, 33, 86, 0.55);
}

.start-menu-button {
  min-height: 58px;
  color: #55217f;
  font-size: 32px;
  background: linear-gradient(#8cf8df, #55dfbd);
}

.instructions-menu-button {
  background: linear-gradient(#a340ec, #7025cf);
}

.fullscreen-menu-button {
  background: linear-gradient(#38baf3, #208fd6);
}

.impressum-menu-button {
  color: #9a5b00;
  background: linear-gradient(#ffe067, #ffc32e);
}

.instructions-overlay {
  z-index: 50;
  display: none;
  padding: 14px;
  background: rgba(0, 12, 48, 0.76);
}

.instructions-panel {
  width: min(620px, 92vw);
  max-height: 94vh;
  padding: 14px 24px;
  overflow-y: auto;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  background: rgba(7, 25, 52, 0.96);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.instructions-title {
  margin: 0 0 10px;
  color: white;
  font-size: 28px;
  text-align: center;
  text-transform: uppercase;
}

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

.control-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.key-img {
  width: 88px;
  height: 45px;
  object-fit: contain;
  flex-shrink: 0;
}

.d-key {
  width: 55px;
}

.space-key {
  width: 150px;
}

.desc-img {
  max-width: 190px;
  height: 22px;
  object-fit: contain;
}

.finslap-title {
  margin: 0;
  color: white;
  font-size: 20px;
  text-align: center;
  text-transform: uppercase;
}

.game-rules {
  margin-top: 18px;
  padding: 14px 18px;
  border: 2px solid rgba(112, 238, 209, 0.8);
  border-radius: 10px;
  color: white;
  background: rgba(31, 102, 155, 0.45);
}

.game-rules h3 {
  margin: 0 0 10px;
  color: #70eed1;
  font-size: 22px;
  text-align: center;
  text-transform: uppercase;
}

.rule-item {
  margin: 7px 0;
  display: flex;
  gap: 10px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.35;
}

.rule-item strong {
  min-width: 90px;
  color: #70eed1;
}

.game-over-rule {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
  font-family: Arial, sans-serif;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}

.close-instructions-button,
.end-button {
  min-width: 160px;
  min-height: 36px;
  margin: 10px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid white;
  border-radius: 10px;
  color: #55217f;
  font-size: 17px;
  text-transform: uppercase;
  background: #70eed1;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
}

.close-instructions-button:active,
.end-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}


.game-over-overlay {
  display: none;
  background: rgba(0, 10, 40, 0.78);
}

.end-panel {
  width: min(430px, 90%);
  padding: 30px;
  border: 3px solid white;
  border-radius: 14px;
  background: rgba(7, 25, 52, 0.94);
}

.end-title {
  margin: 0;
  color: white;
  font-size: 52px;
  text-align: center;
  text-transform: uppercase;
}

.home-button {
  color: white;
  background: #7128ce;
}

.you-win-overlay {
  display: none;
  padding: 0;
  background: black;
}

.you-win-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: youWinPulse 1.2s ease-in-out infinite;
}

.win-options {
  position: absolute;
  display: none;
  z-index: 2;
}

.you-win-overlay.show-options .you-win-img {
  opacity: 0.35;
  animation: none;
}

.you-win-overlay.show-options .win-options {
  display: block;
}

@keyframes youWinPulse {
  0% {transform: scale(1);}
  50% {transform: scale(1.06);}
  100% {transform: scale(1);}
}

.game-wrapper:fullscreen {
  width: 100vw;
  height: 100vh;
  border: none;
  border-radius: 0;
}

.game-wrapper:fullscreen canvas {
  width: 100%;
  height: 100%;
}

.mobile-controls,
.rotate-screen {
  display: none;
}

/* Impressum */

.impressum-page {
  min-height: 100vh;
  padding: 30px 16px;
  overflow-y: auto;
  background-image: url("img/7.BackgroundAsset/sharkie_koralle_background.png");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

.impressum-container {
  width: min(700px, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.impressum-title {
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  font-size: clamp(50px, 8vw, 82px);
  line-height: 0.75;
  text-align: center;
  text-transform: uppercase;
  -webkit-text-stroke: 2px #071934;
  text-shadow:
    0 5px 0 #16477e,
    0 9px 0 #071934,
    0 14px 18px rgba(0, 0, 0, 0.45);
  transform: rotate(-2deg);
}

.impressum-panel {
  width: 100%;
  padding: 28px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  color: white;
  background: rgba(7, 25, 52, 0.94);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.impressum-panel h2 {
  margin: 0 0 22px;
  font-size: 36px;
  text-align: center;
  text-transform: uppercase;
}

.impressum-section {
  margin-top: 16px;
  padding: 14px 18px;
  border: 2px solid rgba(112, 238, 209, 0.65);
  border-radius: 10px;
  background: rgba(31, 102, 155, 0.45);
}

.impressum-section h3 {
  margin: 0 0 8px;
  color: #70eed1;
  font-size: 20px;
  text-transform: uppercase;
}

.impressum-section p {
  margin: 0;
  font-family: Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

.impressum-section a {
  color: #70eed1;
  font-family: Arial, sans-serif;
}

.impressum-actions {
  width: min(330px, 100%);
  margin: 24px auto 0;
}

.impressum-actions .menu-button {
  width: 100%;
}

.mute-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 50;
  width: 52px;
  height: 52px;
  padding: 7px;
  border: 3px solid white;
  border-radius: 12px;
  background: rgba(112, 238, 209, 0.85);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  touch-action: manipulation;
}

.mute-button img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

@media (max-width: 1366px) and (hover: none) and (pointer: coarse) {
  .mute-button {
    top: 8px;
    right: 8px;
    width: 38px;
    height: 38px;
    padding: 5px;
    border-width: 2px;
    border-radius: 9px;
  }

  .game-wrapper.game-started .mobile-controls {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 14px;
    pointer-events: none;
  }

  .mobile-left-controls {
    width: 172px;
    display: grid;
    grid-template-columns: repeat(3, 52px);
    grid-template-rows: repeat(2, 52px);
    gap: 5px;
    pointer-events: auto;
  }

  .mobile-up {
    grid-column: 2;
    grid-row: 1;
  }

  .mobile-left {
    grid-column: 1;
    grid-row: 2;
  }

  .mobile-down {
    grid-column: 2;
    grid-row: 2;
  }

  .mobile-right {
    grid-column: 3;
    grid-row: 2;
  }

  .mobile-right-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
  }

  .mobile-btn {
    width: 52px;
    height: 52px;
    border: 3px solid white;
    border-radius: 12px;
    color: #542080;
    font-size: 20px;
    background: rgba(112, 238, 209, 0.85);
    cursor: pointer;
  
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

  .attack-btn {
    width: 72px;
  }
}


@media (max-width: 700px) and (orientation: landscape) {
  .game-wrapper {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
  }

  .start-menu {
    height: 100%;
  }

  .game-title {
    font-size: clamp(38px, 10vh, 64px);
  }

  .menu-buttons {
    width: min(300px, 70vw);
    margin-top: 12px;
    gap: 5px;
  }

  .menu-button {
    min-height: 37px;
    font-size: 17px;
  }

  .start-menu-button {
    min-height: 45px;
    font-size: 24px;
  }
}

@media (max-width: 700px) and (orientation: portrait) {
  body {
    background: #071934;
  }

  .game-wrapper {
    display: none;
  }

  .rotate-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
  }

  .rotate-screen h2 {
    margin: 0;
    color: white;
    font-size: 38px;
    text-transform: uppercase;
    -webkit-text-stroke: 1px black;
  }
}

@media (max-width: 600px) {
  .impressum-page {
    padding: 22px 12px;
  }

  .impressum-title {
    margin-bottom: 22px;
    font-size: 52px;
  }

  .impressum-panel {
    padding: 18px;
  }

  .impressum-panel h2 {
    font-size: 28px;
  }

  .impressum-section {
    padding: 12px;
  }

  .impressum-section h3 {
    font-size: 17px;
  }

  .impressum-section p {
    font-size: 14px;
  }
}