/* Number Theory L7: Mystery Wall */

.mystery-page {
  --mystery-ink: #241f1a;
  --mystery-paper: #f8ecd3;
  --mystery-slate: #49525f;
  --mystery-gold: #d9ab4d;
  --mystery-green: #5c936c;
  --mystery-rust: #a65741;
  --mystery-violet: #65518f;
  color: var(--mystery-ink);
}

.mystery-topbar {
  border-color: rgba(139, 135, 122, 0.32);
}

.mystery-progressbar {
  background: rgba(248, 236, 211, 0.76);
  border: 1px solid rgba(73, 82, 95, 0.2);
  border-radius: 999px;
  height: 8px;
  margin: 0 auto 10px;
  max-width: 1180px;
  overflow: hidden;
}

.mystery-progressbar span {
  background: linear-gradient(90deg, var(--mystery-slate), var(--mystery-gold), var(--mystery-violet));
  display: block;
  height: 100%;
  transition: width 320ms ease;
}

.mystery-progress {
  display: flex;
  gap: 7px;
  justify-content: center;
  margin: 0 auto 12px;
}

.mystery-progress__dot {
  background: rgba(36, 31, 26, 0.34);
  border: 1px solid rgba(248, 236, 211, 0.7);
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.mystery-progress__dot.is-current {
  background: var(--mystery-paper);
  box-shadow: 0 0 0 3px rgba(217, 171, 77, 0.22);
}

.mystery-progress__dot.is-filled {
  background: var(--mystery-gold);
  box-shadow: 0 0 12px rgba(217, 171, 77, 0.44);
}

.mystery-room {
  margin: 0 auto;
  max-width: 1180px;
}

.mystery-room__scene {
  background:
    radial-gradient(circle at 22% 18%, rgba(217, 171, 77, 0.28), transparent 24%),
    radial-gradient(circle at 82% 30%, rgba(101, 81, 143, 0.24), transparent 24%),
    linear-gradient(180deg, rgba(248, 236, 211, 0.1), rgba(36, 31, 26, 0.18)),
    url("../img/arena-numbertheory.jpg") center center / cover no-repeat;
  border: 1px solid rgba(248, 236, 211, 0.28);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(36, 31, 26, 0.34);
  height: min(740px, calc(100vh - 130px));
  min-height: 680px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.mystery-room__scene::before {
  background:
    radial-gradient(circle at 50% 58%, rgba(217, 171, 77, 0.1), transparent 32%),
    repeating-linear-gradient(90deg, rgba(248, 236, 211, 0.06) 0 1px, transparent 1px 72px),
    linear-gradient(180deg, rgba(20, 20, 20, 0.08), transparent 46%);
  content: "";
  inset: 0;
  position: absolute;
  z-index: 1;
}

.mystery-room__scene::after {
  background:
    repeating-linear-gradient(90deg, rgba(36, 31, 26, 0.16) 0 4px, transparent 4px 44px),
    linear-gradient(180deg, #776b55, #40382f);
  border-top: 1px solid rgba(248, 236, 211, 0.2);
  bottom: -58px;
  box-shadow: 0 -20px 45px rgba(36, 31, 26, 0.3);
  content: "";
  height: 210px;
  left: -3%;
  position: absolute;
  right: -3%;
  transform: skewY(-2deg);
  z-index: -1;
}

.mystery-room__arches {
  display: flex;
  gap: 18px;
  left: 6%;
  position: absolute;
  top: 28px;
  z-index: 2;
}

.mystery-room__arches span {
  background: linear-gradient(180deg, rgba(248, 236, 211, 0.52), rgba(73, 82, 95, 0.5));
  border: 1px solid rgba(255, 247, 228, 0.28);
  border-radius: 28px 28px 4px 4px;
  height: 90px;
  width: 44px;
}

.mystery-room__lamps {
  inset: auto 5% 72px 5%;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.mystery-room__lamps span {
  background: radial-gradient(circle, #fff6ca 0 35%, var(--mystery-gold) 36% 58%, rgba(217, 171, 77, 0.08) 59%);
  border-radius: 50%;
  bottom: 0;
  box-shadow: 0 0 40px rgba(217, 171, 77, 0.5);
  height: 54px;
  position: absolute;
  width: 54px;
}

.mystery-room__lamps span:first-child { left: 0; }
.mystery-room__lamps span:last-child { right: 0; }

.mystery-room__prompt {
  left: 50%;
  max-width: min(760px, 68%);
  position: absolute;
  text-align: center;
  text-shadow: 0 3px 10px rgba(20, 18, 16, 0.56);
  top: 3%;
  transform: translateX(-50%);
  z-index: 5;
}

.mystery-room__prompt span,
.mystery-shelf__title span,
.mystery-question-card > span,
.mystery-range span,
.mystery-clue-panel__title span,
.mystery-grid-panel__title span,
.mystery-status span,
.mystery-why span {
  color: rgba(255, 248, 228, 0.84);
  display: block;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mystery-room__prompt h1 {
  color: #fff7df;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.25vw, 1.95rem);
  line-height: 1.04;
  margin: 3px 0 0;
}

.mystery-shelf {
  background: linear-gradient(180deg, rgba(36, 31, 26, 0.9), rgba(44, 39, 34, 0.88));
  border: 2px solid rgba(248, 236, 211, 0.32);
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(28, 26, 22, 0.28);
  left: 4%;
  padding: 9px 12px;
  position: absolute;
  right: 4%;
  top: 13%;
  z-index: 4;
}

.mystery-shelf__title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
}

.mystery-shelf__title strong {
  color: #fff2c8;
  font-size: 0.82rem;
}

.mystery-shelf__rail {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.mystery-shelf__slot {
  background: rgba(248, 236, 211, 0.08);
  border: 1px dashed rgba(248, 236, 211, 0.28);
  border-radius: 6px;
  display: grid;
  min-height: 74px;
  padding: 6px;
  place-items: center;
}

.mystery-shelf__slot.is-current {
  border-color: rgba(217, 171, 77, 0.62);
}

.mystery-shelf__slot.is-filled {
  animation: mysteryBlockArrive 420ms ease both;
  background: rgba(248, 236, 211, 0.16);
  border-style: solid;
}

.mystery-snapshot {
  background:
    linear-gradient(135deg, rgba(255, 247, 212, 0.24) 0 20%, transparent 21%),
    linear-gradient(180deg, #d9ab4d, #7b5c34);
  border: 1px solid rgba(55, 48, 38, 0.34);
  border-radius: 7px 10px 8px 6px;
  box-shadow: 0 8px 14px rgba(28, 26, 22, 0.22);
  color: var(--mystery-ink);
  display: grid;
  gap: 2px;
  min-height: 58px;
  min-width: 0;
  padding: 8px;
  place-items: center;
  text-align: center;
  width: 100%;
}

.mystery-shelf__slot:not(.is-filled) .mystery-snapshot {
  background: rgba(248, 236, 211, 0.08);
  box-shadow: none;
  color: rgba(255, 242, 212, 0.5);
}

.mystery-snapshot span {
  font-size: 0.54rem;
  font-weight: 900;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.mystery-snapshot strong {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.22vw, 1.3rem);
  line-height: 1;
}

.mystery-steps {
  display: flex;
  gap: 8px;
  justify-content: center;
  left: 50%;
  position: absolute;
  top: 26%;
  transform: translateX(-50%);
  width: min(920px, 84%);
  z-index: 5;
}

.mystery-step {
  background: rgba(248, 236, 211, 0.13);
  border: 1px solid rgba(248, 236, 211, 0.24);
  border-radius: 999px;
  color: rgba(255, 248, 228, 0.74);
  flex: 1;
  font-size: 0.62rem;
  font-weight: 900;
  min-height: 34px;
  padding: 9px 10px;
  text-align: center;
  text-transform: uppercase;
}

.mystery-step--active {
  background: rgba(217, 171, 77, 0.92);
  color: #2b241d;
}

.mystery-step--complete {
  background: rgba(92, 147, 108, 0.88);
  color: #f8f2df;
}

.mystery-step--pending {
  opacity: 0.58;
}

.mystery-workbench {
  bottom: 9%;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(220px, 0.82fr) minmax(0, 2.2fr) minmax(190px, 0.72fr);
  left: 5%;
  position: absolute;
  right: 5%;
  top: 33%;
  z-index: 5;
}

.mystery-question-card,
.mystery-clue-panel,
.mystery-grid-panel,
.mystery-status {
  background: rgba(36, 31, 26, 0.82);
  border: 1px solid rgba(248, 236, 211, 0.24);
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(28, 26, 22, 0.28);
}

.mystery-question-card {
  align-content: start;
  color: #fff7df;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.mystery-question-card h1 {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  line-height: 1;
  margin: 0;
}

.mystery-question-card p {
  color: rgba(255, 248, 228, 0.82);
  line-height: 1.35;
  margin: 0;
}

.mystery-range {
  background:
    radial-gradient(circle at 45% 25%, rgba(255, 247, 212, 0.36) 0 17%, transparent 18%),
    linear-gradient(180deg, #b9b4a6, #6e6a60);
  border: 3px solid rgba(255, 247, 212, 0.22);
  border-radius: 34% 42% 38% 36% / 32% 36% 42% 38%;
  box-shadow: inset 0 -14px 20px rgba(36, 31, 26, 0.22), 0 14px 22px rgba(28, 26, 22, 0.26);
  color: #26231e;
  display: grid;
  min-height: 144px;
  padding: 14px;
  place-items: center;
  text-align: center;
}

.mystery-range span {
  color: rgba(36, 31, 26, 0.72);
}

.mystery-range strong {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 4.4vw, 4rem);
  line-height: 0.86;
}

.mystery-main-panel {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 230px;
  min-height: 0;
}

.mystery-center-panel {
  display: grid;
  gap: 12px;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.mystery-clue-panel,
.mystery-grid-panel,
.mystery-status {
  color: #fff7df;
  padding: 14px;
}

.mystery-clue-panel__title,
.mystery-grid-panel__title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.mystery-clue-panel__title strong,
.mystery-grid-panel__title strong {
  color: #fff2c8;
  font-size: 0.82rem;
}

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

.mystery-clue {
  background: rgba(248, 236, 211, 0.13);
  border: 1px solid rgba(248, 236, 211, 0.24);
  border-radius: 7px;
  color: #fff7df;
  cursor: pointer;
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 9px;
  text-align: left;
}

.mystery-clue:disabled {
  cursor: default;
}

.mystery-clue span {
  color: rgba(255, 248, 228, 0.64);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mystery-clue strong {
  font-size: 0.9rem;
  line-height: 1.1;
}

.mystery-clue.is-applied {
  background: linear-gradient(180deg, #d9ab4d, #8a621f);
  border-color: rgba(255, 247, 212, 0.72);
  color: #241f1a;
}

.mystery-clue.is-applied span {
  color: rgba(36, 31, 26, 0.68);
}

.mystery-grid-panel {
  min-height: 0;
}

.mystery-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  max-height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}

.mystery-candidate {
  background: linear-gradient(180deg, #ede1c6, #b6ab93);
  border: 2px solid rgba(36, 31, 26, 0.22);
  border-radius: 7px;
  box-shadow: 0 7px 10px rgba(27, 25, 22, 0.22);
  color: var(--mystery-ink);
  cursor: pointer;
  display: grid;
  min-height: 44px;
  padding: 6px;
  place-items: center;
  transition: transform 140ms ease, background 180ms ease, opacity 180ms ease;
}

.mystery-candidate:hover:not(:disabled) {
  transform: translateY(-2px);
}

.mystery-candidate:disabled {
  cursor: default;
}

.mystery-candidate strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1;
}

.mystery-candidate.is-eliminated {
  background:
    linear-gradient(140deg, transparent 0 48%, rgba(110, 45, 31, 0.72) 49% 51%, transparent 52%),
    linear-gradient(180deg, #777065, #4d493f);
  color: rgba(255, 248, 228, 0.52);
  opacity: 0.58;
}

.mystery-candidate.is-selected {
  background: linear-gradient(180deg, #f3d77f, #b9872c);
  border-color: rgba(255, 247, 212, 0.72);
  box-shadow: 0 8px 12px rgba(27, 25, 22, 0.24), 0 0 16px rgba(217, 171, 77, 0.36);
}

.mystery-side-panel {
  display: grid;
  gap: 12px;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
}

.mystery-status strong {
  color: #ffe29b;
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.04rem, 1.45vw, 1.32rem);
  line-height: 1.06;
  margin: 7px 0;
  overflow-wrap: anywhere;
}

.mystery-status p,
.mystery-status em {
  color: rgba(255, 248, 228, 0.78);
  display: block;
  font-size: 0.82rem;
  line-height: 1.3;
  margin: 0;
}

.mystery-status em {
  color: #ffe29b;
  font-style: normal;
  font-weight: 900;
  margin-top: 8px;
}

.mystery-lock-panel {
  display: grid;
}

.mystery-lock {
  background: linear-gradient(180deg, #69645b, #33302b);
  border: 2px solid rgba(248, 236, 211, 0.28);
  border-radius: 8px;
  color: rgba(255, 248, 228, 0.7);
  cursor: default;
  display: grid;
  gap: 6px;
  min-height: 102px;
  padding: 10px;
  place-items: center;
  text-align: center;
}

.mystery-lock.is-ready {
  background: linear-gradient(180deg, #e4bc59, #785b22);
  border-color: rgba(255, 247, 212, 0.76);
  box-shadow: 0 0 20px rgba(217, 171, 77, 0.38);
  color: #241e18;
  cursor: pointer;
}

.mystery-lock span {
  background:
    linear-gradient(135deg, transparent 0 42%, currentColor 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 0 42%, currentColor 43% 57%, transparent 58%);
  border: 2px solid currentColor;
  border-radius: 7px;
  height: 40px;
  opacity: 0.72;
  width: 40px;
}

.mystery-lock strong {
  font-family: var(--font-display);
  font-size: 1rem;
}

.mystery-veth {
  align-self: end;
  color: #fff7df;
  min-height: 260px;
  position: relative;
}

.mystery-veth__head {
  background: #bd815c;
  border-radius: 42% 42% 48% 48%;
  height: 50px;
  left: 50%;
  position: absolute;
  top: 38px;
  transform: translateX(-50%);
  width: 44px;
  z-index: 3;
}

.mystery-veth__head span {
  background: #3d3027;
  border-radius: 12px 12px 5px 5px;
  height: 16px;
  left: -2px;
  position: absolute;
  right: -2px;
  top: -4px;
}

.mystery-veth__body {
  background: linear-gradient(180deg, #65518f, #352b52);
  border-radius: 24px 24px 10px 10px;
  height: 110px;
  left: 50%;
  position: absolute;
  top: 84px;
  transform: translateX(-50%);
  width: 68px;
  z-index: 2;
}

.mystery-veth__arm {
  background: rgba(255, 235, 198, 0.86);
  border-radius: 999px;
  height: 9px;
  position: absolute;
  top: 118px;
  width: 58px;
  z-index: 3;
}

.mystery-veth__arm--left {
  left: 44px;
  transform: rotate(-26deg);
}

.mystery-veth__arm--right {
  right: 44px;
  transform: rotate(28deg);
}

.mystery-veth__block {
  background: linear-gradient(180deg, #d9ab4d, #7b5c34);
  border-radius: 7px;
  height: 46px;
  left: 20px;
  position: absolute;
  top: 90px;
  transform: rotate(-12deg);
  width: 52px;
  z-index: 4;
}

.mystery-veth__bubble {
  background: rgba(255, 248, 228, 0.96);
  border: 1px solid rgba(217, 171, 77, 0.32);
  border-radius: 8px;
  box-shadow: 0 14px 26px rgba(26, 23, 20, 0.26);
  color: var(--mystery-ink);
  font-weight: 800;
  line-height: 1.25;
  padding: 12px 14px;
  position: absolute;
  right: 0;
  top: 0;
  width: min(230px, 100%);
  z-index: 5;
}

.mystery-why {
  background: rgba(255, 248, 228, 0.13);
  border: 1px solid rgba(255, 248, 228, 0.18);
  border-radius: 8px;
  margin: 10px 0;
  padding: 10px 12px;
}

.mystery-why p {
  color: #fff7df;
  line-height: 1.32;
  margin: 3px 0 0;
}

.mystery-celebration {
  background: rgba(36, 31, 26, 0.92);
  border: 1px solid rgba(217, 171, 77, 0.42);
  border-radius: 8px;
  bottom: 22px;
  box-shadow: 0 18px 34px rgba(26, 23, 20, 0.38);
  color: #fff7df;
  left: 50%;
  max-width: min(720px, 78%);
  padding: 14px 18px;
  position: absolute;
  text-align: center;
  transform: translateX(-50%);
  z-index: 14;
}

.mystery-celebration > strong {
  color: #ffe29b;
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.7vw, 1.45rem);
  line-height: 1.05;
}

.mystery-celebration > span {
  color: rgba(255, 248, 228, 0.78);
  display: block;
  font-size: 0.82rem;
  font-weight: 900;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.mystery-reward {
  display: grid;
  inset: 0;
  padding: 26px;
  place-items: center;
  position: absolute;
  z-index: 10;
}

.mystery-reward__card {
  background: linear-gradient(180deg, rgba(36, 31, 26, 0.94), rgba(52, 47, 39, 0.94));
  border: 1px solid rgba(217, 171, 77, 0.42);
  border-radius: 8px;
  box-shadow: 0 24px 50px rgba(26, 23, 20, 0.4);
  color: #fff7df;
  display: grid;
  gap: 16px;
  max-height: 100%;
  max-width: 900px;
  overflow-y: auto;
  padding: 24px;
  text-align: center;
  width: min(900px, 100%);
}

.mystery-reward__copy span {
  color: rgba(255, 248, 228, 0.7);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mystery-reward__copy h2 {
  color: #ffe29b;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.96;
  margin: 4px 0 6px;
}

.mystery-reward__copy p {
  margin: 0;
}

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

.mystery-reward__blocks .mystery-snapshot {
  min-height: 90px;
}

.mystery-reward__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.mystery-reward__badges span {
  background: rgba(255, 248, 228, 0.12);
  border: 1px solid rgba(255, 248, 228, 0.18);
  border-radius: 999px;
  color: #fff2c8;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 8px 11px;
}

.mystery-reward__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.mystery-reward .reward-stars {
  color: rgba(255, 255, 255, 0.28);
  font-size: 1.8rem;
}

.mystery-reward .reward-stars span.is-filled {
  color: var(--mystery-gold);
}

@keyframes mysteryBlockArrive {
  from {
    opacity: 0;
    transform: translateY(10px) rotate(-4deg) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@media (max-width: 980px) {
  .mystery-room__scene {
    height: auto;
    min-height: 1020px;
    overflow-y: auto;
  }

  .mystery-workbench {
    grid-template-columns: 1fr;
    position: relative;
    inset: auto;
    margin: 250px 20px 30px;
  }

  .mystery-main-panel {
    grid-template-columns: 1fr;
  }

  .mystery-veth {
    display: none;
  }
}

@media (max-width: 720px) {
  .mystery-shelf__rail,
  .mystery-reward__blocks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mystery-steps {
    flex-direction: column;
    top: 24%;
  }

  .mystery-clues,
  .mystery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mystery-room__prompt {
    max-width: calc(100% - 28px);
  }
}
