/* Logic L5: Gate Bench */

.gate-page {
  --gate-ink: #25222b;
  --gate-paper: #fff2d9;
  --gate-copper: #d2755f;
  --gate-violet: #443f72;
  --gate-blue: #2c778a;
  --gate-green: #609667;
  --gate-gold: #e1b84c;
  color: var(--gate-ink);
}

.gate-topbar {
  border-color: rgba(68, 63, 114, 0.28);
}

.gate-progressbar {
  background: rgba(255, 242, 217, 0.78);
  border: 1px solid rgba(68, 63, 114, 0.18);
  border-radius: 999px;
  height: 8px;
  margin: 0 auto 10px;
  max-width: 1180px;
  overflow: hidden;
}

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

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

.gate-progress__dot {
  background: rgba(37, 34, 43, 0.34);
  border: 1px solid rgba(255, 242, 217, 0.72);
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.gate-progress__dot.is-current {
  background: var(--gate-paper);
  box-shadow: 0 0 0 3px rgba(225, 184, 76, 0.24);
}

.gate-progress__dot.is-filled {
  background: var(--gate-gold);
  box-shadow: 0 0 12px rgba(225, 184, 76, 0.5);
}

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

.gate-room__scene {
  background:
    radial-gradient(circle at 18% 18%, rgba(210, 117, 95, 0.32), transparent 25%),
    radial-gradient(circle at 82% 30%, rgba(44, 119, 138, 0.25), transparent 24%),
    linear-gradient(180deg, rgba(255, 242, 217, 0.2), rgba(68, 63, 114, 0.2)),
    url("../img/arena-logic-library.jpg") center center / cover no-repeat;
  border: 1px solid rgba(255, 242, 217, 0.34);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(37, 34, 43, 0.34);
  height: min(740px, calc(100vh - 130px));
  min-height: 680px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

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

.gate-room__scene::after {
  background:
    repeating-linear-gradient(90deg, rgba(255, 242, 217, 0.08) 0 4px, transparent 4px 44px),
    linear-gradient(180deg, #625d78, #343047);
  border-top: 1px solid rgba(255, 242, 217, 0.22);
  bottom: -58px;
  box-shadow: 0 -20px 45px rgba(37, 34, 43, 0.3);
  content: "";
  height: 210px;
  left: -3%;
  position: absolute;
  right: -3%;
  transform: skewY(-2deg);
  z-index: -1;
}

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

.gate-room__wires span {
  background:
    linear-gradient(90deg, transparent 0 34%, rgba(225, 184, 76, 0.42) 34% 43%, transparent 43% 58%, rgba(44, 119, 138, 0.38) 58% 68%, transparent 68%),
    linear-gradient(180deg, rgba(255, 242, 217, 0.42), rgba(68, 63, 114, 0.24));
  border: 1px solid rgba(255, 242, 217, 0.28);
  border-radius: 8px;
  height: 90px;
  width: 50px;
}

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

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

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

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

.gate-room__prompt span,
.gate-shelf__title span,
.gate-card__title span,
.gate-truth-panel > span,
.gate-why span,
.gate-reward__copy span {
  color: rgba(255, 242, 217, 0.86);
  display: block;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.gate-room__prompt h1 {
  color: #fff8df;
  font-family: var(--font-display);
  font-size: clamp(1.28rem, 2.35vw, 2rem);
  line-height: 1.04;
  margin: 3px 0 0;
}

.gate-shelf {
  background: linear-gradient(180deg, rgba(37, 34, 43, 0.92), rgba(68, 63, 114, 0.88));
  border: 2px solid rgba(255, 242, 217, 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;
}

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

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

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

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

.gate-shelf__slot.is-current {
  border-color: rgba(225, 184, 76, 0.68);
}

.gate-shelf__slot.is-filled {
  background: rgba(225, 184, 76, 0.13);
  border-style: solid;
}

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

.gate-token span {
  color: rgba(37, 34, 43, 0.66);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

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

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

.gate-step {
  background: rgba(37, 34, 43, 0.78);
  border: 1px solid rgba(255, 242, 217, 0.22);
  border-radius: 6px;
  color: rgba(255, 242, 217, 0.74);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  text-align: center;
}

.gate-step--active {
  background: rgba(44, 119, 138, 0.82);
  color: #fff8df;
}

.gate-step--complete {
  background: rgba(225, 184, 76, 0.9);
  color: #302a42;
}

.gate-workbench {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.1fr) minmax(290px, 0.84fr) minmax(180px, 0.48fr);
  inset: 33% 4% 5%;
  position: absolute;
  z-index: 5;
}

.gate-card,
.gate-truth-panel,
.gate-guide {
  background: rgba(255, 242, 217, 0.94);
  border: 1px solid rgba(255, 250, 236, 0.76);
  border-radius: 8px;
  box-shadow: 0 18px 38px rgba(37, 34, 43, 0.26);
  min-height: 0;
}

.gate-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

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

.gate-card__title span,
.gate-truth-panel > span,
.gate-why span,
.gate-reward__copy span {
  color: var(--gate-copper);
}

.gate-card__title strong {
  color: var(--gate-violet);
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.gate-rule {
  background: linear-gradient(90deg, rgba(210, 117, 95, 0.12), rgba(44, 119, 138, 0.1));
  border: 1px solid rgba(210, 117, 95, 0.16);
  border-radius: 6px;
  padding: 10px;
}

.gate-rule span {
  background: var(--gate-violet);
  border-radius: 999px;
  color: #fff8df;
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 7px;
  padding: 5px 9px;
}

.gate-rule strong {
  color: var(--gate-violet);
  display: block;
  font-size: 1rem;
  line-height: 1.18;
}

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

.gate-switch {
  background: #fff8ec;
  border: 1px solid rgba(68, 63, 114, 0.16);
  border-radius: 8px;
  color: var(--gate-violet);
  cursor: pointer;
  display: grid;
  gap: 7px;
  min-height: 92px;
  padding: 12px;
  position: relative;
  text-align: center;
}

.gate-switch::after {
  background: rgba(37, 34, 43, 0.18);
  border-radius: 999px;
  content: "";
  height: 12px;
  margin: 0 auto;
  width: 56px;
}

.gate-switch span {
  color: rgba(37, 34, 43, 0.64);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.gate-switch strong {
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.gate-switch.is-on {
  background: linear-gradient(135deg, rgba(44, 119, 138, 0.94), rgba(68, 63, 114, 0.94));
  color: #fff8df;
}

.gate-switch.is-on span {
  color: rgba(255, 248, 223, 0.74);
}

.gate-switch.is-on::after {
  background: var(--gate-gold);
  box-shadow: 0 0 18px rgba(225, 184, 76, 0.62);
}

.gate-lantern {
  align-items: center;
  background: rgba(37, 34, 43, 0.12);
  border: 1px solid rgba(68, 63, 114, 0.14);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: auto;
  min-height: 96px;
  padding: 12px;
}

.gate-lantern span {
  background: radial-gradient(circle, #ece1c8 0 30%, #9a8b78 31% 62%, rgba(37, 34, 43, 0.25) 63%);
  border-radius: 50%;
  height: 58px;
  width: 58px;
}

.gate-lantern strong {
  color: var(--gate-violet);
  font-family: var(--font-display);
  font-size: 1.38rem;
}

.gate-lantern.is-lit span {
  background: radial-gradient(circle, #fffbd4 0 30%, var(--gate-gold) 31% 62%, rgba(225, 184, 76, 0.18) 63%);
  box-shadow: 0 0 30px rgba(225, 184, 76, 0.65);
}

.gate-lantern.is-lit strong {
  color: #9b6d13;
}

.gate-lantern.is-dark span {
  background: radial-gradient(circle, #726a70 0 30%, #4a4550 31% 62%, rgba(37, 34, 43, 0.16) 63%);
}

.gate-truth-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.gate-settings {
  display: grid;
  gap: 8px;
}

.gate-setting {
  background: #fff8ec;
  border: 1px solid rgba(68, 63, 114, 0.16);
  border-radius: 7px;
  color: rgba(37, 34, 43, 0.78);
  cursor: pointer;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-height: 46px;
  padding: 9px;
  text-align: left;
}

.gate-setting span {
  font-weight: 900;
}

.gate-setting strong {
  color: rgba(37, 34, 43, 0.54);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.gate-setting.is-selected {
  background: linear-gradient(135deg, rgba(44, 119, 138, 0.94), rgba(68, 63, 114, 0.94));
  color: #fff8df;
}

.gate-setting.is-selected strong {
  color: var(--gate-gold);
}

.gate-current {
  background: rgba(68, 63, 114, 0.08);
  border: 1px solid rgba(68, 63, 114, 0.12);
  border-radius: 8px;
  padding: 14px;
}

.gate-current strong {
  color: var(--gate-violet);
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  line-height: 1.05;
  text-transform: uppercase;
}

.gate-current em {
  color: rgba(37, 34, 43, 0.62);
  display: block;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
  margin-top: 6px;
}

.gate-lock {
  background: rgba(37, 34, 43, 0.34);
  border: 0;
  border-radius: 7px;
  color: rgba(255, 242, 217, 0.64);
  cursor: not-allowed;
  margin-top: auto;
  min-height: 48px;
  padding: 10px 12px;
}

.gate-lock.is-ready {
  background: linear-gradient(135deg, var(--gate-copper), var(--gate-violet));
  box-shadow: 0 14px 26px rgba(210, 117, 95, 0.3);
  color: #fff8df;
  cursor: pointer;
}

.gate-lock strong {
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.gate-guide__wires {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  width: 92px;
}

.gate-guide__wires span {
  background: linear-gradient(90deg, var(--gate-blue), var(--gate-gold), var(--gate-violet));
  border-radius: 999px;
  height: 8px;
}

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

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

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

.gate-guide__bubble {
  background: var(--gate-violet);
  border: 1px solid rgba(255, 242, 217, 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;
}

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

.gate-celebration > strong {
  color: var(--gate-gold);
  font-family: var(--font-display);
  font-size: 1.18rem;
}

.gate-celebration > span {
  color: rgba(255, 242, 217, 0.78);
  font-weight: 900;
}

.gate-why {
  color: #fff8df;
}

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

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

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

.gate-reward__card {
  background: rgba(255, 242, 217, 0.96);
  border: 1px solid rgba(255, 250, 236, 0.72);
  border-radius: 8px;
  box-shadow: 0 22px 58px rgba(37, 34, 43, 0.36);
  display: grid;
  gap: 16px;
  max-height: 100%;
  max-width: 850px;
  overflow: auto;
  padding: 24px;
  text-align: center;
  width: min(850px, 100%);
}

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

.gate-reward__copy p {
  color: rgba(37, 34, 43, 0.72);
  font-weight: 800;
  margin: 0 auto;
  max-width: 560px;
}

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

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

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

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

.gate-room__scene--reward .gate-room__wires,
.gate-room__scene--reward .gate-room__lamps {
  opacity: 0.35;
}

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

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

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

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

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

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

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