/* 反向简历生成器 · 视觉样式（移动优先） */
:root {
  --ink: #2b2b47;
  --ink-soft: #6f708c;
  --line: rgba(43, 43, 71, 0.1);
  --primary: #5b4bc4;
  --primary-deep: #4337a3;
  --primary-soft: #efecff;
  --accent: #e07b4a;
  --accent-soft: #fff0e7;
  --ok: #2f9e73;
  --danger: #d05656;
  --card: rgba(255, 255, 255, 0.88);
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --shadow: 0 18px 50px rgba(78, 68, 140, 0.12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(720px 460px at 88% -8%, rgba(255, 202, 160, 0.5), transparent 62%),
    radial-gradient(680px 460px at 2% 8%, rgba(178, 168, 255, 0.42), transparent 60%),
    linear-gradient(165deg, #f8f7ff 0%, #f4f2ff 48%, #fff6ef 100%);
  background-attachment: fixed;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 calc(56px + env(safe-area-inset-bottom));
}

/* ---- 顶栏 ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, #b9aeff, #ffc39c);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 3px;
  border-radius: 2px;
  background: #4b4576;
}
.brand-mark::before { top: 9px; }
.brand-mark::after { top: 16px; right: 11px; background: #d9793f; }

/* ---- 导航 ---- */
.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(80, 70, 140, 0.06);
}
.tab {
  flex: 1;
  padding: 11px 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.tab.is-active {
  color: var(--primary-deep);
  background: #fff;
  box-shadow: 0 4px 14px rgba(80, 70, 140, 0.12);
}

/* ---- Hero ---- */
.hero { padding: 18px 4px 26px; }
.hero-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.24em;
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
}
.hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(28px, 6.4vw, 46px);
  line-height: 1.28;
  letter-spacing: -0.035em;
}
.hero p {
  margin: 0;
  max-width: 620px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.85;
}

/* ---- 卡片 ---- */
.card {
  padding: 22px 20px;
  margin-bottom: 18px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.card-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.card-title-row h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.hint { color: var(--ink-soft); font-size: 12.5px; line-height: 1.6; }
.field-tip { margin: -6px 0 16px; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }

/* ---- 表单 ---- */
.field-grid { display: grid; gap: 14px; }
.field-grid.two { grid-template-columns: 1fr; }
.name-row { margin-top: 14px; }
.field { position: relative; min-width: 0; }
.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}
.field label .hint { font-weight: 400; }
input[type="text"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
  outline: none;
  font-size: 14px;
  line-height: 1.6;
  transition: border-color .2s ease, box-shadow .2s ease;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236f708c' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(91, 75, 196, 0.55);
  box-shadow: 0 0 0 3px rgba(91, 75, 196, 0.1);
}
textarea { resize: vertical; min-height: 78px; }
.suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.suggest button {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  color: var(--ink-soft);
  font-size: 12px;
}
.suggest button:hover { border-color: var(--primary); color: var(--primary); }

/* ---- 成就条目 ---- */
.ach-item {
  position: relative;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.55);
}
.ach-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ach-index {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--primary);
}
.ach-index b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--primary-soft);
  font-size: 11px;
}
.ach-remove {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 3px 6px;
}
.ach-remove:hover { color: var(--danger); }
.ach-item textarea { min-height: 76px; }
.ach-meta { margin-top: 9px; }
.ach-meta input { padding: 9px 12px; font-size: 13px; }
.ach-counter { margin-top: 6px; text-align: right; font-size: 11.5px; color: var(--ink-soft); }

.add-btn {
  width: 100%;
  padding: 12px;
  border: 1.5px dashed rgba(91, 75, 196, 0.35);
  border-radius: 14px;
  background: rgba(91, 75, 196, 0.04);
  color: var(--primary);
  font-size: 13.5px;
  font-weight: 700;
}
.add-btn:hover { background: rgba(91, 75, 196, 0.08); }
.add-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---- 按钮 ---- */
.primary-btn, .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.primary-btn {
  width: 100%;
  margin-top: 18px;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  box-shadow: 0 12px 26px rgba(91, 75, 196, 0.28);
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(91, 75, 196, 0.34); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled { opacity: .6; cursor: wait; transform: none; }
.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.8);
  color: var(--ink-soft);
}
.ghost-btn:hover { border-color: var(--primary); color: var(--primary); }
.ghost-btn.small, .primary-btn.small { padding: 8px 14px; font-size: 12.5px; }
.btn-spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.engine-note { margin: 10px 0 0; text-align: center; color: var(--ink-soft); font-size: 12px; }

/* ---- 结果 ---- */
.result { animation: rise .4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.source-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 11.5px;
  font-weight: 800;
}
.source-badge.ai { background: var(--accent-soft); color: var(--accent); }
.headline-card {
  padding: 18px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #4337a3, #6d5bd0);
  color: #fff;
  box-shadow: 0 14px 30px rgba(67, 55, 163, 0.24);
}
.headline-label { font-size: 11px; letter-spacing: .16em; opacity: .72; }
.headline-card p { margin: 9px 0 0; font-size: 17px; font-weight: 800; line-height: 1.6; }

.result-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.result-tabs::-webkit-scrollbar { display: none; }
.rtab {
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.rtab.is-active { border-color: var(--primary); background: var(--primary); color: #fff; }
.rpanel { animation: rise .25s ease both; }
.summary-box {
  padding: 16px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f6f3ff, #fff6ef);
  font-size: 14.5px;
  line-height: 1.9;
}
.sub-block { margin-top: 18px; }
.sub-block h3 { margin: 0 0 10px; font-size: 13.5px; }
.sub-block p { margin: 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.8; }
.section-intro { margin: 0 0 14px; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }

.chip-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-chip {
  padding: 8px 13px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary-deep);
}
.skill-chip.hot { background: var(--accent-soft); color: var(--accent); }
.radar { display: grid; gap: 10px; }
.radar-row { display: grid; grid-template-columns: 84px 1fr 36px; align-items: center; gap: 10px; font-size: 12.5px; }
.radar-bar { height: 8px; border-radius: 999px; background: rgba(43,43,71,.08); overflow: hidden; }
.radar-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #8a7be0, var(--primary)); }
.radar-row b { text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.story-card {
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.6);
}
.story-card h3 { margin: 0 0 12px; font-size: 14px; }
.story-card h3 em { font-style: normal; color: var(--accent); }
.star-row { display: grid; grid-template-columns: 30px 1fr; gap: 10px; margin-bottom: 9px; }
.star-tag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--primary-soft); color: var(--primary-deep);
  font-size: 11px; font-weight: 800;
}
.star-row p { margin: 3px 0 0; font-size: 13px; line-height: 1.75; color: #4a4a68; }
.star-row.result .star-tag { background: var(--accent-soft); color: var(--accent); }

.role-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 15px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.65);
}
.role-card:hover { border-color: var(--primary); }
.role-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.role-card h3 { margin: 0; font-size: 14.5px; }
.role-match { font-size: 11.5px; font-weight: 800; color: var(--ok); white-space: nowrap; }
.role-card p { margin: 8px 0 0; color: var(--ink-soft); font-size: 12.8px; line-height: 1.7; }
.role-tags { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.role-tags span { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: rgba(91,75,196,.08); color: var(--primary-deep); }

.md-toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.md-toolbar .ghost-btn { margin: 0; }
.md-preview {
  max-height: 440px;
  overflow: auto;
  padding: 16px;
  margin: 0;
  border-radius: 14px;
  background: #24233a;
  color: #e8e6ff;
  font: 12px/1.75 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-overflow-scrolling: touch;
}
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.result-actions .primary-btn { width: auto; flex: 1 1 140px; margin: 0; }
.result-actions .ghost-btn { flex: 1 1 100px; margin: 0; }
.fallback-note { margin: 12px 0 0; color: var(--accent); font-size: 12px; line-height: 1.6; }

/* ---- 简历库 ---- */
.view-head { padding: 8px 4px 20px; }
.view-head h1 { margin: 0 0 8px; font-size: 25px; letter-spacing: -0.02em; }
.view-head p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-box { padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid rgba(255,255,255,.95); box-shadow: var(--shadow); }
.stat-box strong { display: block; font-size: 24px; color: var(--primary-deep); }
.stat-box span { font-size: 12px; color: var(--ink-soft); }
.library-item {
  padding: 16px 18px;
  margin-bottom: 12px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,.95);
  box-shadow: var(--shadow);
}
.library-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.library-top h3 { margin: 0; font-size: 15px; }
.library-time { color: var(--ink-soft); font-size: 11.5px; }
.library-headline { margin: 10px 0; color: var(--primary-deep); font-size: 13px; line-height: 1.6; font-weight: 700; }
.library-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.library-actions button { padding: 7px 12px; font-size: 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.library-actions button:hover { border-color: var(--primary); color: var(--primary); }
.library-actions .del:hover { border-color: var(--danger); color: var(--danger); }
.empty { text-align: center; padding: 48px 12px; color: var(--ink-soft); }
.empty p { font-size: 14px; line-height: 1.7; }
.empty .primary-btn { width: auto; padding: 11px 24px; }

/* ---- 关于 ---- */
.about-flow { margin-bottom: 18px; }
.flow-step { display: grid; grid-template-columns: 38px 1fr; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.flow-step:last-child { border-bottom: 0; }
.flow-step > span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--primary-soft); color: var(--primary-deep);
  font-size: 12px; font-weight: 800;
}
.flow-step h3 { margin: 2px 0 6px; font-size: 14.5px; }
.flow-step p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.75; }
.about-note h2 { margin: 0 0 10px; font-size: 17px; }
.about-note p { margin: 0 0 10px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.85; }
.about-note p:last-child { margin-bottom: 0; }

/* ---- 弹窗 ---- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(28, 24, 55, 0.45); backdrop-filter: blur(3px); }
.modal-box {
  position: relative;
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 60px rgba(28, 24, 55, 0.2);
  animation: slideup .25s ease both;
}
@keyframes slideup { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-label { display: block; margin: 14px 0 7px; font-size: 13px; font-weight: 700; }
.modal-box .action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.modal-box .action-row .primary-btn { width: auto; flex: 1 1 120px; margin: 0; }
.modal-box .action-row .ghost-btn { flex: 1 1 100px; }
.icon-btn { border: 0; background: transparent; font-size: 24px; color: var(--ink-soft); line-height: 1; }
.quota-box { display: flex; justify-content: space-between; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 13px; }
.quota-box strong { color: var(--accent); }
.danger-link { display: block; margin: 16px auto 0; border: 0; background: transparent; color: var(--danger); font-size: 12.5px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(35, 32, 62, 0.94);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  animation: rise .2s ease both;
}

/* ---- 平板 / 桌面 ---- */
@media (min-width: 640px) {
  .app { padding-top: 36px; }
  .field-grid.two { grid-template-columns: 1fr 1fr; }
  .card { padding: 26px 28px; }
  .modal { align-items: center; }
  .modal-box { border-radius: 26px; padding: 28px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
