/* ============================================================
   拖拽合成 / 邮件核销 / 无账号学生页
   ============================================================ */

.student-switch,
.student-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: rgba(255, 252, 245, 0.7);
  font-size: 16px;
  line-height: 1.4;
}

.student-switch select {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  max-width: 96px;
  color: var(--ink);
  padding: 1px 0;
  cursor: pointer;
}

.student-chip {
  font-size: 12.5px;
  gap: 5px;
  padding: 6px 12px;
}

.exchange-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin: 6px 0 20px;
}

.exchange-title {
  font-family: var(--serif);
  font-size: clamp(28px, 4.2vw, 40px);
  line-height: 1.2;
  margin: 8px 0;
  letter-spacing: -0.01em;
}

.exchange-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tray-panel {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100dvh - 110px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 8px 26px rgba(63, 48, 31, 0.06);
}

.tray-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.tray-head h3 {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.04em;
}

.tray-head span {
  font-size: 11px;
  color: var(--ink-3);
}

.tray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
  overflow: auto;
  padding: 4px 2px 8px;
  min-height: 80px;
}

.tray-stamp {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  border-radius: 14px;
  transition: transform 0.15s ease;
}

.tray-stamp:hover {
  transform: translateY(-2px);
}

.tray-stamp .stamp {
  --w: 54px;
}

.tray-stamp.picked .stamp {
  box-shadow: 0 0 0 3px rgba(177, 57, 44, 0.22);
  transform: rotate(-4deg) scale(1.04);
}

.tray-qty {
  position: absolute;
  right: -3px;
  bottom: -3px;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper-2);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 19px;
  text-align: center;
  pointer-events: none;
}

.tray-hint {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.7;
  border-top: 1px dashed var(--line);
  padding-top: 9px;
  margin-top: 4px;
}

.modules {
  display: grid;
  gap: 13px;
}

.module {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 15px 17px 13px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
  animation: rise 0.45s ease both;
  animation-delay: var(--d, 0ms);
}

.module.complete {
  border-color: rgba(177, 57, 44, 0.42);
  background: linear-gradient(135deg, rgba(177, 57, 44, 0.055), rgba(164, 119, 28, 0.04)), var(--card);
  box-shadow: 0 10px 34px rgba(177, 57, 44, 0.1);
}

.module.limit {
  opacity: 0.68;
}

.module.just-complete {
  animation: moduleGlow 0.9s ease;
}

.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.module-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.module-name b {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.03em;
}

.module-name > span:last-child {
  font-size: 11.5px;
  color: var(--ink-3);
}

.module-no {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
}

.module-reward {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--red);
  white-space: nowrap;
}

.slot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 66px;
  align-items: center;
}

.slot {
  width: 62px;
  height: 62px;
  border: 1.5px dashed rgba(38, 32, 27, 0.2);
  border-radius: 15px;
  background: rgba(38, 32, 27, 0.018);
  display: grid;
  place-items: center;
  padding: 0;
  position: relative;
  transition: 0.16s ease;
  flex: none;
}

.slot:hover {
  border-color: rgba(38, 32, 27, 0.4);
}

.slot-label {
  font-size: 9.5px;
  color: var(--ink-3);
  line-height: 1.3;
  max-width: 54px;
  text-align: center;
  word-break: break-all;
}

.slot-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 4px;
}

.slot.can-drop {
  border-color: rgba(177, 57, 44, 0.46);
  background: rgba(177, 57, 44, 0.045);
}

.slot.hover {
  border-color: var(--red);
  background: rgba(177, 57, 44, 0.1);
  transform: scale(1.08);
}

.slot.filled {
  border-style: solid;
  border-color: transparent;
  background: transparent;
}

.slot.filled .stamp {
  --w: 56px;
}

.slot-x {
  position: absolute;
  right: -4px;
  top: -4px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper-2);
  font-size: 11px;
  line-height: 17px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.slot.filled:hover .slot-x {
  opacity: 1;
}

.module-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px dashed var(--line);
  margin-top: 12px;
  padding-top: 10px;
}

.module-status {
  font-size: 11px;
  color: var(--ink-2);
}

.module.complete .module-status {
  color: var(--red);
  font-weight: 600;
}

.module-limit {
  font-size: 10px;
  color: var(--ink-3);
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 68px;
  height: 68px;
  z-index: 120;
  pointer-events: none;
  filter: drop-shadow(0 18px 22px rgba(63, 48, 31, 0.3));
  will-change: transform;
}

.drag-ghost .stamp {
  --w: 68px;
}

body.dragging-stamp {
  cursor: grabbing;
  user-select: none;
}

body.dragging-stamp * {
  cursor: grabbing !important;
}

.spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c, var(--red));
  pointer-events: none;
  z-index: 5;
  animation: sparkfly 0.8s ease-out forwards;
}

@keyframes sparkfly {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2);
  }
}

@keyframes moduleGlow {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.015);
    box-shadow: 0 0 0 6px rgba(177, 57, 44, 0.08), 0 18px 40px rgba(177, 57, 44, 0.16);
  }
  100% {
    transform: scale(1);
  }
}

.pc-mail {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(164, 119, 28, 0.1);
  font-size: 18px;
  flex: none;
}

.parent-page {
  padding-bottom: 50px;
}

.verify-card {
  width: min(520px, 100%);
}

.verify-card h1 {
  line-height: 1.3;
}

.parent-login .setup-card {
  width: min(380px, 100%);
}

.parent-login .pin-input {
  height: 52px;
}

@media (max-width: 900px) {
  .exchange-layout {
    display: block;
  }
  .tray-panel {
    position: sticky;
    top: 63px;
    z-index: 22;
    max-height: none;
    padding: 10px 12px 9px;
    background: rgba(255, 252, 245, 0.96);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 22px rgba(63, 48, 31, 0.1);
  }
  .tray-head {
    margin-bottom: 6px;
  }
  .tray-head h3 {
    font-size: 14px;
  }
  .tray-grid {
    display: flex;
    gap: 7px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0 5px;
    min-height: 0;
    scrollbar-width: none;
  }
  .tray-grid::-webkit-scrollbar {
    display: none;
  }
  .tray-stamp {
    flex: none;
  }
  .tray-stamp .stamp {
    --w: 44px;
  }
  .tray-hint {
    display: none;
  }
  .modules {
    margin-top: 14px;
    padding-top: 0;
  }
  .slot {
    width: 54px;
    height: 54px;
  }
  .slot.filled .stamp {
    --w: 49px;
  }
  .module-reward {
    font-size: 14px;
  }
  .module-name b {
    font-size: 16.5px;
  }
}

@media (max-width: 420px) {
  .slot {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }
  .slot.filled .stamp {
    --w: 43px;
  }
  .slot-label {
    font-size: 8.5px;
    max-width: 42px;
  }
  .tray-stamp .stamp {
    --w: 44px;
  }
  .module {
    padding: 13px 12px 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spark,
  .module.just-complete {
    animation: none !important;
  }
}
