/* Logic L8: Final Case */

.case-page {
  --case-ink: #26232d;
  --case-paper: #fff1d8;
  --case-copper: #ce705b;
  --case-violet: #493f73;
  --case-blue: #2d7889;
  --case-green: #62966a;
  --case-gold: #dfb84d;
  color: var(--case-ink);
}

.case-topbar {
  border-color: rgba(73, 63, 115, 0.28);
}

.case-progressbar {
  background: rgba(255, 241, 216, 0.78);
  border: 1px solid rgba(73, 63, 115, 0.18);
  border-radius: 999px;
  height: 8px;
  margin: 0 auto 10px;
  max-width: 1180px;
  overflow: hidden;
}

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

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

.case-progress__dot {
  background: rgba(38, 35, 45, 0.34);
  border: 1px solid rgba(255, 241, 216, 0.72);
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.case-progress__dot.is-current {
  background: var(--case-paper);
  box-shadow: 0 0 0 3px rgba(223, 184, 77, 0.24);
}

.case-progress__dot.is-filled {
  background: var(--case-gold);
  box-shadow: 0 0 12px rgba(223, 184, 77, 0.5);
}

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

.case-room__scene {
  background:
    radial-gradient(circle at 18% 18%, rgba(206, 112, 91, 0.32), transparent 25%),
    radial-gradient(circle at 82% 30%, rgba(45, 120, 137, 0.25), transparent 24%),
    linear-gradient(180deg, rgba(255, 241, 216, 0.2), rgba(73, 63, 115, 0.2)),
    url("../img/arena-logic-library.jpg") center center / cover no-repeat;
  border: 1px solid rgba(255, 241, 216, 0.34);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(38, 35, 45, 0.34);
  height: min(740px, calc(100vh - 130px));
  min-height: 680px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.case-room__scene::before {
  background:
    repeating-linear-gradient(90deg, rgba(255, 241, 216, 0.06) 0 1px, transparent 1px 72px),
    radial-gradient(ellipse at 50% 78%, rgba(223, 184, 77, 0.18), transparent 46%),
    linear-gradient(180deg, rgba(20, 20, 20, 0.08), transparent 48%);
  content: "";
  inset: 0;
  position: absolute;
  z-index: 1;
}

.case-room__scene::after {
  background:
    repeating-linear-gradient(90deg, rgba(255, 241, 216, 0.08) 0 4px, transparent 4px 44px),
    linear-gradient(180deg, #655b78, #342f48);
  border-top: 1px solid rgba(255, 241, 216, 0.22);
  bottom: -58px;
  box-shadow: 0 -20px 45px rgba(38, 35, 45, 0.3);
  content: "";
  height: 210px;
  left: -3%;
  position: absolute;
  right: -3%;
  transform: skewY(-2deg);
  z-index: -1;
}

.case-room__files {
  display: flex;
  gap: 20px;
  left: 5%;
  opacity: 0.68;
  position: absolute;
  top: 28px;
  z-index: 2;
}

.case-room__files span {
  background:
    linear-gradient(135deg, transparent 0 16%, rgba(223, 184, 77, 0.38) 16% 26%, transparent 26%),
    repeating-linear-gradient(180deg, rgba(255, 241, 216, 0.18) 0 4px, transparent 4px 14px),
    linear-gradient(180deg, rgba(255, 241, 216, 0.42), rgba(73, 63, 115, 0.24));
  border: 1px solid rgba(255, 241, 216, 0.28);
  border-radius: 6px;
  height: 90px;
  width: 50px;
}

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

.case-room__lamps span {
  background: radial-gradient(circle, #fff8cf 0 35%, var(--case-gold) 36% 58%, rgba(223, 184, 77, 0.08) 59%);
  border-radius: 50%;
  bottom: 0;
  box-shadow: 0 0 42px rgba(223, 184, 77, 0.52);
  height: 54px;
  position: absolute;
  width: 54px;
}

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

.case-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;
}

.case-room__prompt span,
.case-shelf__title span,
.case-panel__title span,
.case-why span,
.case-reward__copy span {
  color: rgba(255, 241, 216, 0.86);
  display: block;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.case-shelf {
  background: linear-gradient(180deg, rgba(38, 35, 45, 0.92), rgba(73, 63, 115, 0.88));
  border: 2px solid rgba(255, 241, 216, 0.32);
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(28, 24, 30, 0.28);
  left: 4%;
  padding: 9px 12px;
  position: absolute;
  right: 4%;
  top: 13%;
  z-index: 4;
}

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

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

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

.case-shelf__slot {
  background: rgba(255, 241, 216, 0.08);
  border: 1px dashed rgba(255, 241, 216, 0.3);
  border-radius: 6px;
  display: grid;
  min-height: 74px;
  padding: 6px;
  place-items: center;
}

.case-shelf__slot.is-current {
  border-color: rgba(223, 184, 77, 0.68);
}

.case-shelf__slot.is-filled {
  background: rgba(223, 184, 77, 0.13);
  border-style: solid;
}

.case-token {
  align-items: center;
  background: linear-gradient(180deg, rgba(255, 241, 216, 0.94), rgba(240, 213, 162, 0.92));
  border: 2px solid rgba(73, 63, 115, 0.22);
  border-radius: 6px;
  box-shadow: inset 0 -8px 16px rgba(73, 63, 115, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  min-height: 58px;
  text-align: center;
  width: 100%;
}

.case-token span {
  color: rgba(38, 35, 45, 0.66);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.case-token strong {
  color: var(--case-violet);
  font-family: var(--font-display);
  font-size: 1.24rem;
  line-height: 1;
}

.case-token.is-filled {
  background: linear-gradient(180deg, #fff3bd, #dfb84d);
  border-color: rgba(255, 248, 222, 0.62);
}

.case-steps {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  left: 4%;
  position: absolute;
  right: 4%;
  top: 26.5%;
  z-index: 5;
}

.case-step {
  background: rgba(38, 35, 45, 0.78);
  border: 1px solid rgba(255, 241, 216, 0.22);
  border-radius: 6px;
  color: rgba(255, 241, 216, 0.74);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  text-align: center;
}

.case-step--active {
  background: rgba(45, 120, 137, 0.82);
  color: #fff8df;
}

.case-step--complete {
  background: rgba(223, 184, 77, 0.9);
  color: #342944;
}

.case-workbench {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.04fr) minmax(360px, 1.06fr) minmax(180px, 0.48fr);
  inset: 33% 4% 5%;
  position: absolute;
  z-index: 5;
}

.case-evidence,
.case-final,
.case-guide {
  background: rgba(255, 241, 216, 0.94);
  border: 1px solid rgba(255, 250, 236, 0.76);
  border-radius: 8px;
  box-shadow: 0 18px 38px rgba(38, 35, 45, 0.26);
  min-height: 0;
}

.case-evidence,
.case-final {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.case-panel__title {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.case-panel__title span,
.case-why span,
.case-reward__copy span {
  color: var(--case-copper);
}

.case-panel__title strong {
  color: var(--case-violet);
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1.05;
  text-align: right;
}

.case-evidence p {
  background: linear-gradient(90deg, rgba(206, 112, 91, 0.12), rgba(45, 120, 137, 0.1));
  border: 1px solid rgba(206, 112, 91, 0.16);
  border-radius: 6px;
  color: var(--case-violet);
  font-weight: 900;
  line-height: 1.24;
  margin: 0;
  padding: 10px;
}

.case-evidence__facts {
  display: grid;
  gap: 7px;
}

.case-evidence__facts span {
  background: #fff8ec;
  border: 1px solid rgba(73, 63, 115, 0.12);
  border-radius: 7px;
  color: rgba(38, 35, 45, 0.72);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.18;
  padding: 8px 9px;
}

.case-choices {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.case-choice {
  background: #fff8ec;
  border: 1px solid rgba(73, 63, 115, 0.16);
  border-radius: 7px;
  color: var(--case-violet);
  cursor: pointer;
  font-weight: 900;
  min-height: 38px;
  padding: 8px 9px;
  text-align: left;
}

.case-choice.is-selected {
  background: linear-gradient(135deg, rgba(45, 120, 137, 0.94), rgba(73, 63, 115, 0.94));
  color: #fff8df;
}

.case-lock-step,
.case-lock-final {
  background: rgba(38, 35, 45, 0.34);
  border: 0;
  border-radius: 7px;
  color: rgba(255, 241, 216, 0.64);
  cursor: not-allowed;
  margin-top: auto;
  min-height: 46px;
  padding: 10px 12px;
}

.case-lock-step.is-ready,
.case-lock-final.is-ready {
  background: linear-gradient(135deg, var(--case-copper), var(--case-violet));
  box-shadow: 0 14px 26px rgba(206, 112, 91, 0.3);
  color: #fff8df;
  cursor: pointer;
}

.case-lock-step strong,
.case-lock-final strong {
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.case-final.is-locked {
  opacity: 0.82;
}

.case-final__locked {
  align-items: center;
  background: rgba(73, 63, 115, 0.1);
  border: 1px dashed rgba(73, 63, 115, 0.28);
  border-radius: 8px;
  color: rgba(38, 35, 45, 0.62);
  display: flex;
  flex: 1;
  font-weight: 900;
  justify-content: center;
  min-height: 220px;
  padding: 18px;
  text-align: center;
}

.case-clues {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0 2px 0 22px;
}

.case-clues li {
  background: #fff8ec;
  border: 1px solid rgba(73, 63, 115, 0.12);
  border-radius: 7px;
  color: rgba(38, 35, 45, 0.82);
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.2;
  padding: 7px 8px;
}

.case-candidates {
  display: grid;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.case-candidate {
  background: #fff8ec;
  border: 1px solid rgba(73, 63, 115, 0.14);
  border-radius: 7px;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 8px;
}

.case-candidate__copy strong {
  color: var(--case-violet);
  display: block;
  font-size: 0.88rem;
  line-height: 1.12;
}

.case-candidate__copy span {
  color: rgba(38, 35, 45, 0.62);
  display: block;
  font-size: 0.7rem;
  font-weight: 850;
  margin-top: 2px;
}

.case-candidate__actions {
  display: grid;
  gap: 5px;
  min-width: 86px;
}

.case-candidate__actions button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 900;
  min-height: 28px;
  padding: 5px 7px;
  text-transform: uppercase;
}

.case-candidate__actions button:first-child {
  background: rgba(38, 35, 45, 0.12);
  color: var(--case-violet);
}

.case-candidate__actions button:last-child {
  background: rgba(45, 120, 137, 0.16);
  color: var(--case-blue);
}

.case-candidate--eliminated {
  opacity: 0.56;
}

.case-candidate--eliminated .case-candidate__copy {
  text-decoration: line-through;
}

.case-candidate--chosen {
  background: linear-gradient(135deg, rgba(45, 120, 137, 0.94), rgba(73, 63, 115, 0.94));
  color: #fff8df;
}

.case-candidate--chosen .case-candidate__copy strong,
.case-candidate--chosen .case-candidate__copy span {
  color: #fff8df;
}

.case-candidate--chosen .case-candidate__actions button:last-child {
  background: var(--case-gold);
  color: #302713;
}

.case-status {
  align-items: center;
  background: rgba(73, 63, 115, 0.08);
  border: 1px solid rgba(73, 63, 115, 0.12);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 9px 11px;
}

.case-status strong {
  color: var(--case-violet);
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 1;
}

.case-status em {
  color: rgba(38, 35, 45, 0.64);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 900;
}

.case-guide {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 12px;
  position: relative;
}

.case-guide__folder {
  height: 52px;
  margin-bottom: 8px;
  position: relative;
  width: 92px;
}

.case-guide__folder span {
  background: linear-gradient(180deg, #f4d489, var(--case-gold));
  border-radius: 5px;
  box-shadow: inset 0 -10px 16px rgba(38, 35, 45, 0.12);
  height: 40px;
  left: 8px;
  position: absolute;
  top: 10px;
  width: 74px;
}

.case-guide__folder span::before {
  background: #f4d489;
  border-radius: 5px 5px 0 0;
  content: "";
  height: 12px;
  left: 0;
  position: absolute;
  top: -8px;
  width: 34px;
}

.case-guide__head {
  background: linear-gradient(180deg, #f1bf93, #a96d6b);
  border: 2px solid rgba(73, 63, 115, 0.16);
  border-radius: 50% 50% 42% 42%;
  height: 54px;
  position: relative;
  width: 54px;
}

.case-guide__head span {
  background: var(--case-violet);
  border-radius: 50%;
  box-shadow: 18px 0 0 var(--case-violet);
  height: 5px;
  left: 14px;
  position: absolute;
  top: 24px;
  width: 5px;
}

.case-guide__body {
  background: linear-gradient(180deg, var(--case-blue), #245467);
  border-radius: 22px 22px 6px 6px;
  height: 92px;
  margin-top: -2px;
  width: 74px;
}

.case-guide__bubble {
  background: var(--case-violet);
  border: 1px solid rgba(255, 241, 216, 0.22);
  border-radius: 8px;
  bottom: 12px;
  color: #fff8df;
  font-size: 0.82rem;
  font-weight: 800;
  left: 10px;
  line-height: 1.25;
  padding: 10px;
  position: absolute;
  right: 10px;
  text-align: center;
}

.case-celebration {
  align-items: center;
  background: rgba(38, 35, 45, 0.86);
  border: 1px solid rgba(255, 241, 216, 0.3);
  border-radius: 8px;
  bottom: 5%;
  box-shadow: 0 18px 42px rgba(38, 35, 45, 0.36);
  color: #fff8df;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(130px, 0.55fr) minmax(340px, 1fr) minmax(120px, 0.45fr) auto;
  left: 4%;
  padding: 12px;
  position: absolute;
  right: 4%;
  z-index: 8;
}

.case-celebration > strong {
  color: var(--case-gold);
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.12;
}

.case-celebration > span {
  color: rgba(255, 241, 216, 0.78);
  font-weight: 900;
}

.case-why {
  color: #fff8df;
}

.case-why p {
  font-size: 0.82rem;
  line-height: 1.22;
  margin: 2px 0 4px;
}

.case-why strong {
  color: var(--case-gold);
  display: block;
  font-size: 0.78rem;
  line-height: 1.2;
}

.case-reward {
  display: grid;
  inset: 4%;
  place-items: center;
  position: absolute;
  z-index: 7;
}

.case-reward__card {
  background: rgba(255, 241, 216, 0.96);
  border: 1px solid rgba(255, 250, 236, 0.72);
  border-radius: 8px;
  box-shadow: 0 22px 58px rgba(38, 35, 45, 0.36);
  display: grid;
  gap: 16px;
  max-height: 100%;
  max-width: 850px;
  overflow: auto;
  padding: 24px;
  text-align: center;
  width: min(850px, 100%);
}

.case-reward__copy h2 {
  color: var(--case-violet);
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.96;
  margin: 4px 0 8px;
}

.case-reward__copy p {
  color: rgba(38, 35, 45, 0.72);
  font-weight: 800;
  margin: 0 auto;
  max-width: 560px;
}

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

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

.case-reward__badges span {
  background: rgba(73, 63, 115, 0.12);
  border: 1px solid rgba(73, 63, 115, 0.16);
  border-radius: 999px;
  color: var(--case-violet);
  font-size: 0.78rem;
  font-weight: 900;
  padding: 7px 10px;
}

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

.case-room__scene--reward .case-room__files,
.case-room__scene--reward .case-room__lamps {
  opacity: 0.35;
}

@media (max-width: 900px) {
  .case-room__scene {
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 18px;
  }

  .case-room__prompt,
  .case-shelf,
  .case-steps,
  .case-workbench,
  .case-celebration,
  .case-reward {
    inset: auto;
    left: auto;
    position: relative;
    right: auto;
    top: auto;
    transform: none;
  }

  .case-room__prompt {
    max-width: none;
    margin-bottom: 12px;
  }

  .case-shelf,
  .case-steps,
  .case-workbench,
  .case-celebration {
    margin-bottom: 12px;
  }

  .case-shelf__rail,
  .case-reward__tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .case-steps,
  .case-workbench,
  .case-celebration,
  .case-candidate {
    grid-template-columns: 1fr;
  }

  .case-guide {
    min-height: 220px;
  }
}
