.variant-game-page {
  --vg-blue: #315ed6;
  --vg-ink: #202a3b;
  --vg-muted: #718096;
  --vg-line: #dfe6f1;
  --vg-soft: #f6f8fc;
  --vg-green: #249b68;
  --vg-orange: #e89735;
  --vg-red: #d85f55;
}
.variant-game-page .topbar {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}
.variant-game-page .subject-detail {
  max-width: 1180px;
}
.variant-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(270px, 0.7fr);
  gap: 46px;
  align-items: center;
}
.variant-brief {
  border-left: 1px solid var(--vg-line);
  padding-left: 32px;
}
.variant-brief span {
  font-size: 12px;
  font-weight: 800;
  color: var(--vg-blue);
}
.variant-brief strong {
  display: block;
  margin: 7px 0 10px;
  color: var(--vg-ink);
  font-size: 20px;
  line-height: 1.5;
}
.variant-brief p {
  margin: 0;
  color: var(--vg-muted);
  line-height: 1.75;
}
.vg-shell {
  margin-top: 20px;
  border: 1px solid var(--vg-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(35, 58, 99, 0.07);
  overflow: hidden;
}
.vg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px;
  border-bottom: 1px solid var(--vg-line);
}
.vg-head h2 {
  margin: 4px 0 7px;
  color: var(--vg-ink);
  font-size: 24px;
  letter-spacing: 0;
}
.vg-head p {
  margin: 0;
  color: var(--vg-muted);
  line-height: 1.7;
}
.vg-kicker {
  font-size: 13px;
  color: var(--vg-blue);
  font-weight: 800;
}
.vg-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.vg-stat {
  min-width: 78px;
  padding: 8px 10px;
  border: 1px solid var(--vg-line);
  border-radius: 8px;
  background: #fbfcfe;
  text-align: center;
  color: var(--vg-muted);
  font-size: 11px;
}
.vg-stat b {
  display: block;
  margin-top: 3px;
  color: var(--vg-blue);
  font-size: 17px;
}
.vg-progress {
  display: flex;
  gap: 7px;
  padding: 18px 26px 0;
}
.vg-progress span {
  height: 7px;
  flex: 1;
  border-radius: 99px;
  background: #e8edf5;
}
.vg-progress span.active,
.vg-progress span.done {
  background: var(--vg-blue);
}
.vg-progress span.done {
  background: #68af91;
}
.vg-toast {
  min-height: 22px;
  margin: 16px 26px 0;
  color: #59677d;
  font-size: 14px;
}
.vg-toast.good {
  color: var(--vg-green);
  font-weight: 700;
}
.vg-toast.warn {
  color: #a35b28;
}
.vg-toast.bad {
  color: #a94e47;
}
.vg-actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  padding: 18px 26px;
  border-top: 1px solid var(--vg-line);
}
.vg-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #d7dfeb;
  border-radius: 8px;
  background: #fff;
  color: #37445a;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.vg-button:hover {
  border-color: #9bb4ed;
  color: var(--vg-blue);
}
.vg-button.primary {
  border-color: var(--vg-blue);
  background: var(--vg-blue);
  color: #fff;
}
.vg-button[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
}
.vg-result {
  margin: 0 26px 24px;
  padding: 20px;
  border: 1px solid #cfe1d8;
  border-radius: 10px;
  background: #f4faf7;
}
.vg-result[hidden] {
  display: none;
}
.vg-result h3 {
  margin: 0 0 7px;
  color: #196b49;
  font-size: 21px;
}
.vg-result p {
  margin: 0;
  color: #5c6b62;
  line-height: 1.75;
}
.vg-grade {
  float: right;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid #a9d7c1;
  border-radius: 50%;
  background: #fff;
  color: var(--vg-green);
  font-size: 22px;
  font-weight: 800;
}
.variant-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.variant-note {
  padding: 14px 16px;
  border-left: 3px solid var(--vg-blue);
  background: var(--vg-soft);
  color: #56647a;
  line-height: 1.8;
}
.variant-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.variant-links a {
  display: block;
  padding: 18px;
  border: 1px solid var(--vg-line);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}
.variant-links a:hover {
  border-color: #9cb5ef;
}
.variant-links strong {
  display: block;
  color: var(--vg-ink);
  margin-bottom: 6px;
}
.variant-links span {
  display: block;
  color: var(--vg-muted);
  line-height: 1.7;
  font-size: 13px;
}
.variant-links b {
  display: inline-block;
  margin-top: 10px;
  color: var(--vg-blue);
  font-size: 13px;
}
.vg-confetti {
  position: fixed;
  z-index: 60;
  top: 15%;
  left: 50%;
  width: 8px;
  height: 12px;
  pointer-events: none;
  animation: vg-fall 1s ease-out forwards;
}
@keyframes vg-fall {
  to {
    transform: translate(var(--x), 450px) rotate(540deg);
    opacity: 0;
  }
}
@keyframes vg-pop {
  50% {
    transform: scale(1.03);
  }
}
@keyframes vg-shake {
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}
.vg-pop {
  animation: vg-pop 0.35s ease;
}
.vg-shake {
  animation: vg-shake 0.3s ease;
}
/* Route builder */
.route-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  border-top: 1px solid var(--vg-line);
  margin-top: 18px;
}
.route-map {
  padding: 26px;
  border-right: 1px solid var(--vg-line);
}
.route-map h3,
.route-choice h3 {
  margin: 0 0 6px;
  color: var(--vg-ink);
  font-size: 17px;
}
.route-map > p,
.route-choice > p {
  margin: 0;
  color: var(--vg-muted);
  font-size: 13px;
  line-height: 1.7;
}
.route-track {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 94px;
  margin-top: 18px;
  padding: 15px;
  border: 1px dashed #cbd6e7;
  border-radius: 9px;
  background: #fafcff;
  overflow-x: auto;
}
.route-node {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #233047;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.laid-edge {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}
.laid-edge::before {
  content: "";
  width: 22px;
  height: 2px;
  background: #7f97c9;
}
.laid-edge span {
  padding: 8px 10px;
  border-radius: 7px;
  background: #edf3ff;
  color: #2e5bc6;
  font-size: 12px;
  font-weight: 700;
}
.route-summary {
  margin-top: 14px;
  color: #526078;
  font-size: 14px;
}
.route-choice {
  padding: 26px;
  background: #fbfcfe;
}
.edge-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.edge-button {
  width: 100%;
  padding: 13px 44px 13px 13px;
  border: 1px solid var(--vg-line);
  border-radius: 9px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  position: relative;
}
.edge-button:hover {
  border-color: #9db5ed;
}
.edge-button strong {
  display: block;
  color: var(--vg-ink);
  font-size: 14px;
}
.edge-button span {
  display: block;
  color: var(--vg-muted);
  font-size: 12px;
  margin-top: 4px;
}
.edge-button b {
  position: absolute;
  right: 12px;
  top: 17px;
  color: var(--vg-blue);
}
.route-log {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.route-log button {
  padding: 10px;
  border: 1px solid var(--vg-line);
  border-radius: 7px;
  background: #fff;
  color: #536177;
  font-size: 12px;
}
.route-log button.longest {
  border-color: #8ccaae;
  background: #f1faf6;
  color: #16704a;
  font-weight: 700;
}
/* Escape room */
.escape-room {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  margin-top: 18px;
  border-top: 1px solid var(--vg-line);
}
.room-scene {
  padding: 28px;
  border-right: 1px solid var(--vg-line);
  background: linear-gradient(180deg, #fbfcff, #f5f8fd);
}
.room-number {
  font-size: 12px;
  font-weight: 800;
  color: var(--vg-blue);
}
.room-scene h3 {
  font-size: 25px;
  color: var(--vg-ink);
  margin: 12px 0 10px;
}
.room-scene p {
  color: #536177;
  line-height: 1.85;
  margin: 0;
}
.room-clue {
  margin-top: 20px;
  padding: 15px;
  border-left: 3px solid #7f9ad8;
  background: #fff;
  color: #5a687d;
  font-size: 13px;
  line-height: 1.75;
}
.inventory {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.inventory span {
  padding: 6px 9px;
  border: 1px solid var(--vg-line);
  border-radius: 6px;
  background: #fff;
  color: #637188;
  font-size: 12px;
}
.inventory span.earned {
  border-color: #a5d8bf;
  color: #18704c;
  background: #f1faf6;
}
.room-actions {
  padding: 28px;
}
.room-actions h3 {
  margin: 0 0 5px;
  color: var(--vg-ink);
  font-size: 17px;
}
.room-actions > p {
  margin: 0 0 16px;
  color: var(--vg-muted);
  font-size: 13px;
}
.object-list {
  display: grid;
  gap: 10px;
}
.room-object {
  position: relative;
  width: 100%;
  padding: 14px 42px 14px 14px;
  border: 1px solid var(--vg-line);
  border-radius: 9px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.room-object:hover {
  border-color: #9db5ed;
}
.room-object strong {
  display: block;
  color: var(--vg-ink);
  font-size: 14px;
}
.room-object span {
  display: block;
  color: var(--vg-muted);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 4px;
}
.room-object i {
  position: absolute;
  right: 13px;
  top: 16px;
  font-style: normal;
  color: #8390a4;
}
.room-object.correct {
  border-color: #9fd5ba;
  background: #f1faf6;
}
.room-object.wrong {
  border-color: #edb7b1;
  background: #fff7f6;
}
.door-status {
  margin-top: 16px;
  padding: 12px;
  border: 1px dashed #c9d5e7;
  border-radius: 8px;
  color: #657389;
  text-align: center;
  font-size: 13px;
}
.door-status.open {
  border-color: #91c9ad;
  background: #f2faf6;
  color: #176f4b;
  font-weight: 700;
}
/* Conveyor */
.conveyor-stage {
  padding: 24px 26px;
}
.conveyor-process {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
}
.conveyor-process strong {
  color: var(--vg-ink);
  font-size: 17px;
}
.conveyor-process span {
  color: var(--vg-muted);
  font-size: 12px;
}
.conveyor-belt {
  position: relative;
  height: 150px;
  border: 1px solid #cdd8e8;
  border-radius: 10px;
  background: repeating-linear-gradient(
    90deg,
    #f3f6fa 0,
    #f3f6fa 36px,
    #e7ecf4 36px,
    #e7ecf4 38px
  );
  overflow: hidden;
}
.belt-card {
  position: absolute;
  top: 33px;
  left: calc(100% - 190px);
  width: 170px;
  padding: 15px;
  border: 1px solid #b8c8e4;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(40, 65, 110, 0.12);
  transition: left 0.1s linear;
}
.belt-card strong {
  display: block;
  color: var(--vg-ink);
  font-size: 15px;
}
.belt-card span {
  display: block;
  margin-top: 5px;
  color: var(--vg-muted);
  font-size: 12px;
  line-height: 1.55;
}
.belt-card.danger {
  border-color: #e9a39b;
}
.belt-card.success {
  border-color: #8dcead;
  background: #f2faf6;
}
.belt-gate {
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  width: 8px;
  background: #df786e;
}
.belt-gate::after {
  content: "分拣线";
  position: absolute;
  left: 12px;
  top: 62px;
  width: 48px;
  color: #a25750;
  font-size: 11px;
}
.sort-bins {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.sort-bin {
  padding: 14px;
  border: 1px solid var(--vg-line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  text-align: center;
}
.sort-bin:hover {
  border-color: #9db5ed;
}
.sort-bin strong {
  display: block;
  color: var(--vg-ink);
}
.sort-bin span {
  display: block;
  margin-top: 4px;
  color: var(--vg-muted);
  font-size: 11px;
}
.conveyor-ready {
  text-align: center;
  padding: 28px;
  color: #607087;
}
.conveyor-ready strong {
  display: block;
  color: var(--vg-ink);
  font-size: 20px;
  margin-bottom: 8px;
}
/* Falling blocks */
.fall-stage {
  padding: 22px 26px;
}
.fall-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 390px;
  border: 1px solid #cad5e5;
  border-radius: 10px;
  background: #f8fafd;
  overflow: hidden;
}
.fall-lane {
  position: relative;
  border-right: 1px solid #e1e7f0;
}
.fall-lane:last-child {
  border-right: 0;
}
.fall-lane-head {
  padding: 10px 5px;
  text-align: center;
  color: #56647a;
  font-size: 12px;
  font-weight: 800;
  border-bottom: 1px solid #e1e7f0;
  background: #fff;
}
.fall-stack {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 8px;
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
}
.fall-stack span {
  padding: 6px 5px;
  border-radius: 5px;
  background: #eaf1ff;
  color: #315fc9;
  font-size: 10px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.falling-card {
  position: absolute;
  z-index: 5;
  top: 48px;
  width: calc(20% - 12px);
  padding: 10px 6px;
  border: 1px solid #9fb6e7;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(40, 65, 110, 0.13);
  text-align: center;
  color: var(--vg-ink);
  font-size: 12px;
  font-weight: 700;
  transition:
    left 0.16s,
    top 0.1s linear;
}
.fall-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}
.fall-controls .vg-button {
  min-width: 72px;
}
.lane-pick {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.lane-pick button {
  min-height: 38px;
  border: 1px solid var(--vg-line);
  border-radius: 7px;
  background: #fff;
  color: #5b687d;
  font-size: 12px;
  cursor: pointer;
}
.lane-pick button.active {
  border-color: var(--vg-blue);
  background: #eef3ff;
  color: var(--vg-blue);
  font-weight: 800;
}
.fall-ready {
  position: absolute;
  inset: 49px 0 0;
  display: grid;
  place-items: center;
  background: rgba(248, 250, 253, 0.94);
  z-index: 8;
  text-align: center;
  color: #607087;
}
.fall-ready strong {
  display: block;
  color: var(--vg-ink);
  font-size: 20px;
  margin-bottom: 8px;
}
@media (max-width: 900px) {
  .variant-hero,
  .route-workspace,
  .escape-room {
    grid-template-columns: 1fr;
  }
  .variant-brief {
    border-left: 0;
    border-top: 1px solid var(--vg-line);
    padding: 24px 0 0;
  }
  .route-map,
  .event-panel,
  .room-scene {
    border-right: 0;
    border-bottom: 1px solid var(--vg-line);
  }
  .vg-head {
    display: block;
  }
  .vg-stats {
    justify-content: flex-start;
    margin-top: 16px;
  }
}
@media (max-width: 640px) {
  .vg-head {
    padding: 20px 16px;
  }
  .vg-head h2 {
    font-size: 21px;
  }
  .vg-progress {
    padding: 16px 16px 0;
  }
  .vg-toast {
    margin: 14px 16px 0;
  }
  .vg-actions {
    padding: 16px;
  }
  .vg-button {
    flex: 1 1 calc(50% - 8px);
  }
  .vg-result {
    margin: 0 16px 18px;
  }
  .variant-links,
  .variant-grid-2 {
    grid-template-columns: 1fr;
  }
  .route-map,
  .route-choice,
  .room-scene,
  .room-actions,
  .conveyor-stage,
  .fall-stage {
    padding: 20px 16px;
  }
  .route-log {
    grid-template-columns: 1fr;
  }
  .sort-bins {
    gap: 6px;
  }
  .sort-bin {
    padding: 12px 5px;
  }
  .sort-bin strong {
    font-size: 13px;
  }
  .fall-board {
    height: 350px;
  }
  .fall-lane-head {
    font-size: 10px;
    padding: 9px 2px;
  }
  .falling-card {
    font-size: 10px;
    padding: 8px 3px;
  }
  .fall-controls {
    grid-template-columns: 1fr;
  }
  .lane-pick button {
    font-size: 10px;
    padding: 0 2px;
  }
  .variant-game-page .subject-hero {
    padding-left: 0;
    padding-right: 0;
  }
}

/* Project file organizer */
.archive-office {
  display: grid;
  gap: 20px;
}

.archive-cabinets {
  display: grid;
  grid-template-columns: repeat(var(--cabinet-count, 3), minmax(0, 1fr));
  gap: 14px;
}

.archive-cabinet {
  position: relative;
  min-height: 220px;
  padding: 0;
  overflow: hidden;
  border: 1px solid #d6dfed;
  border-radius: 10px;
  background: #f9fbfe;
  color: #283246;
  text-align: left;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.archive-cabinet:hover,
.archive-cabinet.is-target {
  border-color: #8da8e7;
  box-shadow: 0 8px 20px rgba(49, 94, 214, 0.09);
}

.archive-cabinet.is-complete {
  border-color: #77c5a3;
  background: #f4fbf7;
}

.archive-cabinet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 82px;
  padding: 14px 15px;
  border-bottom: 1px solid #dce4ef;
  background: #fff;
}

.archive-cabinet-head span {
  display: block;
  margin-bottom: 5px;
  color: #78859b;
  font-size: 12px;
}

.archive-cabinet-head strong {
  display: block;
  font-size: 16px;
  line-height: 1.4;
}

.archive-cabinet-count {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf2ff;
  color: #315ed6;
  font-size: 12px;
  font-weight: 700;
}

.archive-drawer {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 137px;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(230, 236, 246, 0.55) 1px, transparent 1px),
    #f8fafd;
  background-size: 20px 20px;
}

.archive-drawer:empty::before {
  content: "把文件放进这个柜子";
  margin: auto;
  color: #9aa6b8;
  font-size: 12px;
}

.archive-filed-item {
  display: block;
  padding: 7px 9px;
  border: 1px solid #dce4ef;
  border-radius: 6px;
  background: #fff;
  color: #536077;
  font-size: 12px;
  line-height: 1.35;
  animation: archive-file-in 0.28s ease;
}

@keyframes archive-file-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
}

.archive-pile {
  padding: 19px;
  border: 1px solid #dce5f3;
  border-radius: 10px;
  background: #fff;
}

.archive-pile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.archive-pile-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.archive-pile-head p {
  margin: 0;
  color: #7d899e;
  font-size: 13px;
}

.archive-remaining {
  color: #64738d;
  font-size: 13px;
  white-space: nowrap;
}

.archive-remaining b {
  margin-right: 4px;
  color: #315ed6;
  font-size: 20px;
}

.archive-files {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.archive-file {
  position: relative;
  min-height: 94px;
  padding: 14px 13px 12px;
  overflow: hidden;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fff;
  color: #253047;
  cursor: grab;
  user-select: none;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.archive-file::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  border-left: 1px solid #d9e2f0;
  border-bottom: 1px solid #d9e2f0;
  background: #f1f5fb;
  clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.archive-file:hover {
  transform: translateY(-2px);
  border-color: #9db1dc;
  box-shadow: 0 7px 16px rgba(40, 62, 104, 0.08);
}

.archive-file.is-selected {
  border-color: #315ed6;
  background: #f2f5ff;
  box-shadow: 0 0 0 2px rgba(49, 94, 214, 0.1);
}

.archive-file.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.archive-file.is-filed {
  opacity: 0;
  transform: translateY(-12px) scale(0.9);
  pointer-events: none;
}

.archive-file span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f0f3f8;
  color: #6c7890;
  font-size: 11px;
  font-weight: 700;
}

.archive-file strong {
  display: block;
  font-size: 14px;
  line-height: 1.45;
}

.archive-file small {
  display: block;
  margin-top: 5px;
  color: #8a95a8;
  font-size: 12px;
  line-height: 1.4;
}

.archive-drag-ghost {
  position: fixed;
  z-index: 1000;
  width: 220px;
  max-width: calc(100vw - 24px);
  padding: 13px;
  border: 1px solid #315ed6;
  border-radius: 8px;
  background: #fff;
  color: #253047;
  box-shadow: 0 14px 32px rgba(35, 56, 98, 0.22);
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(1deg);
}

.archive-drag-ghost span {
  display: inline-flex;
  margin-bottom: 7px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef3ff;
  color: #315ed6;
  font-size: 11px;
  font-weight: 700;
}

.archive-drag-ghost strong {
  display: block;
  font-size: 14px;
}

@media (max-width: 900px) {
  .archive-files {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .archive-cabinets {
    grid-template-columns: 1fr;
  }

  .archive-cabinet {
    min-height: 0;
  }

  .archive-drawer {
    min-height: 90px;
  }

  .archive-files {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .archive-file {
    min-height: 88px;
  }

  .archive-pile-head {
    display: block;
  }

  .archive-remaining {
    margin-top: 8px;
  }
}

/* WBS puzzle factory */
.wbs-factory {
  display: grid;
  gap: 22px;
}

.wbs-factory-board {
  position: relative;
  padding: 26px;
  border: 1px solid #dce5f3;
  border-radius: 12px;
  background:
    linear-gradient(#eef3fb 1px, transparent 1px),
    linear-gradient(90deg, #eef3fb 1px, transparent 1px), #fbfdff;
  background-size: 24px 24px;
}

.wbs-root {
  width: min(360px, 90%);
  margin: 0 auto 26px;
  padding: 15px 18px;
  border: 1px solid #294fba;
  border-radius: 8px;
  background: #315ed6;
  color: #fff;
  text-align: center;
  box-shadow: 0 8px 20px rgba(49, 94, 214, 0.18);
}

.wbs-root span,
.wbs-node-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: #8793a8;
}

.wbs-root span {
  color: #dce5ff;
}

.wbs-root strong {
  font-size: 18px;
}

.wbs-branches {
  display: grid;
  grid-template-columns: repeat(var(--branch-count, 2), minmax(0, 1fr));
  gap: 18px;
}

.wbs-branch {
  position: relative;
  min-width: 0;
  padding-top: 20px;
}

.wbs-branch::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 20px;
  background: #cbd7eb;
}

.wbs-slot {
  width: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1px dashed #adc0df;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #617089;
  text-align: left;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.wbs-slot:hover,
.wbs-slot.is-target {
  border-color: #5b7ee0;
  background: #f3f6ff;
}

.wbs-slot.is-filled {
  border-style: solid;
  border-color: #7ac8a6;
  background: #f0fbf6;
  color: #173f30;
  box-shadow: 0 5px 14px rgba(42, 155, 105, 0.1);
}

.wbs-slot.is-filled .wbs-node-label {
  color: #4f9579;
}

.wbs-slot strong {
  display: block;
  font-size: 15px;
  line-height: 1.45;
}

.wbs-slot small {
  display: block;
  margin-top: 4px;
  color: #8995a8;
  font-size: 12px;
}

.wbs-work-packages {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #dfe7f3;
}

.wbs-work-packages[hidden] {
  display: none;
}

.wbs-parts-panel {
  padding: 20px;
  border: 1px solid #dce5f3;
  border-radius: 10px;
  background: #fff;
}

.wbs-parts-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.wbs-parts-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.wbs-parts-head p {
  margin: 0;
  color: #7e899d;
  font-size: 13px;
}

.wbs-parts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.wbs-part {
  min-height: 76px;
  padding: 12px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fff;
  color: #222b3b;
  text-align: left;
  cursor: grab;
  user-select: none;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.wbs-part.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.wbs-drag-ghost {
  position: fixed;
  z-index: 1000;
  width: 220px;
  max-width: calc(100vw - 24px);
  padding: 12px;
  border: 1px solid #315ed6;
  border-radius: 8px;
  background: #fff;
  color: #222b3b;
  box-shadow: 0 14px 32px rgba(35, 56, 98, 0.2);
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-1deg);
}

.wbs-drag-ghost span {
  display: inline-flex;
  margin-bottom: 7px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef3ff;
  color: #315ed6;
  font-size: 11px;
  font-weight: 700;
}

.wbs-drag-ghost strong {
  display: block;
  font-size: 14px;
}

.wbs-part:hover {
  transform: translateY(-2px);
  border-color: #9eb2dc;
  box-shadow: 0 7px 16px rgba(41, 68, 121, 0.08);
}

.wbs-part.is-selected {
  border-color: #315ed6;
  background: #f2f5ff;
  box-shadow: 0 0 0 2px rgba(49, 94, 214, 0.1);
}

.wbs-part.is-placed {
  opacity: 0;
  transform: scale(0.88);
  pointer-events: none;
}

.wbs-part span {
  display: inline-flex;
  margin-bottom: 7px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef3ff;
  color: #315ed6;
  font-size: 11px;
  font-weight: 700;
}

.wbs-part[data-kind="package"] span {
  background: #eef9f4;
  color: #25835e;
}

.wbs-part strong {
  display: block;
  font-size: 14px;
  line-height: 1.45;
}

.wbs-level-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #657189;
  font-size: 13px;
}

.wbs-level-note b {
  color: #315ed6;
  font-size: 18px;
}

.wbs-complete {
  animation: wbs-complete 0.42s ease;
}

@keyframes wbs-complete {
  50% {
    transform: scale(1.018);
    box-shadow: 0 0 0 4px rgba(42, 155, 105, 0.12);
  }
}

@media (max-width: 900px) {
  .wbs-parts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .wbs-factory-board {
    padding: 18px 12px;
    overflow-x: visible;
  }

  .wbs-branches {
    min-width: 0;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .wbs-parts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wbs-part {
    min-height: 70px;
  }

  .wbs-parts-head {
    display: block;
  }

  .wbs-level-note {
    margin-top: 10px;
  }
}
