/* Probability L7: Draw Cabinet */

.drawbag-page {
  --drawbag-canvas: #f4dfc2;
  --drawbag-brass: #c9a35c;
  --drawbag-violet: #5b2a86;
  --drawbag-plum: #2a162d;
  --drawbag-blue: #274d66;
  --drawbag-teal: #5fb6b8;
  --drawbag-amber: #e9a879;
  --drawbag-wood: #7b4b2a;
  --drawbag-ink: #21191c;
  color: var(--drawbag-ink);
}

.drawbag-topbar {
  border-color: rgba(201, 163, 92, 0.32);
}

.drawbag-progressbar {
  background: rgba(244, 223, 194, 0.74);
  border: 1px solid rgba(91, 42, 134, 0.22);
  border-radius: 999px;
  height: 8px;
  margin: 0 auto 10px;
  max-width: 1180px;
  overflow: hidden;
}

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

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

.drawbag-progress__dot {
  background: rgba(42, 22, 45, 0.5);
  border: 1px solid rgba(244, 223, 194, 0.7);
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.drawbag-progress__dot.is-current {
  background: var(--drawbag-canvas);
  box-shadow: 0 0 0 3px rgba(201, 163, 92, 0.22);
}

.drawbag-progress__dot.is-filled {
  background: var(--drawbag-brass);
  box-shadow: 0 0 12px rgba(201, 163, 92, 0.44);
}

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

.drawbag-room__scene {
  background:
    radial-gradient(circle at 18% 72%, rgba(201, 163, 92, 0.2), transparent 20%),
    radial-gradient(circle at 80% 28%, rgba(95, 182, 184, 0.16), transparent 25%),
    linear-gradient(180deg, rgba(244, 223, 194, 0.08), rgba(42, 22, 45, 0.3)),
    linear-gradient(115deg, rgba(39, 77, 102, 0.42), transparent 44%),
    url("../img/arena-probability.jpg") center center / cover no-repeat;
  border: 1px solid rgba(244, 223, 194, 0.24);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(20, 12, 26, 0.38);
  height: min(740px, calc(100vh - 130px));
  min-height: 680px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.drawbag-room__scene::before {
  background:
    repeating-linear-gradient(90deg, rgba(244, 223, 194, 0.06) 0 18px, rgba(91, 42, 134, 0.1) 18px 36px),
    linear-gradient(180deg, rgba(0, 0, 0, 0.16), transparent 44%);
  content: "";
  height: 150px;
  inset: 0 0 auto;
  position: absolute;
  z-index: 1;
}

.drawbag-room__scene::after {
  background:
    repeating-linear-gradient(90deg, rgba(20, 12, 26, 0.14) 0 4px, transparent 4px 38px),
    linear-gradient(180deg, #5a3c32, #24191d);
  border-top: 1px solid rgba(244, 223, 194, 0.18);
  bottom: -58px;
  box-shadow: 0 -20px 45px rgba(20, 12, 26, 0.34);
  content: "";
  height: 210px;
  left: -3%;
  position: absolute;
  right: -3%;
  transform: skewY(-2deg);
  z-index: -1;
}

.drawbag-room__drawers {
  display: flex;
  gap: 16px;
  left: 6%;
  position: absolute;
  top: 28px;
  z-index: 2;
}

.drawbag-room__drawers span {
  background:
    radial-gradient(circle at 50% 52%, rgba(244, 223, 194, 0.72) 0 12%, transparent 13%),
    linear-gradient(180deg, #8b5a38, #4d2e24);
  border: 1px solid rgba(244, 223, 194, 0.24);
  border-radius: 6px;
  box-shadow: 0 0 20px rgba(20, 12, 26, 0.22);
  height: 58px;
  width: 72px;
}

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

.drawbag-room__lamps span {
  background: radial-gradient(circle, #fff1c8 0 34%, var(--drawbag-brass) 35% 58%, rgba(201, 163, 92, 0.08) 59%);
  border-radius: 50%;
  bottom: 0;
  box-shadow: 0 0 42px rgba(201, 163, 92, 0.48);
  height: 54px;
  position: absolute;
  width: 54px;
}

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

.drawbag-room__prompt {
  left: 50%;
  max-width: min(780px, 68%);
  position: absolute;
  text-align: center;
  text-shadow: 0 3px 10px rgba(22, 12, 28, 0.65);
  top: 3%;
  transform: translateX(-50%);
  z-index: 5;
}

.drawbag-room__prompt span,
.drawbag-shelf__title span,
.drawbag-problem-card > span,
.drawbag-bag > span,
.draw-card__title span,
.draw-product__title span,
.drawbag-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;
}

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

.drawbag-shelf {
  background: linear-gradient(180deg, rgba(42, 22, 45, 0.93), rgba(28, 17, 34, 0.9));
  border: 2px solid rgba(244, 223, 194, 0.3);
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(20, 12, 26, 0.32);
  left: 4%;
  padding: 9px 12px;
  position: absolute;
  right: 4%;
  top: 13%;
  z-index: 4;
}

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

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

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

.drawbag-shelf__slot {
  background: rgba(244, 223, 194, 0.08);
  border: 1px dashed rgba(244, 223, 194, 0.28);
  border-radius: 6px;
  display: grid;
  min-height: 74px;
  padding: 6px;
  place-items: center;
}

.drawbag-shelf__slot.is-current {
  border-color: rgba(201, 163, 92, 0.62);
}

.drawbag-shelf__slot.is-filled {
  animation: drawbagArrive 420ms ease both;
  background: rgba(244, 223, 194, 0.16);
  border-style: solid;
}

.drawbag-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, #efe0c5, #c9a35c);
  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(20, 12, 26, 0.22);
  color: var(--drawbag-ink);
  display: grid;
  gap: 2px;
  min-height: 56px;
  min-width: 0;
  padding: 7px;
  text-align: center;
  width: 100%;
}

.drawbag-shelf__slot:not(.is-filled) .drawbag-snapshot {
  background: rgba(244, 223, 194, 0.08);
  box-shadow: none;
  color: rgba(255, 242, 212, 0.5);
}

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

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

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

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

.drawbag-step {
  background: rgba(36, 24, 40, 0.72);
  border: 1px solid rgba(244, 223, 194, 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;
}

.drawbag-step--active {
  background: rgba(201, 163, 92, 0.22);
  border-color: rgba(201, 163, 92, 0.52);
  color: #fff7df;
}

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

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

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

.drawbag-problem-card,
.drawbag-main-panel,
.drawbag-veth {
  background: rgba(36, 24, 40, 0.84);
  border: 1px solid rgba(244, 223, 194, 0.28);
  border-radius: 8px;
  box-shadow: 0 16px 28px rgba(20, 12, 26, 0.28);
}

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

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

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

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

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

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

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

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

.drawbag-bag {
  background: rgba(255, 247, 223, 0.94);
  border: 2px solid rgba(123, 75, 42, 0.3);
  border-radius: 8px;
  color: var(--drawbag-ink);
  min-height: 142px;
  padding: 10px;
  position: relative;
}

.drawbag-bag > span {
  color: rgba(36, 27, 24, 0.58);
}

.drawbag-bag__mouth {
  background: linear-gradient(180deg, #8b5a38, #4d2e24);
  border-radius: 50% 50% 8px 8px;
  height: 76px;
  left: 18px;
  position: absolute;
  top: 44px;
  width: 98px;
}

.drawbag-bag__marbles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: 128px;
  min-height: 64px;
  padding-top: 8px;
}

.drawbag-marble {
  border: 2px solid rgba(36, 27, 24, 0.18);
  border-radius: 50%;
  box-shadow: 0 3px 6px rgba(20, 12, 26, 0.18);
  display: block;
  height: 26px;
  width: 26px;
}

.drawbag-marble--red { background: #b9452b; }
.drawbag-marble--blue { background: #2f6caa; }
.drawbag-marble--gold { background: #d0a84b; }
.drawbag-marble--silver { background: #d9dde4; }

.drawbag-bag p,
.drawbag-bag em {
  display: block;
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 900;
  margin: 8px 0 0 128px;
}

.drawbag-bag em {
  color: var(--drawbag-violet);
}

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

.draw-card,
.draw-product,
.drawbag-lock-panel {
  background: rgba(255, 247, 223, 0.94);
  border: 2px solid rgba(123, 75, 42, 0.3);
  border-radius: 8px;
  color: var(--drawbag-ink);
  padding: 9px;
}

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

.draw-card__title,
.draw-product__title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
}

.draw-card__title span,
.draw-product__title span {
  color: rgba(36, 27, 24, 0.58);
}

.draw-card__title strong,
.draw-product__title strong {
  font-family: var(--font-display);
  font-size: 1rem;
}

.draw-card__blank,
.draw-product__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: 104px;
  text-align: center;
}

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

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

.drawbag-mini-counter {
  align-items: center;
  display: grid;
  gap: 5px;
  grid-template-columns: 30px 42px 30px;
}

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

.drawbag-mini-counter button {
  background: rgba(42, 22, 45, 0.9);
  color: #fff7df;
  min-height: 28px;
}

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

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

.drawbag-final-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) 150px;
}

.draw-product.is-open {
  border-color: rgba(201, 163, 92, 0.52);
}

.draw-product__unreduced {
  color: var(--drawbag-violet);
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 8px;
  text-align: center;
}

.drawbag-lock-panel {
  display: grid;
  padding: 9px;
}

.drawbag-lock {
  background: linear-gradient(180deg, var(--drawbag-brass), #9f743a);
  color: #25160f;
  min-height: 100%;
  padding: 9px;
}

.drawbag-lock span {
  background: rgba(255, 247, 223, 0.58);
  border-radius: 50%;
  display: block;
  height: 18px;
  margin: 0 auto 5px;
  width: 18px;
}

.drawbag-veth {
  min-height: 300px;
  overflow: visible;
  position: relative;
}

.drawbag-veth__cabinet {
  background: linear-gradient(180deg, #6d452f, #2e1c18);
  border-radius: 24px 24px 6px 6px;
  bottom: 36px;
  height: 154px;
  left: 38px;
  position: absolute;
  width: 100px;
}

.drawbag-veth__cabinet::before,
.drawbag-veth__cabinet::after {
  background: rgba(244, 223, 194, 0.24);
  border-radius: 4px;
  content: "";
  height: 32px;
  left: 18px;
  position: absolute;
  right: 18px;
}

.drawbag-veth__cabinet::before { top: 28px; }
.drawbag-veth__cabinet::after { top: 76px; }

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

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

.drawbag-veth__body {
  background: linear-gradient(180deg, #51316f, #26182d);
  border-radius: 34px 34px 12px 12px;
  height: 124px;
  left: 52px;
  position: absolute;
  top: 120px;
  width: 72px;
}

.drawbag-veth__arm {
  background: #43265d;
  border-radius: 999px;
  height: 16px;
  position: absolute;
  top: 158px;
  width: 68px;
}

.drawbag-veth__arm--left {
  left: 24px;
  transform: rotate(-18deg);
}

.drawbag-veth__arm--right {
  right: 24px;
  transform: rotate(18deg);
}

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

.drawbag-celebration {
  background: rgba(36, 24, 40, 0.94);
  border: 2px solid rgba(201, 163, 92, 0.72);
  border-radius: 8px;
  bottom: 20px;
  box-shadow: 0 18px 35px rgba(20, 12, 26, 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;
}

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

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

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

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

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

.drawbag-reward__card {
  background: rgba(36, 24, 40, 0.94);
  border: 2px solid rgba(201, 163, 92, 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%);
}

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

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

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

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

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

.drawbag-reward__badges span {
  background: rgba(244, 223, 194, 0.1);
  border: 1px solid rgba(244, 223, 194, 0.2);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 7px 10px;
}

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

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

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

  .drawbag-room__scene::before,
  .drawbag-room__scene::after,
  .drawbag-room__drawers,
  .drawbag-room__lamps {
    display: none;
  }

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

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

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

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

  .drawbag-steps,
  .drawbag-workbench,
  .drawbag-draw-row,
  .drawbag-final-row {
    grid-template-columns: 1fr;
  }

  .drawbag-veth {
    min-height: 240px;
  }
}
