/* =========================================================
   前台主题 · 暗夜香槟（Noir & Champagne）
   仅在 index.html（body.front）生效，不影响后台
   ========================================================= */

body.front {
  --paper: #0a090c;
  --surface: #141118;
  --surface-2: #1a1620;
  --ink: #f8f2e8;
  --ink-2: #bdb1a3;
  --ink-3: #8a7f74;
  --line: rgba(224, 189, 140, 0.16);
  --line-2: rgba(255, 255, 255, 0.07);
  --accent: #e0bd8c;
  --accent-2: #f2d7b0;
  --accent-soft: rgba(224, 189, 140, 0.12);
  --gold: #e0bd8c;
  --gold-deep: #c39a63;
  --noir: #0a090c;
  --noir-2: #12101a;
  --shadow-lg: 0 40px 90px -46px rgba(0, 0, 0, 0.9);

  background: var(--noir);
  color: var(--ink);
}

body.front ::selection {
  background: rgba(224, 189, 140, 0.28);
  color: #fff;
}

/* ---------- 氛围背景 ---------- */

.aura {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(820px 620px at 14% 8%, rgba(224, 189, 140, 0.16), rgba(224, 189, 140, 0) 62%),
    radial-gradient(760px 560px at 92% 86%, rgba(154, 72, 92, 0.2), rgba(154, 72, 92, 0) 66%),
    radial-gradient(680px 460px at 52% 112%, rgba(224, 189, 140, 0.1), rgba(224, 189, 140, 0) 72%),
    linear-gradient(180deg, #0b0a0d 0%, #08070a 100%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 容器 ---------- */

body.front .shell {
  max-width: 1180px;
  padding: 48px 28px 64px;
  flex-direction: column;
  justify-content: center;
  gap: 34px;
  position: relative;
  z-index: 1;
}

body.front .hero {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.1fr) minmax(268px, 0.8fr);
  grid-template-areas:
    "portrait copy qr"
    "portrait acts qr";
  align-items: center;
  column-gap: 42px;
  row-gap: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  animation: rise 0.75s var(--ease) both;
}

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

/* ---------- 人像主视觉 ---------- */

.portrait {
  grid-area: portrait;
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 26px;
  overflow: hidden;
  background: #131019;
  box-shadow:
    0 46px 90px -44px rgba(224, 189, 140, 0.42),
    0 26px 60px -30px rgba(0, 0, 0, 0.9),
    inset 0 0 0 1px rgba(224, 189, 140, 0.34);
  animation: floaty 9s ease-in-out infinite;
  will-change: transform;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 24%;
  display: block;
  filter: saturate(1.04) contrast(1.03);
}

/* 底部与两侧融入背景，同时压掉素材水印区 */
.portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to top, rgba(10, 9, 12, 0.74) 0%, rgba(10, 9, 12, 0.34) 9%, rgba(10, 9, 12, 0.08) 18%, rgba(10, 9, 12, 0) 26%),
    linear-gradient(to right, rgba(10, 9, 12, 0.28) 0%, rgba(10, 9, 12, 0) 22%);
}

.portrait-sheen {
  position: absolute;
  inset: -40% -70%;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 44%, rgba(255, 240, 218, 0.16) 50%, transparent 56%);
  animation: sheen 11s ease-in-out 1.6s infinite;
}

@keyframes sheen {
  0%, 100% { transform: translateX(-62%); }
  50% { transform: translateX(62%); }
}

.portrait-tag {
  position: absolute;
  left: 16px;
  bottom: 15px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px 6px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: #f3e6d3;
  background: rgba(20, 16, 22, 0.55);
  border: 1px solid rgba(224, 189, 140, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.portrait-tag .pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7ee2a8;
  box-shadow: 0 0 0 3px rgba(126, 226, 168, 0.16);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- 文案 ---------- */

body.front .hero-copy {
  grid-area: copy;
  align-self: end;
  padding: 4px 0 0;
}

.hero-actions {
  grid-area: acts;
  align-self: start;
  padding-bottom: 4px;
}

body.front .eyebrow {
  margin: 0 0 24px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--gold);
  opacity: 0.82;
}

body.front .eyebrow .dot {
  width: 5px;
  height: 5px;
  background: var(--gold);
  box-shadow: 0 0 12px 2px rgba(224, 189, 140, 0.5);
}

body.front .title {
  font-family: var(--serif);
  font-size: clamp(30px, 3.3vw, 43px);
  line-height: 1.24;
  letter-spacing: 0.005em;
  font-weight: 700;
  color: #fcf6ec;
  text-shadow: 0 0 46px rgba(224, 189, 140, 0.16);
}

body.front .subtitle {
  margin: 20px 0 0;
  font-size: 14.5px;
  line-height: 1.9;
  color: #c9bdb0;
  max-width: 32em;
}

body.front .id-block {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid rgba(224, 189, 140, 0.18);
  gap: 12px;
}

body.front .id-label {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--ink-3);
}

body.front .id-value {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #f6e9d6;
  text-shadow: 0 0 30px rgba(224, 189, 140, 0.22);
}

body.front .id-value.is-empty {
  color: var(--ink-3);
  text-shadow: none;
}

body.front .actions {
  margin-top: 28px;
  gap: 10px;
}

body.front .badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 26px 0 0;
  padding: 0;
}

body.front .badges li {
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: #b9a893;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(224, 189, 140, 0.16);
  background: rgba(255, 255, 255, 0.028);
}

/* ---------- 按钮 ---------- */

body.front .btn {
  border-radius: 12px;
  height: 48px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

body.front .btn-primary {
  background: linear-gradient(135deg, #f0d5ad 0%, #dcb583 46%, #c59a63 100%);
  color: #1c1207;
  font-weight: 600;
  box-shadow:
    0 16px 36px -18px rgba(224, 189, 140, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

body.front .btn-primary:not([disabled]):hover {
  background: linear-gradient(135deg, #f7e1c1 0%, #e5c191 46%, #ceA46e 100%);
  box-shadow:
    0 20px 44px -18px rgba(224, 189, 140, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

body.front .btn-ghost {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(224, 189, 140, 0.24);
  color: #f2e7d8;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

body.front .btn-ghost:not([disabled]):hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(224, 189, 140, 0.48);
}

body.front .btn-sm {
  height: 34px;
  font-size: 12.5px;
  border-radius: 9px;
}

body.front .btn:focus-visible {
  outline: 2px solid rgba(224, 189, 140, 0.75);
  outline-offset: 3px;
}

body.front .btn.is-busy::after {
  border-color: rgba(28, 18, 7, 0.25);
  border-top-color: #1c1207;
}

body.front .btn-ghost.is-busy::after {
  border-color: rgba(255, 255, 255, 0.22);
  border-top-color: #f2e7d8;
}

/* ---------- 二维码 ---------- */

body.front .hero-qr {
  grid-area: qr;
  position: relative;
  align-self: center;
  display: flex;
  justify-content: center;
}

body.front .hero-qr::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(224, 189, 140, 0) 0deg,
    rgba(224, 189, 140, 0.5) 42deg,
    rgba(224, 189, 140, 0) 96deg,
    rgba(224, 189, 140, 0) 190deg,
    rgba(224, 189, 140, 0.34) 232deg,
    rgba(224, 189, 140, 0) 288deg
  );
  filter: blur(26px);
  opacity: 0.75;
  animation: halo 18s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes halo {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.qr-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 292px;
  padding: 24px 22px 20px;
  border-radius: 26px;
  text-align: center;
  background: linear-gradient(158deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.022));
  border: 1px solid rgba(224, 189, 140, 0.24);
  box-shadow:
    0 44px 84px -44px rgba(0, 0, 0, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.qr-label {
  margin: 0 0 16px;
  font-size: 10.5px;
  letter-spacing: 0.24em;
  color: var(--gold);
  opacity: 0.85;
  text-transform: uppercase;
}

body.front .qr-frame {
  max-width: none;
  padding: 11px;
  border-radius: 16px;
  background: #fff;
  border: 0;
  box-shadow:
    0 0 0 1px rgba(224, 189, 140, 0.5),
    0 18px 40px -22px rgba(0, 0, 0, 0.8);
}

body.front .qr-frame.is-empty {
  background: rgba(255, 255, 255, 0.9);
}

body.front .qr-frame img {
  border-radius: 0;
}

body.front .qr-empty {
  color: #8a7f74;
  font-size: 12.5px;
}

body.front .qr-skeleton {
  inset: 11px;
  border-radius: 8px;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.16) 20%, rgba(255, 255, 255, 0.32) 40%, rgba(255, 255, 255, 0.16) 60%);
  background-size: 220% 100%;
}

body.front .qr-hint {
  margin: 16px 0 0;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
}

/* ---------- 页脚 ---------- */

body.front .footnote {
  grid-area: auto;
  margin: 0;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: rgba(138, 127, 116, 0.85);
}

body.front .footnote a {
  color: rgba(224, 189, 140, 0.72);
  border-bottom: 1px solid rgba(224, 189, 140, 0.24);
  padding-bottom: 1px;
  text-decoration: none;
}

body.front .footnote a:hover {
  color: var(--gold);
  text-decoration: none;
}

/* ---------- 错误态 ---------- */

body.front .state {
  width: 100%;
  padding: 64px 24px;
}

body.front .state-title {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
}

body.front .state-desc {
  color: var(--ink-3);
}

/* ---------- Toast ---------- */

body.front .toast {
  background: rgba(24, 19, 28, 0.9);
  border: 1px solid rgba(224, 189, 140, 0.28);
  color: #f7ecdc;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.8), 0 0 30px -12px rgba(224, 189, 140, 0.4);
}

/* ---------- 保存图片层 ---------- */

body.front .sheet {
  background: rgba(6, 5, 8, 0.74);
}

body.front .sheet-inner {
  background: #16121c;
  border: 1px solid rgba(224, 189, 140, 0.2);
  color: var(--ink);
}

body.front .sheet-inner img {
  border-color: rgba(224, 189, 140, 0.24);
}

body.front .sheet-desc {
  color: var(--ink-3);
}

/* ---------- 吸底操作条 ---------- */

body.front .mobile-bar {
  background: rgba(10, 9, 12, 0.86);
  border-top: 1px solid rgba(224, 189, 140, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

body.front .mobile-bar .btn {
  height: 48px;
  font-size: 14px;
}

body.front .preview-badge {
  background: rgba(24, 19, 28, 0.9);
  border: 1px solid rgba(224, 189, 140, 0.3);
  color: #f2e5d3;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1080px) {
  body.front .hero {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    grid-template-areas:
      "portrait copy"
      "portrait acts"
      "qr qr";
    row-gap: 26px;
    column-gap: 30px;
    justify-items: stretch;
  }

  body.front .hero-copy {
    align-self: end;
    text-align: left;
  }

  .hero-actions {
    align-self: start;
  }

  .portrait {
    width: 100%;
    max-width: none;
    aspect-ratio: 4 / 5;
    animation: none;
  }

  .portrait img {
    object-position: 50% 22%;
  }

  .portrait::after {
    background:
      linear-gradient(to top, rgba(10, 9, 12, 0.74) 0%, rgba(10, 9, 12, 0.34) 9%, rgba(10, 9, 12, 0.08) 18%, rgba(10, 9, 12, 0) 26%),
      linear-gradient(to right, rgba(10, 9, 12, 0.28) 0%, rgba(10, 9, 12, 0) 22%);
  }

  body.front .hero-qr {
    width: 100%;
    margin-top: 6px;
  }

  .qr-panel {
    max-width: 320px;
  }
}

@media (max-width: 720px) {
  html,
  body.front {
    height: 100%;
    overflow: hidden;
  }

  body.front {
    /* 二维码边长：随屏幕自适应，保证微信长按可识别的最小尺寸 */
    --qr: min(212px, 54vw, 29vh);
  }

  body.front .page {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    flex: 0 0 auto;
  }

  body.front .shell {
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    max-width: none;
    padding: calc(10px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));
    gap: 0;
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
  }

  /* 一屏自适应：人像吃掉剩余高度，其余按内容固定 */
  body.front .hero {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    grid-template-columns: none;
    grid-template-areas: none;
    gap: clamp(8px, 1.4vh, 15px);
    animation: none;
  }

  .portrait {
    flex: 1 1 auto;
    min-height: 132px;
    height: auto;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 20px;
    animation: none;
    box-shadow:
      0 22px 44px -28px rgba(224, 189, 140, 0.4),
      0 14px 30px -18px rgba(0, 0, 0, 0.85),
      inset 0 0 0 1px rgba(224, 189, 140, 0.3);
  }

  .portrait img {
    object-position: 50% 26%;
  }

  .portrait-tag {
    left: 12px;
    bottom: 11px;
    font-size: 10.5px;
    padding: 4px 10px 4px 9px;
  }

  /* 文案区压缩 */
  body.front .hero-copy {
    flex: 0 0 auto;
    padding: 0;
    align-self: auto;
  }

  body.front .eyebrow {
    margin-bottom: 9px;
    font-size: 9.5px;
    letter-spacing: 0.24em;
  }

  body.front .title {
    font-size: clamp(20px, 5.6vw, 26px);
    line-height: 1.28;
  }

  body.front .subtitle {
    margin-top: 7px;
    font-size: 12.5px;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  body.front .id-block {
    margin-top: 9px;
    padding-top: 9px;
    gap: 9px;
  }

  body.front .id-label {
    font-size: 9.5px;
    letter-spacing: 0.16em;
  }

  body.front .id-value {
    font-size: 15px;
    letter-spacing: 0.03em;
  }

  body.front .badges {
    display: none;
  }

  /* 二维码：完整展示、居中，img 无覆盖层，可长按识别 */
  body.front .hero-qr {
    order: 3;
    flex: 0 0 auto;
    width: 100%;
    margin-top: 0;
    justify-content: center;
  }

  .qr-panel {
    width: calc(var(--qr) + 26px);
    max-width: none;
    padding: 11px 13px 10px;
    border-radius: 18px;
    background: linear-gradient(158deg, rgba(30, 24, 36, 0.94), rgba(18, 14, 24, 0.96));
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .qr-label {
    margin-bottom: 7px;
    font-size: 9px;
    letter-spacing: 0.2em;
  }

  body.front .qr-frame {
    width: var(--qr);
    height: var(--qr);
    margin: 0 auto;
    padding: 7px;
    border-radius: 14px;
  }

  body.front .qr-frame img {
    /* 微信长按识别依赖原生图片命中，这里不做任何裁剪与遮罩 */
    -webkit-touch-callout: default;
    touch-action: manipulation;
  }

  body.front .qr-hint {
    margin-top: 8px;
    font-size: 10.5px;
    letter-spacing: 0.06em;
  }

  /* 按钮回到页内，位于一屏最底部，拇指可达 */
  .hero-actions {
    order: 4;
    flex: 0 0 auto;
    padding: 0;
  }

  body.front .actions {
    display: flex;
    flex-wrap: nowrap;
    margin-top: 0;
    gap: 8px;
  }

  body.front .actions .btn {
    flex: 1 1 0;
    min-width: 0;
    height: 44px;
    padding: 0 10px;
    font-size: 13px;
    border-radius: 11px;
  }

  body.front .actions .btn-primary {
    flex: 1.45 1 0;
  }

  body.front .mobile-bar {
    display: none;
  }

  body.front .footnote {
    display: none;
  }

  body.front .state {
    padding: 36px 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portrait,
  .portrait-sheen,
  body.front .hero-qr::before,
  .portrait-tag .pip {
    animation: none !important;
  }
}

/* 矮屏手机（iPhone SE 等）：进一步压缩，保证人像仍有构图空间 */
@media (max-width: 720px) and (max-height: 730px) {
  body.front {
    --qr: min(206px, 52vw, 29vh);
  }

  body.front .hero {
    gap: 8px;
  }

  body.front .eyebrow {
    margin-bottom: 6px;
  }

  body.front .subtitle {
    -webkit-line-clamp: 1;
    margin-top: 6px;
  }

  body.front .id-block {
    margin-top: 7px;
    padding-top: 7px;
  }

  body.front .qr-hint {
    margin-top: 6px;
  }
}
