/* ==========================================================================
   花式道歉对话 · SorryBox —— 公共样式
   风格：奶油蓝莓手账（奶油白底 + 蓝莓紫/雾霾蓝 + 纸胶带/贴纸/圆点纸/虚线框）
   布局：居中聚焦单卡 —— 居中一列，道歉输入大卡为主，场景贴纸卡在下方。
   与前 5 个项目的风格与布局刻意彻底区分。
   ========================================================================== */

/* ------------------------------ 设计变量 ------------------------------ */
:root {
  --bg: #fbfaf7;
  --bg-2: #f3f0ff;

  --blueberry: #6d5ae6;
  --blueberry-deep: #5b47d1;
  --haze: #7c93c3;
  --grad: linear-gradient(120deg, #8b7bf0 0%, #6d5ae6 55%, #5b47d1 100%);

  /* 贴纸点缀色 */
  --s-yellow: #ffd54f;
  --s-mint: #7fc9b3;
  --s-peach: #ff9e88;

  --ink: #2e2b3d;
  --ink-2: #6b6880;
  --ink-3: #a7a3ba;

  --card: #ffffff;
  --line: #e9e5f2;
  --line-strong: #cdbef2;

  --tape-blue: rgba(109, 90, 230, .20);
  --tape-yellow: rgba(255, 213, 79, .42);
  --tape-mint: rgba(127, 201, 179, .38);

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-pill: 999px;

  --shadow-sm: 0 6px 16px rgba(76, 60, 160, .10);
  --shadow: 0 16px 38px rgba(76, 60, 160, .16);
  --shadow-lg: 0 24px 50px rgba(60, 46, 140, .22);

  --maxw: 680px;

  --font: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* 标题带一点圆润手账感 */
  --font-title: 'Quicksand', 'Nunito', var(--font);
}

/* ------------------------------ 基础 ------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }

body {
  margin: 0;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  font-family: var(--font);
  font-size: 15px; line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.mode-chat { height: 100vh; height: 100dvh; overflow: hidden; }
body.mode-chat .site-footer { display: none; }

a { color: var(--blueberry-deep); }
h1, h2, h3 { font-family: var(--font-title); font-weight: 800; letter-spacing: .3px; }

/* ------------------------------ 手账纸背景 ------------------------------ */
.paperbg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(circle at 15% 12%, rgba(109,90,230,.06), transparent 40%),
    radial-gradient(circle at 88% 82%, rgba(124,147,195,.08), transparent 42%),
    var(--bg);
}
/* 圆点纸纹 */
.paperbg::before { content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(109,90,230,.10) 1.2px, transparent 1.2px);
  background-size: 22px 22px; opacity: .5;
}
/* 漂浮的纸胶带/贴纸装饰 */
.paperbg .deco { position: absolute; opacity: .8; }
.paperbg .deco.t1 { top: 10%; left: 6%; width: 92px; height: 26px; background: var(--tape-yellow); transform: rotate(-8deg); border-radius: 2px; }
.paperbg .deco.t2 { bottom: 14%; right: 7%; width: 80px; height: 24px; background: var(--tape-mint); transform: rotate(6deg); border-radius: 2px; }
.paperbg .deco.s1 { top: 22%; right: 12%; font-size: 26px; transform: rotate(10deg); }
.paperbg .deco.s2 { bottom: 20%; left: 10%; font-size: 22px; transform: rotate(-12deg); }

/* ------------------------------ 顶栏（居中简约） ------------------------------ */
.topbar {
  position: relative; z-index: 3; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px clamp(16px, 4vw, 30px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; font-size: 22px;
  border-radius: 13px; background: #fff; border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--blueberry); transform: rotate(-4deg);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font-title); font-size: 18px; color: var(--ink); }
.brand-text em { font-style: normal; font-size: 11px; letter-spacing: 3px; color: var(--blueberry); text-transform: uppercase; }
.site-nav { display: flex; align-items: center; gap: 8px; }
.nav-btn {
  appearance: none; border: 2px solid var(--ink); background: #fff; color: var(--ink);
  font-family: inherit; font-weight: 700; font-size: 13px; padding: 7px 14px; border-radius: var(--r-pill);
  text-decoration: none; cursor: pointer; transition: transform .14s, box-shadow .14s, background .14s;
}
.nav-btn:hover { transform: translateY(-2px); box-shadow: 2px 3px 0 var(--blueberry); background: var(--bg-2); }

/* ------------------------------ 舞台 / 居中列 ------------------------------ */
.stage { position: relative; z-index: 1; flex: 1 1 auto; min-height: 0; width: 100%; }
body.mode-chat .stage { display: flex; }
.landing { width: 100%; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: clamp(10px, 3vw, 24px) clamp(16px, 5vw, 28px) 48px; }

/* ------------------------------ HERO ------------------------------ */
.hero { text-align: center; padding: clamp(6px, 2vw, 18px) 0 4px; }
.hero-sticker {
  display: inline-grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 14px; font-size: 40px;
  background: #fff; border: 2px solid var(--ink); border-radius: 22px;
  box-shadow: 4px 5px 0 var(--blueberry); transform: rotate(-5deg);
}
.empty-eyebrow {
  display: inline-flex; align-items: center; gap: 7px; margin: 0 0 12px; padding: 4px 13px;
  font-size: 12.5px; font-weight: 700; color: var(--blueberry-deep);
  background: #efeaff; border: 2px dashed var(--line-strong); border-radius: var(--r-pill);
}
.empty-title { margin: 0 auto 12px; max-width: 15em; font-size: clamp(25px, 5.2vw, 40px); line-height: 1.22; color: var(--ink); }
.empty-title b { color: var(--blueberry); position: relative; }
/* 手账下划波浪线 */
.empty-title b::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 6px;
  background: repeating-linear-gradient(-45deg, var(--s-yellow) 0 5px, transparent 5px 9px); opacity: .8; border-radius: 3px; }
.empty-sub { margin: 0 auto; max-width: 30em; color: var(--ink-2); font-size: 15px; }

/* ------------------------------ 道歉输入卡（手账便签） ------------------------------ */
.composer-slot { margin-top: 24px; }
.composer { width: 100%; }
.composer-card {
  position: relative;
  padding: 26px 20px 16px;
  background:
    radial-gradient(rgba(109,90,230,.09) 1.1px, transparent 1.1px) 0 0 / 20px 20px,
    #fff;
  border: 2px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: 6px 8px 0 var(--blueberry);
}
/* 顶部两条纸胶带 */
.composer-card .tape { position: absolute; top: -12px; height: 24px; border-radius: 2px; }
.composer-card .tape-1 { left: 26px; width: 84px; background: var(--tape-yellow); transform: rotate(-6deg); }
.composer-card .tape-2 { right: 30px; width: 72px; background: var(--tape-blue); transform: rotate(5deg); }
/* 角落贴纸 */
.composer-sticker { position: absolute; top: -18px; right: -12px; display: grid; place-items: center;
  width: 44px; height: 44px; font-size: 22px; background: #fff; border: 2px solid var(--ink); border-radius: 50%;
  box-shadow: 3px 3px 0 var(--s-peach); transform: rotate(8deg); }
.composer-head { margin-bottom: 8px; }
.composer-label { font-family: var(--font-title); font-weight: 800; color: var(--ink); font-size: 15px; }
.composer-input {
  display: block; width: 100%; padding: 8px 4px; resize: none; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 15px; line-height: 1.7; color: var(--ink); max-height: 160px;
}
.composer-input::placeholder { color: var(--ink-3); }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px;
  border-top: 2px dashed var(--line); padding-top: 12px; }
.composer-stage { font-size: 13px; color: var(--ink-2); padding: 4px 12px; background: #efeaff; border: 2px solid var(--line-strong); border-radius: var(--r-pill); }
.composer-stage b { color: var(--blueberry-deep); }
.composer-actions { display: flex; align-items: center; gap: 10px; }
.stop-btn {
  appearance: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13px; color: var(--blueberry-deep);
  background: #fff; border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 8px 13px; transition: transform .14s;
}
.stop-btn:hover { transform: translateY(-1px); }
.send-btn {
  appearance: none; cursor: pointer; font-family: var(--font-title); font-weight: 800; font-size: 14.5px; color: #fff;
  background: var(--blueberry); border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 9px 20px;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .14s, box-shadow .14s;
}
.send-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.send-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.composer-tip { margin: 10px 4px 0; font-size: 12px; color: var(--ink-3); text-align: center; }

/* ------------------------------ 关系阶段（小贴纸行） ------------------------------ */
.stage-bar { margin-top: 22px; text-align: center; }
.stage-bar-title { display: block; font-family: var(--font-title); font-weight: 800; color: var(--ink); font-size: 14px; margin-bottom: 10px; }
.stage-bar-title b { color: var(--blueberry-deep); }
.state-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.state-chip {
  appearance: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13px; color: var(--ink-2);
  background: #fff; border: 2px solid var(--line-strong); border-radius: var(--r-pill); padding: 7px 14px;
  transition: transform .14s, box-shadow .14s, color .14s, background .14s, border-color .14s;
}
.state-chip:hover { transform: translateY(-2px); color: var(--blueberry-deep); }
.state-chip.is-active { color: #fff; background: var(--blueberry); border-color: var(--ink); box-shadow: 2px 3px 0 var(--ink); }

/* ------------------------------ 道歉场景（贴纸卡） ------------------------------ */
.scenes { margin-top: 42px; }
.sec-title { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 8px; font-size: clamp(19px, 3.4vw, 23px); color: var(--ink); }
.sec-title::before, .sec-title::after { content: "✿"; color: var(--blueberry); font-size: 16px; }
.sec-sub { margin: 0 0 18px; text-align: center; color: var(--ink-3); font-size: 13px; }
.cat-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 18px; }
.cat-tab {
  appearance: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13px; color: var(--ink-2);
  background: #fff; border: 2px solid var(--line); border-radius: var(--r-pill); padding: 6px 14px; transition: transform .14s, color .14s, border-color .14s, background .14s;
}
.cat-tab:hover { transform: translateY(-2px); color: var(--blueberry-deep); }
.cat-tab.is-active { color: var(--blueberry-deep); background: #efeaff; border-color: var(--line-strong); }

.starters { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.starter {
  position: relative; display: block; width: 100%; text-align: left; cursor: pointer; font-family: inherit; color: var(--ink);
  padding: 16px 15px 15px; background: #fff; border: 2px solid var(--ink); border-radius: var(--r-md);
  box-shadow: 4px 5px 0 var(--line-strong); transition: transform .16s, box-shadow .16s;
}
.starter:nth-child(3n)   { transform: rotate(-1.2deg); }
.starter:nth-child(3n+2) { transform: rotate(1deg); }
.starter:hover { transform: translate(-1px, -2px) rotate(0deg); box-shadow: 6px 7px 0 var(--blueberry); }
.starter-tag {
  display: inline-block; margin-bottom: 10px; padding: 3px 11px; font-size: 11.5px; font-weight: 800; color: var(--ink);
  border: 2px solid var(--ink); border-radius: var(--r-pill); background: var(--s-yellow);
}
.starter:nth-child(4n+1) .starter-tag { background: var(--s-mint); }
.starter:nth-child(4n+2) .starter-tag { background: var(--s-peach); }
.starter:nth-child(4n+3) .starter-tag { background: #cdbef2; }
.starter strong { display: block; font-size: 14.5px; font-weight: 700; line-height: 1.5; }

/* ------------------------------ 认错官擅长 ------------------------------ */
.feats { margin-top: 44px; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.feat {
  display: flex; align-items: flex-start; gap: 12px; padding: 16px;
  background: #fff; border: 2px solid var(--ink); border-radius: var(--r-md); box-shadow: 3px 4px 0 var(--line-strong);
}
.feat-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; font-size: 22px; background: #efeaff; border: 2px solid var(--ink); border-radius: 12px; }
.feat-body strong { display: block; font-size: 15px; color: var(--ink); margin-bottom: 3px; font-family: var(--font-title); }
.feat-body p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }

/* ------------------------------ FAQ ------------------------------ */
.faq { margin-top: 44px; }
.faq .sec-title { margin-bottom: 16px; }
.faq-item { margin-bottom: 12px; background: #fff; border: 2px solid var(--ink); border-radius: var(--r-md); overflow: hidden; box-shadow: 3px 4px 0 var(--line-strong); }
.faq-q {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px;
  cursor: pointer; appearance: none; border: none; background: transparent; font-family: var(--font-title); font-weight: 800; font-size: 14.5px; color: var(--ink); text-align: left;
}
.faq-arrow { flex: none; display: grid; place-items: center; width: 24px; height: 24px; font-weight: 900; color: var(--blueberry-deep); background: #efeaff; border: 2px solid var(--ink); border-radius: 7px; transition: transform .2s; }
.faq-item.is-open .faq-arrow { transform: rotate(135deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .28s ease; }
.faq-item.is-open .faq-a { max-height: 320px; }
.faq-a p { margin: 0; padding: 0 16px 15px; font-size: 13.5px; color: var(--ink-2); }

/* ------------------------------ 对话视图 ------------------------------ */
.chatview { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(16px, 5vw, 28px); }
body.mode-chat .chatview { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chatview-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 0 10px; }
.chatview-back, .chatview-clear {
  appearance: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 13px; color: var(--ink);
  background: #fff; border: 2px solid var(--ink); border-radius: var(--r-pill); padding: 6px 13px; transition: transform .14s, box-shadow .14s;
}
.chatview-back:hover, .chatview-clear:hover { transform: translateY(-2px); box-shadow: 2px 3px 0 var(--blueberry); }
.chatview-state { font-size: 13px; color: var(--ink-2); }
.chatview-state b { color: var(--blueberry-deep); }
.chat-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 2px 18px; display: flex; flex-direction: column; gap: 16px; }
.msg { display: flex; gap: 11px; align-items: flex-start; }
.msg-user { flex-direction: row-reverse; }
.msg-avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; font-size: 20px; background: #fff; border: 2px solid var(--ink); border-radius: 12px; box-shadow: 2px 2px 0 var(--line-strong); }
.msg-body { max-width: min(80%, 560px); }
.msg-user .msg-body { text-align: right; }
.msg-name { font-family: var(--font-title); font-size: 11.5px; color: var(--ink-3); margin: 2px 6px 4px; }
.msg-text { display: inline-block; text-align: left; padding: 12px 15px; border-radius: 4px 14px 14px 14px; background: #fff; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--line-strong); color: var(--ink); }
.msg-user .msg-text { border-radius: 14px 4px 14px 14px; background: #efeaff; box-shadow: 3px 3px 0 var(--line-strong); }
.msg-text p { margin: 0 0 8px; } .msg-text p:last-child { margin-bottom: 0; }
.msg-text ul { margin: 6px 0; padding-left: 20px; } .msg-text li { margin: 3px 0; }
.msg-text strong { color: var(--blueberry-deep); }
.msg-note { color: var(--ink-3); font-size: 12.5px; } .msg-error { color: #e0466f; }
.typing { display: inline-flex; gap: 5px; padding: 2px 0; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--blueberry); animation: typing 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
body.mode-chat .composer-slot#slotChat { flex: none; padding: 8px 0 14px; background: linear-gradient(0deg, var(--bg), transparent); }

/* ------------------------------ 页脚 ------------------------------ */
.site-footer {
  flex: none; position: relative; z-index: 1; margin-top: auto;
  padding: 26px clamp(16px, 4vw, 30px) 30px; text-align: center;
  background: #fff; border-top: 2px dashed var(--line-strong);
}
.footer-tagline { margin: 0 0 6px; font-weight: 700; color: var(--ink); font-size: 13.5px; font-family: var(--font-title); }
.footer-company { margin: 0 0 10px; color: var(--ink-2); font-size: 13px; }
.footer-contact { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-bottom: 10px; font-size: 12.5px; color: var(--ink-2); }
.footer-contact a { color: var(--ink-2); text-decoration: none; } .footer-contact a:hover { color: var(--blueberry-deep); }
.footer-beian { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 12px; }
.footer-beian a { color: var(--ink-3); text-decoration: none; } .footer-beian a:hover { color: var(--blueberry-deep); text-decoration: underline; }

/* ------------------------------ Toast ------------------------------ */
.toast-wrap { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 18px; font-size: 13.5px; font-weight: 800; color: #fff; background: var(--blueberry); border: 2px solid var(--ink); border-radius: var(--r-pill); box-shadow: 3px 4px 0 var(--ink); animation: toastIn .3s ease; }
.toast.out { animation: toastOut .5s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px); } }

/* ------------------------------ 关于页顶栏（about.html 复用） ------------------------------ */
.site-header {
  position: relative; z-index: 3; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px clamp(16px, 4vw, 30px); border-bottom: 2px dashed var(--line-strong); background: #fff;
}

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 560px) {
  .starters { grid-template-columns: 1fr; }
  .brand-text em { display: none; }
  .msg-body { max-width: 86%; }
}

/* ------------------------------ 无障碍：减少动效 ------------------------------ */
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
