/* 做片台：米白紙底＋珍北平紅；字級下限 手機正文 17px、任何字 ≥14px；桌機正文 18px */
:root {
  --paper: #FBF5EA; --card: #FFFDF8; --ink: #33231A; --soft: #7A6250; --line: #E8DCC8;
  --red: #8E2B22; --red-soft: #F6E3DC; --ok: #2F6B3A; --ok-soft: #E2F0E0; --wait: #9A6A12; --wait-soft: #FBEFCF;
  --blue: #2D5577; --blue-soft: #E1EBF3; --gray-soft: #EFE9DF;
  --r: 18px; --shadow: 0 2px 10px rgba(80, 50, 20, .08);
  font-family: "GenSenRounded TW", "jf-openhuninn-2.0", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 17px; line-height: 1.65; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 760px) { body { font-size: 18px; } }
button { font: inherit; color: inherit; cursor: pointer; }
textarea, input { font: inherit; color: var(--ink); }
img { display: block; max-width: 100%; }

/* 頂列 */
.top { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: 8px; border: 0; background: none; font-weight: 900; font-size: 19px; padding: 4px 2px; flex: none; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--red); color: #FFF7E8; display: grid; place-items: center; font-size: 19px; }
.switcher { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; padding: 2px; }
.switcher::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: 15px; font-weight: 700; white-space: nowrap; display: flex; align-items: center; gap: 6px; min-height: 40px; }
.chip.on { background: var(--red); border-color: var(--red); color: #FFF7E8; }
.chip .dot { min-width: 22px; height: 22px; border-radius: 11px; background: var(--wait); color: #fff; font-size: 14px; display: grid; place-items: center; padding: 0 6px; }
.chip.on .dot { background: #FFF7E8; color: var(--red); }

main { max-width: 880px; margin: 0 auto; padding: 16px 14px 120px; }
.loading, .empty { text-align: center; color: var(--soft); padding: 48px 10px; }
h1 { font-size: 26px; margin: 6px 0 4px; line-height: 1.3; }
h2 { font-size: 21px; margin: 22px 0 10px; }
.sub { color: var(--soft); margin: 0 0 16px; }

/* 首頁：等你決定 */
.decide { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 16px 14px; margin-bottom: 14px; border-left: 6px solid var(--wait); width: 100%; text-align: left; border-top: 0; border-right: 0; border-bottom: 0; display: block; }
.decide.calm { border-left-color: var(--line); }
.decide .t { font-weight: 900; font-size: 20px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.decide ul { margin: 8px 0 0; padding-left: 1.2em; }
.decide li { margin: 2px 0; }
.decide .go { margin-top: 10px; color: var(--red); font-weight: 800; }
.allclear { background: var(--ok-soft); color: var(--ok); border-radius: var(--r); padding: 18px; font-weight: 800; font-size: 19px; text-align: center; margin-bottom: 18px; }
.newbtn { width: 100%; border: 2px dashed var(--line); background: transparent; border-radius: var(--r); padding: 16px; font-weight: 800; color: var(--soft); min-height: 56px; }

/* 專案頁 */
.demo-banner { background: #B3261E; color: #fff; font-weight: 900; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 17px; }
.tabs { display: flex; gap: 6px; background: var(--gray-soft); border-radius: 14px; padding: 5px; margin: 12px 0 16px; position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 10; }
.tab { flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 9px 4px; font-weight: 800; font-size: 16px; min-height: 46px; }
.tab.on { background: var(--card); box-shadow: var(--shadow); color: var(--red); }
.tab[disabled] { color: #B4A493; cursor: default; }
.tab small { display: block; font-size: 14px; font-weight: 600; line-height: 1.2; }

/* 狀態圓點 */
.dots { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; }
.dots::-webkit-scrollbar { display: none; }
.dotbtn { flex: none; width: 44px; height: 44px; border-radius: 22px; border: 2px solid var(--line); background: var(--card); font-weight: 900; font-size: 16px; }
.dotbtn.s-draft, .dotbtn.s-failed { border-color: var(--wait); background: var(--wait-soft); }
.dotbtn.s-approved, .dotbtn.s-adopted { border-color: var(--ok); background: var(--ok); color: #fff; }
.dotbtn.s-needs_claude { border-color: var(--blue); background: var(--blue-soft); }
.dotbtn.s-sent, .dotbtn.s-generated { border-color: var(--soft); background: var(--gray-soft); }

/* 鏡頭卡 */
.shot { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; scroll-margin-top: 130px; }
.shot .head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.num { width: 38px; height: 38px; border-radius: 12px; background: var(--ink); color: #FFF7E8; display: grid; place-items: center; font-weight: 900; flex: none; }
.shot .name { font-weight: 900; font-size: 19px; flex: 1; line-height: 1.35; }
.badge { flex: none; border-radius: 999px; padding: 3px 12px; font-size: 15px; font-weight: 800; }
.b-draft { background: var(--wait-soft); color: var(--wait); }
.b-failed { background: var(--red-soft); color: var(--red); }
.b-needs_claude { background: var(--blue-soft); color: var(--blue); }
.b-approved, .b-adopted { background: var(--ok-soft); color: var(--ok); }
.b-sent, .b-generated, .b-rejected { background: var(--gray-soft); color: var(--soft); }
.frames { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 0 14px; }
.frames.two { grid-template-columns: 1fr 1fr; max-width: 640px; margin: 0 auto; }
.frame { position: relative; border: 0; padding: 0; background: #2a2018; border-radius: 12px; overflow: hidden; aspect-ratio: 9 / 16; max-height: 62vh; width: 100%; }
.frames:not(.two) .frame { max-width: 380px; margin: 0 auto; }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame .cap { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; padding: 2px 10px; border-radius: 999px; }
.noimg { display: grid; place-items: center; color: #CDBBA5; font-size: 15px; height: 100%; }
.body { padding: 12px 14px 4px; }
.summary { font-size: 19px; font-weight: 700; margin: 0 0 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 10px; }
.meta span { background: var(--gray-soft); border-radius: 10px; padding: 3px 10px; font-size: 15px; }
.meta .pts { background: var(--red-soft); color: var(--red); font-weight: 800; }
.reason { background: var(--blue-soft); color: var(--blue); border-radius: 12px; padding: 8px 12px; font-size: 16px; margin: 0 0 10px; }
.reason.warn { background: var(--wait-soft); color: var(--wait); }
.checks-ok { color: var(--ok); font-weight: 800; font-size: 15px; }
.checks-bad { color: var(--red); font-weight: 800; font-size: 15px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 14px 6px; }
.big { border: 0; border-radius: 16px; min-height: 58px; font-weight: 900; font-size: 19px; }
.big.ok { background: var(--ok); color: #fff; }
.big.ok.done { background: var(--ok-soft); color: var(--ok); }
.big.change { background: var(--card); border: 2px solid var(--red); color: var(--red); }
.big[disabled] { opacity: .45; cursor: default; }
.links { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 4px 14px 14px; }
.link { border: 0; background: none; color: var(--soft); text-decoration: underline; text-underline-offset: 3px; padding: 8px 0; font-size: 16px; min-height: 40px; }
.drawer { margin: 0 14px 14px; background: var(--paper); border-radius: 12px; padding: 10px 12px; font-size: 16px; }
.drawer h4 { margin: 8px 0 4px; font-size: 16px; }
.drawer pre { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Consolas, monospace; font-size: 15px; background: var(--card); border-radius: 10px; padding: 10px; margin: 4px 0 8px; }
.drawer ol { margin: 4px 0; padding-left: 1.3em; }

/* 留言 */
.thread { border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.msg { border-radius: 14px; padding: 8px 12px; margin: 6px 0; max-width: 92%; font-size: 16px; }
.msg.weifu { background: var(--red-soft); margin-left: auto; }
.msg.claude { background: var(--blue-soft); }
.msg .who { font-size: 14px; color: var(--soft); font-weight: 700; }
.msg.unread { outline: 2px solid var(--blue); }
.talk { width: 100%; border: 1.5px dashed var(--line); background: transparent; border-radius: 12px; padding: 10px; color: var(--soft); font-weight: 700; min-height: 48px; text-align: left; }

/* 構想 */
.concept { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.crow { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.crow .k { font-size: 15px; color: var(--soft); font-weight: 800; }
.crow .v { white-space: pre-wrap; }
.crow .v.none { color: #B4A493; }

/* 底部總結 */
.sumbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--ink); color: #FFF7E8; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); font-weight: 800; font-size: 16px; text-align: center; }
.sumbar b { color: #FFD58A; }

/* 下方抽屜 */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(30, 18, 10, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet .panel { background: var(--card); width: 100%; max-width: 640px; border-radius: 22px 22px 0 0; padding: 18px 16px; padding-bottom: max(18px, env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
.sheet h3 { margin: 0 0 6px; font-size: 21px; }
.sheet p { margin: 4px 0 10px; color: var(--soft); }
.sheet textarea { width: 100%; min-height: 150px; border: 2px solid var(--line); border-radius: 14px; padding: 12px; font-size: 17px; background: var(--paper); resize: vertical; }
.sheet input { width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px; font-size: 17px; background: var(--paper); margin-bottom: 10px; }
.sheet .row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 12px; }
.sheet .row.one { grid-template-columns: 1fr; }
.btn2 { border: 2px solid var(--line); background: var(--card); border-radius: 14px; min-height: 54px; font-weight: 800; font-size: 17px; }
.btn1 { border: 0; background: var(--red); color: #FFF7E8; border-radius: 14px; min-height: 54px; font-weight: 900; font-size: 18px; }
.btn1.green { background: var(--ok); }
.hint { font-size: 15px; color: var(--soft); }
.quote { background: var(--paper); border-radius: 12px; padding: 10px; white-space: pre-wrap; margin: 6px 0; }

/* 看大圖 */
.viewer { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; }
.viewer .imgs { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
.viewer .imgs figure { flex: none; width: 100%; height: 100%; margin: 0; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: calc(100% - 40px); object-fit: contain; }
.viewer figcaption { color: #ddd; font-size: 15px; padding: 6px; }
.viewer .close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 52px; height: 52px; border-radius: 26px; border: 0; background: rgba(255,255,255,.2); color: #fff; font-size: 24px; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: #FFF7E8; padding: 10px 18px; border-radius: 999px; z-index: 70; font-weight: 700; font-size: 16px; max-width: 90vw; text-align: center; }

/* 登入門 */
.gate { max-width: 380px; margin: 12vh auto 0; background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 28px 22px; text-align: center; }
.gate .logo { width: 64px; height: 64px; font-size: 34px; border-radius: 18px; margin: 0 auto 10px; }
.gate h1 { font-size: 24px; }
.gate p { color: var(--soft); }

/* 實際送出設定（聲音開關等）：關聲音或沒寫一律紅色 */
.sendset { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 10px; margin: 0 0 10px; font-size: 15px; }
.sendset.warn { border-color: var(--red); background: var(--red-soft); color: var(--red); font-weight: 700; }
.sendset .lbl { font-weight: 800; color: var(--soft); margin-bottom: 4px; }
.sendset.warn .lbl { color: var(--red); }
.sendset .chips { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.sendset .chips span { background: var(--gray-soft); color: var(--ink); border-radius: 10px; padding: 3px 10px; font-weight: 600; }
.sendset .chips .on { background: var(--ok-soft); color: var(--ok); font-weight: 800; }
.sendset .chips .off { background: var(--red); color: #fff; font-weight: 800; }
.sendnote { margin-top: 6px; color: var(--soft); font-weight: 600; }
.sendnote.off { color: var(--red); font-weight: 800; }
