: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; }
.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 { display: flex; align-items: center; gap: 0.6rem; background: #fff; padding: 0.4rem 0.8rem 0.3rem; color: #555; }
.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; }
