/* @import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Bellota:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&family=Inter:wght@100..900&family=Poppins:wght@300;400&display=swap'); */
@font-face {
  font-family: "OpenSans";
  src: url("/Assets/fonts/OpenSans-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "ComicNeue";
  src: url("/Assets/fonts/ComicNeue-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --color-accent: 66, 196, 226;
  --color-bg: #33a7ff;
  --color-bg-highlight: #59b7ff;
  --color-bg-mute: #788b98;
  --color-bg-mute-highlight: #919fa9;
  --color-bg-red: #ff5656;
  --color-bg-red-highlight: #ff8b8b;
  --bg-transparent-dark: rgba(0, 0, 0, 0.5);
  --text-dark: white;
  --text-maroon: #8d3932;
  --color-bg-yellow: #fff533;
  --cursor-arrow: url("../img/ui/cursor_none.png"), auto;
  --cursor-pointer: url("../img/ui/hand_point.png"), auto;
  --bg-booklet: linear-gradient(#da4f54, #910207);
  --btn-box-shadow: 0 2px 2px #0005;
}

* {
  padding: 0;
  margin: 0;
  border: unset;
  font-family: "Open Sans", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  box-sizing: border-box;
}

*:focus {
  outline: none;
}

html {
  height: 100dvh;
  width: 100dvw;
  cursor: var(--cursor-arrow);
}

body {
  background-position-y: 20%;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-image: url("/Assets/img/zagorske-price-full.jpg");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

.loading-wrapper {
  position: absolute;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  justify-content: center;
  align-items: center;
}

#loading-menu {
  gap: 32px;
}

#loading {
  width: 50px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 8px solid var(--color-bg);
  border-right-color: var(--color-bg-highlight);
  position: relative;
  animation: spin 1s infinite linear;
}

#loading:before,
#loading:after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: inherit;
  animation: inherit;
  animation-duration: 2s;
}

#loading:after {
  animation-duration: 4s;
}

@keyframes spin {
  100% {
    transform: rotate(1turn);
  }
}

#btn-start {
  font-size: 2em;
  padding: 0.75em 1.25em;
  text-transform: uppercase;
}

#select-language-text {
  color: white;
  font-weight: bold;
  text-shadow: var(--btn-box-shadow);
}

.lang-btn {
  aspect-ratio: 1 / 1;
  display: grid;
  align-content: center;
  padding: 12px !important;
  font-size: 18px;
}

#version {
  color: var(--text-dark);
}

.wrapper {
  position: fixed;
  display: flex;
  flex-direction: column;
  top: 0;
  left: 0;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  z-index: 10;
  overflow: hidden;
}

.hidden:not(#unity-wrapper, .notification, #unity-ui) {
  display: none !important;
}

#img-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background-color: rgba(0, 0, 0, 0.5);
}

#modal-img {
  max-width: min(1280px, 90%);
  max-height: min(1080px, 90%);
  object-fit: cover;
}

#unity-wrapper.hidden {
  z-index: -10;
  opacity: 0;
}

#unity-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

#unity-canvas {
  transition: 1s all ease;
  width: 100%;
  height: 100%;
}

#unity-ui {
  --margin: 8px;
  position: absolute;
  top: var(--margin);
  right: var(--margin);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  max-width: 48px;
  height: 40%;
  max-height: calc(100% - 2 * var(--mar));
  flex-wrap: wrap-reverse;
  transition: all 0.5s ease-out;
  user-select: none;
}

#unity-ui.hidden {
  right: -15dvw;
}

#unity-ui img:visited {
  background-color: rgba(255, 255, 255, 0.5);
}

#unity-ui .active {
  background-color: rgb(var(--color-accent));
}

.o-100 {
  opacity: 1 !important;
}

.btn-ui {
  width: 48px;
  height: 48px;
  padding: 3px;
  border-radius: 17px;
  background-color: white;
}

.mute {
  background-color: var(--color-bg-mute) !important;
}

.btn-ui > img {
  width: 100%;
  height: 100%;
  object-fit: none;
  background-color: var(--color-bg);
  padding: 5px;
  border-radius: 14px;
  transition: background-color 0.25s ease;
  box-shadow: inset 0 0 0 2px #0004;
}

#btn-index {
  background-color: var(--color-bg-red) !important;
}

#btn-close {
  position: absolute;
  top: -36px;
  right: 20px;

  width: 46px;
  cursor: var(--cursor-pointer);
  box-shadow: inset -2px -2px 2px rgba(0, 0, 0, 0.1);
  transition: transform 0.125s linear;
  z-index: -7;
}

#content-header {
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: space-between;
  width: 100%;
}

#content-title {
  font-size: 22px;
  font-weight: 600;
  text-align: left;
  color: black;
  margin-bottom: 8px;
  text-wrap: wrap;
  word-wrap: break-word;
}

.container-rot {
  position: absolute;
  top: var(--outer-padding);
  left: var(--outer-padding);
  width: calc(100% - 2 * var(--outer-padding));
  height: calc(100% - 2 * var(--outer-padding));
  border-radius: 18px;
  background-image: url("/Assets/img/ui/paper-texture.png");
  box-shadow: 0 0px 4px #000;
  z-index: -4;
}

.cw {
  transform: rotate(1deg);
  z-index: -5;
}

.ccw {
  transform: rotate(-1deg);
  z-index: -10;
}

#mark-qr {
  position: absolute;
  left: 42px;
  top: -32px;
  transform: rotateZ(-184deg);
  width: 120px;
  height: auto;
  z-index: -7;
  transition: all 0.125s linear;
}

#mark-qr.active {
  transform: rotateZ(0);
  top: -120px;
}

.mark-qr-bg {
  width: 100%;
}

.qr-inner {
  width: 100%;
  height: 100%;
  padding: 16px;
  gap: 4px;
  position: absolute;
  transform: translate(-50%, -50%);
  top: 50%;
  left: 50%;
  mix-blend-mode: multiply;
}

#mark-qr-img {
  width: 100%;
}

#mark-qr-label {
  font-size: 12px;
  font-weight: bold;
  color: black;
}

#mark-pull {
  position: absolute;
  right: 70px;
  top: -32px;
  transform: rotateZ(184deg);
  z-index: -7;
  box-shadow: 0 -4px 4px #0005;
  cursor: var(--cursor-pointer);
  transition: all 0.125s linear;
}

#mark-pull:hover {
  top: -40px;
  transform: rotateZ(180deg);
  filter: brightness(1.1);
}

#mark-pull.active {
  filter: brightness(1.3);
}

#mark-pull-icon {
  position: absolute;
  left: calc(50% + 2px);
  top: calc(50% + 2px);
  transform: translate(-50%, -50%);
  width: 90%;
  opacity: 0.3;
}

.container-inner {
  display: flex;
  padding: 16px;
  gap: 12px;
  border-radius: 18px;
  flex-grow: 1;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.content-container {
  --outer-padding: 10px;
  position: absolute;
  display: flex;
  bottom: -150%;
  left: 50%;
  transform: translateX(-50%);

  width: 90%;
  height: fit-content;
  max-height: 50%;

  padding: var(--outer-padding);
  border-radius: 18px;
  text-align: left;

  background-image: var(--bg-booklet);
  color: var(--text-maroon);

  opacity: 0;
  transition: all 0.5s ease; /* cubic-bezier(.47,1.64,.41,.8) */
  z-index: 10;
}

.max {
  max-height: 90% !important;
}

.blue-content-box {
  --outer-padding: 10px;
  position: absolute;
  display: flex;
  top: -150%;
  /* top: 5dvh; */
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 90%;
  max-height: 90%;
  border-radius: 18px;
  text-align: left;
  background-image: url("../img/ui/bg-blue-box.png");
  color: var(--text-blue);
  opacity: 0;
  transition: all 0.5s ease;
  z-index: 10;
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  flex-direction: column;
  flex-wrap: nowrap;
  align-content: center;
  align-items: center;
  justify-content: flex-end;
}

.blue-content-box-header {
  position: absolute;
  top: -3%;
  width: 100%;
  height: 32px;
}

.blue-content-box-title {
  background-image: url("../img/ui/Blue-Title-Bg.png");
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  width: 65%;
  position: absolute;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5em;
  top: 0;
  left: 14%;
}

.blue-content-box-closeBtn {
  position: absolute;
  top: 0%;
  right: 10%;
  width: 10%;
  object-fit: contain;
  cursor: var(--cursor-pointer);
}

.blue-content-box-inner {
  /* min-width: 100%; */
  height: 80%;
  width: 80%;
  left: 50%;
  top: 8%;
  position: absolute;
  transform: translate(-50%);
  font-size: larger;
  font-family: cursive;
  text-align: left;
  overflow: auto;
}

.blue-content-box-inner img {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
}

.blue-content-box.min {
  height: 65% !important;
}

.blue-content-box.show {
  top: 5dvh;
  opacity: 1;
}

.start-game-btn {
  position: absolute;
  font-weight: bold;
  align-content: center;
  cursor: var(--cursor-pointer);
  text-align: center;
  color: var(--text-blue);
  text-shadow: 2px 2px 4px #fff;
  background-image: url("../img/ui/Blue-Title-Bg.png");
  transition: all 0.5s ease;
  user-select: none;
  height: auto;
  width: 40%;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  bottom: -50%;
  right: 3%;
  padding: 3%;
  padding-inline: 6%;
  font-family: sans-serif;
  opacity: 0;
}

.start-game-btn.active {
  opacity: 1;
  bottom: 5%;
}

.btn {
  font-weight: bold;
  align-content: center;
  cursor: var(--cursor-pointer);
  text-align: center;
  border: 4px solid white;
  color: white;
  background-color: var(--color-bg);
  border-radius: 13px;
  padding: 8px 24px;
  transition: all 0.125s linear;
  transform: translateY(0);
  box-shadow: var(--btn-box-shadow), inset 0 0 0 2px #0004;
  user-select: none;
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--btn-box-shadow), inset 0 0 0 2px #0004;
  background-color: var(--color-bg-highlight);
}

#btn-explore {
  width: 128px;
  margin: 12px auto;
}

.content-container.show {
  bottom: 5dvw;
  opacity: 1;
  box-shadow: 5px 14px 15px rgba(0, 0, 0, 0.2);
}

#version {
  position: absolute;
  bottom: 2vmax;
  font-size: 0.8em;
  user-select: none;
}

.notification {
  position: absolute;
  z-index: 10000000;
  background-color: white;
  padding: 8px 16px;
  padding-left: 8px;
  border-radius: 50px;
  left: 50%;
  transform: translateX(-50%);
  top: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  transition: top 0.5s ease-in-out;
}

.notification > .icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  vertical-align: middle;
  text-align: center;
  display: grid;
  align-items: center;
  color: white;
}

.notification.hidden {
  top: -100px;
}

#notification-text {
  text-wrap: nowrap;
}

/* Balloon Game UI */
#game-ui {
  --outer-padding: 12px;
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  user-select: none;
}

#game-ui .container-inner {
  justify-content: flex-start;
  overflow-y: auto;
}

#game-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background-image: var(--bg-booklet);
  color: var(--text-maroon);
  border-radius: 18px;
  padding: var(--outer-padding);
  gap: var(--outer-padding);
  max-width: 344px;
  max-height: 90%;
  z-index: 0;
}

#game-menu,
#game-hud {
  pointer-events: auto;
}

#game-menu-box #menu-canvas {
  position: absolute;
  width: 100%;
  z-index: -1;
}

#game-title {
  font-size: 32px;
  font-weight: 600;
  color: black;
}

#game-rules {
  text-align: left;
  font-size: 18px;
}

#btn-back {
  background-color: var(--color-bg-mute);
}

#btn-cancel-game {
  position: absolute;
  bottom: 12px;
  left: 50%;
  background-color: var(--color-bg-red);
  transform: translate(-50%);
}

#btn-cancel-game:active {
  transform: translate(-50%);
  background-color: var(--color-bg-red-highlight);
}

#game-score,
#game-timer {
  width: fit-content;
  display: flex;
}

#game-score-text,
#game-timer-text {
  font-weight: bold;
  font-size: large;
}

#game-score {
  position: absolute;
  left: 0;
  top: 12px;
  transform: translate(0, 0);
  transition: all 1s cubic-bezier(0.39, 0.575, 0.565, 1);
}

#game-score.center {
  top: 50%;
  left: 50%;
  font-size: 80px;
  transform: translate(-50%, -50%);
}

#score-bookmark {
  position: absolute;
  left: 100%;
  height: 100%;
}

#game-score-text {
  background-color: var(--color-bg);
  padding: var(--outer-padding) calc(var(--outer-padding) * 2);
  padding-right: 0;
  color: white;
}

#game-timer {
  position: absolute;
  right: 0;
  top: 12px;
}

#game-timer-text {
  color: black;
  background-color: var(--color-bg-yellow);
  padding: var(--outer-padding) calc(var(--outer-padding) * 2);
  padding-left: 0;
}

#timer-bookmark {
  position: absolute;
  right: 100%;
  height: 100%;
}

#hi-score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

#hi-score-sticker {
  transform: rotateZ(-1deg);
  margin: var(--outer-padding) 0;
  width: 80%;
  cursor: var(--cursor-arrow);
}

#hi-score-text {
  font-weight: bold;
}

.btn.disabled {
  cursor: not-allowed;
}

.btn.disabled:hover {
  transform: none;
  box-shadow: var(--btn-box-shadow);
}

#game-mark {
  position: absolute;
  left: 50px;
  bottom: -16px;
  transform: rotateZ(4deg);
  z-index: -7;
  box-shadow: 0 -4px 4px #0005;
}

.d-flex {
  display: flex !important;
}

.flex-row {
  flex-direction: row !important;
}

.flex-column {
  flex-direction: column !important;
}

.justify-center {
  justify-content: center !important;
}

.justify-start {
  justify-content: flex-start !important;
}

.align-center {
  align-items: center;
}

.gap-1 {
  gap: 12px !important;
}

@media only screen and (orientation: landscape) and (max-width: 1024px) {
  .content-container {
    top: 50%;
    left: -100%;
    transform: translateY(-50%);
    width: 40%;
    max-height: 80%;
  }

  .content-container.show {
    left: 5dvh;
  }

  .content-container.max {
    max-height: 80%;
    width: 65%;
  }

  #content-title {
    font-size: 15px;
  }

  .content-text {
    font-size: 13px;
    line-height: 1.5;
  }
  /* 
    #mark-qr {
        left: 75%;
        top: 128px;
    } */

  #mark-qr.active {
    transform: rotateZ(0);
    top: 0;
    left: calc(100% + 48px);
    box-shadow: var(--btn-box-shadow);
  }

  #btn-close {
    transform: rotateZ(81deg);
    top: 12px;
    right: -32px;
  }

  #mark-pull,
  #mark-pull:hover {
    right: -32px;
    top: 64px;
    transform: rotateZ(-100deg);
  }
}

/* Character Styling - Mobile */
.character-wrapper {
  position: absolute;
  bottom: -100%;
  left: 0;
  width: 56%;
  height: auto;
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  pointer-events: none;
  z-index: 20; /* Ensure above Unity, below UI */
}

.character-wrapper.hidden {
  display: none;
}

.character-wrapper.slide-up {
  animation: slideUp 1s cubic-bezier(0.175, 0.885, 0.32, 1) forwards;
  animation-delay: 0.5s;
}

.character-wrapper.slide-down {
  animation: slideDown 1s cubic-bezier(0.175, 0.885, 0.32, 1) forwards;
}

.character {
  width: 100%;
  object-fit: contain;
}

/* Speech Bubble Styling - Mobile */
.speech-bubble-container {
  position: absolute;
  bottom: 20%;
  right: 7%;
  width: 55%;
  max-width: 280px;
  opacity: 0;
  transform: scale(0.5) translateX(20px);
  transform-origin: bottom left;
  pointer-events: auto;
  filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
  z-index: 30; /* Ensure above Character */
}

.speech-bubble-container.hidden {
  display: none;
}

.speech-bubble-container.show-bubble {
  animation: popIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
  animation-delay: 0.5s;
}

.speech-box-wrapper {
  position: relative;
  width: 100%;
  /* don't force a fixed height so the bubble can grow with its content */
  display: flex;
  justify-content: flex-end; /* bubble aligns to character */
}

/* Speech bubble styled using the Box.png image to preserve look and scale */
.speech-box {
  position: relative;
  background-image: url("/Assets/img/character/Box.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: center center;
  border-radius: 18px;
  /* padding: 12px 22px; */
  z-index: 31;
  max-width: 100%;
  min-height: 115px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  word-break: break-word;
  padding-left: 9%;
}

/* Elliminate the CSS triangle: Box.png provides the pointer, so no extra tail element needed */

.speech-content {
  position: static;
  transform: none;
  width: auto;
  height: auto;
  display: block;
  text-align: center;
  font-size: clamp(0.7rem, 2.5vw, 1rem);
  font-weight: 700;
  color: #333;
  line-height: 1.35;
  text-transform: uppercase;
  z-index: 32;
  font-family: "Outfit", "Open Sans", sans-serif;
  padding: 5%;
}

.speech-content p {
  margin: 0;
  word-break: break-word;
}

/* Close Button Styling */
.close-btn {
  position: absolute;
  bottom: -24%;
  right: 11px;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease;
  width: 18%;
  max-width: 50px;
  aspect-ratio: 1/1;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 29;
  opacity: 0;
}

.close-btn.show-btn {
  animation: dropFlag 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  animation-delay: 0.5s;
}

.close-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.close-btn:hover {
  transform: scale(1.1);
}

.close-btn:active {
  transform: scale(0.95);
}

/* Animations */
@keyframes slideUp {
  0% {
    bottom: -100%;
  }
  100% {
    bottom: 0;
  }
}

@keyframes slideDown {
  0% {
    bottom: 0;
  }
  100% {
    bottom: -100%;
  }
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5) translate(20px, 20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
}

@keyframes dropFlag {
  0% {
    transform: translateY(-80px); /* Start hidden "behind" or above */
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.fade-out {
  animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.8);
  }
}
