:root {
  --primary: #7c5cfc;
  --primary-dark: #6a48f0;
  --primary-light: #efecff;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-sub: #8a8f99;
  --border: #eceef1;
  --danger: #fa5151;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

/* ===== 顶部 ===== */
.header {
  background: linear-gradient(135deg, #8b5cf6 0%, #4f7df9 100%);
  padding: 18px 16px 14px;
  padding-top: calc(18px + env(safe-area-inset-top));
  color: #fff;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-text span {
  font-size: 12px;
  opacity: 0.9;
}

.free-badge {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ===== 关注引导条 ===== */
.follow-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff7e6;
  color: #ad6800;
  padding: 9px 14px;
  font-size: 13px;
  border-bottom: 1px solid #ffe7ba;
}

.follow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fa8c16;
  flex-shrink: 0;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.follow-text {
  flex: 1;
}

.follow-btn {
  background: #fa8c16;
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ===== 主内容 ===== */
.main {
  padding: 14px 14px 20px;
  max-width: 560px;
  margin: 0 auto;
}

/* Tab */
.tabs {
  display: flex;
  background: var(--card);
  border-radius: var(--radius);
  padding: 5px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-sub);
  background: transparent;
  transition: all 0.25s;
}

.tab.active {
  background: var(--primary);
  color: #fff;
}

/* 面板 */
.panel {
  display: none;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* 模式切换 */
.mode-switch {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 14px;
}

.mode-btn {
  flex: 1;
  padding: 8px 0;
  font-size: 14px;
  border-radius: 8px;
  color: var(--text-sub);
  background: transparent;
  font-weight: 500;
  transition: all 0.25s;
}

.mode-btn.active {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.hidden {
  display: none !important;
}

/* 输入框 */
.text-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fafbfc;
  transition: border-color 0.25s;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

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

/* 短文本输入（粘贴分享内容） */
.textarea-short {
  min-height: 110px;
}

.mode-tip {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 8px;
}

/* 提取进度 */
.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--primary-light);
  border-radius: 10px;
  font-size: 13px;
  color: var(--primary-dark);
}

.spinner-dark {
  border-color: rgba(124, 92, 252, 0.3);
  border-top-color: var(--primary);
}

/* 两列风格网格 */
.style-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.textarea {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  color: var(--text);
  background: #fafbfc;
  transition: border-color 0.25s;
}

.textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
}

.textarea::placeholder {
  color: #b5b9c0;
}

/* 主按钮 */
.primary-btn {
  width: 100%;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #8b5cf6 0%, #4f7df9 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 6px 16px rgba(124, 92, 252, 0.32);
  transition: transform 0.15s, box-shadow 0.15s;
}

.primary-btn:active {
  transform: scale(0.98);
  box-shadow: 0 3px 10px rgba(124, 92, 252, 0.28);
}

.primary-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* 上传器 */
.uploader {
  border: 2px dashed #d5d9e0;
  border-radius: 12px;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-sub);
  transition: all 0.25s;
  background: #fafbfc;
}

.uploader:active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.uploader-icon {
  color: #c3c8d0;
  margin-bottom: 8px;
}

.uploader-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.uploader-tip {
  font-size: 12px;
  margin-top: 4px;
}

.preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}

.preview img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: #000;
  display: block;
}

.remove-img {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 20px;
}

/* 润色风格 */
.style-label {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 10px;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.style-chip {
  padding: 10px 0;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.style-chip.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
  font-weight: 600;
}

/* 结果区 */
.result {
  margin-top: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.result-title {
  font-size: 15px;
  font-weight: 700;
  position: relative;
  padding-left: 12px;
}

.result-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
}

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

.ghost-btn,
.copy-btn {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.ghost-btn {
  background: var(--bg);
  color: var(--text-sub);
}

.copy-btn {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.copy-btn:active,
.ghost-btn:active {
  opacity: 0.7;
}

.result-body {
  padding: 16px;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  color: #333;
}

/* 底部 */
.footer {
  padding: 6px 14px calc(20px + env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
}

.footer-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.qr-placeholder {
  width: 96px;
  height: 96px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.qr-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.footer-title {
  font-size: 16px;
  font-weight: 700;
}

.footer-desc {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 4px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 999;
  max-width: 80vw;
}

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

/* 按钮点击 loading 动画 */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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