/* ==========================================================
   恋爱嘴替 Love Tips · styles
   移动端优先，适配 iPhone 安全区
   ========================================================== */

:root {
  --pink: #ff5f7a;
  --pink-deep: #f0405f;
  --orange: #ff8a4c;
  --grad: linear-gradient(135deg, #ff7a59 0%, #ff5f7a 55%, #ff4d8d 100%);
  --grad-soft: linear-gradient(180deg, #fff6f7 0%, #fffdfd 55%, #fff9f6 100%);
  --bg: #fffafb;
  --card: #ffffff;
  --text: #2b2024;
  --text-2: #6d5b62;
  --text-3: #a3949a;
  --line: #f2e5e8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 22px rgba(240, 64, 95, .08), 0 1px 3px rgba(64, 30, 40, .05);
  --shadow-lg: 0 14px 40px rgba(240, 64, 95, .16);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabbar-h: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--grad-soft);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(var(--safe-t) + 12px) 16px 10px;
  background: rgba(255, 250, 251, .86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(242, 229, 232, .8);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand { display: flex; align-items: center; gap: 8px; }

.brand-heart {
  font-size: 18px;
  color: var(--pink);
  filter: drop-shadow(0 2px 6px rgba(255, 95, 122, .45));
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .5px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.6;
  border: 1px solid transparent;
}
.badge-online { color: #1f8a5b; background: #eafaf1; border-color: #cdefdd; }
.badge-offline { color: #b0803a; background: #fdf6e9; border-color: #f6e7c8; }

.icon-btn {
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  color: #fff;
  background: var(--grad);
  border: 0;
  border-radius: 999px;
  font-weight: 600;
}

/* ---------------- 视图 ---------------- */
.main { padding: 14px 14px 6px; }

.view { display: none; animation: fade .22s ease; }
.view.is-active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(242, 229, 232, .7);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .3px;
}

.card-tools { display: flex; gap: 6px; }

/* ---------------- 输入 ---------------- */
.input-text {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffcfc;
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}

.input-text::placeholder { color: #c9b8be; }

.input-text:focus {
  border-color: #ffb3c1;
  box-shadow: 0 0 0 3px rgba(255, 95, 122, .1);
  background: #fff;
}

.input-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}

.scene-auto { display: flex; align-items: center; gap: 6px; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-ui {
  position: absolute; inset: 0;
  background: #e8dcdf;
  border-radius: 999px;
  transition: background .18s;
}
.switch-ui::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform .18s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.switch input:checked + .switch-ui { background: var(--pink); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }

/* ---------------- 分组标题 / 标签 ---------------- */
.block { margin-bottom: 16px; }

.block-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: .4px;
}

.count {
  font-weight: 500;
  font-size: 11px;
  color: var(--pink);
  background: #fff0f3;
  border-radius: 999px;
  padding: 0 7px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  padding: 7px 13px;
  border-radius: 999px;
  transition: all .15s;
  font-family: inherit;
  line-height: 1.3;
}

.chip:active { transform: scale(.96); }

.chip.is-on {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(255, 95, 122, .28);
  font-weight: 600;
}

/* ---------------- 按钮 ---------------- */
.primary-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  background: var(--grad);
  box-shadow: var(--shadow-lg);
  font-family: inherit;
  margin: 2px 0 16px;
  transition: transform .12s, box-shadow .16s;
}

.primary-btn:active { transform: scale(.985); box-shadow: 0 6px 18px rgba(240, 64, 95, .22); }

.primary-btn.small { height: 42px; font-size: 14.5px; margin-bottom: 0; }

.primary-btn[disabled] { opacity: .68; }

.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin .7s linear infinite;
}

.primary-btn.is-loading .btn-spinner { display: inline-block; }

@keyframes spin { to { transform: rotate(360deg); } }

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 10px;
  font-family: inherit;
  transition: all .15s;
  line-height: 1.4;
}

.ghost-btn:active { background: #fff4f6; }

.ghost-btn.wide { width: 100%; padding: 10px 12px; font-size: 14px; border-radius: 12px; }

.ghost-btn.danger { color: #d9465f; border-color: #f8dde3; }

.btn-stack { display: flex; flex-direction: column; gap: 9px; }

/* ---------------- 结果 ---------------- */
.results { animation: fade .24s ease; }

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 9px;
  padding: 0 2px;
}

.results-title { font-size: 14px; font-weight: 700; }
.results-source { font-size: 11.5px; color: var(--text-3); }

.result-list { display: flex; flex-direction: column; gap: 10px; }

.result-card {
  background: var(--card);
  border: 1px solid rgba(242, 229, 232, .9);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 13px 13px 10px;
  animation: pop .26s ease both;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.tone-tag {
  font-size: 11px;
  color: var(--pink-deep);
  background: #fff0f3;
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}

.result-text {
  margin: 0 0 10px;
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.result-actions { display: flex; gap: 8px; }

.mini-btn {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  border-radius: 10px;
  padding: 7px 0;
  font-size: 13px;
  font-family: inherit;
  transition: all .15s;
}

.mini-btn.primary {
  background: #fff0f3;
  color: var(--pink-deep);
  border-color: #ffdbe2;
  font-weight: 600;
}

.mini-btn:active { transform: scale(.97); }
.mini-btn.is-fav { color: var(--pink-deep); border-color: #ffdbe2; background: #fff5f7; }

.results-foot {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ---------------- 话术列表 ---------------- */
.line-list { display: flex; flex-direction: column; gap: 9px; }

.line-item {
  background: var(--card);
  border: 1px solid rgba(242, 229, 232, .9);
  border-radius: 14px;
  padding: 12px 13px;
  box-shadow: 0 3px 12px rgba(240, 64, 95, .05);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.line-text {
  flex: 1;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
}

.line-copy {
  flex: 0 0 auto;
  border: 1px solid #ffdbe2;
  background: #fff5f7;
  color: var(--pink-deep);
  font-size: 12.5px;
  border-radius: 9px;
  padding: 5px 10px;
  font-family: inherit;
}

.line-copy:active { transform: scale(.95); }

.empty-line, .empty-tip {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.7;
}

.empty-tip {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.empty-tip p { margin: 0 0 8px; }

.empty-examples { display: flex; flex-direction: column; gap: 6px; }

.example-btn {
  text-align: left;
  border: 0;
  background: #fff6f8;
  color: var(--text-2);
  font-size: 13px;
  border-radius: 10px;
  padding: 9px 11px;
  font-family: inherit;
  line-height: 1.5;
}

.example-btn:active { background: #ffeef2; }

/* ---------------- 设置表单 ---------------- */
.field { margin-bottom: 13px; }

.field > label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="url"],
.field select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fffcfc;
  padding: 0 12px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a3949a' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 32px;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: #ffb3c1;
  box-shadow: 0 0 0 3px rgba(255, 95, 122, .1);
}

.field-row { display: flex; gap: 8px; align-items: center; }
.field-row input { flex: 1; min-width: 0; }
.field-row .ghost-btn { flex: 0 0 auto; height: 42px; }

.hint {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-3);
}

.hint.muted { color: #c0b1b7; }

/* ---------------- 底栏 ---------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  max-width: 560px;
  margin: 0 auto;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid rgba(242, 229, 232, .9);
}

.tab {
  flex: 1;
  border: 0;
  background: none;
  color: var(--text-3);
  font-size: 11px;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0 4px;
  transition: color .15s;
}

.tab-ico { font-size: 17px; line-height: 1; }

.tab.is-active { color: var(--pink-deep); font-weight: 700; }
.tab.is-active .tab-ico { transform: translateY(-1px); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
  transform: translate(-50%, 12px);
  background: rgba(43, 32, 36, .92);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 9px 16px;
  border-radius: 999px;
  max-width: 86vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  z-index: 60;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 横屏 / 大屏微调 */
@media (min-width: 620px) {
  .app { box-shadow: 0 0 60px rgba(240, 64, 95, .08); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
