/* Probability L5: Double Device Room */

.twindevice-page {
  --twindevice-peach: #e9a879;
  --twindevice-canvas: #f7dec1;
  --twindevice-brass: #d0a84b;
  --twindevice-magenta: #a8328b;
  --twindevice-teal: #5fb6b8;
  --twindevice-ink: #241b18;
  --twindevice-plum: #442143;
  --twindevice-wood: #7b4b2a;
  color: var(--twindevice-ink);
}

.twindevice-topbar {
  border-color: rgba(208, 168, 75, 0.32);
}

.twindevice-progressbar {
  background: rgba(247, 222, 193, 0.74);
  border: 1px solid rgba(168, 50, 139, 0.18);
  border-radius: 999px;
  height: 8px;
  margin: 0 auto 10px;
  max-width: 1180px;
  overflow: hidden;
}

.twindevice-progressbar span {
  background: linear-gradient(90deg, var(--twindevice-peach), var(--twindevice-magenta), var(--twindevice-brass));
  display: block;
  height: 100%;
  transition: width 320ms ease;
}

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

.twindevice-progress__dot {
  background: rgba(68, 33, 67, 0.42);
  border: 1px solid rgba(247, 222, 193, 0.7);
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.twindevice-progress__dot.is-current {
  background: var(--twindevice-canvas);
  box-shadow: 0 0 0 3px rgba(208, 168, 75, 0.22);
}

.twindevice-progress__dot.is-filled {
  background: var(--twindevice-brass);
  box-shadow: 0 0 12px rgba(208, 168, 75, 0.44);
}

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

.twindevice-room__scene {
  background:
    radial-gradient(circle at 28% 20%, rgba(208, 168, 75, 0.28), transparent 22%),
    radial-gradient(circle at 78% 26%, rgba(95, 182, 184, 0.24), transparent 24%),
    linear-gradient(180deg, rgba(255, 238, 204, 0.12), rgba(67, 28, 45, 0.18)),
    linear-gradient(115deg, rgba(168, 50, 139, 0.4), transparent 43%),
    url("../img/arena-probability.jpg") center center / cover no-repeat;
  border: 1px solid rgba(247, 222, 193, 0.28);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(44, 22, 44, 0.34);
  height: min(740px, calc(100vh - 130px));
  min-height: 680px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.twindevice-room__scene::before {
  background:
    repeating-linear-gradient(90deg, rgba(247, 222, 193, 0.08) 0 18px, rgba(168, 50, 139, 0.08) 18px 36px),
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), transparent 46%);
  content: "";
  height: 150px;
  inset: 0 0 auto;
  opacity: 0.9;
  position: absolute;
  z-index: 1;
}

.twindevice-room__scene::after {
  background:
    repeating-linear-gradient(90deg, rgba(36, 24, 25, 0.13) 0 4px, transparent 4px 38px),
    linear-gradient(180deg, #986039, #58311f);
  border-top: 1px solid rgba(255, 239, 202, 0.2);
  bottom: -58px;
  box-shadow: 0 -20px 45px rgba(54, 30, 27, 0.34);
  content: "";
  height: 210px;
  left: -3%;
  position: absolute;
  right: -3%;
  transform: skewY(-2deg);
  z-index: -1;
}

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

.twindevice-room__switches span {
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 247, 223, 0.9), transparent 18%),
    linear-gradient(180deg, var(--twindevice-brass), #8e5d28);
  border: 1px solid rgba(255, 245, 218, 0.3);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(208, 168, 75, 0.32);
  height: 66px;
  width: 48px;
}

.twindevice-room__cables {
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 1;
}

.twindevice-room__cables span {
  background: rgba(36, 24, 40, 0.42);
  border-radius: 999px;
  height: 5px;
  left: 18%;
  position: absolute;
  right: 18%;
  top: 286px;
}

.twindevice-room__cables span:nth-child(2) {
  left: 28%;
  right: 28%;
  top: 332px;
}

.twindevice-room__cables span:nth-child(3) {
  left: 37%;
  right: 37%;
  top: 378px;
}

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

.twindevice-room__prompt span,
.twindevice-shelf__title span,
.twindevice-problem-card > span,
.event-card__title span,
.event-card__counter > span,
.joint-panel__title span,
.twindevice-why span {
  color: rgba(255, 248, 226, 0.84);
  display: block;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.twindevice-shelf {
  background: linear-gradient(180deg, rgba(68, 33, 67, 0.9), rgba(48, 27, 48, 0.88));
  border: 2px solid rgba(247, 222, 193, 0.32);
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(48, 24, 48, 0.28);
  left: 4%;
  padding: 9px 12px;
  position: absolute;
  right: 4%;
  top: 13%;
  z-index: 4;
}

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

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

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

.twindevice-shelf__slot {
  background: rgba(247, 222, 193, 0.08);
  border: 1px dashed rgba(247, 222, 193, 0.28);
  border-radius: 6px;
  display: grid;
  min-height: 74px;
  padding: 6px;
  place-items: center;
}

.twindevice-shelf__slot.is-current {
  border-color: rgba(208, 168, 75, 0.62);
}

.twindevice-shelf__slot.is-filled {
  animation: twinDeviceArrive 420ms ease both;
  background: rgba(247, 222, 193, 0.16);
  border-style: solid;
}

.twindevice-snapshot {
  background:
    linear-gradient(90deg, rgba(36, 27, 24, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(36, 27, 24, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #fff1cf, #e8bd78);
  background-size: 18px 18px, 18px 18px, auto;
  border: 1px solid rgba(87, 51, 28, 0.28);
  border-radius: 6px;
  box-shadow: 0 8px 14px rgba(28, 16, 20, 0.22);
  color: var(--twindevice-ink);
  display: grid;
  gap: 2px;
  min-height: 56px;
  min-width: 0;
  padding: 7px;
  text-align: center;
  width: 100%;
}

.twindevice-shelf__slot:not(.is-filled) .twindevice-snapshot {
  background: rgba(247, 222, 193, 0.08);
  box-shadow: none;
  color: rgba(255, 242, 212, 0.5);
}

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

.twindevice-snapshot strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  line-height: 1;
}

.twindevice-snapshot em {
  font-size: 0.68rem;
  font-style: normal;
}

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

.twindevice-step {
  background: rgba(36, 24, 40, 0.72);
  border: 1px solid rgba(247, 222, 193, 0.2);
  border-radius: 999px;
  color: rgba(255, 247, 223, 0.74);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  padding: 8px 9px;
  text-align: center;
}

.twindevice-step--active {
  background: rgba(208, 168, 75, 0.22);
  border-color: rgba(208, 168, 75, 0.52);
  color: #fff7df;
}

.twindevice-step--complete {
  background: rgba(95, 182, 184, 0.24);
  border-color: rgba(95, 182, 184, 0.48);
  color: #ddfffb;
}

.twindevice-step--pending {
  opacity: 0.62;
}

.twindevice-workbench {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: 182px minmax(0, 1fr) 178px;
  left: 4%;
  position: absolute;
  right: 4%;
  top: 33%;
  z-index: 6;
}

.twindevice-problem-card,
.twindevice-main-panel,
.twindevice-pellan {
  background: rgba(36, 24, 40, 0.84);
  border: 1px solid rgba(247, 222, 193, 0.28);
  border-radius: 8px;
  box-shadow: 0 16px 28px rgba(34, 18, 34, 0.25);
}

.twindevice-problem-card {
  color: #fff5d8;
  padding: 14px;
}

.twindevice-problem-card h1 {
  font-family: var(--font-display);
  font-size: 1.24rem;
  line-height: 1.05;
  margin: 8px 0;
}

.twindevice-problem-card p {
  font-size: 0.88rem;
  line-height: 1.35;
  margin: 0 0 10px;
}

.twindevice-targets {
  display: grid;
  gap: 8px;
}

.twindevice-targets p {
  background: rgba(255, 247, 223, 0.1);
  border: 1px solid rgba(255, 247, 223, 0.16);
  border-radius: 6px;
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 8px;
}

.twindevice-targets span {
  color: rgba(255, 248, 226, 0.72);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.twindevice-targets strong {
  color: var(--twindevice-brass);
  font-size: 0.9rem;
}

.twindevice-main-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
}

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

.event-card {
  background: rgba(255, 247, 223, 0.94);
  border: 2px solid rgba(123, 75, 42, 0.3);
  border-radius: 8px;
  color: var(--twindevice-ink);
  display: grid;
  gap: 7px;
  min-height: 212px;
  padding: 9px;
}

.event-card.is-correct {
  border-color: rgba(95, 182, 184, 0.74);
  box-shadow: 0 0 0 3px rgba(95, 182, 184, 0.12);
}

.event-card__title {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.event-card__title span,
.event-card__counter > span,
.joint-panel__title span {
  color: rgba(36, 27, 24, 0.58);
}

.event-card__title strong,
.joint-panel__title strong {
  font-family: var(--font-display);
  font-size: 1rem;
}

.twindevice-device {
  margin: 0 auto;
}

.twindevice-device--coin {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.twindevice-device--coin span {
  align-items: center;
  background: radial-gradient(circle at 34% 26%, #fff7d4, var(--twindevice-brass));
  border: 2px solid rgba(87, 51, 28, 0.4);
  border-radius: 50%;
  color: #3a2318;
  display: flex;
  font-family: var(--font-display);
  font-size: 1.25rem;
  height: 58px;
  justify-content: center;
  width: 58px;
}

.twindevice-device--die {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(3, 38px);
  justify-content: center;
}

.twindevice-device--die span {
  align-items: center;
  background: #fff7df;
  border: 2px solid rgba(87, 51, 28, 0.28);
  border-radius: 8px;
  color: var(--twindevice-ink);
  display: flex;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.twindevice-device--spinner {
  align-items: center;
  background: var(--spinner-bg);
  border: 7px solid rgba(87, 51, 28, 0.88);
  border-radius: 50%;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.22), 0 10px 16px rgba(20, 12, 18, 0.2);
  display: flex;
  height: 106px;
  justify-content: center;
  position: relative;
  width: 106px;
}

.twindevice-device--spinner span {
  background: rgba(255, 247, 223, 0.9);
  border-radius: 50%;
  height: 28px;
  width: 28px;
  z-index: 2;
}

.twindevice-device--spinner i {
  background: #2a1b1a;
  clip-path: polygon(0 44%, 78% 0, 100% 50%, 78% 100%, 0 56%);
  height: 14px;
  position: absolute;
  right: 6px;
  top: 45px;
  width: 44px;
  z-index: 3;
}

.twindevice-device--spinner strong {
  background: rgba(36, 24, 40, 0.78);
  border-radius: 999px;
  bottom: -28px;
  color: #fff7df;
  font-size: 0.7rem;
  padding: 4px 8px;
  position: absolute;
  text-transform: uppercase;
}

.event-card__counter {
  display: grid;
  gap: 5px;
}

.twindevice-fraction-counter {
  align-items: center;
  display: grid;
  gap: 4px;
  justify-items: center;
}

.twindevice-fraction-counter > i {
  background: rgba(36, 27, 24, 0.5);
  display: block;
  height: 2px;
  width: 92px;
}

.twindevice-mini-counter {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 34px 44px 34px;
}

.twindevice-mini-counter button,
.twindevice-lock {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
}

.twindevice-mini-counter button {
  background: rgba(68, 33, 67, 0.9);
  color: #fff7df;
  min-height: 30px;
}

.twindevice-mini-counter button:disabled,
.twindevice-lock:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.twindevice-mini-counter strong {
  align-items: center;
  background: #fff7df;
  border: 1px solid rgba(87, 51, 28, 0.22);
  border-radius: 6px;
  color: var(--twindevice-plum);
  display: flex;
  font-family: var(--font-display);
  font-size: 1.1rem;
  height: 30px;
  justify-content: center;
}

.joint-panel {
  background: rgba(255, 247, 223, 0.94);
  border: 2px solid rgba(123, 75, 42, 0.3);
  border-radius: 8px;
  color: var(--twindevice-ink);
  min-height: 170px;
  padding: 9px;
}

.joint-panel.is-open {
  border-color: rgba(208, 168, 75, 0.52);
}

.joint-panel.is-correct {
  border-color: rgba(95, 182, 184, 0.74);
  box-shadow: 0 0 0 3px rgba(95, 182, 184, 0.12);
}

.joint-panel__title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.joint-panel__blank {
  align-items: center;
  background:
    linear-gradient(90deg, rgba(36, 27, 24, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(36, 27, 24, 0.08) 1px, transparent 1px),
    rgba(255, 255, 255, 0.32);
  background-size: 28px 28px;
  border: 1px dashed rgba(36, 27, 24, 0.22);
  border-radius: 6px;
  color: rgba(36, 27, 24, 0.56);
  display: flex;
  font-weight: 900;
  justify-content: center;
  min-height: 118px;
  text-align: center;
}

.overlap-grid {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(var(--overlap-cols), minmax(0, 1fr));
  margin-bottom: 8px;
}

.overlap-grid span {
  align-items: center;
  background: rgba(36, 27, 24, 0.08);
  border: 1px solid rgba(36, 27, 24, 0.12);
  border-radius: 4px;
  color: transparent;
  display: flex;
  font-size: 0.54rem;
  font-weight: 900;
  height: 21px;
  justify-content: center;
}

.overlap-grid span.is-overlap {
  background: linear-gradient(180deg, var(--twindevice-brass), #f0c96a);
  color: #3a2318;
}

.joint-panel__work {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 126px;
}

.joint-panel__work p {
  color: var(--twindevice-plum);
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0;
  text-align: center;
}

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

.twindevice-lock {
  background: linear-gradient(180deg, var(--twindevice-brass), #b98323);
  color: #25160f;
  min-height: 42px;
  padding: 9px 10px;
}

.twindevice-lock span {
  background: rgba(255, 247, 223, 0.58);
  border-radius: 50%;
  display: inline-block;
  height: 16px;
  margin-right: 7px;
  vertical-align: -3px;
  width: 16px;
}

.twindevice-pellan {
  min-height: 300px;
  overflow: visible;
  position: relative;
}

.twindevice-pellan__tools {
  bottom: 44px;
  display: flex;
  gap: 8px;
  left: 30px;
  position: absolute;
}

.twindevice-pellan__tools span {
  background: linear-gradient(180deg, var(--twindevice-brass), #7b4b2a);
  border-radius: 999px;
  height: 54px;
  width: 10px;
}

.twindevice-pellan__tools span:last-child {
  transform: rotate(32deg);
}

.twindevice-pellan__head {
  background: #5d3b2f;
  border-radius: 50% 50% 44% 44%;
  height: 54px;
  left: 61px;
  position: absolute;
  top: 70px;
  width: 54px;
}

.twindevice-pellan__head span {
  background: #f3dbc1;
  border-radius: 50%;
  display: block;
  height: 40px;
  left: 7px;
  position: absolute;
  top: 8px;
  width: 40px;
}

.twindevice-pellan__body {
  background: linear-gradient(180deg, #8a4f32, #43251b);
  border-radius: 34px 34px 12px 12px;
  height: 124px;
  left: 52px;
  position: absolute;
  top: 120px;
  width: 72px;
}

.twindevice-pellan__arm {
  background: #6d3e2a;
  border-radius: 999px;
  height: 16px;
  position: absolute;
  top: 158px;
  width: 68px;
}

.twindevice-pellan__arm--left {
  left: 24px;
  transform: rotate(-18deg);
}

.twindevice-pellan__arm--right {
  right: 24px;
  transform: rotate(18deg);
}

.twindevice-pellan__bubble {
  background: rgba(255, 247, 223, 0.96);
  border: 1px solid rgba(68, 33, 67, 0.18);
  border-radius: 8px;
  color: var(--twindevice-plum);
  font-size: 0.82rem;
  font-weight: 800;
  left: -22px;
  line-height: 1.25;
  padding: 9px 10px;
  position: absolute;
  right: -12px;
  top: 10px;
}

.twindevice-celebration {
  background: rgba(36, 24, 40, 0.94);
  border: 2px solid rgba(208, 168, 75, 0.72);
  border-radius: 8px;
  bottom: 20px;
  box-shadow: 0 18px 35px rgba(24, 18, 28, 0.38);
  color: #fff7df;
  left: 50%;
  max-width: 650px;
  padding: 14px;
  position: absolute;
  text-align: center;
  transform: translateX(-50%);
  width: min(650px, 86%);
  z-index: 10;
}

.twindevice-celebration strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.twindevice-celebration p {
  font-size: 0.9rem;
  margin: 6px 0 8px;
}

.twindevice-why span {
  color: rgba(255, 248, 226, 0.72);
}

.twindevice-celebration > span {
  display: block;
  font-size: 0.78rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.twindevice-reward {
  display: grid;
  inset: 0;
  overflow-y: auto;
  padding: 24px;
  place-items: center;
  position: absolute;
  z-index: 20;
}

.twindevice-reward__card {
  background: rgba(36, 24, 40, 0.94);
  border: 2px solid rgba(208, 168, 75, 0.72);
  border-radius: 8px;
  box-shadow: 0 24px 52px rgba(18, 12, 22, 0.46);
  color: #fff7df;
  display: grid;
  gap: 12px;
  max-width: 940px;
  padding: 20px;
  text-align: center;
  width: min(940px, 96%);
}

.twindevice-reward__copy span {
  color: rgba(255, 248, 226, 0.78);
  display: block;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.twindevice-reward__copy h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
  margin: 4px 0 6px;
}

.twindevice-reward__copy p {
  margin: 0 auto;
  max-width: 680px;
}

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

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

.twindevice-reward__badges span {
  background: rgba(247, 222, 193, 0.1);
  border: 1px solid rgba(247, 222, 193, 0.2);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 7px 10px;
}

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

@keyframes twinDeviceArrive {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

  .twindevice-room__scene::before,
  .twindevice-room__scene::after,
  .twindevice-room__switches,
  .twindevice-room__cables {
    display: none;
  }

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

  .twindevice-room__prompt,
  .twindevice-shelf,
  .twindevice-steps,
  .twindevice-workbench {
    margin-bottom: 12px;
  }

  .twindevice-room__prompt {
    max-width: none;
  }

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

  .twindevice-steps,
  .twindevice-workbench,
  .event-panel,
  .joint-panel__work {
    grid-template-columns: 1fr;
  }

  .twindevice-pellan {
    min-height: 240px;
  }
}
