/* =========================================
   FIND ME! — GLOBAL DESIGN
   Lightweight CSS, no external libraries
========================================= */

:root {
  --blue: #1554bd;
  --blue-dark: #103e91;
  --blue-deep: #092d70;
  --yellow: #ffdf24;
  --orange: #ffad00;
  --green: #28bd45;
  --white: #ffffff;
  --red: #ed303b;
  --ink: #09295e;
  --panel-shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--blue);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--white);
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  background-color: var(--blue);
  background-image: url("./assets/background.png");
  background-position: center center;
  background-size: cover;
  background-repeat: repeat-y;
  background-attachment: fixed;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

button:disabled {
  cursor: default;
}

img {
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================
   APP AND BRAND
========================================= */

#app {
  width: 100%;
  min-height: 100vh;
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 20px 30px;
  position: relative;
}

.brand {
  width: 100%;
  text-align: center;
  margin: 0 auto 22px;
}

.logo {
  display: block;
  width: min(300px, 78vw);
  max-height: 190px;
  object-fit: contain;
  margin: 0 auto 4px;
  transform: scale(1.35);
}

.tagline {
  color: var(--yellow);
  font-size: clamp(15px, 2vw, 15px);
  font-weight: 900;
  letter-spacing: 3px;
  text-align: center;
  transform: translateY(-10px);
}
/* =========================================
   SCREENS
========================================= */

.screen {
  display: none;
  width: 100%;
  animation: screen-in 220ms ease-out;
}

.screen.active {
  display: block;
}

@keyframes screen-in {
  from {
    opacity: 0.6;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================
   SETUP FORM
========================================= */

.setup-form {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

.name-input {
  display: block;
  width: 80%;
  min-height: 44px;
  margin: 10px 0 22px;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  background: #516fae;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 4px 0 rgba(4, 35, 92, 0.18);
  margin-left: auto;
  margin-right: auto;
}
.name-input::placeholder {
  color: #7593d9;
  opacity: 1;
}

.section-label {
  display: block;
  margin: 22px 0 12px;
  color: var(--white);
  font-size: clamp(17px, 3.5vw, 23px);
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

.difficulty-title {
  margin-top: 26px;
  margin-bottom: 28px;
}

/* =========================================
   DIFFICULTY CARDS
========================================= */

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  padding-top: 8px;
}

.difficulty-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 225px;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 17px 8px 13px;
  border: 3px solid transparent;
  border-radius: 17px;
  background: #fff;
  color: var(--blue-dark);
  box-shadow: 0 7px 0 rgba(4, 35, 92, 0.22);
  transition: transform 140ms ease, border-color 140ms ease;
}

.difficulty-card:hover {
  transform: translateY(-2px);
}

.difficulty-card.selected {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px var(--blue-dark), 0 7px 0 rgba(4, 35, 92, 0.22);
}

.difficulty-card strong {
  font-size: clamp(17px, 3.4vw, 24px);
  font-weight: 900;
}

.difficulty-card small {
  margin-bottom: -8px;
  font-size: 12px;
  font-weight: 900;
}

.difficulty-card b {
  font-size: clamp(25px, 5vw, 35px);
  line-height: 1;
}

.thin-rule {
  display: block;
  width: 75%;
  height: 2px;
  flex-shrink: 0;
  background: #d3def2;
}

.card-description {
  min-height: 30px;
  color: #e87c00;
  font-size: clamp(10px, 2.2vw, 13px);
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
}

.emoji {
  margin-top: auto;
  font-size: clamp(25px, 5vw, 37px);
  line-height: 1.1;
}

.difficulty-card.featured {
  border-color: transparent;
}

.difficulty-card.featured.selected {
  border-color: var(--yellow);
}

.sweet-spot {
  position: absolute;
  top: -20px;
  left: 50%;
  width: max-content;
  max-width: 120%;
  padding: 6px 11px;
  transform: translateX(-50%);
  border-radius: 8px;
  background: #ff8d16;
  color: #fff;
  font-size: clamp(9px, 1.9vw, 12px);
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.16);
}

.crown-heading {
  margin-top: 34px;
  margin-bottom: 17px;
}

/* =========================================
   BRAINROT CROWN SELECTOR
========================================= */

.brainrot-panel {
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 9px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 16px;
  background: rgba(7, 43, 113, 0.28);
  scrollbar-width: thin;
  scrollbar-color: var(--yellow) rgba(255, 255, 255, 0.15);
}

.brainrot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.brainrot-option {
  display: flex;
  min-width: 0;
  min-height: 110px;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: none;
  border-radius: 13px;
  background: #ffffff00;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.16);
  transition: transform 140ms ease, border-color 140ms ease;
}

.brainrot-option:hover {
  transform: translateY(-2px);
}

.brainrot-option.selected {
  border-color: var(--yellow);
  background: #fff8c9;
  box-shadow: 0 0 0 2px var(--blue-dark), 0 4px 0 rgba(0, 0, 0, 0.16);
}

.brainrot-option img {
  display: block;
  width: 100%;
  height: 105px;
  object-fit: contain;
}

/* =========================================
   BUTTONS
========================================= */

.primary-button,
.secondary-button {
  display: block;
  width: 60%;
  min-height: 58px;
  margin: 16px auto 0;
  padding: 15px 18px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  font-size: clamp(16px, 3.4vw, 22px);
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  box-shadow: 0 6px 0 rgba(5, 34, 89, 0.55);
  transition: transform 120ms ease, box-shadow 120ms ease;
  margin-left: auto;
  margin-right: auto;
}

.primary-button {
  background: var(--orange);
}

.primary-button:hover {
  filter: brightness(1.04);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 rgba(5, 34, 89, 0.55);
}

.green-button {
  margin-top: 22px;
  background: var(--green);
  box-shadow: 0 6px 0 rgba(0, 57, 15, 0.6);
}

.secondary-button {
  background: #fff;
  color: var(--blue-dark);
}

.text-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 18px auto;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.save-link {
  margin: 24px auto 8px;
  letter-spacing: 1px;
}

/* =========================================
   RETURNING PLAYER, PROFILE, RESULTS
========================================= */

.compact-screen {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.compact-screen h1 {
  margin: 16px 0;
  color: var(--yellow);
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 900;
}

.avatar {
  display: flex;
  width: 62px;
  height: 62px;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--blue-dark);
  font-size: 25px;
}

.avatar img {
  display: block;
  width: 80%;
  height: 80%;
  object-fit: cover;
  border-radius: 50%;
}

.body-copy {
  font-size: 16px;
  line-height: 1.5;
}

.filter-row {
  display: flex;
  gap: 8px;
  margin: 20px 0;
}

.filter {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid #fff;
  border-radius: 10px;
  background: transparent;
  color: #fff;
  font-weight: 900;
}

.filter.active {
  background: #fff;
  color: var(--blue-dark);
}

.results-list {
  margin: 18px 0;
  max-height: 390px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.55) rgba(255, 255, 255, 0.12);
}

.results-list::-webkit-scrollbar {
  width: 4px;
}

.results-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.results-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
}

.result-row {
  overflow-wrap: anywhere;
}

.power-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.power-grid > div {
  padding: 16px 10px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.12);
}

.power-grid h2 {
  font-size: 14px;
  line-height: 1.3;
}

.power-grid p {
  color: var(--yellow);
  font-size: 25px;
}

/* =========================================
   FINDER OPENING SCREEN
========================================= */

/* Hide the normal global logo while the Finder
   opening screen is being shown. */
#app.finder-mode > .brand {
  display: none;
}

/* Finder opening is part of the normal page flow.
   It does NOT create its own fixed scrolling area. */
#finder-opening {
  position: relative;
  inset: auto;
  z-index: auto;

  width: 100%;
  max-width: 900px;

  height: auto;
  min-height: 100dvh;

  margin: 0 auto;
  padding: 0 20px 35px;

  overflow: visible;

  background: transparent;
  text-align: center;
}

.finder-opening-content {
  width: 100%;
  max-width: 900px;

  min-height: auto;

  margin: 0 auto;
  padding: 30px 0 35px;
}

/* NEW FINDER OPENING LOGO */

.finder-opening-logo {
  display: block;
  width: min(520px, 82vw);
  max-height: 58vh;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}

/* FIRST TEXT — hidden initially */

.finder-step-text {
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: opacity 350ms ease, transform 350ms ease, visibility 350ms ease;
}
#finder-save {
  opacity: 1;
  visibility: visible;
  transform: none;
}
/* START BUTTON AREA — hidden initially */

.finder-step-actions {
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: opacity 350ms ease, transform 350ms ease, visibility 350ms ease;
}

/* IT'S SIMPLE — hidden initially */

.finder-how-to {
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: opacity 350ms ease, transform 350ms ease, visibility 350ms ease;
}

/* STEP 2 — reveal challenge text after 1 second */

#finder-opening.reveal-text .finder-step-text {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* STEP 3 — reveal START CHALLENGE after 3 more seconds */

#finder-opening.reveal-actions .finder-step-actions {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* STEP 4 — reveal IT'S SIMPLE 1 second later */

#finder-opening.reveal-how-to .finder-how-to {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.challenge-intro {
  margin: 28px auto 0;
  font-size: clamp(24px, 5vw, 38px);
  font-weight: 900;
  line-height: 1.35;
}

.challenge-intro strong {
  color: var(--yellow);
}

.finder-action-area {
  margin-top: 3px;
}

.how-to {
  margin: 30px auto 25px;
}

.how-to h2 {
  color: var(--yellow);
  font-size: clamp(19px, 4vw, 27px);
  font-weight: 900;
  letter-spacing: 4px;
}

.how-to p {
  font-size: clamp(14px, 3vw, 19px);
  font-weight: 800;
  line-height: 1.8;
}

/* =========================================
   HUNT AND TIMER
========================================= */

.hunt-screen {
  text-align: center;
}

.hunt-heading {
  margin: 12px auto 20px;
}

.hunt-heading h2 {
  margin: 0 0 10px;
  font-size: clamp(20px, 4.4vw, 31px);
  font-weight: 900;
}

#round-label {
  margin: 8px 0;
  color: var(--yellow);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 2px;
}

.timer-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 18px auto;
  font-size: clamp(13px, 3vw, 18px);
  font-weight: 900;
}

.timer-circle {
  display: inline-flex;
  width: 43px;
  height: 43px;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--yellow);
  border-radius: 50%;
  color: var(--yellow);
  font-size: 25px;
  font-weight: 900;
}

.door-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  gap: clamp(8px, 2vw, 18px);
  width: 100%;
  margin: 20px auto;
  transition: opacity 220ms ease, transform 220ms ease;
}

.door-grid.disappear {
  opacity: 0;
  transform: scale(0.82);
}

.door-tile {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 150px;
  min-width: 0;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  transition: transform 180ms ease, opacity 180ms ease, filter 180ms ease;
}

.door-tile img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.door-number {
  position: absolute;
  right: 5%;
  bottom: 5%;
  display: flex;
  width: 25px;
  height: 25px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.door-tile.forward {
  z-index: 5;
  transform: scale(1.1);
  animation: door-wiggle 380ms ease-in-out;
}

@keyframes door-wiggle {
  0%,
  100% {
    rotate: 0deg;
  }
  25% {
    rotate: -2deg;
  }
  50% {
    rotate: 2deg;
  }
  75% {
    rotate: -1deg;
  }
}

.door-result-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 32%;
  height: auto;
  max-width: 58px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
}

.door-tile.wrong,
.door-tile.correct {
  isolation: isolate;
}

.door-tile.dimmed {
  opacity: 0.4;
}

.hunt-feedback {
  min-height: 30px;
  margin: 20px auto;
  color: var(--yellow);
  font-size: clamp(16px, 3vw, 23px);
  font-weight: 900;
}

/* =========================================
   OUTCOME SCREEN
========================================= */

.outcome-screen {
  text-align: center;
}

.outcome-image {
  display: block;
  width: min(400px, 90%);
  max-height: 260px;
  object-fit: contain;
  margin: 8px auto 15px;
}

.outcome-screen h1 {
  margin: 18px 0;
  color: var(--yellow);
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 900;
  line-height: 1.15;
}

.outcome-screen > p {
  font-size: clamp(16px, 3.5vw, 22px);
  line-height: 1.5;
}

/* LOSS SCREEN — CROWN MESSAGE */
.loss-crown-message {
  margin: 18px auto 0;
  max-width: 620px;
  color: var(--white);
  font-size: clamp(20px, 4.2vw, 32px);
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

/* LOSS SCREEN — BRAINROT */
.loss-brainrot {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px auto 0;
  min-height: 180px;
}

.loss-brainrot img {
  display: block;
  width: min(280px, 78%);
  max-height: 280px;
  object-fit: contain;
  margin: 0 auto;
}

/* OUTCOME BUTTON AREA */
.outcome-actions {
  position: relative;
  isolation: isolate;

  width: min(420px, 90%);
  margin: 24px auto 0;
  padding: 24px 0;
}

.outcome-actions::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;

  opacity: 0.55;

  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.88) 1.5px,
    transparent 1.8px
  );

  background-size: 15px 15px;
}

.outcome-actions > * {
  position: relative;
  z-index: 1;
}

.outcome-actions .primary-button,
.outcome-actions .secondary-button {
  width: 100%;
  margin-bottom: 10px;
}
/* =========================================
   FINDER LOSS — USE LOST IMAGE AS HEADER
========================================= */

/* Hide the normal global FIND ME logo */
#app.finder-loss-mode > .brand {
  display: none;
}

/* Keep the loss screen in normal page flow */
#outcome-screen.finder-loss {
  position: relative;
  width: 100%;
  max-width: 900px;
  min-height: 100dvh;
  height: auto;

  margin: 0 auto;
  padding: 30px 20px 40px;

  overflow: visible;
  background: transparent;
}

/* Put LOST image where the normal game logo would normally sit */
#outcome-screen.finder-loss #outcome-image {
  display: block;
  position: relative;

  width: min(300px, 78vw);
  max-height: 190px;
  height: auto;

  margin: 0 auto 4px;

  object-fit: contain;
  transform: scale(1.35);
}
/* =========================================
   CONFIRM DETAILS POPUP
========================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(4, 13, 34, 0.78);
  backdrop-filter: blur(2px);
}

.modal-backdrop.hidden {
  display: none;
}

.confirm-card {
  position: relative;
  isolation: isolate;
  width: min(100%, 590px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  flex-shrink: 0;
  margin: auto;
  padding: 24px 28px 25px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 23px;

  background-color: var(--blue);
  background-image: url("./assets/background.png");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  background-size: cover;
  color: #fff;
  text-align: center;
  box-shadow: 12px 15px 0 rgba(0, 0, 0, 0.24), 0 15px 45px rgba(0, 0, 0, 0.2);
  scrollbar-width: thin;
  scrollbar-color: var(--yellow) rgba(255, 255, 255, 0.1);
}

.confirm-logo {
  display: block;
  width: min(235px, 68%);
  max-height: 145px;
  object-fit: contain;
  margin: 0 auto 0;
}

.confirm-tagline {
  margin: 0 0 22px;
  color: var(--yellow);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 5px;
}

#confirm-title {
  display: none;
  margin: 0 0 23px;
  color: #fff;
  font-size: clamp(23px, 4.2vw, 31px);
  font-weight: 900;
  line-height: 1.15;
}

.confirm-label {
  margin: 20px 0 10px;
  color: var(--yellow);
  font-size: clamp(17px, 3.4vw, 25px);
  font-weight: 900;
  line-height: 1.15;
}

.confirm-value {
  margin: 0;
  color: #fff;
  font-size: clamp(21px, 4vw, 29px);
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.confirm-divider {
  width: 58%;
  margin: 18px auto;
  border-top: 2px dotted rgba(255, 255, 255, 0.75);
}

.confirm-crown {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 125px;
  margin: 12px auto 8px;
}

.confirm-crown img {
  display: block;
  width: min(250px, 76%);
  max-height: 230px;
  object-fit: contain;
  margin: 0 auto;
}

#confirm-crown-name {
  display: none;
  margin-top: 4px;
}

.confirm-card .text-link {
  margin: 18px auto 24px;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 3px;
}

.confirm-action-area {
  position: relative;
  isolation: isolate;
  margin: 14px -3px 0;
  padding: 24px 0;
}

.confirm-action-area::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.55;
  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.88) 1.5px,
    transparent 1.8px
  );
  background-size: 15px 15px;
}

.finder-action-area {
  position: relative;
  isolation: isolate;
  margin: 26px -3px 0;
  padding: 24px 0;
}

.finder-action-area::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.55;
  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.88) 1.5px,
    transparent 1.8px
  );
  background-size: 15px 15px;
}

.confirm-card .primary-button {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  min-height: 64px;
  margin: 0 auto;
  padding: 16px 12px;
  border: 0;
  border-radius: 19px;
  background: #ffb900;
  color: #fff;
  font-size: clamp(19px, 3.5vw, 25px);
  font-weight: 900;
  line-height: 1.15;
  box-shadow: 0 7px 0 rgba(83, 48, 0, 0.72);
}

.confirm-card .primary-button:active {
  transform: translateY(3px);
  box-shadow: 0 4px 0 rgba(83, 48, 0, 0.72);
}

.payment-note {
  margin: 17px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.45;
}

/* =========================================
   TOAST ALERT
========================================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: 25px;
  z-index: 2000;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 14px 18px;
  transform: translate(-50%, 20px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: #082d70;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* =========================================
   RESPONSIVE LAYOUT
========================================= */

@media (min-width: 760px) {
  #app {
    padding-top: 24px;
  }

  .brand {
    margin-bottom: 30px;
  }

  .setup-form {
    max-width: 700px;
  }

  .brainrot-panel {
    max-height: 330px;
  }

  .door-grid {
    gap: 20px;
  }
}

@media (max-width: 520px) {
  #app {
    padding: 12px 13px 24px;
  }

  .brand {
    margin-bottom: 20px;
  }

  .logo {
    width: min(245px, 78vw);
    max-height: 145px;
  }

  .tagline {
    letter-spacing: 4px;
  }

  .difficulty-grid {
    gap: 7px;
  }

  .difficulty-card {
    min-height: 190px;
    padding: 16px 5px 11px;
    gap: 7px;
    border-radius: 12px;
  }

  .sweet-spot {
    top: -17px;
    padding: 5px 6px;
    font-size: 8px;
  }

  .brainrot-grid {
    gap: 7px;
  }

  .brainrot-option {
    min-height: 90px;
    padding: 5px;
    border-radius: 10px;
  }

  .brainrot-option img {
    height: 83px;
  }

  .modal-backdrop {
    align-items: flex-start;
    padding: 12px;
  }

  .confirm-card {
    max-height: calc(100dvh - 24px);
    padding: 20px 18px 20px;
    border-radius: 20px;
  }

  .confirm-logo {
    width: min(185px, 65%);
    max-height: 110px;
  }

  .confirm-tagline {
    margin-bottom: 18px;
    font-size: 11px;
    letter-spacing: 4px;
  }

  #confirm-title {
    margin-bottom: 19px;
  }

  .confirm-label {
    margin-top: 16px;
  }

  .confirm-divider {
    margin: 14px auto;
  }

  .confirm-crown {
    min-height: 100px;
  }

  .confirm-crown img {
    max-height: 175px;
  }

  .confirm-card .text-link {
    margin: 15px auto 19px;
  }

  .confirm-action-area {
    padding: 19px 0;
  }

  .confirm-card .primary-button {
    min-height: 58px;
  }

  .door-grid {
    gap: 7px;
  }

  .door-number {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .challenge-intro {
    margin-top: 25px;
  }

  .profile-menu {
    position: fixed;
    top: 62px;
    left: 12px;
    width: min(320px, calc(100% - 24px));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* FOUND stamp over the Hider's name */
.outcome-stamp-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
}

.hider-found-name {
  position: absolute;
  z-index: 1;
  width: 100%;
  margin: 0;
  text-align: center;
  font-size: clamp(40px, 11vw, 72px);
  font-weight: 900;
  line-height: 1.05;
  overflow-wrap: anywhere;
  color: #ffffff;
  -webkit-text-stroke: 1px #111111;
  text-shadow: 3px 3px 0 #111111;
  text-transform: uppercase;
}

.outcome-stamp-wrap .outcome-image {
  position: relative;
  z-index: 2;
  width: 40%;
  max-width: 40%;
  height: auto;
  object-fit: contain;
  transform: rotate(-6deg);
}
/* INTRO SCREEN */
#intro-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;

  background-image: url("./assets/background.png");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 1;
  visibility: visible;
}

.intro-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center center;
  background: #1554bd;
}

/* Hide intro when animation finishes */
#intro-screen.intro-finished {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
/* Prevent result images from flashing before they are ready */
#outcome-image[hidden] {
  display: none !important;
}
/* =========================================
   FINDER WIN CONFETTI
   Lightweight animation, no external libraries
========================================= */

.win-confetti {
  position: fixed;
  inset: 0;
  z-index: 900;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.win-confetti-piece {
  position: absolute;
  top: -24px;
  display: block;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  opacity: 0;
  animation-name: win-confetti-fall;
  animation-timing-function: cubic-bezier(0.18, 0.65, 0.45, 1);
  animation-fill-mode: forwards;
  will-change: transform, opacity;
}

.win-confetti-piece.round {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

@keyframes win-confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -2vh, 0) rotate(0deg);
  }

  8% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--confetti-drift), 110vh, 0)
      rotate(var(--confetti-spin));
  }
}

@media (prefers-reduced-motion: reduce) {
  .win-confetti {
    display: none;
  }
}
/* ================================
   CHALLENGE READY
================================ */

.challenge-ready-card {
  text-align: center;
}

.challenge-link-box {
  width: 100%;
  margin: 12px 0 18px;
}

#ready-challenge-link {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 2px solid rgba(21, 84, 189, 0.25);
  border-radius: 12px;
  background: #f5f8ff;
  color: #16469d;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

#share-challenge-whatsapp {
  width: 100%;
  margin-top: 10px;
}

#close-challenge-ready {
  margin-top: 14px;
}
.power-rank {
  margin: 6px 0 4px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.power-key {
  display: block;
  width: 150px;
  height: auto;
  object-fit: contain;
}

/* =========================================
   MY GAME POWER
========================================= */

.game-power-section {
  width: min(100%, 560px);
  margin: 24px auto 0;
  text-align: center;
}

.game-power-section h2 {
  margin: 0;
  color: var(--yellow);
  font-size: clamp(28px, 6vw, 42px);
  font-weight: 900;
  line-height: 1.05;
}

.power-subtext {
  margin: 6px 0 14px;
  color: var(--white);
  font-size: clamp(16px, 3.8vw, 24px);
  font-weight: 900;
  line-height: 1.15;
  text-transform: uppercase;
}

/* Scrollable area containing the keys */
.power-key-scroll {
  width: min(300px, 82%);
  height: 290px;
  margin: 0 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 12px;
  box-sizing: border-box;

  scrollbar-width: auto;
}

/* Chrome / Edge scrollbar */
.power-key-scroll::-webkit-scrollbar {
  width: 10px;
}

.power-key-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 10px;
}

.power-key-scroll::-webkit-scrollbar-thumb {
  background: rgba(20, 70, 157, 0.95);
  border-radius: 10px;
}

/* Keys inside the scroll area */
.power-key-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 100%;
}

/* Individual key */
.power-key-list img {
  display: block;
  width: 150px;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

/* Divider between Hider and Finder Power */
.power-divider {
  width: min(360px, 72%);
  height: 2px;
  margin: 28px auto 24px;
  background: rgba(255, 255, 255, 0.55);
}

/* Keep the action buttons separated from the key display */
#profile-start {
  margin-top: 34px;
}
/* =========================================
   LOSS RESULT SEQUENCE
========================================= */

/* Everything starts hidden during the loss sequence. */
#outcome-screen.loss-sequence #outcome-image,
#outcome-screen.loss-sequence #loss-crown-message,
#outcome-screen.loss-sequence #loss-brainrot,
#outcome-screen.loss-sequence #outcome-actions {
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 400ms ease, transform 400ms ease, visibility 400ms ease;
}

/* The hidden class normally uses display:none.
   During the loss sequence these elements need to exist
   so CSS can reveal them progressively. */
#outcome-screen.loss-sequence #loss-crown-message.hidden,
#outcome-screen.loss-sequence #loss-brainrot.hidden,
#outcome-screen.loss-sequence #outcome-actions.hidden {
  display: block !important;
}

/* Brainrot needs flex layout even while hidden. */
#outcome-screen.loss-sequence #loss-brainrot.hidden {
  display: flex !important;
}

/* 1. LOST IMAGE */
#outcome-screen.loss-sequence.show-loss-image #outcome-image {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 2. HIDER'S CROWN MESSAGE */
#outcome-screen.loss-sequence.show-crown-message #loss-crown-message {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 3. SELECTED BRAINROT */
#outcome-screen.loss-sequence.show-brainrot #loss-brainrot {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 4. DOTTED AREA + BUTTONS */
#outcome-screen.loss-sequence.show-controls #outcome-actions {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
/* =========================================
   M-PESA PHONE POPUP
========================================= */

.mpesa-phone-card {
  text-align: center;
}

#mpesa-phone-title {
  margin: 0 0 16px;
  color: #fff;
  font-size: clamp(23px, 4.2vw, 31px);
  font-weight: 900;
}

.mpesa-phone-input-wrap {
  width: min(100%, 360px);
  margin: 18px auto 8px;
}

#mpesa-phone-input {
  width: 100%;
  box-sizing: border-box;
  padding: 15px 16px;

  border: 3px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;

  background: rgba(255, 255, 255, 0.96);
  color: #16469d;

  font-size: 18px;
  font-weight: 800;
  text-align: center;

  outline: none;
}

#mpesa-phone-input:focus {
  border-color: var(--yellow);
}

.mpesa-phone-error {
  margin: 8px auto 0;
  color: var(--yellow);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

#mpesa-phone-cancel {
  margin-top: 10px;
}
/* =========================================
   PROFILE MENU
========================================= */

.profile-access-button {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 150;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;
  padding: 0;

  border: 1px solid #fff;
  border-radius: 80%;
  background: transparent;
  overflow: visible;
  cursor: pointer;
}

.profile-access-button:active {
  transform: translateY(2px);
}

.screen-profile-trigger {
  top: 12px;
  left: 12px;
}

.profile-icon-image {
  display: block;
  width: 80%;
  height: 80%;
  object-fit: cover;
  border-radius: 50%;
}

/* Profile popup */
.profile-menu {
  position: fixed;
  top: 68px;
  left: 18px;
  z-index: 100;

  width: min(330px, calc(100% - 36px));
}

.profile-menu-card {
  padding: 18px;

  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;

  background: var(--blue);
  box-shadow: 8px 9px 0 rgba(0, 0, 0, 0.22), 0 12px 30px rgba(0, 0, 0, 0.25);
}

/* Profile identity */
.profile-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-menu-avatar {
  display: flex;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;

  border: 2px solid #fff;
  border-radius: 50%;

  background: var(--yellow);
  color: var(--blue-dark);

  font-size: 18px;
}

.profile-menu-avatar img {
  display: block;
  width: 80%;
  height: 80%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-menu-identity {
  min-width: 0;
  flex: 1;
}

.profile-menu-label {
  margin: 0 0 5px;

  color: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
}

.profile-name-edit-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

#profile-menu-name {
  min-width: 0;
  flex: 1;

  padding: 7px 9px;

  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;

  background: rgba(255, 255, 255, 0.12);
  color: #fff;

  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-name-save {
  flex-shrink: 0;

  padding: 7px 9px;

  border: 0;
  border-radius: 8px;

  background: var(--green);
  color: #fff;

  font-size: 11px;
  font-weight: 900;
}

.profile-menu-divider {
  width: 100%;
  height: 1px;
  margin: 15px 0;

  background: rgba(255, 255, 255, 0.3);
}

/* Compact profile actions */
.profile-menu-button {
  display: block;

  width: 100%;
  min-height: 42px;

  margin: 8px 0;
  padding: 9px 12px;

  border: 0;
  border-radius: 10px;

  background: #fff;
  color: var(--blue-dark);

  font-size: 13px;
  font-weight: 900;
  text-align: center;

  box-shadow: 0 4px 0 rgba(5, 34, 89, 0.4);
}

.profile-menu-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(5, 34, 89, 0.4);
}

.profile-menu-close {
  display: block;

  margin: 12px auto 0;
  padding: 5px 8px;

  border: 0;
  background: transparent;
  color: #fff;

  font-size: 11px;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.finder-dares-section h3 {
  margin: 16px 0 10px;
  color: var(--yellow);
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

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

.finder-dare-row {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;

  border-radius: 10px;

  background: rgba(244, 167, 1, 0.20);
  border: 1px solid rgba(244, 167, 1, 0.38);
  color: #fff;

  font-size: 15px;
  font-weight: 900;
  text-align: left;
}
/* =========================================
   PROFILE UNSEEN RESULTS BADGE
========================================= */

.profile-notification-badge {
  position: absolute;
  z-index: 3;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.profile-notification-badge.hidden {
  display: none;
}

/* Green: live challenges currently running. */
.profile-live-badge {
  top: -10px;
  right: -12px;
  min-width: 24px;
  height: 24px;
  padding: 2px 6px;
  background: #39c20f;
  color: #fff;
  border: 2px solid #1554bd;
  font-size: 12px;
}

/* Red + flexed arm: incoming challenge calls / action needed. */
.profile-action-badge {
  left: -15px;
  bottom: -12px;
  min-width: 34px;
  height: 34px;
  padding: 3px 7px 3px 4px;
  gap: 2px;
  background: #ff1717;
  color: #fff;
  border: 2px solid #1554bd;
  font-size: 13px;
}

.profile-action-arm {
  position: absolute;
  left: -8px;
  bottom: 3px;
  width: 16px;
  height: 16px;
  object-fit: contain;
  transform: translate(-2px, -2px);
}


/* =========================================
   LIVE CHALLENGES — HIDER / FINDER
   Lightweight polling UI; no realtime library required.
========================================= */

.live-section-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.live-section-heading h3 {
  margin: 16px 0 10px;
  color: var(--yellow);
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.live-refresh-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.75;
}

.live-refresh-dot.pulse {
  animation: live-dot-pulse 650ms ease-out;
}

@keyframes live-dot-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  45% { transform: scale(1.55); opacity: 1; }
  100% { transform: scale(1); opacity: 0.75; }
}

.hider-live-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.live-challenge-card {
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.11);
  text-align: left;
}

.live-challenge-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.live-challenge-title strong {
  min-width: 0;
  color: #fff;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.live-challenge-title span {
  flex-shrink: 0;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 900;
}

.live-challenge-round {
  margin-top: 7px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1px;
}

.live-progress-track {
  width: 100%;
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.live-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--yellow);
  transition: width 350ms ease;
}

.live-challenge-status {
  margin-top: 7px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.5px;
}

.live-empty {
  margin: 8px 0 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}


/* Player names are always presented in capitals. */
#profile-menu-name, #profile-name, #welcome-name, #hider-name, #finder-name { text-transform: uppercase; }

.finder-dare-row strong {
  font-size: 16px;
  font-weight: 900;
}

.finder-dare-row span {
  color: #f4a701;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .4px;
}

.finder-dare-message {
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .5px;
}

.finder-dare-go {
  width: 100%;
  margin-top: 6px;
}
