/* 和 CZ 合影 · 极简一页式双端样式（网页版 + 手机版） */
:root {
  --bg: #0b0e11;
  --surface: #151a22;
  --border: rgba(255, 255, 255, 0.09);
  --border-hi: rgba(255, 255, 255, 0.18);
  --gold: #f0b90b;
  --gold-bright: #fcd535;
  --gold-soft: rgba(240, 185, 11, 0.13);
  --text: #f3f5f8;
  --muted: #98a2b3;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image: radial-gradient(circle at 50% 0%, rgba(240, 185, 11, 0.08), transparent 46%);
}

.hidden {
  display: none !important;
}

/* 居中单页舞台 */
.studio-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom));
}

.photo-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.52);
  transition: border-color 0.2s ease;
}

.photo-card.drag-over {
  border-color: var(--gold);
}

.card-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #12151a;
  display: grid;
  place-items: center;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text);
}

.canvas-wrap {
  position: relative;
  width: min(100%, calc((100vh - 300px) * 762 / 1024));
  aspect-ratio: 762 / 1024;
  border-radius: 13px;
  overflow: hidden;
  background: #0d1015;
  touch-action: none;
  user-select: none;
}

/* 极简旋转微调条 */
.rotate-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.rot-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.rot-btn:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.rot-val {
  min-width: 42px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}

.rotate-bar input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
  cursor: pointer;
}

.rotate-bar input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 2px solid var(--surface);
}

#stageCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.empty-guide {
  position: absolute;
  top: 20%;
  right: 4%;
  width: 47%;
  height: 72%;
  border-radius: 14px;
  border: 1.5px dashed rgba(255, 255, 255, 0.78);
  background: rgba(14, 18, 24, 0.42);
  backdrop-filter: blur(4px);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.empty-guide:hover {
  background: rgba(14, 18, 24, 0.56);
  border-color: var(--gold-bright);
}

.guide-title {
  font-size: 14px;
  font-weight: 700;
}

.guide-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.82);
}

.stage-loading {
  position: absolute;
  inset: 0;
  background: rgba(11, 14, 17, 0.76);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 15;
  font-size: 13px;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--gold);
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 按钮 */
.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  text-decoration: none;
  transition: filter 0.15s ease;
  white-space: nowrap;
}

.btn-sm {
  padding: 6px 13px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-lg {
  width: 100%;
  padding: 12px 16px;
  font-size: 14.5px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #12151a;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.action-bar {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.action-bar-2 {
  grid-template-columns: 1fr 1.6fr;
}

/* 底部专属编号徽章 */
.counter-banner {
  width: 100%;
  padding: 9px 14px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  transition: all 0.25s ease;
}

.counter-banner strong {
  color: var(--gold-bright);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  margin: 0 2px;
}

.counter-banner.is-ranked {
  background: var(--gold-soft);
  border-color: rgba(240, 185, 11, 0.45);
  color: var(--text);
}

.counter-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(240, 185, 11, 0.7);
  flex-shrink: 0;
}

/* 作者署名与免责声明 */
.card-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding-top: 2px;
}

.author-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.author-link:hover {
  border-color: rgba(240, 185, 11, 0.5);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

.author-link strong {
  color: var(--text);
  font-weight: 600;
}

.author-link:hover strong {
  color: var(--gold-bright);
}

.author-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(240, 185, 11, 0.45);
}

.x-icon {
  opacity: 0.75;
}

.disclaimer {
  font-size: 11px;
  color: #667085;
  text-align: center;
}

/* 手机端长按保存弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: 15px;
  overflow: hidden;
}

.modal-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h3 {
  font-size: 15px;
}

.icon-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.modal-body {
  padding: 14px 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.modal-body img {
  max-height: 56vh;
  max-width: 100%;
  border-radius: 9px;
}

.modal-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast 放在顶部，避免遮挡底部的合影编号条 */
.toast-container {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
  max-width: 92vw;
}

.toast {
  background: rgba(20, 24, 31, 0.96);
  color: var(--text);
  border: 1px solid var(--border-hi);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}

.toast.toast-gold {
  border-color: rgba(240, 185, 11, 0.6);
  color: var(--gold-bright);
}

.toast.toast-error {
  border-color: rgba(246, 70, 93, 0.6);
  color: #ff8c9b;
}

/* 手机端自适应 */
@media (max-width: 680px) {
  .studio-page {
    padding: calc(10px + env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom));
  }

  .photo-card {
    padding: 12px;
    gap: 11px;
    border-radius: 16px;
  }

  .canvas-wrap {
    width: min(100%, calc((100vh - 275px) * 762 / 1024));
  }

  .empty-guide svg {
    width: 46px;
    height: 58px;
  }

  .guide-title {
    font-size: 13px;
  }
}
