/* ==========================================================================
   jackane宇 · 第 1 期公网传播、好友同盒 PK、9:16 晒卡海报与存档档案样式 (sprint1-social.css)
   兼容暗夜/白昼双主题与移动端 XWeb GPU 显存安全规范
   ========================================================================== */

/* ---------- 1. 顶栏「PK」精致入口胶囊（与奖杯按钮等高对齐） ---------- */
.pk-duel-btn {
  --key-lip: rgba(2, 6, 16, 0.78);
  position: relative;
  pointer-events: auto;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--chrome-surface);
  border: 1px solid rgba(244, 63, 94, 0.48);
  color: #fda4af;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 2.5px 0 var(--key-lip),
    0 8px 18px -6px rgba(0, 0, 0, 0.5);
  transition: border-color 0.16s ease, color 0.16s ease, transform 0.08s ease;
}

.pk-duel-btn:hover {
  border-color: #fb7185;
  color: #ffe4e6;
}

.pk-duel-btn:active {
  transform: translateY(2px) scale(0.98);
}

html[data-studio-light="day"] .pk-duel-btn {
  --key-lip: rgba(100, 116, 139, 0.36);
  color: #be123c;
  border-color: rgba(225, 29, 72, 0.42);
}

/* ---------- 2. 账本内「训练家昵称 & 跨设备存档备份」面板 ---------- */
.ledger-profile-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

html[data-studio-light="day"] .ledger-profile-box {
  background: rgba(15, 23, 42, 0.035);
  border-color: rgba(15, 23, 42, 0.12);
}

.profile-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-nick-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 240px;
}

.profile-nick-input,
.pk-nick-input,
.onboard-nick-input {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(6, 10, 20, 0.55);
  color: #f8fafc;
  font-size: 13.5px;
  font-weight: 700;
  outline: none;
  min-width: 120px;
  flex: 1;
}

.profile-nick-input:focus,
.pk-nick-input:focus,
.onboard-nick-input:focus {
  border-color: #f5c84c;
}

html[data-studio-light="day"] .profile-nick-input,
html[data-studio-light="day"] .pk-nick-input,
html[data-studio-light="day"] .onboard-nick-input {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.22);
}

.profile-sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-import-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.22);
}

.profile-import-panel[hidden] {
  display: none !important;
}

.profile-import-textarea {
  width: 100%;
  min-height: 74px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(6, 10, 20, 0.58);
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
}

html[data-studio-light="day"] .profile-import-textarea {
  background: #ffffff;
  color: #0f172a;
}

.profile-import-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-file-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.profile-sync-status {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #34d399;
}

.profile-sync-status.is-error {
  color: #fb7185;
}

/* ---------- 3. 通用 9:16 超清晒卡海报预览弹窗（最高层级，高于一切 .binder-modal (80)） ---------- */
.poster-studio-modal {
  z-index: 92 !important;
}

.poster-studio-sheet {
  width: min(520px, 94vw);
  max-height: 92svh;
}

.poster-studio-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 18px;
  overflow-y: auto;
}

.poster-studio-tip {
  margin: 0;
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(245, 200, 76, 0.14);
  border: 1px solid rgba(245, 200, 76, 0.42);
  color: #fde68a;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}

html[data-studio-light="day"] .poster-studio-tip {
  color: #92400e;
  background: rgba(245, 158, 11, 0.14);
}

.poster-studio-media {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 62svh;
  border-radius: 14px;
  border: 1.5px solid rgba(245, 200, 76, 0.48);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
  -webkit-touch-callout: default !important;
  -webkit-user-select: auto !important;
  user-select: auto !important;
  pointer-events: auto !important;
}

.poster-studio-media[hidden] {
  display: none !important;
}

.poster-studio-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

/* ---------- 4. 好友同盒 PK 弹窗 ---------- */
.pk-sheet {
  width: min(860px, 95vw);
  max-height: 90svh;
}

.pk-modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pk-fair-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.36);
  color: #6ee7b7;
  font-size: 12px;
  font-weight: 700;
  width: fit-content;
}

html[data-studio-light="day"] .pk-fair-pill {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
}

.pk-setup-wrap,
.pk-invite-hero,
.pk-stage-live,
.pk-result-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pk-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pk-label {
  font-size: 12.5px;
  font-weight: 800;
  color: #cbd5e1;
  letter-spacing: 0.02em;
}

html[data-studio-light="day"] .pk-label {
  color: #334155;
}

.pk-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pk-mode-card,
.pk-choice-chip {
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.04);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pk-mode-card strong,
.pk-choice-chip strong {
  font-size: 14px;
}

.pk-mode-card span,
.pk-choice-chip span {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.45;
}

.pk-mode-card.active,
.pk-choice-chip.active {
  border-color: #f5c84c;
  background: rgba(245, 200, 76, 0.14);
}

html[data-studio-light="day"] .pk-mode-card,
html[data-studio-light="day"] .pk-choice-chip {
  background: rgba(15, 23, 42, 0.04);
  color: #0f172a;
}

.pk-chip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pk-nick-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pk-nick-row label {
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
}

html[data-studio-light="day"] .pk-nick-row label {
  color: #334155;
}

.pk-cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pk-cta-row.left {
  justify-content: flex-start;
}

.pk-big-btn {
  min-width: 240px;
  height: 44px;
  font-size: 14.5px;
}

.pk-invite-hero {
  align-items: center;
  text-align: center;
  padding: 16px 8px;
}

.pk-invite-title {
  margin: 0;
  font-size: 22px;
  color: #fde68a;
}

html[data-studio-light="day"] .pk-invite-title {
  color: #b45309;
}

.pk-invite-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: #cbd5e1;
}

html[data-studio-light="day"] .pk-invite-desc {
  color: #334155;
}

/* 逐包开撕动画 */
.pk-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(245, 200, 76, 0.28);
}

.pk-live-tag {
  display: block;
  font-size: 11.5px;
  color: #fde68a;
  font-weight: 700;
}

.pk-live-meter {
  text-align: right;
}

.pk-live-meter span {
  display: block;
  font-size: 11px;
  color: #94a3b8;
}

.pk-live-meter strong {
  font-size: 24px;
  color: #34d399;
}

.pk-live-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  max-height: 42svh;
  overflow-y: auto;
  padding: 4px;
}

.pk-feed-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
  animation: pkTilePop 0.22s ease-out;
}

.pk-feed-tile.is-hit {
  border-color: rgba(56, 189, 248, 0.65);
}

.pk-feed-tile.is-major {
  border-color: #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.34);
}

.pk-feed-tile img {
  width: 100%;
  aspect-ratio: 500 / 698;
  object-fit: cover;
  border-radius: 7px;
}

.pk-feed-pack {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.82);
  color: #e2e8f0;
  font-size: 10px;
  font-weight: 700;
}

.pk-feed-tile strong {
  font-size: 11.5px;
  color: #fde68a;
}

.pk-feed-tile em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 700;
  color: #34d399;
}

@keyframes pkTilePop {
  from { opacity: 0; transform: scale(0.86) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* 结算与红蓝双人对峙 */
.pk-hero-card {
  display: flex;
  gap: 18px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(244, 63, 94, 0.38);
  align-items: center;
}

html[data-studio-light="day"] .pk-hero-card {
  background: rgba(15, 23, 42, 0.04);
}

.pk-hero-thumb {
  width: 132px;
  flex-shrink: 0;
  cursor: pointer;
}

.pk-hero-thumb img {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.5);
}

.pk-hero-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.pk-hero-info h3,
.pk-hero-info p {
  margin: 0;
}

.pk-score-big {
  font-size: 28px;
  font-weight: 900;
  color: #34d399;
}

.pk-score-big small {
  font-size: 14px;
  font-weight: 700;
  color: #fde68a;
}

.pk-side-badge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  width: fit-content;
}

.pk-side-badge.red {
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(251, 113, 133, 0.45);
  color: #fda4af;
}

.pk-side-badge.blue {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

html[data-studio-light="day"] .pk-side-badge.red { color: #be123c; }
html[data-studio-light="day"] .pk-side-badge.blue { color: #0369a1; }

.pk-hits-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pk-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}

.pk-mini-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  cursor: pointer;
  text-align: center;
}

.pk-mini-card img {
  width: 100%;
  border-radius: 6px;
}

.pk-mini-card span {
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pk-mini-card strong {
  font-size: 11.5px;
  color: #34d399;
}

.pk-verdict-banner {
  padding: 14px 16px;
  border-radius: 14px;
  text-align: center;
  border: 1.5px solid rgba(245, 200, 76, 0.45);
  background: rgba(245, 200, 76, 0.1);
}

.pk-verdict-banner.win {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.12);
}

.pk-verdict-banner.lose {
  border-color: rgba(244, 63, 94, 0.55);
  background: rgba(244, 63, 94, 0.12);
}

.pk-verdict-banner h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.pk-verdict-banner p {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: #cbd5e1;
}

html[data-studio-light="day"] .pk-verdict-banner p { color: #334155; }

.pk-tug-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.5);
}

.pk-tug-bar .tug-a {
  background: linear-gradient(90deg, #f43f5e, #fb7185);
}

.pk-tug-bar .tug-b {
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
}

.pk-vs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.pk-vs-divider {
  font-size: 20px;
  font-weight: 900;
  color: #f5c84c;
  font-style: italic;
}

.pk-vs-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.22);
  text-align: center;
}

html[data-studio-light="day"] .pk-vs-col {
  background: rgba(15, 23, 42, 0.04);
}

.pk-vs-col.is-winner {
  border-color: #facc15;
  box-shadow: 0 0 22px rgba(250, 204, 21, 0.22);
}

.pk-vs-name {
  font-size: 15px;
}

.pk-vs-val {
  font-size: 26px;
  font-weight: 900;
  color: #34d399;
}

.pk-vs-roi {
  font-size: 12px;
  color: #94a3b8;
}

.pk-vs-card-btn {
  margin-top: 6px;
  width: 100%;
  max-width: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  cursor: pointer;
}

.pk-vs-card-btn img {
  width: 100%;
  border-radius: 8px;
}

.pk-vs-card-btn span {
  font-size: 11.5px;
  font-weight: 700;
}

.pk-vs-card-btn em {
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  color: #fde68a;
}

/* ---------- 5. 首访 3 秒轻引导浮层 ---------- */
.onboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
}

.onboard-overlay[hidden] {
  display: none !important;
}

.onboard-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 16, 0.78);
}

.onboard-card {
  position: relative;
  width: min(440px, 94vw);
  padding: 22px 20px 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(16, 23, 42, 0.98), rgba(8, 12, 24, 0.98));
  border: 1.5px solid rgba(245, 200, 76, 0.48);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.onboard-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #f5c84c;
  text-transform: uppercase;
}

.onboard-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.onboard-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.onboard-steps li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  line-height: 1.45;
  color: #cbd5e1;
}

.onboard-steps li strong {
  color: #f8fafc;
  display: block;
  margin-bottom: 2px;
}

.onboard-step-num {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: rgba(245, 200, 76, 0.2);
  border: 1px solid rgba(245, 200, 76, 0.55);
  color: #fde047;
  font-size: 12px;
  font-weight: 900;
}

.onboard-nick-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.onboard-nick-row label {
  font-size: 12.5px;
  color: #94a3b8;
  white-space: nowrap;
}

.onboard-start-btn {
  width: 100%;
  height: 44px;
  font-size: 15px;
}

/* ---------- 6. 移动端与微信 XWeb 安全收口 (<= 768px) ---------- */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
  .pk-duel-btn {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

@media (max-width: 768px) {
  .pk-duel-btn {
    width: 32px;
    height: 32px;
    padding: 0;
  }

  .pk-duel-btn span {
    display: none;
  }

  .profile-nick-input,
  .pk-nick-input,
  .onboard-nick-input,
  .profile-import-textarea {
    font-size: 16px;
  }

  .pk-mode-grid,
  .pk-chip-grid {
    grid-template-columns: 1fr;
  }

  .pk-hero-card {
    flex-direction: column;
    text-align: center;
  }

  .pk-cta-row.left {
    justify-content: center;
  }

  .pk-vs-grid {
    grid-template-columns: 1fr;
  }

  .pk-vs-divider {
    text-align: center;
  }
}
