/* =========================================================
   RESET
   ========================================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;

  margin: 0;
  padding: 0;

  overflow: hidden;

  overscroll-behavior: none;

  background: #020304;
}

body {
  min-height: 100dvh;
  height: 100dvh;

  color: white;

  font-family: Georgia, "Times New Roman", serif;
}

/* =========================================================
   MAIN GAME
   ========================================================= */

.game-container {
  width: 100%;
  height: 100dvh;

  padding: 12px;

  display: grid;

  grid-template-columns:
    minmax(0, 3fr)
    minmax(300px, 1fr);

  gap: 12px;

  overflow: hidden;
}

/* =========================================================
   FOREST IMAGE SECTION
   ========================================================= */

.image-section {
  position: relative;

  width: 100%;
  height: 100%;

  overflow: hidden;

  border-radius: 18px;

  background: #000;

  border: 2px solid rgba(180, 255, 100, 0.3);

  box-shadow:
    0 0 35px rgba(0, 0, 0, 0.8),
    inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.forest-image {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: cover;

  object-position: center;

  user-select: none;

  -webkit-user-drag: none;
}

/* Dark atmosphere */

.image-section::after {
  content: "";

  position: absolute;

  inset: 0;

  pointer-events: none;

  z-index: 3;

  background: radial-gradient(
    circle at center,
    transparent 45%,
    rgba(0, 0, 0, 0.25)
  );
}

/* =========================================================
   HIDDEN OBJECT HOTSPOTS
   ========================================================= */

.ingredient {
  position: absolute;

  z-index: 10;

  transform: translate(-50%, -50%);

  background: transparent;

  border: 2px solid transparent;

  border-radius: 50%;

  touch-action: manipulation;

  transition: 0.2s;
}

/* Increase invisible touch area */

.ingredient::before {
  content: "";

  position: absolute;

  inset: -8px;

  border-radius: 50%;
}

/* Desktop hover */

/* =========================================================
   HIDDEN OBJECT HOVER
   Keep hidden objects completely invisible.
   Only the hint system should reveal a highlight.
   ========================================================= */

.ingredient:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* Found animation */

.ingredient.found {
  pointer-events: none;

  animation: foundAnimation 0.6s forwards;
}

@keyframes foundAnimation {
  0% {
    transform: translate(-50%, -50%) scale(1);

    opacity: 1;
  }

  45% {
    transform: translate(-50%, -50%) scale(1.4);

    background: rgba(180, 255, 80, 0.4);

    box-shadow: 0 0 30px #baff70;
  }

  100% {
    transform: translate(-50%, -50%) scale(2);

    opacity: 0;
  }
}

/* =========================================================
   INGREDIENT PANEL
   ========================================================= */

.ingredients-panel {
  width: 100%;
  height: 100%;

  container-type: inline-size;

  min-height: 0;

  display: flex;

  flex-direction: column;

  overflow: hidden;

  padding: 20px;

  border-radius: 18px;

  background: linear-gradient(
    145deg,
    rgba(23, 19, 32, 0.98),
    rgba(7, 10, 16, 0.98)
  );

  border: 1px solid rgba(180, 130, 255, 0.35);

  box-shadow: 0 0 30px rgba(0, 0, 0, 0.65);
}

/* =========================================================
   HUD
   ========================================================= */

.hud {
  display: flex;

  justify-content: center;

  align-items: center;

  gap: 10px;

  width: 100%;

  margin-bottom: 8px;

  flex-shrink: 0;
}

@container (max-width: 410px) {
  .hud {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hud-box,
  .hint-button {
    min-width: 0;

    width: 100%;
  }

  .hud-box {
    padding: clamp(3px, 0.7vw, 8px) clamp(2px, 0.6vw, 8px);

    font-size: clamp(0.52rem, 1.1vw, 0.84rem);
  }

  .hint-button {
    grid-column: 1 / -1;
  }
}

.hud-box {
  flex: 1;

  min-width: 0;

  padding: 9px 10px;

  text-align: center;

  border-radius: 25px;

  background: rgba(0, 0, 0, 0.65);

  border: 1px solid rgba(190, 255, 110, 0.4);

  box-shadow: 0 0 15px rgba(130, 255, 80, 0.12);

  font-weight: bold;

  white-space: nowrap;
}

#score {
  color: #baff70;
}

#timer {
  color: #ffd96a;
}

#timer.warning {
  color: #ff5757;

  animation: timerWarning 0.5s infinite alternate;
}

@keyframes timerWarning {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.08);

    text-shadow: 0 0 15px red;
  }
}

/* =========================================================
   HINT BUTTON
   ========================================================= */

.hint-button {
  flex: 0 0 auto;

  padding: 9px 14px;

  border: 1px solid #ffe45c;

  border-radius: 25px;

  background: linear-gradient(145deg, #3d3513, #171405);

  color: #ffe96b;

  font-family: Georgia, "Times New Roman", serif;

  font-weight: bold;

  cursor: pointer;

  white-space: nowrap;

  box-shadow: 0 0 10px rgba(255, 225, 70, 0.25);

  transition: 0.2s ease;
}

.hint-button:hover {
  transform: scale(1.05);

  box-shadow: 0 0 20px rgba(255, 225, 70, 0.6);
}

.hint-button:active {
  transform: scale(0.95);
}

.hint-button.disabled {
  opacity: 0.35;

  cursor: not-allowed;

  box-shadow: none;
}

.hint-button.disabled:hover {
  transform: none;
}

/* =========================================================
   INGREDIENT TITLE
   ========================================================= */

.ingredients-panel h2 {
  flex-shrink: 0;

  text-align: center;

  color: #caff82;

  font-size: 1.45rem;

  margin-bottom: 5px;

  text-shadow: 0 0 10px rgba(180, 255, 100, 0.25);
}

.panel-subtitle {
  flex-shrink: 0;

  text-align: center;

  color: #aaa0b6;

  font-size: 0.78rem;

  line-height: 1.2;

  margin-bottom: 15px;
}

/* =========================================================
   PROGRESS BAR
   ========================================================= */

.progress-container {
  flex-shrink: 0;

  width: 100%;

  height: 9px;

  margin-bottom: 18px;

  background: rgba(255, 255, 255, 0.08);

  border-radius: 20px;

  overflow: hidden;
}

#progressBar {
  width: 0%;

  height: 100%;

  background: linear-gradient(90deg, #72c84a, #d3ff80);

  box-shadow: 0 0 10px #9cff65;

  transition: width 0.3s ease;
}

/* =========================================================
   INGREDIENT LIST
   ========================================================= */

#ingredientList {
  flex: 1;

  min-height: 0;

  display: flex;

  flex-direction: column;

  gap: 7px;

  overflow-y: auto;

  overflow-x: hidden;

  padding-right: 5px;

  scrollbar-width: thin;

  scrollbar-color: rgba(180, 255, 100, 0.35) rgba(255, 255, 255, 0.04);
}

/* Chrome / Edge scrollbar */

#ingredientList::-webkit-scrollbar {
  width: 6px;
}

#ingredientList::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
}

#ingredientList::-webkit-scrollbar-thumb {
  background: rgba(180, 255, 100, 0.35);

  border-radius: 10px;
}

/* =========================================================
   INGREDIENT LIST ITEM
   ========================================================= */

.list-item {
  flex-shrink: 0;

  display: flex;

  align-items: center;

  gap: 9px;

  padding: 9px 11px;

  border-radius: 8px;

  background: rgba(255, 255, 255, 0.045);

  border: 1px solid transparent;

  color: #eee7f2;

  font-size: 0.88rem;

  transition: 0.25s;
}

.list-number {
  min-width: 23px;

  height: 23px;

  display: flex;

  align-items: center;

  justify-content: center;

  flex-shrink: 0;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.08);

  color: #aaa;

  font-size: 0.72rem;
}

/* Found item */

.list-item.found {
  color: #71806c;

  background: rgba(100, 255, 100, 0.06);

  text-decoration: line-through;

  border-color: rgba(120, 255, 100, 0.15);
}

.list-item.found .list-number {
  background: #65a747;

  color: white;
}

/* =========================================================
   EXACT HINT HIGHLIGHT
   ========================================================= */

.hint-highlight {
  position: absolute;

  z-index: 50;

  transform: translate(-50%, -50%);

  /*
       Exact same position and size
       as the hidden hotspot.
    */

  border: 3px solid #ffe84d;

  background: rgba(255, 230, 70, 0.2);

  box-shadow:
    0 0 8px #fff36a,
    0 0 18px #ffe84d,
    0 0 35px #ffc800,
    inset 0 0 15px rgba(255, 245, 120, 0.35);

  pointer-events: none;

  animation: selectedObject 0.65s infinite alternate;
}

/* Rotating selection border */

.hint-highlight::before {
  content: "";

  position: absolute;

  inset: -6px;

  border: 2px dashed #fff17a;

  box-shadow: 0 0 12px #ffe84d;

  animation: selectionRotate 1.5s linear infinite;
}

/* Center target */

.hint-highlight::after {
  content: "✦";

  position: absolute;

  left: 50%;
  top: 50%;

  transform: translate(-50%, -50%);

  color: #fffbd0;

  font-size: 22px;

  font-weight: bold;

  text-shadow:
    0 0 8px #fff,
    0 0 18px #ffe84d;

  animation: targetPulse 0.6s infinite alternate;
}

@keyframes selectedObject {
  from {
    opacity: 0.65;

    filter: brightness(1);

    box-shadow:
      0 0 8px #fff36a,
      0 0 18px #ffe84d,
      0 0 30px #ffc800,
      inset 0 0 10px rgba(255, 245, 120, 0.25);
  }

  to {
    opacity: 1;

    filter: brightness(1.5);

    box-shadow:
      0 0 15px #fff36a,
      0 0 30px #ffe84d,
      0 0 55px #ffc800,
      inset 0 0 20px rgba(255, 245, 120, 0.45);
  }
}

@keyframes selectionRotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes targetPulse {
  from {
    transform: translate(-50%, -50%) scale(0.7);

    opacity: 0.5;
  }

  to {
    transform: translate(-50%, -50%) scale(1.3);

    opacity: 1;
  }
}

/* =========================================================
   FOUND MESSAGE
   ========================================================= */

#foundMessage {
  position: fixed;

  left: 50%;

  top: 15%;

  z-index: 1000;

  transform: translateX(-50%);

  padding: 11px 22px;

  border-radius: 30px;

  background: rgba(0, 0, 0, 0.9);

  border: 1px solid rgba(190, 255, 100, 0.5);

  color: #caff82;

  font-weight: bold;

  pointer-events: none;

  opacity: 0;
}

#foundMessage.show {
  animation: messageAnimation 1s ease;
}

@keyframes messageAnimation {
  0% {
    opacity: 0;

    transform: translate(-50%, 20px) scale(0.8);
  }

  20% {
    opacity: 1;

    transform: translate(-50%, 0) scale(1.08);
  }

  75% {
    opacity: 1;
  }

  100% {
    opacity: 0;

    transform: translate(-50%, -20px);
  }
}

/* =========================================================
   HINT MESSAGE
   ========================================================= */

.hint-message {
  position: fixed;

  left: 50%;

  top: 15%;

  z-index: 1500;

  transform: translateX(-50%);

  padding: 10px 20px;

  border-radius: 25px;

  background: rgba(15, 12, 3, 0.95);

  border: 1px solid #ffe84d;

  color: #ffe96b;

  font-weight: bold;

  box-shadow: 0 0 20px rgba(255, 220, 70, 0.5);

  pointer-events: none;

  animation: hintMessageAnimation 2s ease forwards;
}

@keyframes hintMessageAnimation {
  0% {
    opacity: 0;

    transform: translate(-50%, 15px) scale(0.8);
  }

  15% {
    opacity: 1;

    transform: translate(-50%, 0) scale(1.05);
  }

  75% {
    opacity: 1;
  }

  100% {
    opacity: 0;

    transform: translate(-50%, -20px) scale(0.95);
  }
}

/* =========================================================
   START / END OVERLAY
   ========================================================= */

.overlay {
  position: fixed;

  inset: 0;

  z-index: 2000;

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 20px;

  background: rgba(0, 0, 0, 0.88);

  backdrop-filter: blur(8px);
}

.modal {
  width: min(550px, 100%);

  padding: 35px;

  text-align: center;

  border-radius: 22px;

  background: radial-gradient(circle at top, #35204b, #0b0910);

  border: 2px solid #81a94b;

  box-shadow: 0 0 45px rgba(150, 255, 90, 0.18);
}

.start-modal {
  max-height: calc(100dvh - 40px);

  overflow-y: auto;
}

.modal h2 {
  color: #caff82;

  font-size: 2rem;

  margin-bottom: 15px;
}

.modal p {
  color: #ddd4e5;

  line-height: 1.6;

  margin-bottom: 22px;
}

.rules-heading {
  color: #caff82;

  font-size: 1.15rem;

  margin-bottom: 10px;
}

.game-rules {
  display: grid;

  gap: 8px;

  margin: 0 0 22px;

  padding-left: 22px;

  color: #ddd4e5;

  text-align: left;

  line-height: 1.4;
}

.rules-overlay {
  z-index: 2100;
}

.rules-modal {
  position: relative;

  width: min(440px, 100%);

  padding: 32px;
}

.rules-modal .game-rules {
  margin-bottom: 0;
}

.rules-close {
  position: absolute;

  top: 10px;
  right: 14px;

  border: 0;

  background: transparent;

  color: #ddd4e5;

  font-size: 2rem;

  line-height: 1;

  cursor: pointer;
}

.rules-close:hover {
  color: #caff82;
}

.witch-start-art {
  position: relative;

  width: 100%;

  overflow: hidden;

  border: 1px solid rgba(202, 255, 130, 0.45);

  border-radius: 14px;

  box-shadow: 0 0 22px rgba(150, 255, 90, 0.2);
}

.witch-start-image {
  display: block;

  width: 100%;

  height: auto;
}

.start-actions {
  position: absolute;

  right: 7%;

  bottom: 12%;

  display: flex;

  gap: 10px;
}

.start-actions .game-button {
  padding: 11px 22px;

  font-size: clamp(0.8rem, 2.4vw, 1rem);
}

.game-button {
  border: none;

  padding: 13px 28px;

  border-radius: 30px;

  cursor: pointer;

  font-weight: bold;

  background: linear-gradient(#d7ff99, #7bc846);

  color: #16200d;

  box-shadow: 0 0 20px rgba(150, 255, 80, 0.3);

  transition: 0.2s;
}

.game-button:hover {
  transform: scale(1.06);

  box-shadow: 0 0 30px rgba(150, 255, 80, 0.6);
}

.hidden {
  display: none !important;
}

/* =========================================================
   LANDSCAPE TABLETS / PHONES
   ========================================================= */

@media screen and (max-width: 900px) and (orientation: landscape) {
  .game-container {
    height: 100dvh;

    padding: 6px;

    gap: 7px;

    grid-template-columns:
      minmax(0, 3fr)
      minmax(200px, 1fr);
  }

  .ingredients-panel {
    padding: 9px;

    border-radius: 10px;
  }

  .hud {
    gap: 5px;

    margin-bottom: 5px;
  }

  .hud-box {
    padding: 4px 4px;

    font-size: 0.58rem;
  }

  .hint-button {
    padding: 5px 8px;

    font-size: 0.68rem;
  }

  .ingredients-panel h2 {
    font-size: 1rem;

    margin-bottom: 3px;
  }

  .panel-subtitle {
    font-size: 0.62rem;

    margin-bottom: 5px;
  }

  .progress-container {
    height: 5px;

    margin-bottom: 7px;
  }

  #ingredientList {
    gap: 3px;
  }

  .list-item {
    padding: 4px 6px;

    font-size: 0.68rem;

    gap: 5px;
  }

  .list-number {
    min-width: 17px;

    height: 17px;

    font-size: 0.55rem;
  }
}

/* =========================================================
   SMALL LANDSCAPE PHONES
   ========================================================= */

@media screen and (max-width: 650px) and (orientation: landscape) {
  .game-container {
    padding: 4px;

    gap: 5px;

    grid-template-columns:
      minmax(0, 3.2fr)
      minmax(165px, 1fr);
  }

  .ingredients-panel {
    padding: 6px;
  }

  .hud {
    gap: 3px;
  }

  .hud-box {
    font-size: 0.52rem;

    padding: 3px 2px;
  }

  .hint-button {
    padding: 3px 5px;

    font-size: 0.58rem;
  }

  .ingredients-panel h2 {
    font-size: 0.85rem;
  }

  .panel-subtitle {
    display: none;
  }

  .progress-container {
    height: 4px;

    margin-bottom: 5px;
  }

  #ingredientList {
    gap: 2px;
  }

  .list-item {
    font-size: 0.58rem;

    padding: 3px 4px;
  }

  .list-number {
    min-width: 15px;

    height: 15px;

    font-size: 0.5rem;
  }
}

/* =========================================================
   PORTRAIT MODE
   ========================================================= */

@media screen and (max-width: 900px) and (orientation: portrait) {
  .game-container {
    display: none;
  }

  body {
    overflow: hidden;
  }
}

/* =========================================================
   ROTATE DEVICE SCREEN
   ========================================================= */

.rotate-screen {
  display: none;

  position: fixed;

  inset: 0;

  z-index: 5000;

  align-items: center;

  justify-content: center;

  text-align: center;

  padding: 25px;

  background: radial-gradient(circle at center, #211735, #050609);

  color: #caff82;
}

.rotate-content {
  max-width: 350px;
}

.rotate-content .rotate-icon {
  font-size: 4rem;

  margin-bottom: 15px;

  animation: rotatePhone 2s infinite ease-in-out;
}

.rotate-content h2 {
  font-size: 1.6rem;

  margin-bottom: 10px;
}

.rotate-content p {
  color: #c7bdcf;

  line-height: 1.5;
}

@keyframes rotatePhone {
  0%,
  100% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(90deg);
  }
}

@media screen and (max-width: 900px) and (orientation: portrait) {
  .rotate-screen {
    display: flex;
  }
}
