/* ========================================角色手机桌面页样式
   ======================================== */

.phone-desktop-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--color-shell-bg);
  z-index: calc(var(--z-chat) + 1);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(100%);
  /* 关闭后彻底隐藏，避免在某些视口下从右侧露出、撑宽文档（与其他全屏子页保持一致） */
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.2s ease, visibility 0s linear 0.3s;
  overflow: hidden;
  overflow-x: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

.phone-desktop-screen.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.3s ease, opacity 0.2s ease, visibility 0s;
}

/* ---- 顶部导航 ---- */
.phone-desktop-nav {
  display: flex;
  align-items: center;
  padding: 12px var(--spacing-page);
  gap: 10px;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 10;
}

.phone-desktop-nav__back {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  transition: background var(--transition-fast);
  position: relative;
  z-index: 20;
  pointer-events: auto;
}
.phone-desktop-nav__back:active { background: var(--color-accent-active); }
.phone-desktop-nav__back svg { width: 22px; height: 22px; }

.phone-desktop-nav__title {
  flex: 1;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.phone-desktop-nav__badge {
  font-size: var(--font-size-xs);
  color: var(--color-text-hint);
  background: var(--color-card-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  white-space: nowrap;
}

/* ---- 角色信息区 ---- */
.phone-desktop-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px var(--spacing-page) 24px;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.phone-desktop-hero__avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--color-card-muted);
  border: 2px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  overflow: hidden;
  margin-bottom: 12px;
}

.phone-desktop-hero__avatar img {
  width: 100%; height: 100%; object-fit: cover;
}

.phone-desktop-hero__name {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.phone-desktop-hero__status {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.phone-desktop-hero__hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-hint);
  text-align: center;
}

/* ---- APP 图标区 ---- */
.phone-desktop-apps {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 8px var(--spacing-page) 32px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 8px;
  align-content: start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 320px) {
  .phone-desktop-apps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---- 单个 APP 图标 ---- */
.pd-app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pd-app-item:active .pd-app-icon {
  transform: scale(0.9);
  opacity: 0.7;
}

.pd-app-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  color: var(--color-text-primary);
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.pd-app-icon svg {
  width: 26px; height: 26px;display: block;
  flex-shrink: 0;
}

.pd-app-name {
  font-size: 11px;
  color: var(--color-text-secondary);
  text-align: center;
  line-height: 1.2;width: 100%;overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Toast ---- */
.phone-desktop-toast {
  position: absolute;
  bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: var(--font-size-sm);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
}
.phone-desktop-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- 安全感横条 ---- */
.pd-security-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px var(--spacing-page) 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  flex-shrink: 0;
  backdrop-filter: blur(6px);
}
.phone-desktop-screen:not(.has-wallpaper) .pd-security-bar {
  background: var(--color-card-bg, rgba(0, 0, 0, 0.04));
  border-color: var(--color-border, rgba(0, 0, 0, 0.08));
}
.pd-security-bar__label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-size-xs, 12px);
  white-space: nowrap;
  opacity: 0.85;
}
.pd-security-bar__label svg {
  width: 14px;
  height: 14px;
}
.pd-security-bar__track {
  flex: 1;
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(120, 120, 120, 0.25);
  overflow: hidden;
}
.pd-security-bar__fill {
  height: 100%;
  width: 70%;
  background: #34c759;
  border-radius: var(--radius-full);
  transition: width 0.45s ease, background 0.45s ease;
}
.pd-security-bar__value {
  min-width: 26px;
  text-align: right;
  font-size: var(--font-size-sm, 13px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pd-security-bar.is-low {
  animation: pdSecPulse 1.6s ease-in-out infinite;
}
@keyframes pdSecPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
  50% { box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.18); }
}

/* --- 密码锁层 ---- */
.pd-lock-layer {
  position: absolute;
  inset: 0;
  /* 只覆盖当前手机详情页容器，绝不参与文档布局或撑宽视口 */
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  /* 关闭态彻底隐藏：visibility 防止隐藏的输入框被 focus 触发横向滚动 */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  /* 锁屏期间锁死滚动，避免触摸拖动把底层页面滑出来 */
  touch-action: none;
  overscroll-behavior: contain;
}
.pd-lock-layer.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.25s ease, visibility 0s;
}
.pd-lock-card {
  width: 100%;
  max-width: 300px;
  padding: 28px 22px 22px;
  border-radius: 22px;
  background: var(--color-card-bg, #fff);
  color: var(--color-text, #1c1c1e);
  text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  transform: translateY(10px) scale(0.96);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.pd-lock-layer.is-active .pd-lock-card {
  transform: translateY(0) scale(1);
}
.pd-lock-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 59, 48, 0.12);
  color: #ff3b30;
}
.pd-lock-icon svg {
  width: 26px;
  height: 26px;
}
.pd-lock-title {
  font-size: var(--font-size-lg, 17px);
  font-weight: 700;
  margin-bottom: 4px;
}
.pd-lock-sub {
  font-size: var(--font-size-sm, 13px);
  opacity: 0.65;
  margin-bottom: 18px;
}
.pd-lock-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--color-border, rgba(0, 0, 0, 0.12));
  background: var(--color-input-bg, rgba(0, 0, 0, 0.03));
  color: inherit;
  font-size: 20px;
  letter-spacing: 6px;
  text-align: center;
  box-sizing: border-box;
  outline: none;
}
.pd-lock-input:focus {
  border-color: var(--color-accent, #007aff);
}
.pd-lock-error {
  min-height: 18px;
  margin: 8px 0 4px;
  font-size: var(--font-size-xs, 12px);
  color: #ff3b30;
}
.pd-lock-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.pd-lock-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: 12px;
  border: none;
  font-size: var(--font-size-sm, 14px);
  font-weight: 600;
  cursor: pointer;
}
.pd-lock-btn--ghost {
  background: var(--color-input-bg, rgba(0, 0, 0, 0.05));
  color: var(--color-text-secondary, #666);
}
.pd-lock-btn--primary {
  background: var(--color-accent, #007aff);
  color: #fff;
}
.pd-lock-card.shake {
  animation: pdLockShake 0.4s ease;
}
@keyframes pdLockShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
