/* 品牌色（取自 Instagram 主要配色）
   535AB6 靛藍　959AD6 中藍紫　A8AEFD 亮藍紫　D2D5FD 淺藍紫　D5C5FF 淡紫　FFFFBF 淡黃　E0E0E0 灰（低透明度做卡片）　000000 黑 */
:root {
  color-scheme: dark;
  --bg: #0b0b11;
  --bg-glow: radial-gradient(1000px 520px at 90% -10%, rgba(76, 160, 168, .20), transparent 62%),
             radial-gradient(900px 560px at -5% 0%, rgba(83, 90, 182, .22), transparent 62%);
  --surface: rgba(224, 224, 224, .08);
  --surface-2: rgba(224, 224, 224, .14);
  --solid: #1a1a23;
  --line: rgba(224, 224, 224, .18);
  --line-strong: rgba(224, 224, 224, .32);
  --ink: #f2f2f9;
  --ink-strong: #ffffff;
  --muted: #a9aac0;
  --primary: #535ab6;
  --primary-hover: #646cd0;
  --link: #a8aefd;
  --lilac: #d5c5ff;
  --lav: #d2d5fd;
  --lav-mid: #959ad6;
  --cream: #ffffbf;
  --danger: #ff9c93;
  --danger-bg: #c2453b;
  --ok: #8ce8b2;
  --warn: #ffd2a0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --sans: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --serif: var(--sans);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background-color: var(--bg); background-image: var(--bg-glow); background-repeat: no-repeat; background-attachment: fixed; color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.8; }
img, iframe { max-width: 100%; }
a { color: var(--link); }
h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.35; margin: 0 0 .5em; color: var(--ink-strong); }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 900; color: var(--lilac); letter-spacing: .01em; }
h2 { font-size: clamp(1.45rem, 3.6vw, 2rem); font-weight: 800; color: var(--lilac); }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
::selection { background: var(--primary); color: #fff; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 520px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .875rem; }
.mt { margin-top: 1.25rem; }
.mb0 { margin-bottom: 0; }
:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }

/* header */
.topbar { background: rgba(11, 11, 17, .72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.brand { font-weight: 800; letter-spacing: .02em; color: var(--ink-strong); text-decoration: none; font-size: 1.05rem; }
.brand span { color: var(--lilac); }
.topnav { display: flex; gap: 8px; align-items: center; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent; background: var(--primary); color: #fff; font: 700 1rem var(--sans); text-decoration: none; cursor: pointer; transition: background .15s, transform .05s; }
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--lav); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--lav-mid); }
.btn.danger { background: var(--danger-bg); }
.btn.danger:hover { background: #d8564b; }
.btn.gold { background: var(--cream); color: var(--primary); }
.btn.gold:hover { background: #ffffd9; }
.btn.sm { min-height: 34px; padding: 0 14px; font-size: .875rem; }
.btn.lg { min-height: 56px; padding: 0 38px; font-size: 1.12rem; }
.btn.block { width: 100%; }

/* forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.field { margin-bottom: 16px; }
.field label, .lbl { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; color: var(--lav); }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(0, 0, 0, .28); color: var(--ink); font: inherit; }
select option { background: #1a1a23; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #7d7e96; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--link); outline-offset: 1px; border-color: var(--link); }
input[readonly] { background: rgba(224, 224, 224, .06); color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.check input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--primary); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row .auto { flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .row.stack { flex-direction: column; } }

/* notices */
.notice { border-radius: 12px; padding: 12px 16px; font-size: .92rem; margin-bottom: 16px; background: rgba(255, 255, 191, .10); color: #ffffd6; border: 1px solid rgba(255, 255, 191, .22); }
.notice.warn { background: rgba(255, 210, 160, .10); color: var(--warn); border-color: rgba(255, 210, 160, .25); }
.notice.err { background: rgba(255, 156, 147, .10); color: var(--danger); border-color: rgba(255, 156, 147, .28); }
.notice.ok { background: rgba(140, 232, 178, .10); color: var(--ok); border-color: rgba(140, 232, 178, .25); }
.msg { min-height: 1.4em; font-size: .92rem; margin: 8px 0 0; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

.badge { display: inline-block; padding: 2px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: #d9d9e6; white-space: nowrap; }
.badge.pending { background: rgba(255, 255, 191, .16); color: var(--cream); }
.badge.approved { background: rgba(168, 174, 253, .2); color: var(--link); }
.badge.activated, .badge.published, .badge.active { background: rgba(140, 232, 178, .16); color: var(--ok); }
.badge.rejected, .badge.suspended { background: rgba(255, 156, 147, .16); color: var(--danger); }
.badge.draft { background: var(--surface-2); color: #d9d9e6; }

/* sales page */
.hero { padding: 72px 0 52px; }
.hero .eyebrow { display: inline-block; color: var(--primary); background: var(--cream); font-weight: 800; letter-spacing: .14em; font-size: .78rem; padding: 3px 14px; border-radius: 999px; margin-bottom: 18px; }
.hero p.lead { font-size: 1.14rem; color: var(--lav); max-width: 680px; }
.price-box { display: inline-block; margin: 8px 0 24px; padding: 18px 28px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.price-box .now { font-size: 2.4rem; font-weight: 900; color: var(--cream); line-height: 1.2; }
.price-box .was { text-decoration: line-through; color: var(--muted); margin-right: 10px; }
.price-box .promo { color: var(--lilac); font-weight: 700; font-size: .92rem; }
section.block { padding: 52px 0; }
section.block.alt { background: rgba(224, 224, 224, .04); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 820px) { .cards3 { grid-template-columns: 1fr; } }
.cards3 .card h3 { color: var(--cream); }
.outline { list-style: none; counter-reset: ch; margin: 0; padding: 0; }
.outline li { counter-increment: ch; padding: 14px 0 14px 50px; border-bottom: 1px solid var(--line); position: relative; }
.outline li::before { content: counter(ch); position: absolute; left: 0; top: 14px; width: 34px; height: 34px; border-radius: 50%; background: var(--lav); color: var(--primary); font-weight: 800; display: grid; place-items: center; font-size: .92rem; }
.outline .t { font-weight: 700; color: var(--ink-strong); }
.outline .s { color: var(--muted); font-size: .9rem; }
details.faq { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
details.faq summary { cursor: pointer; font-weight: 700; color: var(--ink-strong); }
details.faq p { margin: 10px 0 0; color: var(--lav); }
.risk { border: 1px solid rgba(255, 255, 191, .38); background: rgba(255, 255, 191, .06); border-radius: var(--radius); padding: 18px 20px; font-size: .92rem; color: #f4f4dc; }
.risk strong { color: var(--cream); }
footer.site { padding: 32px 0 56px; color: var(--muted); font-size: .85rem; }
footer.site a { color: var(--muted); }

/* 自訂區塊與編輯器產生的內文 */
.rich { word-break: break-word; }
.rich > :first-child { margin-top: 0; }
.rich p, .rich div { margin: 0 0 1em; }
.rich h3, .rich h4 { margin: 1.4em 0 .5em; }
.rich ul, .rich ol { padding-left: 1.4em; margin: 0 0 1em; }
.rich blockquote { margin: 0 0 1em; padding: 4px 16px; border-left: 3px solid var(--lav-mid); color: var(--lav); }
.rich img { display: block; max-width: 100%; height: auto; border-radius: 12px; margin: 1em 0; }
.rich hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }

/* checkout */
.summary { background: rgba(224, 224, 224, .06); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; }
.summary .line { display: flex; justify-content: space-between; padding: 3px 0; }
.summary .total { border-top: 1px dashed var(--line-strong); margin-top: 6px; padding-top: 8px; font-weight: 800; font-size: 1.15rem; color: var(--cream); }
.bank { white-space: pre-line; background: rgba(255, 255, 191, .06); border: 2px dashed rgba(255, 255, 191, .55); border-radius: 12px; padding: 14px 16px; font-weight: 700; color: #fffff0; }

/* course */
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--cream), var(--link)); border-radius: 999px; transition: width .4s; }
.course { display: grid; grid-template-columns: 330px 1fr; gap: 24px; padding: 24px 0 60px; align-items: start; }
@media (max-width: 900px) { .course { grid-template-columns: 1fr; } }
.side { background: var(--solid); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: sticky; top: 72px; }
@media (max-width: 900px) { .side { position: static; } .side .list { max-height: 260px; } }
.side .head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.side .list { max-height: 70vh; overflow: auto; }
.chitem { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; cursor: pointer; font: inherit; color: inherit; }
.chitem:hover { background: var(--surface); }
.chitem.on { background: rgba(168, 174, 253, .16); }
.chitem .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--lav-mid); display: grid; place-items: center; font-size: .7rem; color: #0b0b11; font-weight: 800; margin-top: 3px; }
.chitem .dot.watching { border-color: var(--cream); background: linear-gradient(90deg, var(--cream) 50%, transparent 50%); }
.chitem .dot.done { background: var(--ok); border-color: var(--ok); }
.chitem .ct { font-size: .94rem; line-height: 1.5; font-weight: 500; }
.chitem .cm { font-size: .78rem; color: var(--muted); }
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #05050a; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); padding: 20px; text-align: center; }
.chead { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin: 18px 0 8px; }
.prose { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-top: 16px; word-break: break-word; }
.prose h2, .prose h3, .prose h4 { margin-top: 1.4em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose code, code { background: rgba(224, 224, 224, .14); color: var(--cream); padding: 1px 6px; border-radius: 4px; font-size: .9em; }

/* toast */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 99; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: #2b2b3a; color: #fff; border: 1px solid var(--line-strong); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: .92rem; }
.toast.err { background: #6e2722; border-color: #a24840; }
.toast.ok { background: #1d553a; border-color: #2f7d58; }

/* admin */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 20px 0; }
.tab { background: none; border: 0; padding: 10px 16px; font: 700 .95rem var(--sans); color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--cream); border-color: var(--cream); }
.tab .n { background: var(--danger-bg); color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px 7px; margin-left: 6px; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th, table.t td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { background: rgba(224, 224, 224, .06); font-size: .8rem; color: var(--muted); white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--line-strong); background: transparent; color: var(--lav); border-radius: 999px; padding: 4px 14px; font: 600 .85rem var(--sans); cursor: pointer; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
dialog { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0; width: min(94vw, 640px); background: var(--solid); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
dialog.wide { width: min(96vw, 860px); }
dialog::backdrop { background: rgba(0, 0, 0, .68); }
dialog .dh { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
dialog .db { padding: 20px 22px; max-height: 72vh; overflow: auto; }
dialog .df { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
dialog .df .msg { margin: 0 auto 0 0; }
.stat { color: var(--muted); font-size: .85rem; }

/* 銷售頁區塊管理 */

/* 文字編輯器 */
.re-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; position: relative; padding: 8px; background: rgba(224, 224, 224, .08); border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 12px 12px 0 0; }
.re-btn { white-space: nowrap; min-height: 34px; min-width: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font: 700 .9rem var(--sans); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.re-btn:hover:not(:disabled) { background: var(--surface-2); }
.re-btn:disabled { opacity: .4; cursor: not-allowed; }
.re-btn .sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--cream); }
.re-sep { width: 1px; align-self: stretch; background: var(--line-strong); margin: 0 2px; }
.re-area { min-height: 240px; max-height: 50vh; overflow: auto; padding: 16px; border: 1px solid var(--line-strong); border-radius: 0 0 12px 12px; background: var(--bg); color: var(--ink); line-height: 1.8; }
.re-area:focus { outline: 2px solid var(--link); outline-offset: 1px; }
.re-area img { cursor: pointer; }
.re-area img.re-sel { outline: 3px solid var(--cream); outline-offset: 2px; }
.re-area:empty::before { content: attr(data-ph); color: #7d7e96; }
.re-hint { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.re-pop { position: absolute; top: 100%; left: 8px; z-index: 30; margin-top: 6px; background: #22222d; border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); width: 296px; max-width: calc(100vw - 48px); }
.re-pop h5 { margin: 0 0 6px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.re-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin-bottom: 10px; }
.re-brand { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; margin-bottom: 10px; }
.re-sw { aspect-ratio: 1; min-height: 20px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, .2); cursor: pointer; padding: 0; }
.re-sw:hover, .re-sw:focus-visible { outline: 2px solid var(--cream); outline-offset: 1px; z-index: 1; }
.re-custom { display: flex; gap: 6px; align-items: center; }
.re-custom input { min-height: 34px; padding: 4px 10px; }
.re-reset { width: 100%; margin-bottom: 10px; justify-content: flex-start; }

/* 後台抽屜 */
.pageplan { display: block; }
.drawer { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.drawer.custom { background: rgba(168, 174, 253, .10); border-color: rgba(168, 174, 253, .35); margin-left: 22px; }
.drawer.off { border-style: dashed; }
.drawer.off .dr-name { opacity: .65; }
.drawer > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border-radius: 12px; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer > summary:hover { background: var(--surface); }
.dr-move { display: flex; flex: none; min-width: 22px; justify-content: center; }
.dr-handle { cursor: grab; color: var(--muted); font-weight: 900; letter-spacing: -2px; padding: 6px 4px; border-radius: 6px; touch-action: none; user-select: none; -webkit-user-select: none; }
.dr-handle:hover, .dr-handle:focus-visible { color: var(--ink-strong); background: var(--surface-2); }
.plan-dragging .dr-body { display: none; }
.plan-dragging { user-select: none; -webkit-user-select: none; }
.drawer.dragging { box-shadow: 0 10px 30px rgba(0, 0, 0, .5); outline: 2px solid var(--cream); cursor: grabbing; }
.drawer.dragging .dr-handle { cursor: grabbing; }
.dr-caret { color: var(--muted); transition: transform .15s; flex: none; }
.drawer[open] > summary .dr-caret { transform: rotate(90deg); }
.dr-name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.dr-name .stat { font-weight: 400; margin-left: 6px; }
.dr-end { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.dr-body { padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.dr-body h4 { margin: 18px 0 8px; color: var(--cream); font-size: .95rem; }
.dr-body h4:first-child { margin-top: 0; }
.dr-save { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.dr-save .msg { margin: 0; }
.lst { display: grid; gap: 8px; margin: 6px 0 10px; }
.lrow { display: flex; gap: 8px; align-items: flex-start; background: rgba(224, 224, 224, .05); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.lr-in { flex: 1; min-width: 0; display: grid; gap: 6px; }
.lr-in textarea { min-height: 64px; }
@media (max-width: 640px) { .drawer > summary { flex-wrap: wrap; } .drawer.custom { margin-left: 10px; } }

/* 預覽／發布列 */
.badge.live { background: rgba(140, 232, 178, .16); color: var(--ok); margin-left: 6px; vertical-align: middle; }
.pubbar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 8px); z-index: 20; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 14px 0; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line, rgba(255,255,255,.14)); box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.pubbar:empty { display: none; }
.pubbar.dirty { border-color: var(--cream); }
.pubbar .pb-info { display: grid; gap: 2px; min-width: 0; }
.pubbar .pb-act { display: flex; flex-wrap: wrap; gap: 8px; }
.pubbar button[disabled] { opacity: .45; cursor: not-allowed; }
.preview-banner { position: sticky; top: 0; z-index: 50; background: var(--cream); color: #1b1b2a; text-align: center; font-weight: 700; padding: 8px max(16px, env(safe-area-inset-left, 0px)); font-size: .92rem; }
