* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #6d28d9;
  --primary-dark: #5b21b6;
  --bg: #f6f5fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(76, 29, 149, 0.08);
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom);
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 14px 40px;
}

/* ── 头部 ── */
.hero {
  margin: 0 -14px 18px;
  padding: 28px 20px 24px;
  background: linear-gradient(135deg, #6d28d9 0%, #a21caf 55%, #db2777 100%);
  color: #fff;
  border-radius: 0 0 24px 24px;
}

.hero h1 {
  font-size: 26px;
  letter-spacing: 1px;
}

.hero p {
  margin-top: 6px;
  font-size: 14px;
  opacity: 0.92;
}

/* ── 卡片 ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(229, 231, 235, 0.7);
}

.card h2 {
  font-size: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count {
  font-size: 12px;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  padding: 1px 8px;
}

/* ── 表单 ── */
.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field textarea,
.batch-box textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 16px;
  font-family: inherit;
  background: #fafafa;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field input:focus,
.field textarea:focus,
.batch-box textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}

.field-row {
  display: flex;
  gap: 10px;
}

.field-row .field {
  flex: 1;
}

/* ── 按钮 ── */
.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.05s, background 0.15s, opacity 0.15s;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.ghost {
  background: #f3f4f6;
  color: var(--text);
}

.btn.ghost:hover {
  background: #e5e7eb;
}

.btn.big {
  flex: 1;
  padding: 14px;
  font-size: 17px;
  font-weight: 600;
}

.btn.tiny {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  background: #f3f4f6;
}

.btn.tiny:hover {
  background: #e5e7eb;
}

.btn.tiny.danger {
  color: var(--danger);
}

.btn.small {
  padding: 8px 12px;
  font-size: 13px;
  background: #f3f4f6;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

/* ── 批量 ── */
.batch-box {
  margin-top: 12px;
}

.batch-box textarea {
  resize: vertical;
}

.hidden {
  display: none;
}

/* ── 列表 ── */
.item-list {
  list-style: none;
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.item:last-child {
  border-bottom: none;
}

.item-title {
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
}

.item-meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 18px 0;
}

/* ── 预览 ── */
.preview {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  min-height: 60px;
  margin-bottom: 12px;
}

/* ── 设置 ── */
details.settings summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  list-style: none;
}

details.settings summary::-webkit-details-marker {
  display: none;
}

details.settings[open] summary {
  margin-bottom: 12px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.6;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 0 0;
}

/* ── 提示 ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 99;
  max-width: 90%;
}

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

@media (max-width: 480px) {
  .field-row {
    flex-direction: column;
    gap: 0;
  }

  .hero h1 {
    font-size: 23px;
  }
}
