/* psp-desk.css — 第二屏正中 360° 纯白哑光 PSP & 灰白居中弹出编辑卡片 */
:root {
  --psp-body-bg: #ffffff;
  --psp-accent: #e0e7f1;
  --psp-accent-mid: #edf1f7;
  --psp-btn-bg: #f1f6fc;
  --psp-rx: 7deg;
  --psp-ry: -16deg;
  --psp-rz: -0.5deg;
}

@keyframes pspLedGlow {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* 第二屏定位基准 */
.desktop-screen[data-screen-idx="1"] {
  position: relative;
}

/* 精准居于第二页正中间 */
.psp-desk-widget {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  transform: translateY(-52%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

/* 桌面 3D 舞台 */
.psp-desk-scene {
  position: relative;
  width: 100%;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1100px;
  perspective-origin: 50% 44%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.psp-desk-surface {
  position: absolute;
  bottom: 12px;
  width: 92%;
  height: 104px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.88);
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 14px 34px rgba(130, 160, 200, 0.14);
  transform: rotateX(68deg);
  transform-origin: center bottom;
  pointer-events: none;
}

.psp-floor-shadow {
  position: absolute;
  bottom: 26px;
  width: 306px;
  height: 42px;
  background: radial-gradient(
    ellipse at center,
    rgba(120, 130, 145, 0.2) 0%,
    rgba(120, 130, 145, 0.09) 42%,
    rgba(120, 130, 145, 0.02) 66%,
    rgba(120, 130, 145, 0) 78%
  );
  pointer-events: none;
}

/* 3D PSP 主体 */
.psp-3d-rig {
  position: relative;
  width: 344px;
  height: 154px;
  transform-style: preserve-3d;
  transform: rotateX(var(--psp-rx)) rotateY(var(--psp-ry)) rotateZ(var(--psp-rz));
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.psp-desk-scene.is-dragging .psp-3d-rig {
  transition: none;
  will-change: transform;
}

/* 实心立体侧面切片 */
.psp-solid-core {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}

.psp-slice {
  position: absolute;
  inset: 0;
  border-radius: 74px;
  background: var(--psp-accent);
  border: 1px solid var(--psp-accent);
}

.psp-slice:nth-child(1) { transform: translateZ(1.0px);  background: var(--psp-accent-mid); border-color: var(--psp-accent-mid); }
.psp-slice:nth-child(2) { transform: translateZ(-0.5px); background: var(--psp-accent-mid); border-color: var(--psp-accent-mid); }
.psp-slice:nth-child(3) { transform: translateZ(-2.0px); background: var(--psp-accent-mid); }
.psp-slice:nth-child(4) { transform: translateZ(-3.6px); }
.psp-slice:nth-child(5) { transform: translateZ(-5.2px); }
.psp-slice:nth-child(6) { transform: translateZ(-6.8px); }
.psp-slice:nth-child(7) { transform: translateZ(-8.4px); }
.psp-slice:nth-child(8) { transform: translateZ(-10.2px); }

/* 顶部 L / R 肩键 */
.psp-shoulder {
  position: absolute;
  top: -4px;
  width: 56px;
  height: 12px;
  background: var(--psp-accent-mid);
  border: 1.5px solid var(--psp-accent);
  border-radius: 12px 12px 2px 2px;
  transform-style: preserve-3d;
  pointer-events: none;
}

.psp-shoulder.left { left: 26px; transform: translateZ(-2px) rotate(-8deg); }
.psp-shoulder.right { right: 26px; transform: translateZ(-2px) rotate(8deg); }

.psp-shoulder::before,
.psp-shoulder::after {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  background: var(--psp-accent);
  border: 1px solid var(--psp-accent);
}

.psp-shoulder::before { transform: translateZ(-3px); }
.psp-shoulder::after  { transform: translateZ(-6px); }

/* ================= 背面哑光面板 ================= */
.psp-back-plate {
  position: absolute;
  inset: 0;
  border-radius: 74px;
  background: var(--psp-body-bg);
  border: 1.5px solid #d8dde6;
  transform: translateZ(-11.5px) rotateY(180deg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  overflow: hidden;
  cursor: pointer;
}

.psp-back-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  z-index: 0;
  pointer-events: none;
}

.psp-back-plate.has-image .psp-back-bg-img {
  display: block;
}

.psp-back-grip {
  position: relative;
  z-index: 1;
  width: 50px;
  height: 94px;
  border-radius: 25px;
  border: 1.5px solid #d8dde6;
  background: rgba(248, 250, 252, 0.85);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.psp-back-umd {
  position: relative;
  z-index: 1;
  width: 98px;
  height: 98px;
  border-radius: 50%;
  border: 2px solid var(--psp-accent);
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 8px #f8fafc;
}

.psp-back-umd-inner {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1.5px solid #d8dde6;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.psp-slot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  pointer-events: none;
}

.has-image > .psp-slot-img {
  display: block;
}

.has-image > .psp-slot-hint {
  display: none;
}

.psp-slot-hint {
  font-size: 9px;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
  line-height: 1.25;
  padding: 4px;
  pointer-events: none;
}

/* ================= 正面机身 ================= */
.psp-body {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 74px;
  background: var(--psp-body-bg);
  border: 1.5px solid #d8dde6;
  box-shadow:
    0 8px 24px rgba(110, 120, 138, 0.14),
    0 2px 6px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 12px 18px;
  transform: translateZ(2px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.psp-leds-top {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 4;
  pointer-events: none;
}

.psp-led-dot {
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: #e2e8f0;
}

.psp-led-power {
  background: #a8d5ff;
  box-shadow: 0 0 6px rgba(168, 213, 255, 0.8);
  animation: pspLedGlow 2.5s ease-in-out infinite;
}

/* 左侧按键 */
.psp-left-zone {
  width: 46px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.psp-dpad {
  position: relative;
  width: 34px;
  height: 34px;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.psp-dpad:active {
  transform: scale(0.9);
}

.psp-dpad-bar {
  position: absolute;
  background: var(--psp-btn-bg);
  border: 1.5px solid #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.psp-dpad-h {
  left: 2px;
  top: 10px;
  width: 30px;
  height: 14px;
}

.psp-dpad-v {
  left: 10px;
  top: 2px;
  width: 14px;
  height: 30px;
}

.psp-dpad-center {
  position: absolute;
  left: 11px;
  top: 11px;
  width: 12px;
  height: 12px;
  background: var(--psp-btn-bg);
  border-radius: 50%;
}

.psp-analog-stick {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--psp-btn-bg);
  border: 1.5px solid #d1d5db;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.psp-analog-stick:active {
  transform: scale(0.88);
}

.psp-analog-stick.is-playing {
  border-color: #9ca3af;
  box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.32), 0 2px 5px rgba(0, 0, 0, 0.06);
}

/* 中间加宽屏幕 */
.psp-center-col {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 6px;
}

.psp-screen-bezel {
  width: 100%;
  height: 100%;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 3.5px;
  border: 1px solid #d1d5db;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.psp-screen-display {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 9px;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.psp-screen-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  pointer-events: none;
}

.psp-screen-display.has-image .psp-screen-img {
  display: block;
}

.psp-screen-display.has-image .psp-screen-placeholder {
  display: none;
}

.psp-screen-placeholder {
  text-align: center;
  padding: 8px;
  color: #94a3b8;
  pointer-events: none;
}

.psp-screen-placeholder-text {
  font-size: 10.5px;
  letter-spacing: 0.6px;
  font-weight: 600;
  display: block;
}

/* 右侧按钮区（圆形触发按钮 + 纯白灰标 XYAB） */
.psp-right-zone {
  width: 46px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.psp-right-round-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #d1d5db;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 0.14s ease, background-color 0.14s ease;
}

.psp-right-round-btn:active {
  transform: scale(0.88);
  background: #f1f5f9;
}

.psp-abxy-pad {
  position: relative;
  width: 40px;
  height: 40px;
}

.psp-face-btn {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 1px 1px rgba(0, 0, 0, 0.02);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 700;
  color: #787c82;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.psp-face-btn:active {
  transform: scale(0.84);
  background: #f1f5f9;
}

.psp-btn-x { top: 0; left: 13px; }
.psp-btn-y { top: 13px; left: 0; }
.psp-btn-a { top: 13px; right: 0; }
.psp-btn-b { bottom: 0; left: 13px; }

/* ================= 自定义 PNG 贴纸层（黑色虚线框 + 打勾保存 + 点叉删除） ================= */
.psp-custom-png-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}

.psp-sticker-wrap {
  position: absolute;
  left: 22px;
  top: 12px;
  width: 48px;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.psp-sticker-wrap img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.14));
}

.psp-sticker-wrap.selected {
  border: 1.5px dashed #18191c;
  border-radius: 6px;
}

.psp-sticker-act {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #18191c;
  background: #ffffff;
  color: #18191c;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  z-index: 10;
}

.psp-sticker-wrap.selected .psp-sticker-act {
  display: flex;
}

.psp-sticker-del {
  top: -9px;
  right: -9px;
}

.psp-sticker-ok {
  bottom: -9px;
  right: -9px;
  background: #18191c;
  color: #ffffff;
}

/* ================= 居中弹出灰白小卡片编辑面板 ================= */
.psp-edit-mask {
  position: fixed;
  inset: 0;
  z-index: 520;
  background: transparent;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 20px;
}

.psp-edit-mask.show {
  display: flex;
}

.psp-edit-sheet {
  width: 284px;
  max-width: calc(100vw - 44px);
  max-height: 34vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  padding: 14px 15px 15px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: pspPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pspPopIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.psp-edit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid #f3f4f6;
}

.psp-edit-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #374151;
}

.psp-edit-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #6b7280;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.psp-panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.psp-panel-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
}

.psp-reset-color-btn {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #6b7280;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.psp-color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.psp-color-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px 4px;
  cursor: pointer;
}

.psp-color-item span {
  font-size: 10.5px;
  font-weight: 600;
  color: #6b7280;
}

.psp-color-picker-input {
  width: 28px;
  height: 20px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.psp-angle-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.psp-angle-btn {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #4b5563;
  font-size: 11px;
  font-weight: 600;
  padding: 7px 4px;
  border-radius: 9px;
  cursor: pointer;
}

.psp-angle-btn.active {
  background: #374151;
  color: #ffffff;
  border-color: #374151;
}

.psp-back-img-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.psp-back-img-btn {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #4b5563;
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 4px;
  border-radius: 9px;
  cursor: pointer;
}

.psp-back-img-btn:active {
  background: #f3f4f6;
}

.psp-png-tools-row {
  display: flex;
  gap: 7px;
  align-items: center;
}

.psp-png-upload-btn {
  flex: 1;
  border: 1px dashed #6b7280;
  background: #f9fafb;
  color: #374151;
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.psp-png-clear-btn {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #6b7280;
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.psp-png-size-row {
  display: none;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  padding: 6px 10px;
}

.psp-png-size-row.show {
  display: flex;
}

.psp-png-size-row span {
  font-size: 11px;
  color: #6b7280;
  font-weight: 600;
  white-space: nowrap;
}

.psp-png-size-slider {
  flex: 1;
  accent-color: #4b5563;
}

.psp-url-row {
  display: flex;
  gap: 6px;
}

.psp-url-input {
  flex: 1;
  min-width: 0;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  padding: 7px 9px;
  color: #374151;
  font-size: 11.5px;
  outline: none;
}

.psp-url-input::placeholder {
  color: #9ca3af;
}

.psp-url-apply-btn {
  border: 1px solid #374151;
  background: #374151;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
}

.psp-hidden-file-input {
  display: none;
}

/* ================= 十字键「屏幕相册」居中弹出卡片 ================= */
.psp-gallery-tip {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.4;
}

.psp-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.psp-gallery-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  overflow: hidden;
  border: 1.5px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
}

.psp-gallery-thumb.active {
  border-color: #374151;
}

.psp-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.psp-gallery-del {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.94);
  color: #374151;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.psp-gallery-add {
  aspect-ratio: 1 / 1;
  border-radius: 9px;
  border: 1.5px dashed #9ca3af;
  background: #f9fafb;
  color: #6b7280;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.psp-gallery-add:active {
  background: #f3f4f6;
}

.psp-gallery-add-plus {
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.psp-gallery-add-text {
  font-size: 9.5px;
  font-weight: 600;
}
