:root {
  --ink: #f4fbff;
  --muted: #c5d7e2;
  --deep: #06202b;
  --reef: #0d7f84;
  --reef-2: #1fb6a9;
  --coral: #ff6f61;
  --amber: #ffd166;
  --panel: rgba(4, 23, 34, 0.72);
  --line: rgba(244, 251, 255, 0.18);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(3, 34, 49, 0.85), rgba(2, 16, 24, 0.96)),
    url("images/game-bg.png") center / cover fixed;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: rgba(1, 20, 28, 0.48);
}

button,
a {
  font: inherit;
}

.hidden {
  display: none !important;
}

.game {
  min-height: 100vh;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.home-link,
.primary-btn {
  border: 0;
  border-radius: 8px;
  background: #fff5c5;
  color: #102f36;
  cursor: pointer;
  font-weight: 900;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
}

.home-link:hover,
.home-link:focus,
.primary-btn:hover,
.primary-btn:focus {
  outline: 3px solid rgba(255, 209, 102, 0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-mark {
  width: 2.8rem;
  height: 2.8rem;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.86), transparent 16%),
    linear-gradient(135deg, var(--reef-2), #145d66);
  box-shadow: var(--shadow);
}

.brand strong,
.brand small {
  display: block;
  overflow-wrap: anywhere;
}

.brand strong {
  line-height: 1.08;
}

.brand small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  min-height: 2.45rem;
  padding: 0.55rem 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.stats strong {
  color: var(--ink);
}

.stage {
  display: grid;
  align-items: center;
  padding: 0 1rem 1rem;
}

.screen {
  width: min(100%, 1420px);
  margin: 0 auto;
}

.screen-start {
  min-height: calc(100vh - 6rem);
  display: grid;
  align-items: end;
  background:
    linear-gradient(180deg, transparent 20%, rgba(0, 0, 0, 0.66)),
    url("images/game-bg.png") center / cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.start-copy {
  width: min(680px, 100%);
  padding: 2rem;
}

.start-copy p:first-child,
.result-head p:first-child {
  color: var(--amber);
  font-weight: 950;
  margin: 0 0 0.55rem;
  text-transform: uppercase;
}

.start-copy h1,
.result-head h1 {
  margin: 0;
  max-width: 14ch;
  font-size: 3rem;
  line-height: 1.03;
}

.start-copy p,
.result-head p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 58ch;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}

.scene-panel,
.info-panel,
.result-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.scene-panel {
  overflow: hidden;
}

.scene-wrap {
  position: relative;
  width: 100%;
  background: #041722;
}

.scene-wrap img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.hotspots,
.miss-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  border: 2px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #06202b;
  cursor: default;
  display: grid;
  place-items: center;
  font-weight: 950;
  min-width: 24px;
  min-height: 24px;
  pointer-events: auto;
}

.hotspot[data-shape="rect"] {
  border-radius: 16px;
}

.hotspot:focus-visible {
  outline: 3px solid rgba(255, 209, 102, 0.9);
}

.hotspot.is-found {
  border: 3px solid #ff4d4d;
  background: rgba(255, 77, 77, 0.08);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.5),
    0 0 18px rgba(255, 77, 77, 0.45);
  animation: hotspot-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.hotspot.is-found::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  border: 2px solid rgba(255, 77, 77, 0.55);
  animation: hotspot-ring 0.7s ease-out forwards;
  pointer-events: none;
}

.hotspot.is-found span.hotspot-num {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: #ff4d4d;
  border: 2px solid #fff;
  font-size: 0.8rem;
  line-height: 1;
  color: #fff;
  text-shadow: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

@keyframes hotspot-pop {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  60% {
    opacity: 1;
    transform: scale(1.12);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes hotspot-ring {
  0% {
    opacity: 0.9;
    transform: scale(0.85);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

.miss-mark {
  position: absolute;
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--coral);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  animation: miss-pop 0.85s ease forwards;
}

@keyframes miss-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.45);
  }
}

.info-panel {
  padding: 1rem;
  position: sticky;
  top: 1rem;
}

.feedback {
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 1rem;
}

.feedback.is-good {
  border-left-color: var(--reef-2);
}

.feedback.is-bad {
  border-left-color: var(--coral);
}

.feedback strong {
  display: block;
  font-size: 1.1rem;
  line-height: 1.2;
}

.feedback p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0.45rem 0 0;
}

.found-detail {
  margin-top: 0.75rem;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: slideIn 0.25s ease;
}

.found-detail__img-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: rgba(0,0,0,0.2);
}

.found-detail__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.found-detail__body {
  padding: 0.65rem 0.85rem 0.75rem;
}

.found-detail__body strong {
  display: block;
  font-size: 0.9rem;
  color: #fff7c2;
  margin-bottom: 0.3rem;
}

.found-detail__body p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.found-box {
  margin-top: 1rem;
}

.found-box h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.found-box ol {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.found-box li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  line-height: 1.3;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  animation: found-item-in 0.35s ease both;
}

.found-box li::before {
  content: attr(data-order);
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(150deg, #ffe39a, #ffb74d 70%, #ff9f43);
  color: #3a1f00;
  font-size: 0.8rem;
  font-weight: 950;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
}

@keyframes found-item-in {
  0% {
    opacity: 0;
    transform: translateX(-6px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.result-shell {
  padding: 1.25rem;
}

.result-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.75rem;
}

.result-card h2 {
  font-size: 0.98rem;
  margin: 0 0 0.35rem;
  line-height: 1.25;
}

.result-card p,
.result-card small {
  color: var(--muted);
  line-height: 1.4;
}

.result-card p {
  margin: 0;
}

.result-card small {
  display: block;
  margin-top: 0.5rem;
  opacity: 0.75;
}

@media (max-width: 1100px) {
  .play-layout {
    grid-template-columns: 1fr;
  }

  .info-panel {
    position: static;
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar,
  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .stats {
    justify-content: flex-start;
  }

  .start-copy {
    padding: 1.25rem;
  }

  .start-copy h1,
  .result-head h1 {
    font-size: 2.15rem;
  }

  .stage,
  .topbar {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }
}
