/* Shared touch, keyboard, and small-screen behavior for the four legacy labs. */
.drag-block,
.drag-item {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-exp-status {
  min-height: 40px;
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px solid #cbd8ed;
  border-radius: 8px;
  background: #f2f6ff;
  color: #263b5e;
  font-size: 14px;
  line-height: 1.45;
}

.mobile-exp-selected {
  position: relative;
  z-index: 1;
  outline: 3px solid #ffbf47;
  box-shadow: 0 0 0 5px #285cad33;
}

.drop-slot,
.drop-area {
  cursor: pointer;
}

.mobile-exp-dragging {
  opacity: 0.55;
}

.mobile-exp-ghost {
  position: fixed;
  z-index: 2147483000;
  max-width: min(82vw, 28rem);
  max-height: 32vh;
  overflow: hidden;
  padding: 10px 12px;
  border: 2px solid #ffbf47;
  border-radius: 9px;
  background: #285cad;
  box-shadow: 0 8px 24px #0000003b;
  color: #fff;
  font: 15px/1.45 "Microsoft Yahei", sans-serif;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.drag-block:focus-visible,
.drag-item:focus-visible,
.drop-slot:focus-visible,
.drop-area:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 3px;
}

@media (max-width: 700px) {
  table {
    table-layout: fixed;
  }

  th,
  td {
    overflow-wrap: anywhere;
  }

  body {
    padding: 12px;
    font-size: 15px;
  }

  h1 {
    font-size: 20px;
    line-height: 1.4;
  }

  .wrapper,
  .container {
    flex-direction: column;
    gap: 12px;
  }

  .left-col,
  .right-col {
    width: auto;
    min-width: 0;
    padding: 14px;
  }

  .drag-block,
  .drag-item,
  .drop-slot,
  .drop-area {
    font-size: 15px;
  }

  .drop-slot,
  .drop-area {
    min-height: 76px;
    padding: 12px;
  }

  button {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
    touch-action: manipulation;
  }
}

@media (max-width: 700px) {
  .game-wrap {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    align-items: start;
    gap: 8px;
  }

  .left-drag,
  .right-drop {
    width: auto;
    min-width: 0;
    height: 62vh;
    min-height: 250px;
    max-height: 540px;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
  }

  .left-drag h3,
  .right-drop h3 {
    font-size: 15px;
    line-height: 1.4;
  }

  .drag-item,
  .drop-slot {
    padding: 10px;
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  .drop-slot {
    min-height: 72px;
  }

  .slot-explain {
    font-size: 14px;
    line-height: 1.45;
  }

  .arrow-center {
    margin: 2px 0;
  }

  .k-control button {
    margin: 2px 0;
  }

  #kText {
    display: block;
    margin-top: 4px;
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .game-wrap {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 6px;
  }

  .left-drag,
  .right-drop {
    padding: 8px;
  }

  .left-drag h3,
  .right-drop h3 {
    font-size: 14px;
  }
}
