:root {
  --bg: #fbf6ee;
  --paper: #ffffff;
  --ink: #2b2420;
  --muted: #7a6e66;
  --line: #ece2d4;
  --accent: #d2452b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe5dd;
  --gold: #e3a32b;
  --green: #2f7d5b;
  --shadow: 0 8px 24px rgba(60, 40, 20, 0.08);
  --radius: 18px;
  --serif: 'Noto Serif TC', 'Songti TC', serif;
  --sans: 'Noto Sans TC', -apple-system, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1916; --paper: #28221e; --ink: #f3ebe2; --muted: #b3a79c; --line: #3d3530;
    --accent: #f06b4f; --accent-soft: #46271f; --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.75; font-size: 16px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
img { max-width: 100%; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; }

/* 頁首頁尾 */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: 1px; }
.brand span { color: var(--accent); }
.foot { color: var(--muted); font-size: 13px; padding: 40px 0 56px; text-align: center; }
.foot a { color: var(--muted); margin: 0 8px; }

/* 按鈕 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 14px 26px; font-size: 17px; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--accent); color: var(--accent-ink); font-family: inherit; transition: transform .08s ease, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.small { padding: 8px 16px; font-size: 14px; }
.btn.block { width: 100%; }

/* 卡片 */
.card { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 20px; margin: 16px 0; border: 1px solid var(--line); }
.muted { color: var(--muted); }
.tag { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* 首頁 */
.hero { padding: 36px 0 20px; text-align: center; }
.hero h1 { font-family: var(--serif); font-size: clamp(30px, 7vw, 46px); line-height: 1.25; margin: 10px 0 14px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); font-size: 17px; margin: 0 auto 24px; max-width: 30em; }
.avatars { display: flex; justify-content: center; gap: 10px; margin-bottom: 8px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font-size: 30px; box-shadow: var(--shadow); border: 2px solid var(--line); }
.steps3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.steps3 .card { margin: 0; text-align: center; padding: 18px 12px; }
.steps3 b { display: block; font-size: 26px; }
@media (max-width: 560px) { .steps3 { grid-template-columns: 1fr; } }
.persona-grid { display: grid; gap: 12px; }
.persona { display: flex; gap: 14px; align-items: flex-start; }
.persona .avatar { flex: none; }
.persona h3 { margin: 0; font-size: 18px; }
.persona p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.persona q { display: block; margin-top: 8px; font-size: 14px; color: var(--ink); background: var(--bg); border-radius: 12px; padding: 8px 12px; quotes: none; }
.section-title { font-family: var(--serif); font-size: 24px; margin: 36px 0 6px; text-align: center; }

/* 問卷流程 */
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 6px 0 20px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.step-label { color: var(--muted); font-size: 13px; }
.q { font-family: var(--serif); font-size: 24px; line-height: 1.4; margin: 6px 0 18px; }
.options { display: grid; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--paper); color: var(--ink); border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; font-size: 16px; cursor: pointer; font-family: inherit; }
.opt .e { font-size: 26px; width: 34px; text-align: center; flex: none; }
.opt small { display: block; color: var(--muted); font-size: 13px; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt:focus-visible { outline: 3px solid var(--gold); }
.row { display: flex; gap: 10px; justify-content: space-between; margin-top: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip { border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; font-family: inherit; }
textarea, input[type=text], input[type=password] { width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 16px; font-family: inherit; background: var(--paper); color: var(--ink); }
textarea { min-height: 90px; resize: vertical; }
.drop { display: block; border: 2.5px dashed var(--line); border-radius: 18px; padding: 28px 16px; text-align: center; background: var(--paper); cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { display: block; font-size: 18px; margin-bottom: 4px; }
details.howto { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 10px 0; }
details.howto summary { cursor: pointer; font-weight: 700; }
details.howto ol { margin: 8px 0 4px; padding-left: 22px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 15px; }
.check input { width: 20px; height: 20px; margin-top: 4px; flex: none; accent-color: var(--accent); }
.err { background: #fde8e4; color: #9b2a14; border-radius: 12px; padding: 10px 14px; margin: 12px 0; }
@media (prefers-color-scheme: dark) { .err { background: #4a2219; color: #ffc9bc; } }
.summary { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 15px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; }

/* 產生中 */
.loading { text-align: center; padding: 40px 0; }
.loading .avatar { width: 84px; height: 84px; font-size: 46px; margin: 0 auto 18px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }
.loading .line { font-size: 18px; min-height: 3.6em; }
.dots::after { content: '…'; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* 報告 */
.report h1 { font-family: var(--serif); font-size: clamp(24px, 5.6vw, 34px); line-height: 1.35; margin: 18px 0 8px; }
.byline { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.byline .avatar { width: 40px; height: 40px; font-size: 22px; }
.sec { margin: 28px 0; }
.sec > h2 { font-family: var(--serif); font-size: 22px; margin: 0 0 10px; }
.sec p { margin: 0 0 12px; }
.share { background: linear-gradient(160deg, var(--accent) 0%, #b3331c 100%); color: #fff; border-radius: 22px; padding: 24px 22px; box-shadow: var(--shadow); }
.share .k { font-size: 12px; opacity: .85; letter-spacing: 2px; }
.share .h { font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1.35; margin: 6px 0 4px; }
.share .badge { display: inline-block; background: rgba(255,255,255,.18); border-radius: 999px; padding: 3px 12px; font-size: 14px; margin-bottom: 10px; }
.share ul { margin: 6px 0 10px; padding-left: 20px; }
.share .stars { font-size: 14px; opacity: .95; }
.share .site { margin-top: 10px; font-size: 12px; opacity: .8; }
.quote { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 12px; padding: 10px 14px; margin: 10px 0; white-space: pre-wrap; }
.verdict { font-size: 18px; }
.conf { font-size: 12px; color: var(--muted); margin-left: 6px; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
table.t th, table.t td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { color: var(--muted); font-weight: 600; font-size: 13px; }
table.t td:first-child { white-space: nowrap; }
.stars-cell { white-space: nowrap; color: var(--gold); letter-spacing: 1px; }
.tl { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--line); }
.tl li { position: relative; padding: 0 0 16px 18px; }
.tl li::before { content: ''; position: absolute; left: -8px; top: 8px; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); }
.tl .d { font-weight: 700; }
.rolecard { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin: 14px 0; box-shadow: var(--shadow); }
.rolecard h3 { margin: 0 0 4px; font-size: 19px; }
.rolecard .title { color: var(--accent); font-weight: 700; }
.attrs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.attrs span { background: var(--bg); border-radius: 10px; padding: 3px 10px; font-size: 13px; }
.alert { background: #fff4d6; border: 2px solid var(--gold); border-radius: 18px; padding: 18px; color: #4a3500; }
@media (prefers-color-scheme: dark) { .alert { background: #3b2f12; color: #ffe7a8; } }
.private { border: 1.5px dashed var(--accent); border-radius: 18px; padding: 16px 18px; background: var(--paper); }
.private .lock { font-size: 12px; color: var(--accent); font-weight: 700; }
.draft { background: var(--bg); border-radius: 14px; padding: 12px 14px; margin: 8px 0; }
.draft b { display: block; font-size: 13px; color: var(--muted); }
.paywall { background: var(--paper); border: 2px solid var(--accent); border-radius: 22px; padding: 22px 20px; margin: 28px 0; text-align: center; box-shadow: var(--shadow); }
.paywall .cta { font-family: var(--serif); font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.paywall .price { font-size: 30px; font-weight: 800; color: var(--accent); margin: 8px 0; }
.paywall .code { font-family: ui-monospace, monospace; font-size: 28px; letter-spacing: 4px; background: var(--bg); border-radius: 12px; padding: 8px 14px; display: inline-block; margin: 6px 0 10px; }
.paywall .pay { white-space: pre-wrap; text-align: left; background: var(--bg); border-radius: 14px; padding: 12px 14px; margin: 12px 0; font-size: 15px; }
.blurred { filter: blur(6px); user-select: none; pointer-events: none; opacity: .6; }
.disclaimer { font-size: 13px; color: var(--muted); background: var(--paper); border-radius: 12px; padding: 10px 14px; border: 1px solid var(--line); }
.mockbar { background: var(--gold); color: #2b2420; text-align: center; font-size: 14px; padding: 8px 12px; font-weight: 700; }
.followups { display: flex; flex-wrap: wrap; gap: 8px; }
.followups span { border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; }

/* 後台 */
.admin table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin td, .admin th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.ok { color: var(--green); font-weight: 700; }

/* ===== 引言：LINE／WhatsApp 對話框 ===== */
.chat { border-radius: 14px; padding: 12px 10px; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; font-size: 15px; line-height: 1.45; }
.chat .b { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; }
.chat .b.me { justify-content: flex-end; }
.chat .bb { white-space: pre-wrap; word-break: break-word; max-width: 78%; position: relative; }
.chat .col { display: flex; flex-direction: column; min-width: 0; max-width: calc(100% - 44px); }
.chat .lr { display: flex; align-items: flex-end; gap: 6px; }
.chat .lr .bb { max-width: 100%; }
.chat .bt { font-size: 10.5px; line-height: 1.25; white-space: nowrap; flex: none; }
/* LINE */
.chat.line { background: #7494c0; }
.chat.line .av { width: 34px; height: 34px; border-radius: 50%; flex: none; align-self: flex-start; color: #fff; font-size: 15px; font-weight: 700; display: grid; place-items: center; }
.chat.line .nm { color: #fff; font-size: 12px; margin: 0 0 3px 2px; opacity: .95; }
.chat.line .bb { background: #fff; color: #111; border-radius: 18px; padding: 8px 12px; }
.chat.line .b:not(.me) .bb::before { content: ""; position: absolute; left: -5px; top: 7px; border: 6px solid transparent; border-right-color: #fff; border-left: 0; }
.chat.line .me .bb { background: #8de055; }
.chat.line .me .bb::after { content: ""; position: absolute; right: -5px; top: 7px; border: 6px solid transparent; border-left-color: #8de055; border-right: 0; }
.chat.line .bt { color: #e9eef7; text-align: right; }
.chat.line .b:not(.me) .bt { text-align: left; }
/* WhatsApp */
.chat.whatsapp { background: #efeae2; background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px); background-size: 14px 14px; }
.chat.whatsapp .bb { background: #fff; color: #111b21; border-radius: 8px; padding: 6px 9px 8px; box-shadow: 0 1px .5px rgba(11,20,26,.13); }
.chat.whatsapp .b:not(.me) .bb { border-top-left-radius: 0; }
.chat.whatsapp .b:not(.me) .bb::before { content: ""; position: absolute; left: -7px; top: 0; border-top: 8px solid #fff; border-left: 8px solid transparent; }
.chat.whatsapp .me .bb { background: #d9fdd3; border-top-right-radius: 0; }
.chat.whatsapp .me .bb::after { content: ""; position: absolute; right: -7px; top: 0; border-top: 8px solid #d9fdd3; border-right: 8px solid transparent; }
.chat.whatsapp .nm { font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.chat.whatsapp .bt { float: right; color: #667781; margin: 6px 0 -4px 10px; }
.chat.whatsapp .tick { font-style: normal; color: #53bdeb; letter-spacing: -3px; margin-left: 2px; }

/* ===== 請客大抽獎 ===== */
.draw { text-align: center; }
.draw .prize { font-weight: 600; margin: 6px 0 14px; }
.draw .slot { margin: 0 auto 14px; max-width: 320px; height: 76px; border-radius: 16px; background: #2b2420; color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 800; letter-spacing: 1px; border: 4px solid var(--gold, #e0a526); box-shadow: inset 0 0 0 3px rgba(255,255,255,.12); overflow: hidden; }
.draw .slot span { padding: 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.draw .slot.win { animation: drawpop .5s ease; background: #c0392b; }
@keyframes drawpop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
.draw .why { min-height: 8px; margin-bottom: 14px; font-size: 16px; }
.draw .why .who { font-size: 18px; margin-bottom: 6px; }
.draw .why .reason { text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; line-height: 1.8; }

/* ===== 兩人性格詳寫 ===== */
.portrait { margin: 14px 0; }
.portrait h3 { margin: 0 0 8px; font-size: 19px; }
.portrait .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.portrait .tags span { background: var(--paper); border: 1.5px solid var(--gold); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; }
