:root {
  --bg-deep: #0a0908;
  --bg-glow: #1a1510;
  --surface: rgba(24, 20, 17, 0.72);
  --surface-strong: rgba(32, 27, 23, 0.92);
  --border: rgba(212, 165, 116, 0.22);
  --border-strong: rgba(232, 196, 154, 0.45);
  --gold: #e8c49a;
  --gold-soft: #d4a574;
  --amber: #c9895a;
  --cream: #faf6ef;
  --muted: #9c958c;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  font-family: "Outfit", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(201, 137, 90, 0.18), transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(212, 165, 116, 0.08), transparent 35%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-glow) 45%, #120f0d 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.hero {
  position: relative;
  text-align: center;
  padding: 12px 0 36px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--gold-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.hero-title {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 700;
  line-height: 1.15;
  background: linear-gradient(135deg, #fff7ed 0%, var(--gold) 55%, var(--amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  margin: 12px 0 0;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--gold-soft);
  font-weight: 500;
}

.hero-desc {
  margin: 16px auto 0;
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

.config-btn {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold);
  font-size: 0.875rem;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  backdrop-filter: blur(12px);
}

.config-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.08);
}

/* GPU 模式切换按钮：header 双按钮布局（2026-09-19 复用回忆录/照片提问平台能力） */
.header-actions {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 10px;
}

.header-actions .config-btn {
  position: static;
}

.gpu-mode-btn.mode-day #gpu-mode-icon { color: #f5c451; }
.gpu-mode-btn.mode-night #gpu-mode-icon { color: #8ab4f8; }
.gpu-mode-btn.mode-busy { opacity: 0.6; pointer-events: none; }

@media (max-width: 640px) {
  .header-actions {
    position: static;
    justify-content: center;
    margin-bottom: 16px;
  }
}

/* 合影背景选择器（2026-09-19） */
.bg-select {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text, #eee);
  font-size: 0.9rem;
}

.bg-hint {
  margin: 8px 2px 0;
  font-size: 0.8rem;
  color: var(--gold);
  opacity: 0.75;
}

.progress-bar-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.step-track {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
}

.step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.step-dot.active {
  border-color: var(--gold);
  background: linear-gradient(135deg, var(--gold-soft), var(--amber));
  color: #1c1410;
  box-shadow: 0 0 0 4px rgba(232, 196, 154, 0.15);
}

.step-dot.done {
  border-color: rgba(232, 196, 154, 0.5);
  background: rgba(232, 196, 154, 0.12);
  color: var(--gold);
}

.step-line {
  flex: 1;
  height: 2px;
  min-width: 24px;
  margin: 0 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 1px;
  overflow: hidden;
}

.step-line-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-soft), var(--amber));
  transition: width 0.35s ease;
}

.step-line-fill.done {
  width: 100%;
}

.step-meta {
  text-align: right;
  min-width: 120px;
}

.step-meta-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--gold-soft);
  font-weight: 600;
}

.step-meta-title {
  margin: 4px 0 0;
  font-size: 0.95rem;
  color: var(--cream);
}

.panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel-title {
  margin: 0 0 20px;
  font-family: "Noto Serif SC", serif;
  font-size: 1.35rem;
  color: var(--gold);
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .split-grid {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
  }
}

.photo-stage {
  position: relative;
  min-height: 320px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.2)),
    #14110f;
}

.photo-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

#photo-upload-area {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  cursor: pointer;
  border: 2px dashed rgba(232, 196, 154, 0.28);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, background 0.2s ease;
}

#photo-upload-area:hover {
  border-color: rgba(232, 196, 154, 0.55);
  background: rgba(255, 255, 255, 0.02);
}

.upload-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 196, 154, 0.1);
  color: var(--gold);
  font-size: 1.6rem;
  margin-bottom: 16px;
}

.upload-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.upload-hint {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

#camera-container,
#photo-preview-container,
#result-preview-container {
  min-height: 320px;
}

#camera-preview,
#photo-preview,
#result-preview {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.camera-container:hover .camera-overlay {
  opacity: 1;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-soft) 0%, var(--amber) 100%);
  color: #1a120d;
  box-shadow: 0 10px 24px rgba(201, 137, 90, 0.25);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 14px 28px rgba(201, 137, 90, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--gold);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tip-card {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.18);
}

.tip-card h4 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--gold-soft);
}

.tip-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tip-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
  padding: 5px 0;
}

.tip-list li i {
  color: var(--gold);
  margin-top: 3px;
}

.template-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .template-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.template-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  background: rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.template-card:hover {
  transform: translateY(-4px);
}

.template-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(232, 196, 154, 0.12), 0 16px 40px rgba(0, 0, 0, 0.35);
}

.template-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-thumb-icon {
  font-size: 3rem;
  color: var(--gold);
  opacity: 0.8;
  z-index: 1;
}

.template-thumb-blueflower {
  background: linear-gradient(135deg, #5C9DFF, #9DC4F5, #E8F1FF);
}
.template-thumb-vintage {
  background: linear-gradient(135deg, #8B7355, #5C4033, #3E2723);
}
.template-thumb-campus {
  background: linear-gradient(135deg, #1565C0, #42A5F5, #90CAF9);
}
.template-thumb-emotional {
  background: linear-gradient(135deg, #E65100, #FF9800, #FFC107);
}

.template-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.template-card:hover .template-thumb img {
  transform: scale(1.04);
}

.template-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(10, 9, 8, 0.85) 100%);
}

.template-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 9, 8, 0.75);
  border: 2px solid var(--gold);
  color: var(--gold);
  z-index: 2;
}

.template-body {
  padding: 14px 14px 16px;
}

.template-body h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--cream);
}

.template-body p {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.control-group label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold-soft);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.slider-thumb::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.slider-value {
  min-width: 36px;
  text-align: center;
  font-weight: 700;
  color: var(--cream);
}

.slider-unit {
  font-size: 0.85rem;
  color: var(--muted);
}

.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

#result-placeholder,
#generating-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

#result-preview-container {
  position: relative;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 16px;
}

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

.fade-in {
  animation: fadeIn 0.55s ease;
}

.slide-in {
  animation: slideIn 0.45s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

#retake-photo {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 3;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: rgba(10, 9, 8, 0.72);
  color: var(--cream);
  font-size: 0.82rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(100%, 440px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  color: var(--gold);
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gold-soft);
}

.field input,
.field select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--cream);
  font-size: 0.925rem;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--border-strong);
}

.field-hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.site-footer {
  margin-top: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.hidden {
  display: none !important;
}

#generate-status.error {
  color: #fca5a5 !important;
}
