:root{
  --pink:#FEDFE4;
  --pink-line:#E4C3C8;
  --ink:#020202;
  --zh:#66505A;
  --time:#7A7A7A;
  --mine:#F3F2F7;
  --line:rgba(0,0,0,.05);
  --accent:#F7A8BC;
  --accent-deep:#F27FA3;
  --accent-soft:#FDEDF1;
  --accent-ink:#D9668B;
  --accent-track:#F3D7DE;
  --accent-line:#F0BCC9;
  --day:#888888;
  --day-line:#F4F4F4;
  --pill-bg:#FFFFFF;
}
/* 三套主题：粉 / 薄荷 / 天蓝。颜色都是对着参考图取的 */
html[data-theme="mint"]{
  --pink:#B9F3F5;
  --pink-line:#A4DEE0;
  --zh:#3E6569;
  --accent:#7FD8DE;
  --accent-deep:#4FBFCA;
  --accent-soft:#E9FAFB;
  --accent-ink:#2E8F98;
  --accent-track:#D8F1F3;
  --accent-line:#B7E6EA;
}
html[data-theme="blue"]{
  --pink:#D9F0FE;
  --pink-line:#C6DBEA;
  --zh:#50636E;
  --accent:#8FC6EE;
  --accent-deep:#5FA8DF;
  --accent-soft:#EAF5FD;
  --accent-ink:#3A7FAE;
  --accent-track:#DEEDF9;
  --accent-line:#BFDDF3;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
button,input,textarea,select{font:inherit;color:inherit}
html,body{height:100%;margin:0}
@font-face{
  font-family:"Noto Sans SC";src:url("fonts/NotoSansSC-400.woff2") format("woff2");
  font-weight:400;font-style:normal;font-display:swap;
  unicode-range:U+2E80-9FFF,U+3000-303F,U+FF00-FFEF;
}
@font-face{
  font-family:"Pretendard";src:url("fonts/Pretendard.woff2") format("woff2");
  font-weight:45 920;font-style:normal;font-display:swap;
}
body{
  background:#fff;color:var(--ink);
  font-family:"Pretendard",-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","PingFang SC","Noto Sans SC","Noto Sans KR","Malgun Gothic","Segoe UI",sans-serif;
  -webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;
  overscroll-behavior:none;touch-action:manipulation;
}
.app{
  position:fixed;left:50%;top:0;transform:translateX(-50%);
  width:100%;max-width:520px;height:100%;
  display:flex;flex-direction:column;background:#fff;overflow:hidden;
}

/* header */
.hdr{
  position:relative;z-index:6;flex:0 0 auto;
  display:flex;align-items:center;justify-content:space-between;
  padding:calc(env(safe-area-inset-top) + 3px) 15px 7px 15px;
  background:#fff;
}
.hbtn{
  width:40px;height:36px;display:grid;place-items:center;border:0;background:none;
  color:#111;padding:0;cursor:pointer;
}
.hbtn:active{opacity:.45}
.hbtns{display:flex;align-items:center}
.title{
  position:absolute;left:0;right:0;top:calc(env(safe-area-inset-top) + 3px);height:36px;
  display:flex;align-items:center;justify-content:center;gap:4px;
  pointer-events:auto;
}
.title h1{
  margin:0;font-size:18.5px;font-weight:700;letter-spacing:-.2px;color:#0b0b0b;
  max-width:64vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.themes{display:flex;align-items:center;gap:14px}
.tbtn{width:30px;height:30px;padding:0;border:0;border-radius:50%;background:none;display:grid;place-items:center;cursor:pointer}
.tbtn i{display:block;width:24px;height:24px;border-radius:50%;box-shadow:inset 0 0 0 1px rgba(0,0,0,.06)}
.tbtn[aria-pressed="true"]{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--accent-deep)}
.ava-row{flex-direction:row;align-items:center;justify-content:space-between}
.ava-pick{display:flex;align-items:center;gap:8px}
.ava-pick img{width:34px;height:34px;border-radius:50%;object-fit:cover;background:#eee}
.mini{display:inline-flex;align-items:center;justify-content:center;height:28px;padding:0 12px;border-radius:14px;
  background:var(--accent-soft);color:var(--accent-ink);font-size:12px;font-weight:600;border:0;cursor:pointer;font-family:inherit}
.mini.ghost{background:#F4F4F6;color:#8B8B90}
.mini:active{opacity:.6}

/* messages */
.scroll{
  flex:1 1 auto;display:flex;flex-direction:column;overflow-y:auto;overflow-x:hidden;
  -webkit-overflow-scrolling:touch;overscroll-behavior:contain;
  padding:8px 0 14px;scrollbar-width:none;
}
.scroll::-webkit-scrollbar{display:none}
.list{display:flex;flex-direction:column}
.tail{height:2px}

.day{display:flex;align-items:center;gap:10px;margin:14px 20px 16px;color:var(--day);font-size:12px;line-height:16px;letter-spacing:0}
.day i{flex:1 1 auto;height:1px;background:var(--day-line)}
.day span{white-space:nowrap}

.msg{display:flex;gap:11.3px;padding:0 10px 0 11px;margin-bottom:26px;animation:pop .26s cubic-bezier(.2,.8,.3,1) both}
.msg.him{justify-content:flex-start}
.msg.me{justify-content:flex-end;padding-right:12px}
.ava{width:41px;height:41px;border-radius:50%;object-fit:cover;flex:0 0 41px;margin-top:1px;background:#f3ecee}
.body{display:flex;flex-direction:column;min-width:0;max-width:calc(100% - 51px)}
.name{font-size:12px;line-height:15px;color:#020202;margin:0 0 8px;letter-spacing:-.1px}
.row{display:flex;align-items:flex-end;gap:11px}
.msg.me .row{gap:10px}
/* 我这边也有一枚头像（参考图里是圆头像在右） */
.myava{width:41px;height:41px;border-radius:50%;flex:0 0 41px;margin-top:1px;object-fit:cover;background:#EFEEF3;display:grid;place-items:center;font-size:15px;color:#9A96A4;overflow:hidden}

.bubble{
  position:relative;background:var(--pink);border-radius:12px;
  padding:10.3px 12px 7.7px;font-size:15px;line-height:21px;color:var(--ink);
  max-width:296px;
  word-break:break-word;white-space:pre-wrap;
  font-weight:var(--wko,400);
}
.bubble .ko{display:block}
.bubble .zh{
  display:block;margin:8.15px -12px -7.7px;padding:10.55px 12px 7.7px;
  border-top:1px dashed var(--pink-line);
  color:var(--zh);font-size:15px;line-height:21px;font-weight:var(--wzh,400);
}
.bubble.only .zh{margin:0;padding:0;border:0;color:inherit;font-size:inherit;font-family:inherit}
input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:22px;background:transparent}
input[type=range]::-webkit-slider-runnable-track{height:3px;border-radius:2px;background:var(--accent-track)}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;margin-top:-7.5px;border-radius:50%;background:var(--accent-deep);box-shadow:0 1px 3px rgba(0,0,0,.14)}
/* Windows 的中文回退字体比苹方粗一档，用 Light 顶上去；苹果设备用苹方，不受影响 */
/* Windows/Android 没有苹方，回退雅黑——只有中文会略粗，韩文 Pretendard 两边一致 */
.msg.me .bubble{background:var(--mine);border-radius:12px;padding:10.3px 12px 7.7px;font-size:15px;line-height:21px;color:#111}
.time{font-size:12px;color:var(--time);flex:0 0 auto;padding-bottom:3px;letter-spacing:0}

.typing .bubble{padding:14px 15px;display:flex;gap:4px;align-items:center}
.typing .bubble i{width:6px;height:6px;border-radius:50%;background:var(--accent-deep);display:block;animation:blink 1.1s infinite}
.typing .bubble i:nth-child(2){animation-delay:.16s}
.typing .bubble i:nth-child(3){animation-delay:.32s}

@keyframes blink{0%,60%,100%{opacity:.32;transform:translateY(0)}30%{opacity:1;transform:translateY(-2px)}}
@keyframes pop{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:none}}

/* heart pill */
.pill{
  position:absolute;right:10px;top:calc(env(safe-area-inset-top) + 55px);
  display:flex;align-items:center;gap:3.4px;height:24px;
  border:0;background:#fff;border-radius:999px;padding:0 10.76px 0 11px;min-width:max-content;box-sizing:border-box;white-space:nowrap;
  font-size:11.2px;font-weight:700;color:#111;z-index:5;cursor:pointer;font-family:inherit;
  box-shadow:0 5px 14px rgba(196,150,164,.28),0 1px 2px rgba(0,0,0,.04);
  transition:transform .18s ease;
}
.pill .heart{display:block;width:11.3333px;height:9.3333px;flex:none;image-rendering:auto}
.pill b{font-weight:700;letter-spacing:-.10px}
.pill:active{transform:scale(.94)}
.pill.bump{animation:bump .4s ease}
@keyframes bump{0%{transform:scale(1)}35%{transform:scale(1.12)}100%{transform:scale(1)}}

/* composer */
.composer{
  flex:0 0 auto;display:flex;align-items:flex-end;gap:8px;
  padding:8px 10px calc(8px + env(safe-area-inset-bottom));
  background:#fff;border-top:1px solid var(--line);
}
.circle{
  flex:0 0 auto;width:34px;height:34px;border-radius:50%;border:0;display:grid;place-items:center;
  background:#F3EFF0;color:#8C8084;margin-bottom:2px;cursor:pointer;transition:background .2s,color .2s,transform .15s;
}
.circle:active{transform:scale(.92)}
.circle.send{background:var(--accent);color:#fff}
.circle.send:disabled{background:#F4E8EB;color:#DCC6CC}
.field{
  flex:1 1 auto;min-width:0;background:#F6F4F5;border-radius:20px;
  padding:7px 14px;display:flex;align-items:center;min-height:38px;
}
.field textarea{
  width:100%;border:0;background:transparent;resize:none;outline:none;
  font:inherit;font-size:16px;line-height:1.38;color:#1f1f1f;max-height:104px;padding:2px 0;
}
.field textarea::placeholder{color:#B9B0B3}

/* settings */
.sheet{
  position:fixed;inset:0;z-index:40;background:rgba(30,20,24,.28);
  display:flex;align-items:flex-end;justify-content:center;
  animation:fade .2s ease both;
}
.sheet[hidden]{display:none}
.sheet-card{
  width:100%;max-width:520px;max-height:92%;background:#fff;
  border-radius:22px 22px 0 0;display:flex;flex-direction:column;
  animation:up .28s cubic-bezier(.2,.8,.3,1) both;
  padding-bottom:env(safe-area-inset-bottom);
}
.sheet-top{display:flex;align-items:center;justify-content:space-between;padding:16px 18px 10px}
.sheet-top h2{margin:0;font-size:16px;font-weight:600;letter-spacing:-.2px}
.done{border:0;background:none;color:var(--accent-ink);font-size:15px;font-weight:600;padding:4px 0}
.sheet-body{overflow-y:auto;padding:4px 18px 22px;-webkit-overflow-scrolling:touch}
.hint{margin:0 0 14px;font-size:12px;line-height:1.6;color:#A99EA2}
.f{display:block;margin-bottom:14px}
.f>span{display:block;font-size:12px;color:#8E8387;margin-bottom:6px}
.f input[type=text],.f input[type=password],.f input[type=url],.f input[type=number],.f input[type=time],.f input:not([type]),.f textarea{
  width:100%;border:1px solid #EFE9EA;background:#FBFAFA;border-radius:11px;
  padding:11px 12px;font:inherit;font-size:16px;color:#222;outline:none;
}
.f textarea{line-height:1.55;resize:vertical}
.f input:focus,.f textarea:focus{border-color:var(--accent-line);background:#fff}
.f.row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.f.row>span{margin:0;font-size:14px;color:#3a3336}
.times{display:flex;align-items:center;gap:6px}
.times em{font-style:normal;font-size:12px;color:#A99EA2}
.f input[type=time]{width:auto;padding:8px 6px;font-size:14px}
.f input[type=number]{width:64px;padding:8px;font-size:14px;text-align:center}
.sw{position:absolute;opacity:0;width:0;height:0}
.f.row .track{
  width:46px;height:28px;border-radius:999px;background:#EDE7E9;position:relative;
  flex:0 0 46px;transition:background .2s;cursor:pointer;
}
.f.row .track::after{
  content:"";position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;
  background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.18);transition:transform .2s;
}
.sw:checked + .track{background:var(--accent)}
.sw:checked + .track::after{transform:translateX(18px)}
.f.row .track{margin-left:auto}
.tools{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:22px 0 8px}
.tools button{
  border:1px solid #EFE9EA;background:#fff;border-radius:12px;padding:12px 4px;
  font:inherit;font-size:13.5px;color:#4a4245;white-space:nowrap;
}
.tools button.danger{color:#D9557A;border-color:#F6DDE4}
.foot{margin:14px 0 0;font-size:11px;line-height:1.65;color:#B4A9AD}
.diag{margin:12px 0 0;font-size:11px;line-height:1.6;color:#D08A9C;word-break:break-all}
.diag:empty{display:none}

/* toast */
.toast{
  position:fixed;left:50%;bottom:calc(env(safe-area-inset-bottom) + 78px);transform:translate(-50%,10px);
  background:rgba(38,30,33,.88);color:#fff;font-size:13px;padding:10px 16px;border-radius:999px;
  opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;z-index:50;max-width:80vw;text-align:center;line-height:1.4;
}
.toast.show{opacity:1;transform:translate(-50%,0)}

/* heart burst */
.burst{position:fixed;pointer-events:none;font-size:20px;z-index:60;animation:rise 1s ease-out forwards}
@keyframes rise{0%{opacity:0;transform:translate(-50%,0) scale(.6)}20%{opacity:1}100%{opacity:0;transform:translate(-50%,-70px) scale(1.1)}}
@keyframes fade{from{opacity:0}to{opacity:1}}
@keyframes up{from{transform:translateY(40px);opacity:.4}to{transform:none;opacity:1}}
@media (min-width:560px){
  body{background:#F7F4F5}
  .app{box-shadow:0 0 40px rgba(120,90,100,.08)}
}