:root { --accent: #06c755; --fg: #1c1917; --muted: #6b6560; --border: #e5e2de; }
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif; color: var(--fg); background: #faf9f7; line-height: 1.6; }
.topbar { text-align: center; padding: 1.2rem 1rem 0.4rem; }
.topbar h1 { margin: 0; font-size: 1.5rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-weight: 800; }
.bubble-badge { display: inline-block; background: var(--accent); color: #fff; font-weight: 800; font-size: 1.05rem; padding: 0.25rem 0.7rem; border-radius: 14px; border-bottom-left-radius: 2px; letter-spacing: 0.02em; }
.topbar .tag { color: var(--muted); font-size: 0.85rem; margin: 0.3rem 0 0; }

.layout { display: flex; gap: 1.5rem; max-width: 62rem; margin: 0 auto; padding: 1rem; align-items: flex-start; flex-wrap: wrap; }
.panel { flex: 1 1 16rem; min-width: 15rem; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.panel h2 { font-size: 0.95rem; margin: 0.8rem 0 0.5rem; } .panel h2:first-child { margin-top: 0; }
.panel label { display: block; font-size: 0.85rem; margin-bottom: 0.5rem; color: var(--muted); }
.panel label select { width: 100%; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; background: #fff; }
.panel label input[type=range] { width: 60%; vertical-align: middle; }
.panel label .addbar { display: inline-flex; }
.panel label input[type=text], .panel label input[type=number] { width: 100%; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; }
.panel label.row { display: flex; align-items: center; gap: 0.4rem; }
.addbar { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.addbar button { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 0.35rem 0.7rem; font-size: 0.85rem; cursor: pointer; }
.addbar button:hover { border-color: var(--accent); color: var(--accent); }
.addbar button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
#ai-images { flex: 1 0 100%; } /* AI 補圖:自成一列、滿寬 */
.hint { font-size: 0.75rem; color: var(--muted); }

.stage { flex: 1 1 24rem; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2.2rem; }
.phone-wrap { position: relative; width: 100%; max-width: 24rem; }
.phone-wrap .phone { position: relative; z-index: 1; }
.phone-backlight { position: absolute; inset: -130px; z-index: 0; filter: blur(60px); pointer-events: none; }
.wm-preview { position: absolute; right: 6px; bottom: 2px; z-index: 2; font-size: 14px; color: rgba(0,0,0,0.5); text-shadow: 0 1px 0 rgba(255,255,255,0.6); pointer-events: none; }
.phone { width: 100%; max-width: 24rem; position: relative; }
.phone .screen { overflow: hidden; display: flex; flex-direction: column; }
/* 僅對話/螢幕擷圖:擷圖是方角、無機身 */
.phone.level-chat .screen, .phone.level-screen .screen { border-radius: 0; box-shadow: 0 8px 30px rgba(0,0,0,0.12); }
.phone.level-chat [data-ui], .phone.level-chat [data-hw], .phone.level-screen [data-hw] { display: none; }
/* 包含手機 */
.phone.level-phone { background: #1a1a1e; border-radius: 40px; padding: 8px; box-shadow: 0 24px 60px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.08) inset; }
.phone .notch { position: absolute; left: 50%; transform: translateX(-50%); background: #0a0a0c; z-index: 3; }
.phone .notch.island { top: 17px; width: 78px; height: 20px; border-radius: 11px; }
.phone .notch.notch { top: 8px; width: 132px; height: 24px; border-radius: 0 0 16px 16px; }
.phone .notch.punch { top: 15px; width: 13px; height: 13px; border-radius: 50%; }
.phone .notch.none { display: none; }
/* 側邊按鈕 */
.phone .sbtn { position: absolute; width: 3px; background: #2a2a30; border-radius: 2px; }
.phone .sbtn.vol1 { left: -3px; top: 18%; height: 34px; }
.phone .sbtn.vol2 { left: -3px; top: calc(18% + 44px); height: 34px; }
.phone .sbtn.pwr { right: -3px; top: 24%; height: 52px; }
.statusbar { display: flex; align-items: center; justify-content: space-between; background: #2d3b4e; color: #fff; font-size: 0.7rem; font-weight: 600; padding: 0.35rem 0.9rem 0.1rem; }
.statusbar .batt-text { font-size: 0.68rem; margin: 0 1px 0 3px; }
.statusbar .sicons { display: flex; align-items: center; gap: 5px; }
.homebar { background: #fff; padding: 0 0 0.3rem; text-align: center; line-height: 0; }
.homebar span { display: inline-block; width: 110px; height: 4px; border-radius: 999px; background: rgba(0,0,0,0.75); }
.linehead { display: flex; align-items: center; gap: 0.6rem; background: #2d3b4e; color: #fff; padding: 0.35rem 0.9rem 0.55rem; font-size: 0.95rem; }
.linehead .hicons { display: flex; align-items: center; opacity: 0.9; }
.linehead .back { font-size: 1.3rem; line-height: 1; }
.linehead .htitle { flex: 1; font-weight: 600; }
.linehead .hmembers { font-weight: 400; opacity: 0.7; margin-left: 0.25rem; }
.inputbar { position: relative; display: flex; align-items: flex-end; gap: 0.6rem; background: #fff; padding: 0.4rem 0.8rem 0.3rem; color: #555; }
.inputbar > .plus, .inputbar > svg { margin-bottom: 5px; } /* 多行時 icon 貼底(LINE 行為),補一點視覺置中 */
.inputbar .plus { font-size: 1.1rem; color: #8a8a8a; }
.inputbar .fakein { flex: 1; min-width: 0; background: #f1f0ee; border-radius: 18px; padding: 0.2rem 0.8rem; color: #999; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }

/* LINE 對話區(與 yazelin.github.io About 同款,加編輯態) */
.line-chat { background: #7d9bc1; padding: 1rem 1rem 0.5rem; min-height: 14rem; }
.line-chat .who { display: block; font-size: 0.75rem; color: #eef3f9; margin: 0 0 0.15rem 0.3rem; }
.line-chat .msg { position: relative; display: flex; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.6rem; }
.line-chat .av { width: 36px; height: 36px; border-radius: 50%; flex: none; margin-top: 2px; cursor: pointer; background: #cfd8e3; object-fit: cover; }
.line-chat .mbody { max-width: 85%; }
.line-chat .msg .bubble { display: inline-block; background: #fff; border-radius: 14px; padding: 0.4rem 0.8rem; margin: 0; font-size: 0.9rem; line-height: 1.5; color: #1c1917; text-align: left; white-space: pre-wrap; word-break: break-word; }
.line-chat .q { display: block; font-size: 0.78rem; color: #57534e; border-bottom: 1px solid rgba(0,0,0,0.14); padding-bottom: 0.3rem; margin-bottom: 0.3rem; }
.line-chat .q strong { display: block; font-size: 0.72rem; font-weight: 700; }
.line-chat .time { font-size: 0.7rem; color: #dde7f2; margin-left: 0.35rem; white-space: nowrap; }
.line-chat .read { font-size: 0.7rem; color: #dde7f2; margin-right: 0.35rem; white-space: nowrap; }
.line-chat .msg.cont { margin-top: -0.25rem; padding-left: calc(36px + 0.5rem); }
.line-chat .msg.me { display: block; text-align: right; }
.line-chat .msg.me .bubble { background: #8de055; max-width: 85%; }
.line-chat .skip, .line-chat .date { position: relative; text-align: center; margin: 0.7rem 0; }
.line-chat .skip span, .line-chat .date span { display: inline-block; font-size: 0.72rem; color: #f0f4f9; background: rgba(0,0,0,0.18); border-radius: 999px; padding: 0.12rem 0.8rem; }
[contenteditable]:hover { outline: 1px dashed rgba(255,255,255,0.6); }
[contenteditable]:focus { outline: 2px solid var(--accent); }
.line-chat .btxt:hover { outline: 1px dashed rgba(0,0,0,0.3); }

/* 懸浮控制鈕(匯出時移除) */
.ctl { position: absolute; top: -0.9rem; right: 0; display: none; gap: 2px; z-index: 5; }
.msg:hover > .ctl, .skip:hover > .ctl, .date:hover > .ctl { display: flex; }
.ctl button { border: 0; background: rgba(0,0,0,0.55); color: #fff; border-radius: 6px; font-size: 0.68rem; padding: 0.1rem 0.4rem; cursor: pointer; }
.ctl button:hover { background: var(--accent); }

.footer { text-align: center; padding: 1.5rem 1rem 2rem; color: var(--muted); font-size: 0.8rem; display: flex; flex-direction: column; gap: 0.3rem; }
.footer nav { display: flex; gap: 1rem; justify-content: center; }
.footer a { color: var(--accent); text-decoration: none; }
.footer .footer-icon { display: inline-flex; padding: 0.3rem; border-radius: 50%; color: var(--muted); }
.footer .footer-icon:hover { color: var(--accent); }
body.dark .footer .footer-icon { color: #8a8f98; }
body.dark .footer .footer-icon:hover { color: var(--accent); }
.footer a:hover { text-decoration: underline; }
.footer .legal { font-size: 0.72rem; }

/* 手機固定高模式:內容貼底,超出的往上裁(像真的聊天室) */
.phone.fixedh .line-chat { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
.phone.fixedh .line-chat::-webkit-scrollbar { display: none; }

/* 圖片/貼圖/語音/檔案訊息 */
.line-chat .imgmsg { display: inline-block; border-radius: 14px; overflow: hidden; max-width: 70%; cursor: pointer; }
.line-chat .imgmsg img { display: block; width: 100%; }
.line-chat .sticker { display: inline-block; width: 120px; cursor: pointer; }
.line-chat .sticker img { display: block; width: 100%; }
.line-chat .voice { display: inline-flex; align-items: center; gap: 8px; }
.line-chat .voice .vbars { display: inline-flex; align-items: center; gap: 2px; }
.line-chat .voice .vbars i { display: inline-block; width: 3px; border-radius: 2px; background: #7a7f87; }
.line-chat .msg.me .voice .vbars i { background: #3f7a2c; }
.line-chat .file { display: inline-flex; align-items: center; gap: 8px; }
.line-chat .file .fmeta { display: flex; flex-direction: column; }
.line-chat .file .fname { font-size: 0.88rem; }
.line-chat .file .fsize { font-size: 0.7rem; color: #8a8a8a; }

/* 左側分頁 */
.tabs { display: flex; gap: 0.3rem; margin-bottom: 0.8rem; border-bottom: 1px solid var(--border); }
.tabs .tab { border: 0; background: none; padding: 0.4rem 0.8rem; font-size: 0.9rem; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs .tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.pane { display: none; }
.pane.active { display: block; }

/* 聊天視窗內的新增浮條(匯出時剝掉) */
.chat-addbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; justify-content: center; max-width: 24rem; }
.chat-addbar button { border: 1px solid var(--border); background: #fff; border-radius: 999px; font-size: 0.72rem; padding: 0.15rem 0.6rem; cursor: pointer; color: #555; }
.chat-addbar button:hover { border-color: var(--accent); color: var(--accent); }

/* 輸入框草稿:空的時候顯示 Aa 佔位 */
.inputbar .fakein:empty::before { content: attr(data-ph); color: #999; }
.inputbar .fakein { color: #333; outline: none; }
/* 播放動畫 */
.chat-addbar .playbtn { background: var(--accent); color: #fff; border-color: var(--accent); }
.line-chat .appear { animation: lcmIn 0.3s ease-out; }
@keyframes lcmIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* 置頂公告 */
.announce { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.92); padding: 0.3rem 0.7rem; font-size: 0.75rem; color: #555; border-bottom: 1px solid rgba(0,0,0,0.06); }
.announce #announce-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; }
.announce .achev { color: #999; }

/* 預覽模式:隱藏所有編輯痕跡 */
body.previewing .ctl { display: none !important; }
body.previewing [contenteditable]:hover, body.previewing [contenteditable]:focus { outline: none; }
body.previewing .chat-addbar button:not(#preview-toggle):not(.playbtn) { display: none; }
#preview-toggle { border-color: #888; }
body.previewing #preview-toggle { background: #333; color: #fff; border-color: #333; }

/* 暗色工作區(只換編輯環境,不動作品本身) */
body.dark { background: #0f1013; color: #e5e2de; }
body.dark .topbar h1 { color: #f4f2ef; }
body.dark .topbar .tag, body.dark .hint, body.dark .panel label { color: #9aa0a8; }
body.dark .panel { background: #17181c; border-color: #2a2c32; }
body.dark .panel input[type=text], body.dark .panel input[type=number], body.dark .panel select { background: #1f2126; border-color: #33363c; color: #e5e2de; }
body.dark .tabs { border-bottom-color: #2a2c32; }
body.dark .tabs .tab { color: #8a8f98; }
body.dark .tabs .tab.active { color: var(--accent); }
body.dark .addbar button, body.dark .chat-addbar button { background: #1f2126; border-color: #33363c; color: #c8ccd2; }
body.dark .addbar button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
body.dark .chat-addbar .playbtn { background: var(--accent); border-color: var(--accent); color: #fff; }
body.dark .footer { color: #8a8f98; }
body.dark .panel h2 { color: #d7dade; }

/* 草稿分頁 */
.draft-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; padding: 0.45rem 0.5rem; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.5rem; }
.draft-item.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.draft-item input { flex: 1 1 8rem; min-width: 6rem; border: none; background: none; font: inherit; color: inherit; border-bottom: 1px dashed transparent; }
.draft-item input:hover, .draft-item input:focus { border-bottom-color: var(--muted); outline: none; }
.draft-meta { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.draft-acts { display: flex; gap: 0.3rem; margin-left: auto; }
.draft-acts button { font-size: 0.8rem; padding: 0.15rem 0.5rem; }
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 8px); background: rgba(28, 25, 23, 0.92); color: #fff; padding: 0.55rem 1rem; border-radius: 999px; font-size: 0.88rem; opacity: 0; transition: opacity 0.3s, transform 0.3s; z-index: 99; pointer-events: none; max-width: 92vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 表情回應 */
.line-chat .reacts { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 1rem; line-height: 1; }
.line-chat .msg.me .reacts { justify-content: flex-end; }
.line-chat .reacts .ricon { width: 19px; height: 19px; color: #eef2f7; opacity: 0.95; flex: 0 0 auto; }
.line-chat .reacts span.remoji { display: inline-block; min-width: 0.9em; outline: none; }
.line-chat .reacts img.remoji { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; cursor: pointer; }
.line-chat .reacts .radd { display: none; gap: 2px; margin-left: 4px; }
.line-chat .msg:hover .reacts .radd { display: inline-flex; }
.line-chat .radd button { border: 0; background: rgba(0, 0, 0, 0.35); color: #fff; border-radius: 5px; font-size: 0.62rem; padding: 0.08rem 0.3rem; cursor: pointer; }
.line-chat .radd button:hover { background: var(--accent); }
body.previewing .radd { display: none !important; }

/* 泡泡+時間同列:時間貼泡泡底部、永不換行(LINE 行為);下一行留給表情回應 */
.line-chat .brow { display: flex; align-items: flex-end; }
.line-chat .brow .bubble, .line-chat .brow .imgmsg { min-width: 0; }
.line-chat .brow .time, .line-chat .brow .read { flex: none; }
.line-chat .msg.me .brow { justify-content: flex-end; }
.line-chat .msg.me .brow .bubble, .line-chat .msg.me .brow .imgmsg { max-width: 78%; }

/* 泡泡 R 角不對稱:說話者那側的上角小 R(左訊息=左上小、右訊息=右上小) */
.line-chat .msg .bubble, .line-chat .msg .imgmsg { border-radius: 4px 16px 16px 16px; }
.line-chat .msg.me .bubble, .line-chat .msg.me .imgmsg { border-radius: 16px 4px 16px 16px; }

/* 引用回覆:被引用者小頭像 + 文字欄 */
.line-chat .q { display: flex; align-items: flex-start; gap: 6px; }
.line-chat .qav { width: 18px; height: 18px; border-radius: 50%; flex: none; margin-top: 2px; object-fit: cover; background: #cfd8e3 url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"%3E%3Ccircle cx="18" cy="14" r="6.5" fill="%23ffffff" opacity="0.85"/%3E%3Cpath d="M6 32c1.7-7 7-9.5 12-9.5s10.3 2.5 12 9.5z" fill="%23ffffff" opacity="0.85"/%3E%3C/svg%3E') center/cover no-repeat; }
.line-chat .qtxt { min-width: 0; }

/* 預設頭像:灰底白人形剪影(LINE 兩平台皆同) */
.line-chat .av { background: #cfd8e3 url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"%3E%3Ccircle cx="18" cy="14" r="6.5" fill="%23ffffff" opacity="0.85"/%3E%3Cpath d="M6 32c1.7-7 7-9.5 12-9.5s10.3 2.5 12 9.5z" fill="%23ffffff" opacity="0.85"/%3E%3C/svg%3E') center/cover no-repeat; }

/* 表情回應的灰笑臉:半透明深色圓底,任何桌布都看得見 */
.line-chat .reacts .ricon { background: rgba(0, 0, 0, 0.3); border-radius: 50%; padding: 3px; }

/* LINE AI 懸浮鈕(畫面的一部分,匯出/嵌入包含) */
.phone .screen { position: relative; }
.phone .ai-fab { position: absolute; right: 12px; bottom: calc(100% + 10px); width: 32px; height: 32px; border: 5px solid rgba(74, 80, 88, 0.92); border-radius: 50%; background: #d7dade; color: #4a5058; font-weight: 900; font-size: 10px; -webkit-text-stroke: 0.3px #4a5058; display: flex; align-items: center; justify-content: center; z-index: 4; letter-spacing: 0; }

/* ── 系統列(單一套手繪 icon,顏色由「系統顏色」設定,JS 以亮度自動配黑/白前景) ── */
.phone .sicons-android { display: inline-flex; align-items: center; gap: 4.5px; }
.phone .hicons-android { display: inline-flex; align-items: center; gap: 15px; }
.phone .inputbar .in-a { display: inline-block; }
.phone .inputbar .in-smile { margin-left: -30px; margin-right: 2px; position: relative; z-index: 1; }
.phone .inputbar .fakein { padding-right: 34px; border-radius: 18px; } /* 定值=單行高一半:單行看是膠囊,多行自然變圓角矩形(LINE 行為) */
.phone.mode-group .h-call, .phone.mode-group .h-cal { display: none; }
.phone.mode-dm .h-bub { display: none; }
.phone .statusbar { font-weight: 500; }
.phone .volte { font-size: 6px; line-height: 1.05; font-weight: 700; letter-spacing: 0.02em; display: inline-block; text-align: center; }
.phone .linehead .htitle { font-weight: 700; }

/* ── LINE 深色主題(作品本身,雙 os 通用) ── */
.phone.skin-real.theme-dark .statusbar, .phone.skin-real.theme-dark .linehead { background: #0f1216; color: #fff; }
.phone.skin-real.theme-dark .inputbar { background: #0f1216; color: #cfd3d8; }
.phone.skin-real.theme-dark .inputbar .plus { color: #cfd3d8; }
.phone.skin-real.theme-dark .inputbar .fakein { background: #22262b; color: #d5d9de; }
.phone.skin-real.theme-dark .inputbar .fakein:empty::before { color: #7d838a; }
.phone.skin-real.theme-dark .homebar { background: #0f1216; }
.phone.skin-real.theme-dark .homebar span { background: rgba(255, 255, 255, 0.85); }
.phone.skin-real.theme-dark .line-chat .msg .bubble { background: #2b2d31; color: #e8eaed; }
.phone.skin-real.theme-dark .line-chat .msg.me .bubble { background: #7fe15a; color: #101710; }
.phone.skin-real.theme-dark .line-chat .q { color: #b9bdc2; border-bottom-color: rgba(255, 255, 255, 0.18); }
.phone.skin-real.theme-dark .line-chat .msg.me .q { color: #2c4423; border-bottom-color: rgba(0, 0, 0, 0.2); }
.phone.skin-real.theme-dark .line-chat .file .fsize { color: #9aa0a6; }
.phone.skin-real.theme-dark .line-chat .voice .vbars i { background: #9aa0a6; }
.phone.skin-real.theme-dark .announce { background: rgba(18, 20, 24, 0.82); color: #c9ced4; border-bottom-color: rgba(255, 255, 255, 0.05); }
.phone.skin-real.theme-dark .announce .achev { color: #8a8f96; }

/* ── AI 助手面板 ── */
.panel label textarea { width: 100%; padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; font-family: inherit; resize: vertical; }
.addbar button:disabled { opacity: 0.45; cursor: not-allowed; }
.ai-log { font-size: 0.75rem; max-height: 14rem; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0.5rem 0; }
.ai-log:empty { display: none; }
.ai-log div { border-left: 3px solid var(--border); padding: 2px 6px; color: var(--muted); word-break: break-word; }
.ai-log .prompt { border-left-color: var(--accent); color: var(--fg); }
.ai-log .done { border-left-color: var(--accent); color: var(--fg); }
.ai-log .warn { border-left-color: #d99000; }
.ai-log .err { border-left-color: #d33a2f; color: #b3261e; }
body.dark .panel label textarea, body.dark .panel input[type=password] { background: #1f2126; border-color: #33363c; color: #e5e2de; }
body.dark .ai-log .prompt, body.dark .ai-log .done { color: #e5e2de; }

/* ── AI 微調列(預覽正下方,直改目前畫面) ── */
.ai-quickbar { display: flex; gap: 0.4rem; width: 100%; max-width: 24rem; }
.ai-quickbar input { flex: 1; min-width: 0; padding: 0.45rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.85rem; }
.ai-quickbar button { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 0.35rem 0.7rem; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }
.ai-quickbar button:hover { border-color: var(--accent); color: var(--accent); }
.ai-quickbar button:disabled { opacity: 0.45; cursor: not-allowed; }
body.previewing .ai-quickbar { display: none; }
body.dark .ai-quickbar input { background: #1f2126; border-color: #33363c; color: #e5e2de; }
body.dark .ai-quickbar button { background: #1f2126; border-color: #33363c; color: #e5e2de; }

/* ── 連線設定摺疊區+兩段主按鈕整行 ── */
#ai-settings { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.6rem; margin-bottom: 0.8rem; }
#ai-settings summary { cursor: pointer; font-size: 0.85rem; font-weight: 700; color: var(--fg); }
#ai-settings[open] summary { margin-bottom: 0.6rem; }
body.dark #ai-settings { border-color: #2a2c32; }
body.dark #ai-settings summary { color: #e5e2de; }
#ai-ideas { margin-bottom: 0.6rem; }
#ai-run { flex: 1 1 100%; }
#ai-enhance, #ai-copy-prompt { flex: 1 1 auto; } /* 劇本強化 + 複製 prompt 同一列 */
.ai-quickbar { margin-top: -1.7rem; } /* .stage gap 2.2rem 太遠,拉回貼著 chat-addbar */
.chat-addbar .playbtn:hover { background: #05b34e; border-color: #05b34e; color: #fff; } /* 蓋掉通用 hover 綠字,避免綠字疊綠底 */

/* ── 右上角免費 AI 額度徽章 ── */
.topbar { position: relative; }
.ai-quota { position: absolute; top: 0.7rem; right: 0.9rem; font-size: 0.75rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.6rem; background: #fff; }
@media (max-width: 640px) { .ai-quota { position: static; display: inline-block; margin-top: 0.3rem; } }
body.dark .ai-quota { background: #1f2126; border-color: #33363c; color: #9aa0a8; }
.footer .ver { opacity: 0.7; margin-left: 0.3rem; }

/* 玩樂基礎:傾斜由 --tilt(每泡)× --playful(全域)× 各 skin 的 --tilt-range 決定;real skin 不設 --tilt-range 故為 0 */
.phone { --playful: 0.5; }
.phone[class*="skin-"]:not(.skin-real) .line-chat .msg { transform: rotate(calc(var(--tilt, 0deg) * var(--playful, .5) * var(--tilt-range, 0))); transition: transform .15s ease; }

/* ===== skin: Memo 貼紙手帳 ===== */
.phone.skin-memo { --tilt-range: 4; }
.phone.skin-memo .screen { background: #f4ece0; }
.phone.skin-memo .line-chat { background: #f4ece0; }
/* 次要文字在奶油底上要讀得到:暱稱、時間、已讀、日期/略分隔(baseline 為深底淺字,在此改暖色) */
.phone.skin-memo .line-chat .who { color: #6b5a44; }
.phone.skin-memo .line-chat .time, .phone.skin-memo .line-chat .read { color: #a08d74; }
.phone.skin-memo .line-chat .date > *, .phone.skin-memo .line-chat .skip > * { background: rgba(107,90,68,.5); color: #fbf6ec; }
/* 便利貼泡泡:紙感(方角、暖邊、紙紋、底部微捲陰影+頂部反光) */
.phone.skin-memo .line-chat .msg .bubble {
  position: relative; overflow: visible;
  background-color: #fffdf8; color: #3a3226;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'120'%20height%3D'120'%3E%3Cfilter%20id%3D'n'%3E%3CfeTurbulence%20type%3D'fractalNoise'%20baseFrequency%3D'0.85'%20numOctaves%3D'2'%20stitchTiles%3D'stitch'%2F%3E%3CfeColorMatrix%20type%3D'saturate'%20values%3D'0'%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D'100%25'%20height%3D'100%25'%20filter%3D'url(%23n)'%20opacity%3D'0.09'%2F%3E%3C%2Fsvg%3E");
  background-size: 100px 100px; background-blend-mode: multiply;
  border: 1px solid #eee3ce; border-radius: 4px;
  box-shadow: 0 3px 6px rgba(120,100,70,.20), inset 0 -8px 10px -8px rgba(150,130,95,.22), inset 0 1px 0 rgba(255,255,255,.7);
}
.phone.skin-memo .line-chat .msg.me .bubble { background-color: #eafbe6; color: #2b3a24; }
/* 撕邊紙膠帶:只貼文字便利貼(有 .btxt),角度依每則 --tilt 微變 */
.phone.skin-memo .line-chat .msg .bubble:has(.btxt)::before {
  content: ''; position: absolute; top: -9px; left: 50%; margin-left: -28px; width: 56px; height: 16px;
  background:
    linear-gradient(90deg, rgba(126,199,178,.22), rgba(126,199,178,.52) 14%, rgba(126,199,178,.52) 86%, rgba(126,199,178,.22)),
    linear-gradient(rgba(255,255,255,.30), rgba(255,255,255,0) 55%);
  transform: rotate(calc(-3deg + var(--tilt, 0deg) * 4));
  clip-path: polygon(0% 0%, 100% 0%, 89% 16.6%, 100% 33.3%, 89% 50%, 100% 66.6%, 89% 83.3%, 100% 100%, 0% 100%, 11% 83.3%, 0% 66.6%, 11% 50%, 0% 33.3%, 11% 16.6%);
  filter: drop-shadow(0 1px 1px rgba(90,74,52,.20));
}
/* 拍立得頭像:白框、厚下緣、微傾 */
.phone.skin-memo .line-chat .av {
  border-radius: 2px; border: 3px solid #fff; border-bottom: 9px solid #fff;
  background: #fff; object-fit: cover; box-sizing: content-box;
  box-shadow: 0 2px 5px rgba(120,100,70,.30); transform: rotate(-4deg);
}
.phone.skin-memo .statusbar, .phone.skin-memo .linehead { background: #efe4d4 !important; color: #5b4a34 !important; }
.phone.skin-memo .inputbar { background: #efe4d4; color: #5b4a34; }
.phone.skin-memo .homebar { background: #efe4d4; }
.phone.skin-memo .homebar span { background: rgba(90,74,52,.55); }
.phone.skin-memo .line-chat .appear { animation: memoIn .34s cubic-bezier(.22,1.2,.36,1) both; }
@keyframes memoIn {
  from { opacity: 0; transform: scale(.9) translateY(10px) rotate(2deg); }
  to   { opacity: 1; transform: scale(1) translateY(0) rotate(0); }
}

/* ===== skin: Jelly 果凍軟糖 ===== */
.phone.skin-jelly { --tilt-range: 2; }
.phone.skin-jelly .screen, .phone.skin-jelly .line-chat { background: linear-gradient(160deg,#ffeaf4,#eaf3ff); }
.phone.skin-jelly .line-chat .who { color:#c0417f; }
.phone.skin-jelly .line-chat .time, .phone.skin-jelly .line-chat .read { color:#b06a92; }
.phone.skin-jelly .line-chat .date > *, .phone.skin-jelly .line-chat .skip > * { background: rgba(200,90,150,.55); color:#fff; }
.phone.skin-jelly .line-chat .msg .bubble {
  border-radius: 22px; border: none; color:#7a2f52;
  background: linear-gradient(#fff0f7,#ffdcec);
  box-shadow: inset 0 3px 6px rgba(255,255,255,.9), inset 0 -5px 9px rgba(220,120,170,.28), 0 6px 14px rgba(210,130,175,.30);
}
.phone.skin-jelly .line-chat .msg.me .bubble {
  color:#1f5b3c; background: linear-gradient(#dcffe9,#b6f0c9);
  box-shadow: inset 0 3px 6px rgba(255,255,255,.9), inset 0 -5px 9px rgba(90,190,140,.28), 0 6px 14px rgba(120,200,150,.30);
}
/* 光澤糖果貼紙頭像:圓角方、白框、糖果陰影+內反光、微傾 */
.phone.skin-jelly .line-chat .av { border-radius: 42%; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(210,120,175,.5), inset 0 2px 5px rgba(255,255,255,.95); transform: rotate(-3deg); }
.phone.skin-jelly .statusbar, .phone.skin-jelly .linehead { background:#ffd6ea !important; color:#8a3a63 !important; }
.phone.skin-jelly .inputbar { background:#ffd6ea; color:#8a3a63; }
.phone.skin-jelly .homebar { background:#ffd6ea; }
.phone.skin-jelly .homebar span { background: rgba(140,58,99,.5); }
.phone.skin-jelly .line-chat .appear { animation: jellyIn .42s cubic-bezier(.18,1.5,.3,1) both; }
@keyframes jellyIn { 0%{opacity:0;transform:scale(.5)} 55%{opacity:1;transform:scale(1.12)} 75%{transform:scale(.96)} 100%{transform:scale(1)} }

/* ===== skin: Doodle 手繪塗鴉 ===== */
.phone.skin-doodle { --tilt-range: 3; }
.phone.skin-doodle .screen, .phone.skin-doodle .line-chat {
  background:#fffef8; background-image: repeating-linear-gradient(#fffef8 0 26px, #e7ecdd 26px 27px);
}
.phone.skin-doodle .line-chat .who { color:#c0562a; font-weight:700; }
.phone.skin-doodle .line-chat .time, .phone.skin-doodle .line-chat .read { color:#8a8a76; }
.phone.skin-doodle .line-chat .date > *, .phone.skin-doodle .line-chat .skip > * { background: rgba(58,58,58,.14); color:#4a4a42; }
.phone.skin-doodle .line-chat .msg .bubble {
  background:#fff; color:#333; border:2.5px solid #3a3a3a;
  border-radius: 235px 18px 220px 18px / 18px 210px 18px 235px;
  box-shadow: 2px 3px 0 rgba(0,0,0,.13);
}
.phone.skin-doodle .line-chat .msg.me .bubble { background:#fff6c8; }
/* 手繪抖動墨框頭像:不規則圓、粗墨線、漫畫小陰影、微傾 */
.phone.skin-doodle .line-chat .av { border:2.5px solid #3a3a3a !important; border-radius: 47% 53% 51% 49% / 52% 47% 53% 48% !important; box-shadow: 1.5px 2px 0 rgba(0,0,0,.16); transform: rotate(-3deg); }
.phone.skin-doodle .statusbar, .phone.skin-doodle .linehead { background:#fffef8 !important; color:#3a3a3a !important; }
.phone.skin-doodle .linehead { border-bottom:2.5px solid #3a3a3a; }
.phone.skin-doodle .inputbar { background:#fffef8; color:#3a3a3a; border-top:2.5px solid #3a3a3a; }
.phone.skin-doodle .homebar { background:#fffef8; }
.phone.skin-doodle .homebar span { background:#3a3a3a; }
.phone.skin-doodle .line-chat .appear { animation: doodleIn .32s ease-out both; }
@keyframes doodleIn { from{opacity:0;transform:scale(.85) rotate(-3deg)} to{opacity:1;transform:scale(1) rotate(0)} }

/* ===== skin: Pop 波普霓虹(暗底) ===== */
.phone.skin-pop { --tilt-range: 3; }
.phone.skin-pop .screen, .phone.skin-pop .line-chat { background:#12101c; }
.phone.skin-pop .line-chat .who { color:#22e0c4; font-weight:700; }
.phone.skin-pop .line-chat .time, .phone.skin-pop .line-chat .read { color:#9a9ab4; }
.phone.skin-pop .line-chat .date > *, .phone.skin-pop .line-chat .skip > * { background: rgba(255,79,216,.20); color:#f4f2ff; }
.phone.skin-pop .line-chat .msg .bubble {
  background: rgba(255,255,255,.06); color:#f4f2ff;
  border:2px solid #ff4fd8; border-radius:16px;
  box-shadow: 0 0 12px rgba(255,79,216,.55), inset 0 0 8px rgba(255,79,216,.22);
}
.phone.skin-pop .line-chat .msg.me .bubble {
  border-color:#00e5c0; color:#eafffb;
  box-shadow: 0 0 12px rgba(0,229,192,.55), inset 0 0 8px rgba(0,229,192,.22);
}
/* 霓虹雙圈頭像:青內框 + 洋紅外圈 + 發光、圓角方、微傾 */
.phone.skin-pop .line-chat .av { border:2px solid #00e5c0 !important; border-radius: 32%; box-shadow: 0 0 10px rgba(0,229,192,.85), 0 0 0 3px rgba(255,79,216,.55); transform: rotate(-2deg); }
.phone.skin-pop .statusbar, .phone.skin-pop .linehead { background:#0c0a14 !important; color:#f4f2ff !important; }
.phone.skin-pop .inputbar { background:#0c0a14; color:#cfc9e6; }
.phone.skin-pop .homebar { background:#0c0a14; }
.phone.skin-pop .homebar span { background: rgba(255,255,255,.85); }
.phone.skin-pop .line-chat .appear { animation: popIn .36s ease-out both; }
@keyframes popIn { 0%{opacity:0;transform:scale(.7);box-shadow:0 0 26px rgba(255,79,216,.9)} 100%{opacity:1;transform:scale(1)} }

/* ===== skin 細節收尾:引用文字對比 + Pop 暗底元件 + 造型挖孔 ===== */
/* 引用/回覆文字(.q)在各 skin 泡泡上要讀得到(baseline 深底淺字,亮泡/Pop 暗泡都會出問題) */
.phone.skin-memo .line-chat .q { color:#7a6a52; }
.phone.skin-jelly .line-chat .q { color:#a85684; }
.phone.skin-doodle .line-chat .q { color:#5a5a4c; }
.phone.skin-pop .line-chat .q { color:#cbc7e0; }
.phone.skin-pop .line-chat .msg.me .q { color:#cbc7e0; } /* 蓋過 theme-dark 的 .msg.me .q(6 類,同分靠順序):暗底下 me 引用不落回深綠 */
/* Pop 暗底:假輸入框與 AI 懸浮鈕不能留 baseline 亮色 */
.phone.skin-pop .inputbar .fakein { background: rgba(255,255,255,.09); color:#d5d5e2; }
.phone.skin-pop .ai-fab { background: rgba(255,255,255,.08); color:#eafffb; border:1px solid rgba(0,229,192,.55); }
/* Pop 霓虹感:狀態列/表頭圖示與標題加微光暈 */
.phone.skin-pop .statusbar .sicons svg, .phone.skin-pop .linehead .hicons svg { filter: drop-shadow(0 0 2.5px rgba(0,229,192,.65)); }
.phone.skin-pop .linehead .htitle { text-shadow: 0 0 6px rgba(0,229,192,.35); }
/* 造型挖孔:鏡頭挖孔形狀隨 skin(亮 skin 用黑洞;Pop 暗底改霓虹發光六角,否則黑洞在暗底看不見) */
.phone .notch.skinhole { top: 11px; width: 24px; height: 24px; background:#0a0a0c; border-radius:0; clip-path: circle(45%); }
.phone.skin-memo .notch.skinhole { clip-path: polygon(50% 2%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.phone.skin-jelly .notch.skinhole { clip-path: path('M12 22 C 4 15.5, 1 11.5, 1 7.2 C 1 4, 3.4 2, 6 2 C 8.6 2, 10.8 3.8, 12 6.2 C 13.2 3.8, 15.4 2, 18 2 C 20.6 2, 23 4, 23 7.2 C 23 11.5, 20 15.5, 12 22 Z'); }
.phone.skin-doodle .notch.skinhole { clip-path: polygon(50% 0%, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0% 50%, 42% 42%); }
.phone.skin-pop .notch.skinhole { background: #00e5c0; clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); filter: drop-shadow(0 0 3px #00e5c0) drop-shadow(0 0 6px rgba(0,229,192,.85)) drop-shadow(0 0 5px rgba(255,79,216,.6)); }
.phone.skin-pop .notch.skinhole::before { content:''; position:absolute; inset:2.5px; background:#12101c; clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); } /* 暗心 → 霓虹管外框(不是實心色塊) */

/* ===== skin: Ink 宣紙水墨(淺底·文人書法) ===== */
/* 白紙 · 墨 · 朱印:筆觸暈開的墨箋泡泡、遠山墨雲霧底、紅毛筆點評圈鏡頭。SVG #ink-edge 濾鏡在 index.html #phone-wrap 內(供匯出) */
.phone.skin-ink { --tilt-range: 1.4; font-family: 'Kaiti TC','Kaiti','STKaiti','BiauKai','DFKai-SB','KaiTi','TW-Kai','Noto Serif TC',serif; }
/* 灰階水墨:白紙→灰→墨的濃淡,唯一色彩是頭像朱印(依 yazelin:減黃、增白灰黑) */
.phone.skin-ink .screen, .phone.skin-ink .line-chat {
  background-color: #f4f4f2;
  background-image:
    radial-gradient(165% 70% at 20% 132%, rgba(22,23,26,.5), rgba(58,60,64,.13) 44%, transparent 68%),
    radial-gradient(130% 54% at 96% 128%, rgba(34,36,40,.32), transparent 56%),
    radial-gradient(112% 48% at 110% 2%, rgba(44,46,50,.14), transparent 52%),
    url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'120'%20height%3D'120'%3E%3Cfilter%20id%3D'n'%3E%3CfeTurbulence%20type%3D'fractalNoise'%20baseFrequency%3D'0.85'%20numOctaves%3D'2'%20stitchTiles%3D'stitch'%2F%3E%3CfeColorMatrix%20type%3D'saturate'%20values%3D'0'%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D'100%25'%20height%3D'100%25'%20filter%3D'url(%23n)'%20opacity%3D'0.06'%2F%3E%3C%2Fsvg%3E");
  background-size: auto, auto, auto, 150px 150px; background-repeat: no-repeat, no-repeat, no-repeat, repeat; background-blend-mode: multiply, multiply, multiply, multiply;
}
.phone.skin-ink .line-chat .who { color: #454547; letter-spacing: .03em; }
.phone.skin-ink .line-chat .time, .phone.skin-ink .line-chat .read { color: #8b8b8d; }
.phone.skin-ink .line-chat .date > *, .phone.skin-ink .line-chat .skip > * { background: rgba(38,39,42,.62); color: #f2f2f0; letter-spacing: .05em; }
.phone.skin-ink .line-chat .msg .bubble { position: relative; background: transparent; border: none; color: #1a1a1b; }
/* 墨雲泡泡:徑向漸層中心夠實供文字、往外羽化為霧;有機雲形。灰階濃淡=對方淡墨(近白)、自己中墨(較深灰) */
.phone.skin-ink .line-chat .msg .bubble::before { content: ''; position: absolute; inset: -6px; z-index: 0; background: radial-gradient(115% 130% at 50% 45%, #fcfcfb 56%, rgba(252,252,251,.5) 80%, rgba(252,252,251,0) 100%); border: none; box-shadow: none; border-radius: 47% 53% 52% 48% / 56% 49% 51% 44%; }
.phone.skin-ink .line-chat .msg.me .bubble::before { background: radial-gradient(118% 134% at 48% 40%, #c6c6c4 46%, #acaca9 70%, rgba(150,150,148,.4) 88%, rgba(150,150,148,0) 100%); border-radius: 54% 46% 49% 51% / 49% 56% 44% 51%; }
.phone.skin-ink .line-chat .msg .bubble > * { position: relative; z-index: 1; } /* 全部泡泡內容(含引用 .q 與其小頭像)都要在墨雲 ::before 之上,否則被雲遮住 */
.phone.skin-ink .line-chat .q { color: #565658; border-bottom-color: rgba(40,40,42,.22); }
.phone.skin-ink .line-chat .msg.me .q { color: #3f3f41; border-bottom-color: rgba(40,40,42,.26); }
/* (移除泡泡右下角小朱印:11px 下讀成方塊、易混淆;朱色由頭像印框承擔) */
.phone.skin-ink .line-chat .av { position: relative; z-index: 2; border-radius: 3px !important; border: 2px solid #b34a3e !important; box-shadow: 0 0 0 2px rgba(168,50,42,.35), 2px 3px 6px rgba(90,40,25,.2); transform: rotate(-2deg); }
.phone.skin-ink .statusbar, .phone.skin-ink .linehead { background: #e8e8e6 !important; color: #343436 !important; }
.phone.skin-ink .linehead { border-bottom: 1px solid rgba(40,40,42,.25); }
.phone.skin-ink .inputbar { background: #e8e8e6; color: #454547; border-top: 1px solid rgba(40,40,42,.2); }
.phone.skin-ink .inputbar .fakein { background: #f1f1ef; color: #454547; }
.phone.skin-ink .homebar { background: #e8e8e6; } .phone.skin-ink .homebar span { background: rgba(50,50,52,.6); }
.phone.skin-ink .ai-fab { background: #e9e9e7; color: #4a4a4c; border-color: rgba(60,60,62,.6); }
.phone.skin-ink .line-chat .appear { animation: inkIn .48s cubic-bezier(.22,.9,.3,1) both; }
@keyframes inkIn { 0%{opacity:0;transform:scale(.96) translateY(5px);filter:blur(2.5px)} 60%{opacity:1;filter:blur(.8px)} 100%{opacity:1;transform:none;filter:blur(0)} }
/* 造型挖孔:朱紅毛筆點評圈(乾淨紅圈,不用濾鏡以免糊掉) */
.phone.skin-ink .notch.skinhole { background: transparent; border: 3px solid #bb3b2b; border-radius: 50%; clip-path: none; box-shadow: 0 0 0 1px rgba(187,59,43,.15); top: 9px; width: 22px; height: 22px; }
