/* ============================================================
   Canon Photo · 喜庆主题样式
   兼容微信内置浏览器（X5 内核）与手机端
   ============================================================ */

:root {
  --red-900: #6d0f11;
  --red-800: #8e1616;
  --red-700: #a51c1c;
  --red-600: #c0272d;
  --gold-400: #f3d27a;
  --gold-500: #e0b451;
  --gold-600: #c8993a;
  --gold-line: rgba(224, 180, 81, .55);
  --ivory: #fff8ea;
  --ink: #3a1d12;
  --muted: #8c6f5c;
  --panel: #ffffff;
  --line: #ead9bd;
  --shadow: 0 18px 44px rgba(70, 12, 12, .22);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  background: #f3ece2;
  color: var(--ink);
}

body { touch-action: manipulation; }

a { text-decoration: none; }

.brand {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold-400);
}

.tip {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* ============ 上传首页（喜庆） ============ */

.festive-page {
  min-height: 100vh;
  min-height: 100vh;
  background:
    radial-gradient(520px 320px at 50% -60px, rgba(240, 200, 120, .28), transparent 70%),
    radial-gradient(360px 260px at 12% 108%, rgba(255, 214, 140, .16), transparent 70%),
    linear-gradient(160deg, #a51c1c 0%, #8e1616 48%, #6d0f11 100%);
  overflow-x: hidden;
  position: relative;
}

.festive-wrap {
  position: relative;
  z-index: 2;
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 22px calc(40px + env(safe-area-inset-bottom));
  text-align: center;
}

.seal {
  width: 66px;
  height: 66px;
  line-height: 66px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: linear-gradient(145deg, #d63b32, #a51c1c);
  border: 2px solid var(--gold-400);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .28);
  color: #ffe9b0;
  font-size: 38px;
  font-weight: 700;
  transform: rotate(-4deg);
}

.festive-title {
  margin: 0;
  font-size: 27px;
  line-height: 1.35;
  font-weight: 700;
  color: #ffe9b0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .35);
  letter-spacing: 1px;
}

.festive-sub {
  margin: 10px 0 0;
  font-size: 14px;
  color: rgba(255, 233, 176, .86);
}

.festive-card {
  margin-top: 26px;
  padding: 26px 20px 22px;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--ivory) 0%, #fdf1dd 100%);
  border: 1px solid var(--gold-line);
  box-shadow: var(--shadow);
  text-align: center;
}

.card-tip {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.75;
  color: #6d4a3a;
}

.card-tip strong {
  color: var(--red-600);
  font-size: 18px;
  padding: 0 2px;
}

.festive-btn {
  display: block;
  width: 100%;
  border: 0;
  cursor: pointer;
  color: #fff6e0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 17px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, #c0272d 0%, #a51c1c 100%);
  border: 1px solid var(--gold-500);
  box-shadow: 0 12px 26px rgba(165, 28, 28, .38);
  -webkit-appearance: none;
  appearance: none;
}

.festive-btn:active { transform: translateY(1px); }
.festive-btn:disabled { opacity: .65; cursor: not-allowed; }

.festive-btn__icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 20px;
  vertical-align: -1px;
}

.festive-btn--small {
  display: inline-block;
  width: auto;
  font-size: 14px;
  letter-spacing: 0;
  padding: 10px 18px;
}

.festive-note {
  margin: 22px 0 0;
  font-size: 12px;
  color: rgba(255, 233, 176, .68);
}

/* 状态提示 */
.status {
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .6);
  color: var(--muted);
  word-break: break-all;
}
.status--loading { color: #a86a1c; border-color: #e7c893; background: #fff6e6; }
.status--success { color: #1f7a4d; border-color: #a8d8bd; background: #eefaf3; }
.status--error { color: #b3261e; border-color: #f0b6b1; background: #fdefee; }

/* 上传预览 */
.preview-row {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 10px;
}
.preview-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px;
  background: #fff;
  overflow: hidden;
}
.preview-item img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
  border-radius: 8px;
  -webkit-touch-callout: default;
  background: #f1e6d6;
}
.preview-item span {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 飘落花瓣 */
.petals {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.petal {
  position: absolute;
  top: -40px;
  width: 12px;
  height: 18px;
  border-radius: 60% 40% 55% 45%;
  background: linear-gradient(160deg, #f6dfa6, rgba(224, 180, 81, .25));
  opacity: .85;
  animation-name: petalFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes petalFall {
  0% { transform: translateY(-40px) rotate(0deg); opacity: 0; }
  10% { opacity: .85; }
  100% { transform: translateY(105vh) rotate(360deg); opacity: 0; }
}

/* ============ 登录页 ============ */

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(600px 340px at 50% -80px, rgba(240, 200, 120, .25), transparent 70%),
    linear-gradient(160deg, #a51c1c 0%, #8e1616 50%, #6d0f11 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 26px;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--ivory) 0%, #fdf1dd 100%);
  border: 1px solid var(--gold-line);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card .brand { color: var(--red-700); }
.login-card .tip { margin-bottom: 22px; }

.field { display: block; margin-bottom: 16px; text-align: left; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  outline: none;
}
.field input:focus {
  border-color: var(--red-600);
  box-shadow: 0 0 0 3px rgba(192, 39, 45, .15);
}

.primary-btn {
  width: 100%;
  margin-top: 6px;
  padding: 13px 18px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff6e0;
  background: linear-gradient(135deg, #c0272d, #a51c1c);
  box-shadow: 0 10px 22px rgba(165, 28, 28, .3);
}

.gallery-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

/* ============ 管理后台 ============ */

.console-page {
  min-height: 100vh;
  background:
    radial-gradient(700px 380px at 50% -120px, rgba(240, 200, 120, .18), transparent 70%),
    linear-gradient(180deg, #2a0d0e 0%, #1a0809 100%);
  color: #f0e6da;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(42, 13, 14, .9);
  border-bottom: 1px solid rgba(224, 180, 81, .3);
}
.topbar__actions { display: flex; align-items: center; }
.topbar__actions > * { margin-left: 10px; }
.user { color: rgba(240, 230, 218, .7); font-size: 14px; }

.ghost-btn, .danger-btn {
  display: inline-block;
  border: 1px solid rgba(224, 180, 81, .45);
  background: transparent;
  color: #f0e6da;
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
}
.ghost-btn:hover { border-color: var(--gold-400); color: var(--gold-400); }
.danger-btn:hover { border-color: #e0665c; color: #e0665c; }

.gallery { padding: 24px; max-width: 1400px; margin: 0 auto; }

.group { margin-bottom: 28px; }
.group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(240, 230, 218, .65);
  font-size: 13px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(224, 180, 81, .22);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-gap: 16px;
}

.cell {
  margin: 0;
  position: relative;
  background: #241012;
  border: 1px solid rgba(224, 180, 81, .25);
  border-radius: var(--radius);
  overflow: hidden;
}
.cell img {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
  cursor: zoom-in;
  background: #120607;
}
.cell figcaption {
  font-size: 11px;
  color: rgba(240, 230, 218, .6);
  padding: 9px 11px 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell__tools {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  opacity: 0;
}
.cell__tools > * { margin-left: 6px; }
.cell__dl, .cell__del {
  border: 0;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
}
.cell__dl {
  display: inline-block;
  color: #3a1d12;
  background: rgba(224, 180, 81, .94);
  text-decoration: none;
}
.cell__del {
  color: #fff;
  background: rgba(190, 45, 40, .92);
}
.cell:hover .cell__tools { opacity: 1; }

.empty {
  text-align: center;
  color: rgba(240, 230, 218, .6);
  padding: 80px 0;
  font-size: 15px;
}

/* 灯箱 */
.lightbox {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(10, 4, 4, .95);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 88vw;
  max-height: 82vh;
  border-radius: 10px;
}
.lightbox__close, .lightbox__nav {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 26px;
  line-height: 1;
  padding: 0;
}
.lightbox__close { top: 22px; right: 22px; }
.lightbox__nav--prev { left: 22px; top: 50%; margin-top: -22px; }
.lightbox__nav--next { right: 22px; top: 50%; margin-top: -22px; }
.lightbox__dl {
  position: absolute;
  top: 24px;
  left: 50%;
  margin-left: -70px;
  width: 140px;
  text-align: center;
  padding: 8px 12px;
  border-radius: 9px;
  color: #3a1d12;
  background: rgba(224, 180, 81, .95);
  font-size: 13px;
  text-decoration: none;
}
.lightbox__dl:hover { background: var(--gold-400); }
.lightbox__info {
  position: absolute;
  bottom: 22px;
  left: 50%;
  margin-left: -160px;
  width: 320px;
  text-align: center;
  color: rgba(240, 230, 218, .75);
  font-size: 13px;
  background: rgba(255, 255, 255, .07);
  padding: 7px 14px;
  border-radius: 8px;
}

/* ============ 打印告示 ============ */

.print-page {
  background: #e9e2d8;
  padding: 0 0 40px;
}

.print-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 14px 20px;
  background: #2a0d0e;
  color: #f0e6da;
  text-align: center;
}
.print-toolbar__tip { margin-left: 14px; font-size: 12px; color: rgba(240, 230, 218, .65); }
.print-toolbar__input {
  margin-left: 12px;
  padding: 7px 11px;
  width: 320px;
  max-width: 46vw;
  border-radius: 8px;
  border: 1px solid rgba(224, 180, 81, .45);
  background: rgba(255, 255, 255, .08);
  color: #f0e6da;
  font-size: 13px;
  outline: none;
}
.print-toolbar__input:focus { border-color: var(--gold-400); }
.print-toolbar__input::placeholder { color: rgba(240, 230, 218, .45); }

.poster {
  width: 210mm;
  height: 297mm;
  margin: 24px auto;
  padding: 12mm;
  box-sizing: border-box;
  background:
    radial-gradient(600px 300px at 50% -60px, rgba(243, 210, 122, .30), transparent 70%),
    linear-gradient(160deg, #a51c1c 0%, #8e1616 55%, #6d0f11 100%);
  box-shadow: 0 18px 50px rgba(60, 20, 10, .35);
  position: relative;
}

.poster__inner {
  height: 100%;
  border: 2px solid var(--gold-line);
  padding: 18mm 14mm;
  text-align: center;
  position: relative;
  color: #ffe9b0;
}

.poster__corner {
  position: absolute;
  width: 26mm;
  height: 26mm;
  border: 2px solid var(--gold-500);
}
.poster__corner--tl { left: 8mm; top: 8mm; border-right: 0; border-bottom: 0; }
.poster__corner--tr { right: 8mm; top: 8mm; border-left: 0; border-bottom: 0; }
.poster__corner--bl { left: 8mm; bottom: 8mm; border-right: 0; border-top: 0; }
.poster__corner--br { right: 8mm; bottom: 8mm; border-left: 0; border-top: 0; }

.poster__seal {
  width: 26mm;
  height: 26mm;
  line-height: 26mm;
  margin: 4mm auto 6mm;
  border-radius: 6mm;
  background: linear-gradient(145deg, #d63b32, #a51c1c);
  border: 1.5px solid var(--gold-400);
  font-size: 15mm;
  font-weight: 700;
  color: #ffe9b0;
}

.poster__title {
  margin: 0;
  font-size: 34pt;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff2cf;
}

.poster__subtitle {
  margin: 5mm 0 0;
  font-size: 13pt;
  color: rgba(255, 233, 176, .85);
}

.poster__divider {
  margin: 8mm 0;
  color: var(--gold-400);
  font-size: 12pt;
}
.poster__divider span {
  display: inline-block;
  width: 40mm;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
  vertical-align: middle;
  margin: 0 4mm;
}

.poster__qr { margin: 0 auto; }
.poster__qr-box {
  width: 72mm;
  height: 72mm;
  margin: 0 auto;
  padding: 4mm;
  background: #fff;
  border-radius: 3mm;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
}
.poster__qr-box img {
  display: block;
  width: 100%;
  height: 100%;
}
.poster__qr-tip {
  margin-top: 4mm;
  font-size: 11pt;
  color: rgba(255, 233, 176, .88);
}
.poster__qr-url {
  margin-top: 2mm;
  font-size: 9pt;
  color: rgba(255, 233, 176, .6);
  word-break: break-all;
  max-width: 110mm;
  margin-left: auto;
  margin-right: auto;
}
.poster__qr-fallback { padding: 10mm 4mm; font-size: 11pt; color: #6d0f11; }

.poster__steps {
  list-style: none;
  margin: 9mm auto 0;
  padding: 0;
  max-width: 120mm;
  text-align: left;
}
.poster__steps li {
  display: flex;
  align-items: center;
  margin-bottom: 4mm;
  font-size: 12pt;
  color: #ffeec4;
}
.poster__steps b {
  flex: 0 0 auto;
  width: 9mm;
  height: 9mm;
  line-height: 9mm;
  text-align: center;
  margin-right: 5mm;
  border-radius: 50%;
  background: var(--gold-500);
  color: #6d0f11;
  font-size: 11pt;
}
.poster__steps span { flex: 1 1 auto; }

.poster__blessing {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18mm;
  font-size: 13pt;
  letter-spacing: 3px;
  color: rgba(255, 233, 176, .9);
}

/* ============ 打印 ============ */

@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  html, body {
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-toolbar { display: none !important; }
  .print-page { padding: 0; background: #fff; }
  .poster {
    margin: 0;
    box-shadow: none;
    width: 210mm;
    height: 297mm;
  }
  .petals { display: none !important; }
}

/* ============ 移动端 ============ */

@media (max-width: 600px) {
  .festive-wrap { padding: 30px 18px calc(30px + env(safe-area-inset-bottom)); }
  .festive-title { font-size: 23px; }
  .festive-card { padding: 22px 16px 18px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .cell img { height: 120px; }
  .cell__tools { opacity: 1; }
  .topbar { padding: 12px 14px; }
  .gallery { padding: 16px; }
  .poster {
    width: 100%;
    height: auto;
    min-height: 120mm;
    padding: 8mm;
  }
  .poster__inner { padding: 12mm 8mm; }
  .poster__title { font-size: 22pt; }
  .poster__qr-box { width: 56mm; height: 56mm; }
  .poster__blessing { position: static; margin-top: 8mm; }
  .print-toolbar__tip { display: none; }
}
