:root { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: #111; background: #d9d9d9; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, textarea { font: inherit; }
button { cursor: pointer; }
.phone-chat { width: min(100%, 480px); height: 100dvh; margin: 0 auto; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; background: #ededed; box-shadow: 0 0 36px rgba(0,0,0,.15); }
.chat-header { min-height: 58px; padding: max(8px, env(safe-area-inset-top)) 11px 8px; display: grid; grid-template-columns: 76px 1fr 76px; align-items: center; border-bottom: 1px solid #d5d5d5; background: rgba(237,237,237,.96); z-index: 2; }
.nudge-button { width: 76px !important; font-size: 14px; color: #576b95 !important; }
.nudge-button:disabled { opacity: .55; }
.nudge-notice { grid-column: 1 / -1; margin: 2px 0 4px; color: #727272; font-size: 12px; text-align: center; }
.header-action { width: 44px; height: 42px; padding: 0; border: 0; background: transparent; color: #181818; }
.back { font-family: Arial, sans-serif; font-size: 42px; font-weight: 200; line-height: 35px; text-align: left; }
.more { font-size: 17px; font-weight: 800; letter-spacing: 2px; text-align: right; transform: translateY(-3px); }
.chat-title { text-align: center; min-width: 0; }
.chat-title h1 { margin: 0; font-size: 17px; font-weight: 600; line-height: 23px; }
.chat-title p { margin: 0; color: #8a8a8a; font-size: 11px; line-height: 14px; }
.chat-title p.offline { color: #d15241; }
.messages { overflow-y: auto; overscroll-behavior: contain; padding: 16px 12px 22px; background: #ededed; scroll-behavior: smooth; }
.empty-state { padding-top: 6px; text-align: center; color: #b1b1b1; font-size: 12px; }
.empty-state span { display: inline-block; padding: 3px 8px; border-radius: 4px; background: #dadada; color: #fff; }
.empty-state p { margin: 18px 0 0; }
.message { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr); grid-template-areas: "avatar content"; gap: 10px; align-items: start; margin-bottom: 20px; animation: arrive .18s ease-out; }
.message::before { content: attr(data-avatar); grid-area: avatar; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 4px; background: linear-gradient(145deg, #66ad8b, #337a61); color: white; font-size: 18px; font-weight: 600; }
.message-head, .bubble { grid-column: 2; }
.message-head { margin: -1px 0 4px 1px; color: #9b9b9b; font-size: 12px; line-height: 15px; }
.message-head strong { font-weight: 400; }
.message-head time { display: none; }
.bubble { position: relative; justify-self: start; width: fit-content; max-width: min(78%, 320px); padding: 10px 12px; border: 1px solid #d6d6d6; border-radius: 5px; background: #fff; color: #111; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble::before { content: ""; position: absolute; left: -7px; top: 12px; width: 12px; height: 12px; border-left: 1px solid #d6d6d6; border-bottom: 1px solid #d6d6d6; background: inherit; transform: rotate(45deg); }
.message.mine { grid-template-columns: minmax(0, 1fr) 42px; grid-template-areas: "content avatar"; }
.message.mine::before { grid-column: 2; background: linear-gradient(145deg, #7b9ed0, #466894); }
.mine .message-head { grid-column: 1; text-align: right; margin-right: 1px; }
.mine .bubble { grid-column: 1; justify-self: end; border-color: #95c66d; background: #95ec69; }
.mine .bubble::before { left: auto; right: -7px; border: 0; border-top: 1px solid #95c66d; border-right: 1px solid #95c66d; }
.bubble img { display: block; max-width: 100%; max-height: 300px; border-radius: 3px; object-fit: contain; }
.bubble video { display: block; width: min(68vw, 320px); max-width: 100%; max-height: 420px; border-radius: 4px; background: #000; }
.bubble img + .text { margin-top: 8px; }
.bubble video + .text { margin-top: 8px; }
.media-actions { display: flex; justify-content: flex-end; margin-top: 7px; }
.save-media { min-width: 68px; height: 28px; padding: 0 9px; border: 1px solid rgba(0,0,0,.14); border-radius: 4px; background: rgba(255,255,255,.72); color: #576b95; font-size: 12px; line-height: 26px; }
.save-media:active { background: rgba(0,0,0,.08); }
.save-media:disabled { opacity: .55; }
.media-actions + .text { margin-top: 8px; }
.composer { padding: 7px 8px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid #d7d7d7; background: #f7f7f7; }
.input-row { display: flex; align-items: flex-end; gap: 7px; }
.tool-button { flex: 0 0 34px; width: 34px; height: 38px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: #1b1b1b; font-size: 31px; line-height: 1; user-select: none; }
.voice span { width: 25px; height: 25px; border: 2px solid #1d1d1d; border-radius: 50%; position: relative; }
.voice span::after { content: ""; position: absolute; left: 5px; top: 4px; width: 8px; height: 12px; border: 2px solid #1d1d1d; border-top: 0; border-bottom: 0; }
.emoji { font-family: Arial, sans-serif; font-size: 30px; font-weight: 300; }
.emoji-panel { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; margin: 8px 0 3px; padding: 8px; border-radius: 7px; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.08); }
.emoji-panel[hidden] { display: none; }
.emoji-panel button { height: 38px; padding: 0; border: 0; border-radius: 5px; background: transparent; font-size: 24px; line-height: 38px; }
.emoji-panel button:active { background: #ededed; }
.add { font-size: 30px; }
.add > span { width: 25px; height: 25px; display: grid; place-items: center; border: 2px solid #1d1d1d; border-radius: 50%; font-size: 23px; font-weight: 300; line-height: 20px; }
textarea { flex: 1; min-width: 0; min-height: 38px; max-height: 112px; resize: none; padding: 8px 9px; border: 0; border-radius: 5px; outline: none; background: #fff; color: #111; font-size: 16px; line-height: 22px; }
.send-button { display: none; flex: 0 0 58px; width: 58px; height: 36px; padding: 0; border: 0; border-radius: 4px; background: #07c160; color: #fff; font-size: 14px; }
.composer.has-text .emoji, .composer.has-text .add { display: none; }
.composer.has-text .send-button { display: inline-block; }
.send-button:disabled { opacity: .5; }
.composer-meta { min-height: 0; display: flex; justify-content: flex-end; padding-top: 2px; font-size: 11px; }
.composer-meta:empty { display: none; }
#errorText { color: #d15241; text-align: right; }
#errorText:empty { display: none; }
.preview-wrap { position: relative; width: max-content; margin: 0 0 8px 42px; }
.preview-wrap img { display: block; max-width: 118px; max-height: 86px; border-radius: 4px; }
.preview-wrap video { display: block; width: 150px; max-height: 110px; border-radius: 4px; background: #000; }
.preview-wrap button { position: absolute; right: -8px; top: -8px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: #333; color: white; line-height: 20px; }
.save-guide { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.48); }
.save-guide[hidden] { display: none; }
.save-guide-card { width: min(100%, 340px); padding: 22px 20px 18px; border-radius: 10px; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.save-guide-card h2 { margin: 0 0 10px; font-size: 18px; }
.save-guide-card p { margin: 0; color: #555; font-size: 14px; line-height: 1.65; }
.save-guide-card > div { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.save-guide-card button, .save-guide-card a { min-width: 82px; height: 36px; display: grid; place-items: center; padding: 0 12px; border: 0; border-radius: 5px; font-size: 14px; text-decoration: none; }
.save-guide-card button { background: #ededed; color: #333; }
.save-guide-card a { background: #07c160; color: #fff; }
@keyframes arrive { from { opacity: 0; transform: translateY(4px); } }
@media (min-width: 481px) { body { display: grid; place-items: center; background: #cfcfcf; } .phone-chat { height: min(880px, 100dvh); } }
