/* AIDEA 會員區/結帳 — 極簡行動優先(LINE webview 為主要載體) */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #1f2933; --sub: #52606d; --line: #e4e7eb; --bg: #f7f8fa;
  --brand: #0f62fe; --brand-ink: #ffffff; --warn-bg: #fff8e1; --warn-bd: #f0c000;
  --ok: #0e8345; --err: #c0392b;
}
body { font-family: "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.65; -webkit-font-smoothing: antialiased; }
.container { max-width: 640px; margin: 0 auto; padding: 16px 16px 48px; }
.center { text-align: center; padding-top: 48px; }
header.app { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
header.app .logo { font-weight: 700; font-size: 18px; }
header.app .who { font-size: 13px; color: var(--sub); }
h1 { font-size: 22px; margin: 12px 0; }
h2 { font-size: 17px; margin: 20px 0 10px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.muted { color: var(--sub); font-size: 13px; }
.btn { display: inline-block; width: 100%; padding: 13px 16px; border: 0; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink); font-size: 16px; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none; }
/* 停用態:原為白字配淺灰底(對比不足),改深灰字提高可讀性 */
.btn:disabled { background: #dfe3e8; color: #6b7784; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-bd); border-radius: 10px;
  padding: 12px 14px; font-size: 14px; margin: 12px 0; }
.msg { margin: 12px 0; font-size: 14px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }

/* 方案卡(radio) */
.product { display: block; position: relative; cursor: pointer; }
.product input { position: absolute; opacity: 0; }
.product .card { transition: border-color .15s; }
.product input:checked + .card { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(15, 98, 254, .18); }
.product .p-title { font-weight: 700; }
.product .p-price { font-size: 20px; font-weight: 800; margin-top: 4px; }
.product .p-courses { font-size: 13px; color: var(--sub); margin-top: 6px; }
/* 已購買方案:停用選取、視覺淡化(checkout 後端亦擋 already_owned) */
.product.owned { cursor: not-allowed; }
.product.owned .card { opacity: .55; background: var(--bg); }
.product.owned .card:hover { border-color: var(--line); }
.tag.owned-tag { background: #e6f4ec; color: var(--ok); }

/* 表單 */
.field { margin: 10px 0; }
.field label { display: block; font-size: 14px; margin-bottom: 4px; color: var(--sub); }
.field input[type="text"], .field input[type="email"], .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
  background: #fff; box-sizing: border-box; font-family: inherit; }
/* date / number 沿用同一組外觀。上一條規則逐一列出 type,新增型別就會被漏掉 ——
   iOS 未被涵蓋時會退回瀏覽器內建尺寸(日期成灰色小膠囊、數字成窄框),與同一張
   表單裡的文字欄位落差極大(訂單頁匯款回報實機發現)。
   另立一條而非改寫上一條:上一條被所有既有頁面使用,改動選擇器會擴大影響範圍。 */
.field input[type="date"], .field input[type="number"] {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
  background: #fff; box-sizing: border-box; font-family: inherit;
  -webkit-appearance: none; appearance: none; }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.seg { display: flex; gap: 8px; margin: 8px 0; }
.seg label { flex: 1; text-align: center; padding: 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; cursor: pointer; font-size: 14px; }
.seg input { display: none; }
.seg input:checked + span { color: var(--brand); font-weight: 700; }
.seg label:has(input:checked) { border-color: var(--brand); }

/* 同意勾選 */
.agree { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px; margin: 8px 0; }
.agree input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.agree.waiver { background: var(--warn-bg); border: 1px solid var(--warn-bd); }
details.legal { margin: 6px 0; }
details.legal summary { cursor: pointer; font-size: 14px; color: var(--brand); }
details.legal .legal-body { font-size: 13px; color: var(--sub); max-height: 260px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 6px; background: #fff; }
details.legal blockquote { border-left: 3px solid var(--line); padding-left: 8px; color: var(--sub); }

/* 我的課程 */
.card.course { padding: 0; overflow: hidden; border-left: 3px solid var(--brand); }
.course .c-head { padding: 16px 16px 13px; }
.course .c-title { font-weight: 800; font-size: 16px; line-height: 1.45; }
.course .c-sub { font-size: 13px; color: var(--sub); margin-top: 4px; }
.course .c-meta { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.chip { font-size: 12px; line-height: 1.7; color: var(--sub); background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; white-space: nowrap; }
.chip.ready { color: var(--ok); background: #e9f6ef; border-color: #cfe8db; }
.course .units { list-style: none; padding: 0 16px 8px; }
/* 單元列:標題可換行不擠壓右側動作;動作固定寬 → 文字變「載入中…」不會撐大按鈕 */
.course .units li { display: flex; gap: 12px; align-items: center;
  padding: 11px 0; border-top: 1px solid var(--line); }
.unit-main { flex: 1; min-width: 0; }
.unit-title { font-size: 14px; line-height: 1.5; }
.unit-meta { font-size: 12px; color: var(--sub); margin-top: 2px; }
.unit-action { flex: none; display: flex; justify-content: flex-end; }
.tag { font-size: 12px; color: var(--sub); background: var(--bg); border-radius: 6px; padding: 2px 8px; }
.empty { text-align: center; padding: 32px 0; color: var(--sub); }
.loading { text-align: center; padding: 40px 0; color: var(--sub); }
.btn.mini-play { width: auto; min-width: 88px; padding: 8px 14px; font-size: 13px;
  border-radius: 8px; white-space: nowrap; }
.tag.pending { display: inline-block; min-width: 88px; text-align: center; padding: 7px 8px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
.courses-cta { margin-top: 18px; }
.foot-note { margin-top: 20px; padding: 12px 14px; border-radius: 10px; background: #fff;
  border: 1px solid var(--line); font-size: 13px; color: var(--sub); line-height: 1.7; }

/* 影片播放 modal */
.player-modal { position: fixed; inset: 0; background: rgba(0,0,0,.82); display: none;
  align-items: center; justify-content: center; padding: 12px; z-index: 60; }
.player-modal.show { display: flex; }
.player-box { width: 100%; max-width: 900px; }
.player-bar { display: flex; align-items: center; justify-content: space-between; color: #fff; padding: 6px 4px 10px; }
.player-bar span { font-size: 15px; font-weight: 600; }
.player-bar button { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; padding: 4px 8px; }
.player-frame { position: relative; width: 100%; padding-top: 56.25%; background: #000; border-radius: 10px; overflow: hidden; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-actions { display: flex; align-items: center; gap: 2px; }

/* 溯源浮水印(T30):蓋在 iframe 上,不擋操作、不可選取;雙層 text-shadow 深淺畫面皆可辨。
   三期(T40):位置改由父層 CSS 變數驅動、涵蓋整個播放框(含中央)——四角固定會被
   「錄影時裁掉邊緣」整組避開。變數掛父層而非改本元素 inline style,
   是為了讓竄改監控(監看本元素 style 屬性)不會被我方換位動作誤觸。 */
.player-wm { position: absolute; z-index: 5; pointer-events: none; user-select: none; -webkit-user-select: none;
  left: var(--wm-x, 70%); top: var(--wm-y, 80%); transform: translate(-50%, -50%);
  max-width: 70%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  color: rgba(255,255,255,.55); font-size: 12px; letter-spacing: .06em; opacity: .65;
  text-shadow: 0 0 2px rgba(0,0,0,.85), 0 0 6px rgba(0,0,0,.5); }

/* 偽全螢幕(T30):原生全螢幕已停用(浮水印蓋不到),放大改由 modal 撐滿視窗 */
.player-modal.expand { padding: 0; background: #000; }
.player-modal.expand .player-box { max-width: none; }
.player-modal.expand .player-frame { border-radius: 0; }
.player-modal.expand .player-bar { padding: 6px 10px 10px; }
/* 偽「橫向」全螢幕(T32 真機修正):直向手機下,16:9 影片撐滿寬度後放大無感——
   比照各視訊站 webview 做法,旋轉 90° 以視窗高為寬撐滿整個畫面(浮水印同容器一起轉) */
@media (orientation: portrait) {
  .player-modal.expand .player-box {
    position: fixed; top: 0; left: 0;
    width: 100vh; height: 100vw;
    transform: rotate(90deg) translateY(-100%);
    transform-origin: top left;
    display: flex; flex-direction: column;
  }
  .player-modal.expand .player-bar { flex: none; }
  .player-modal.expand .player-frame { flex: 1; padding-top: 0; }
}
/* 橫向:以視窗高反推 16:9 寬上限,影片完整入鏡不溢出 */
@media (orientation: landscape) {
  .player-modal .player-box { max-width: calc(160vh - 24px); }
  .player-modal.expand .player-box { max-width: 160vh; }
}

/* ---- 訂單/付款指示頁(轉帳金流 M1-8) ---- */
.pay-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pay-row:last-child { border-bottom: 0; }
.pay-row > span { color: var(--sub); font-size: 13px; min-width: 5.5em; }
.pay-row > b { flex: 1; font-size: 17px; letter-spacing: .02em; word-break: break-all; }
.pay-row .btn.copy { width: auto; flex: none; padding: 6px 12px; font-size: 13px; }
.qr { display: block; width: 200px; max-width: 100%; margin: 12px auto 4px; }
.pending-order { display: block; text-decoration: none; color: inherit; }
.pending-order:hover { border-color: var(--brand); }
/* 逾期訂單:收在課程之後,樣式刻意比待付款區塊低調(次要資訊,不與課程搶注意力) */
#expired-orders { margin: 18px 0 4px; }
#expired-orders > summary { cursor: pointer; font-size: 14px; color: var(--sub); padding: 6px 0; }
#expired-orders > summary:hover { color: var(--brand); }
#expired-orders .pending-order { opacity: .72; }
