/* R89 婚宴互动 · 全局样式 */
:root {
  --primary: #B76E79;
  --accent: #D4AF37;
  --bg: #FFF8F5;
  --text: #3D2C2E;
  --text-secondary: #8B7355;
  --card: #fff;
  --dark: #2D1B1E;
  --radius: 14px;
  --tabbar-h: 56px;
  --contact-footer-h: 72px;
}

[data-theme="t2"] { --primary: #C41E3A; --accent: #FFD700; --bg: #FFF5F5; --text: #4A1515; }
[data-theme="t3"] { --primary: #2D6A4F; --accent: #95D5B2; --bg: #F0FFF4; --text: #1B4332; }
[data-theme="t4"] { --primary: #C9A962; --accent: #F5E6C8; --bg: #FFFBF0; --text: #5C4A1F; }
[data-theme="t5"] { --primary: #7C3AED; --accent: #A78BFA; --bg: #0F0A1A; --text: #EDE9FE; --card: #1a1225; }
[data-theme="t6"] { --primary: #3B82F6; --accent: #93C5FD; --bg: #F0F9FF; --text: #1E3A5F; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: "PingFang SC", -apple-system, sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }

.btn-primary, .btn-outline {
  border-radius: 999px; padding: 12px 20px; font-size: 14px; font-weight: 600; cursor: pointer; border: 0;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-full { width: 100%; display: block; margin-top: 8px; text-align: center; }
.btn-sm { padding: 8px 14px; font-size: 12px; }
.card { background: var(--card); border-radius: var(--radius); margin: 0 16px 12px; padding: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.card h4 { margin: 0 0 10px; font-size: 15px; }
.p-desc, .empty-tip { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.empty-tip { text-align: center; padding: 24px; }
.stats-row { display: flex; text-align: center; }
.stats-row div { flex: 1; }
.stats-row strong { display: block; font-size: 22px; color: var(--primary); }
.stats-row span { font-size: 11px; color: var(--text-secondary); }

.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(0,0,0,0.78); color: #fff; padding: 12px 20px; border-radius: 8px; z-index: 400; }
.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-end; justify-content: center; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.modal__sheet { position: relative; background: var(--card); width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); }
.modal label { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.modal input { width: 100%; margin-top: 6px; border: 1px solid #E2E8F0; border-radius: 8px; padding: 10px; font-size: 14px; }

/* 时间轴 */
.timeline-wrap { overflow-x: auto; padding: 8px 12px 12px; -webkit-overflow-scrolling: touch; }
.timeline-bar { display: flex; align-items: center; min-width: max-content; gap: 0; }
.timeline-step { display: flex; flex-direction: column; align-items: center; width: 52px; flex-shrink: 0; cursor: default; }
.timeline-step__icon { width: 36px; height: 36px; border-radius: 50%; background: var(--card); border: 2px solid #E2E8F0; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.timeline-step__name { font-size: 9px; margin-top: 4px; color: var(--text-secondary); text-align: center; line-height: 1.2; }
.timeline-step.active .timeline-step__icon { border-color: var(--primary); background: var(--primary); box-shadow: 0 0 0 4px rgba(183,110,121,0.2); }
.timeline-step.active .timeline-step__name { color: var(--primary); font-weight: 700; }
.timeline-step.done .timeline-step__icon { border-color: var(--accent); }
.timeline-connector { width: 16px; height: 2px; background: #E2E8F0; flex-shrink: 0; margin-bottom: 18px; }
.timeline-connector.done { background: var(--accent); }
.timeline-bar--compact .timeline-step { width: 44px; }
.timeline-bar--compact .timeline-step__icon { width: 30px; height: 30px; font-size: 14px; }
[data-action="goSegment"] { cursor: pointer; }

/* 宾客端 */
.guest-app { padding-bottom: calc(var(--tabbar-h) + var(--contact-footer-h) + 16px); }
.guest-hero { text-align: center; padding: 20px 16px 8px; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #000)); color: #fff; }
.guest-hero h1 { margin: 4px 0; font-size: 22px; font-family: "Source Han Serif SC", serif; }
.guest-hero__eyebrow, .guest-hero__date { margin: 0; font-size: 12px; opacity: 0.9; }
.guest-panel { min-height: 280px; padding-bottom: 16px; }
.guest-tabs { position: fixed; left: 0; right: 0; bottom: calc(var(--contact-footer-h) + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; height: var(--tabbar-h); display: flex; background: var(--card); border-top: 1px solid #E2E8F0; z-index: 50; }
.tab-bar-item { flex: 1; border: 0; background: none; font-size: 10px; color: var(--text-secondary); cursor: pointer; padding-top: 6px; }
.tab-bar-item span { display: block; font-size: 20px; margin-bottom: 2px; }
.tab-bar-item.active { color: var(--primary); font-weight: 600; }
.fab-links { position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + var(--contact-footer-h) + 20px); width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; font-size: 18px; cursor: pointer; z-index: 55; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

.tpl-scroll { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 4px; }
.tpl-chip { flex-shrink: 0; border: 1px solid #E2E8F0; background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 12px; cursor: pointer; white-space: nowrap; }
textarea { width: 100%; border: 1px solid #E2E8F0; border-radius: 8px; padding: 10px; font-size: 14px; margin-bottom: 8px; resize: vertical; }
.bless-row { padding: 8px 0; border-bottom: 1px solid #F1E8E8; font-size: 13px; }
.bless-row strong { display: block; color: var(--primary); font-size: 12px; }

.lottery-card { text-align: center; }
.lottery-num { font-size: 48px; font-weight: 800; color: var(--primary); padding: 20px; }
.lottery-num.rolling { animation: pulse 0.3s ease infinite; }
@keyframes pulse { 0%,100%{ transform: scale(1); } 50%{ transform: scale(1.05); } }

.vote-opt { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px; margin-bottom: 8px; border: 1px solid #E2E8F0; border-radius: 10px; background: var(--bg); cursor: pointer; font-size: 14px; }
.vote-opt.disabled { opacity: 0.6; cursor: default; }
.vote-opt strong { color: var(--primary); }

.photo-upload { min-height: 100px; border: 2px dashed #E2E8F0; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.photo-grid small { display: block; font-size: 11px; color: var(--text-secondary); text-align: center; }

.contact-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--card); border-top: 1px solid #E2E8F0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; }
.contact-footer__btns { display: flex; gap: 8px; }
.contact-footer__cta { flex: 1; text-align: center; background: var(--primary); color: #fff !important; padding: 10px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; }
.contact-footer__btn { flex: 1; text-align: center; background: var(--bg); padding: 10px; border-radius: 999px; font-size: 13px; border: 0; cursor: pointer; text-decoration: none; color: inherit; }
.contact-footer__brand { margin: 6px 0 0; text-align: center; font-size: 10px; color: var(--text-secondary); }

/* 主持端 */
.host-app { min-height: 100vh; padding-bottom: 60px; }
.host-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px; flex-wrap: wrap; }
.host-top h1 { margin: 0; font-size: 20px; }
.host-top p { margin: 4px 0 0; font-size: 12px; color: var(--text-secondary); }
.host-links { display: flex; gap: 8px; flex-wrap: wrap; }
.host-grid { display: grid; grid-template-columns: 1fr; gap: 0; padding: 0 8px 16px; }
@media (min-width: 900px) { .host-grid { grid-template-columns: 1fr 1.2fr 1fr; } }
.host-col .card { margin: 0 8px 12px; }
.seg-now { font-size: 24px; margin: 8px 0; }
.host-nav { display: flex; gap: 8px; margin-top: 12px; }
.host-nav .btn-outline, .host-nav .btn-primary { flex: 1; margin: 0; }
.host-actions { display: flex; flex-direction: column; gap: 0; }
.host-preview iframe { width: 100%; height: 240px; border: 1px solid #E2E8F0; border-radius: 8px; background: #000; }
.lottery-result { margin-top: 10px; font-size: 16px; color: var(--primary); }
.host-bottom { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 8px; justify-content: center; padding: 10px; background: var(--card); border-top: 1px solid #E2E8F0; z-index: 50; }
.host-bottom a { text-decoration: none; }

/* 大屏端 */
.screen-app { margin: 0; min-height: 100vh; background: var(--bg); overflow: hidden; }
.screen-root { min-height: 100vh; display: flex; flex-direction: column; }
.screen-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 40px; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 80%, var(--accent))); color: #fff; }
.screen-couple h1 { margin: 4px 0; font-size: clamp(28px, 4vw, 48px); font-family: "Source Han Serif SC", serif; }
.screen-couple p { margin: 0; opacity: 0.9; font-size: 14px; }
.screen-seg { font-size: 20px; font-weight: 700; background: rgba(255,255,255,0.15); padding: 10px 20px; border-radius: 999px; }
.screen-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 40px; min-height: 50vh; }
.screen-welcome { text-align: center; max-width: 800px; }
.screen-welcome__heart { font-size: 64px; animation: pulse 2s ease infinite; }
.screen-welcome h2 { font-size: clamp(24px, 3vw, 40px); font-family: "Source Han Serif SC", serif; }
.screen-qr-hint { font-size: 12px; opacity: 0.7; word-break: break-all; margin-top: 16px; }

.screen-lottery { text-align: center; }
.screen-lottery__label { font-size: 24px; margin-bottom: 16px; }
.screen-lottery__num { font-size: clamp(80px, 15vw, 160px); font-weight: 900; color: var(--primary); line-height: 1; }
.screen-lottery__num.rolling { animation: pulse 0.25s ease infinite; }

.screen-vote { width: 100%; max-width: 900px; }
.screen-vote h2 { text-align: center; margin-bottom: 24px; }
.vote-bar-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 16px; align-items: center; margin-bottom: 16px; font-size: 18px; }
.vote-bar { height: 24px; background: rgba(0,0,0,0.08); border-radius: 999px; overflow: hidden; }
.vote-bar div { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.5s ease; }

.screen-photo { text-align: center; max-width: 80%; }
.screen-photo img { max-width: 100%; max-height: 55vh; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.screen-photo p { margin-top: 12px; font-size: 16px; color: var(--text-secondary); }

.screen-ticker { background: var(--dark); color: #fff; padding: 12px 0; overflow: hidden; white-space: nowrap; }
.ticker-item { display: inline-block; padding: 0 40px; font-size: 16px; animation: ticker 20s linear infinite; }
@keyframes ticker { 0%{ transform: translateX(0); } 100%{ transform: translateX(-50%); } }

.danmaku-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.danmaku-item {
  position: absolute; right: -100%; white-space: nowrap; padding: 6px 16px;
  background: rgba(255,255,255,0.85); border-radius: 999px; font-size: 15px; color: var(--text);
  border: 1px solid var(--primary); animation: danmaku-fly linear forwards;
}
@keyframes danmaku-fly { from { right: -30%; } to { right: 110%; } }

.screen-wipe { animation: wipe 0.6s ease; }
@keyframes wipe { 0%{ opacity: 1; } 50%{ opacity: 0.3; } 100%{ opacity: 1; } }

/* 分享页 */
.share-page { min-height: 100vh; padding: 24px 16px calc(24px + var(--contact-footer-h)); display: flex; justify-content: center; }
.share-card { max-width: 400px; width: 100%; text-align: center; }
.share-card__eyebrow { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--primary); }
.share-logo-wrap { font-size: 48px; }
.share-card h1 { font-size: 24px; margin: 8px 0; }
.share-card__tagline { font-size: 14px; color: var(--text-secondary); }
.share-card__desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; text-align: left; }
.share-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 16px 0; }
.share-stat { background: var(--card); border-radius: 10px; padding: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.share-stat strong { display: block; font-size: 18px; color: var(--primary); }
.share-stat span { font-size: 11px; color: var(--text-secondary); }
.share-book-list { list-style: none; padding: 0; margin: 0 0 16px; text-align: left; }
.share-book-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #E2E8F0; font-size: 13px; }
.share-poster-panel { margin-top: 20px; padding-top: 20px; border-top: 1px solid #E2E8F0; text-align: left; }
.share-poster-panel h2 { text-align: center; font-size: 17px; }
.share-poster-hint { font-size: 12px; color: var(--text-secondary); text-align: center; }
.poster-wrap canvas { max-width: 100%; border-radius: 8px; margin-top: 8px; }
.share-card .btn-primary, .share-card .btn-outline { text-decoration: none; box-sizing: border-box; }

/* ── P1 ── */
.host-p1-row { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 0 8px 24px; }
@media (min-width: 900px) { .host-p1-row { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }
.p1-block { margin: 0 8px 12px !important; }
.room-list { margin-top: 10px; max-height: 200px; overflow-y: auto; }
.room-item { display: block; padding: 10px 12px; border-bottom: 1px solid #E2E8F0; text-decoration: none; color: inherit; }
.room-item--cur { background: rgba(183,110,121,0.08); border-left: 3px solid var(--primary); }
.room-item strong { display: block; font-size: 14px; }
.room-item small { font-size: 11px; color: var(--text-secondary); }

.redpacket-card { text-align: center; }
.redpacket-zone { min-height: 120px; display: flex; align-items: center; justify-content: center; }
.redpacket-btn { font-size: 48px; border: 0; background: none; cursor: pointer; animation: pulse 1s ease infinite; }
.quiz-q { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.quiz-opt { display: block; width: 100%; text-align: left; padding: 12px; margin-bottom: 8px; border: 1px solid #E2E8F0; border-radius: 10px; background: var(--bg); cursor: pointer; font-size: 14px; }
.rank-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #F1E8E8; font-size: 13px; }

.screen-redpacket { text-align: center; width: 100%; position: relative; }
.screen-redpacket h2 { font-size: 36px; }
.redpacket-rain { position: relative; height: 280px; overflow: hidden; margin: 20px auto; max-width: 900px; }
.rain-item { position: absolute; top: -40px; font-size: 32px; animation: rain-fall linear forwards; }
@keyframes rain-fall { to { transform: translateY(320px) rotate(20deg); opacity: 0.3; } }
.catch-list { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 16px; }
.catch-list span { background: rgba(255,255,255,0.15); padding: 8px 16px; border-radius: 999px; font-size: 16px; }

.screen-quiz { width: 100%; max-width: 900px; }
.quiz-q-big { font-size: clamp(22px, 3vw, 36px); text-align: center; margin: 16px 0 24px; font-weight: 700; }
.quiz-answer-reveal { text-align: center; font-size: 28px; color: var(--accent); font-weight: 700; margin-bottom: 20px; }
.quiz-bars .quiz-bar-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 16px; align-items: center; margin-bottom: 14px; font-size: 18px; }

.guest-tabs .tab-bar-item { font-size: 8px; }
.guest-tabs .tab-bar-item span { font-size: 16px; }

/* P2 */
.ai-bless-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tool-btn { border: 1px solid #E2E8F0; background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 11px; cursor: pointer; }
.table-map-canvas { width: 100%; max-width: 340px; display: block; margin: 0 auto; border-radius: 12px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.table-you { text-align: center; margin-top: 10px; color: var(--primary); }
.table-legend { display: flex; justify-content: center; gap: 16px; font-size: 11px; color: var(--text-secondary); margin-top: 8px; }
.table-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #F1F5F9; font-size: 13px; }
.p2-block { margin-top: 0; }
.sync-badge { font-size: 12px; font-weight: 600; }
.sync-badge--guest { display: inline-block; margin-top: 8px; font-size: 11px; opacity: 0.85; }
.mp-path { display: block; font-size: 11px; word-break: break-all; margin-top: 8px; padding: 8px; background: var(--bg); border-radius: 8px; }
.screen-tablemap { width: 100%; text-align: center; }
.screen-tablemap h2 { font-size: clamp(24px, 3vw, 36px); margin-bottom: 16px; }
.screen-tablemap canvas { max-width: 100%; border-radius: 16px; background: rgba(255,255,255,0.08); }
.checkin-particles { position: fixed; inset: 0; pointer-events: none; z-index: 400; display: flex; align-items: center; justify-content: center; }
.checkin-flash { background: rgba(0,0,0,0.75); color: #fff; padding: 16px 24px; border-radius: 12px; font-size: 16px; font-weight: 600; z-index: 401; }
.particle { position: absolute; font-size: 24px; animation: particle-fly 1.8s ease-out forwards; }
@keyframes particle-fly { 0% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-120px) scale(0.5); } }
.from-miniprogram .contact-footer { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
