:root {
  --ink: #17222d;
  --muted: #667484;
  --line: #dce5ec;
  --wash: #f4f8fb;
  --brand: #167f7a;
  --brand-dark: #0f5f5d;
  --accent: #d9644a;
  --soft: #e8f4f2;
  --shadow: 0 20px 60px rgba(19, 45, 64, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 5vw, 64px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(220, 229, 236, 0.8);
  backdrop-filter: blur(18px);
}

.brand,
.top-nav,
.hero-actions,
.resume-row,
.site-footer,
.ad-row,
.contact-line,
.field-row,
.fieldset-title,
.entry-actions,
.upload-preview {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  background: var(--brand);
  border-radius: 8px;
}

.top-nav {
  gap: 22px;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-nav a:hover {
  color: var(--ink);
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
}

.primary-button {
  color: white;
  background: var(--brand);
}

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

.secondary-button,
.ghost-button {
  color: var(--ink);
  background: white;
  border-color: var(--line);
}

.small {
  min-height: 38px;
  padding: 0 14px;
}

.page-panel {
  padding: 28px clamp(18px, 5vw, 64px) 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 470px);
  gap: 38px;
  align-items: center;
  min-height: calc(100vh - 76px);
}

.hero .ad-wide {
  grid-column: 1 / -1;
}

.hero-copy h1,
.section-head h2,
.form-head h2,
.preview-toolbar h2 {
  margin: 0;
  letter-spacing: 0;
}

.hero-copy h1 {
  max-width: 820px;
  font-size: clamp(2.4rem, 6vw, 5.1rem);
  line-height: 0.98;
}

.hero-copy p:not(.eyebrow) {
  max-width: 650px;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.8;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-stats {
  display: grid;
  max-width: 600px;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 34px 0 0;
}

.hero-stats div,
.resume-form,
.preview-column,
.template-card,
.tips-grid article {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-stats div {
  padding: 18px;
}

.hero-stats dt {
  font-weight: 850;
  font-size: 1.35rem;
}

.hero-stats dd {
  margin: 5px 0 0;
  color: var(--muted);
}

.hero-preview {
  display: grid;
  gap: 18px;
}

.mini-resume {
  min-height: 560px;
  padding: 36px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.mini-head,
.mini-title,
.mini-line,
.mini-section,
.mini-grid div,
.mini-columns span {
  display: block;
  background: #d7e4ea;
  border-radius: 5px;
}

.mini-head {
  width: 72px;
  height: 72px;
  background: var(--brand);
}

.mini-title {
  width: 70%;
  height: 24px;
  margin-top: 26px;
}

.mini-line {
  width: 100%;
  height: 10px;
  margin-top: 16px;
}

.mini-line.short {
  width: 48%;
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 34px 0;
}

.mini-grid div {
  height: 68px;
  background: var(--soft);
}

.mini-section {
  width: 36%;
  height: 16px;
  margin-top: 26px;
  background: var(--accent);
}

.mini-section.small {
  width: 26%;
}

.mini-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.mini-columns span {
  height: 28px;
  background: var(--soft);
}

.ad {
  display: block;
  min-height: 90px;
  border-radius: 8px;
  overflow: hidden;
}

/* 广告位未加载时显示占位符样式（仅当内容为空时） */
.ad:empty {
  display: grid;
  place-items: center;
  gap: 4px;
  color: #61707d;
  background: repeating-linear-gradient(45deg, #eef3f6 0 10px, #f8fbfc 10px 20px);
  border: 1px dashed #b8c6cf;
  text-align: center;
}

.ad span {
  font-size: 0.76rem;
  text-transform: uppercase;
}

.ad em {
  font-size: 0.78rem;
  font-style: normal;
}

.ad-box {
  min-height: 250px;
}

.ad-box:empty {
  min-height: 250px;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(320px, 470px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.resume-form {
  padding: 24px;
}

fieldset {
  margin: 0;
  padding: 22px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

legend {
  padding: 0 0 14px;
  font-weight: 850;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: #314252;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  color: var(--ink);
  background: #f8fbfc;
  border: 1px solid #cfdce4;
  border-radius: 8px;
  outline: 0;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 127, 122, 0.14);
}

.three-fields,
.control-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.control-grid {
  grid-template-columns: 1fr 1fr;
}

.mini-fieldset {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-fieldset legend {
  padding: 0 4px;
}

.mini-fieldset label {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 650;
}

.mini-fieldset input[type="radio"] {
  width: auto;
  min-height: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: #314252;
  font-size: 0.92rem;
  font-weight: 700;
}

.file-control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.file-control span,
.image-upload p {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.image-upload p {
  margin: 0 0 14px;
  line-height: 1.5;
}

.upload-preview {
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px;
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upload-preview[hidden] {
  display: none;
}

.upload-preview img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.fieldset-title {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.fieldset-title legend {
  padding: 0;
}

.entry-card {
  padding: 14px;
  margin-bottom: 14px;
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.field-row {
  align-items: end;
  gap: 10px;
}

.field-row label {
  flex: 1;
}

.entry-actions {
  justify-content: flex-end;
  margin-top: 2px;
}

.template-picker {
  display: grid;
  max-height: 380px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.template-picker label {
  margin: 0;
}

.template-picker input {
  position: absolute;
  opacity: 0;
}

.template-picker span {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 10px;
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.25;
}

.template-picker span::before {
  content: "";
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  background: var(--swatch);
  border-radius: 50%;
}

.template-picker input:checked + span {
  color: white;
  background: var(--swatch);
  border-color: var(--swatch);
}

.template-picker input:checked + span::before {
  background: white;
}

.preview-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  padding: 22px;
}

.preview-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.resume-sheet {
  min-height: 920px;
  padding: 52px;
  background: white;
  border: 1px solid #d5dee6;
  border-radius: 4px;
  box-shadow: 0 14px 38px rgba(28, 52, 70, 0.12);
}

.resume-sheet header {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-bottom: 26px;
  border-bottom: 2px solid var(--resume-dark, var(--ink));
}

.resume-sheet h3 {
  margin: 0;
  font-size: 2.45rem;
}

.resume-sheet header p {
  margin: 8px 0;
  color: var(--resume-primary, var(--brand));
  font-size: 1.08rem;
  font-weight: 850;
}

.resume-sheet p,
.resume-sheet li,
.resume-sheet .resume-row span,
.contact-line {
  color: #4f6070;
  line-height: 1.65;
}

.contact-line {
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 0.9rem;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.contact-item svg {
  width: 15px;
  height: 15px;
  color: var(--resume-primary, var(--brand));
}

.resume-sheet section {
  margin-top: 28px;
}

.resume-sheet h4 {
  margin: 0 0 12px;
  color: var(--resume-dark, var(--ink));
  font-size: 0.88rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.resume-photo {
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 3px solid var(--resume-soft, var(--soft));
  border-radius: 10px;
}

.resume-sheet.photo-circle .resume-photo {
  border-radius: 999px;
}

.resume-row {
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.resume-entry {
  margin-top: 18px;
}

.resume-entry:first-child {
  margin-top: 0;
}

.resume-entry ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

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

.skill-list span {
  padding: 7px 10px;
  background: var(--resume-soft, var(--soft));
  border-radius: 6px;
  color: var(--resume-primary, var(--brand-dark));
  font-weight: 750;
}

.resume-sheet.modern {
  border-top: 12px solid var(--resume-primary, var(--brand));
}

.resume-sheet.compact {
  min-height: 760px;
  padding: 40px;
  font-size: 0.92rem;
}

.resume-sheet.compact h3 {
  font-size: 2rem;
}

.resume-sheet.compact section {
  margin-top: 20px;
}

.resume-sheet.sidebar {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  border-left: 14px solid var(--resume-primary, var(--brand));
}

.resume-sheet.sidebar header {
  grid-column: 1 / -1;
}

.resume-sheet.sidebar section:nth-of-type(3),
.resume-sheet.sidebar section:nth-of-type(4) {
  padding: 18px;
  background: var(--resume-soft, var(--soft));
  border-radius: 8px;
}

.resume-sheet.accent {
  background: linear-gradient(90deg, var(--resume-soft, var(--soft)) 0 30%, transparent 30%), white;
}

.resume-sheet.accent header {
  padding: 24px;
  background: var(--resume-primary, var(--brand));
  border: 0;
  border-radius: 8px;
}

.resume-sheet.accent header h3,
.resume-sheet.accent header p,
.resume-sheet.accent header .contact-line,
.resume-sheet.accent .contact-item svg {
  color: white;
}

.resume-sheet.editorial h4 {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--resume-primary, var(--brand));
}

.resume-sheet.executive {
  border-top: 22px solid var(--resume-dark, var(--ink));
}

.bg-clean {
  background-color: white;
}

.bg-linen {
  background: #fffaf2;
}

.bg-mist {
  background: linear-gradient(135deg, #ffffff 0%, #eef6f7 100%);
}

.bg-grid {
  background-color: white;
  background-image:
    linear-gradient(rgba(18, 42, 56, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 42, 56, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
}

.bg-band {
  background: linear-gradient(90deg, var(--resume-soft, var(--soft)) 0 18%, white 18%);
}

.bg-paper {
  background: #fbfaf7;
  background-image: radial-gradient(rgba(23, 34, 45, 0.045) 0.7px, transparent 0.7px);
  background-size: 12px 12px;
}

.bottom-ad {
  margin-top: 24px;
}

.section-head {
  max-width: 780px;
  margin: 34px auto;
  text-align: center;
}

.section-head h2 {
  font-size: clamp(2rem, 4vw, 3.35rem);
}

.section-head p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
}

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

.template-library {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.template-card {
  padding: 18px;
}

.template-card h3,
.tips-grid h3 {
  margin: 18px 0 8px;
}

.template-card p,
.tips-grid p {
  color: var(--muted);
  line-height: 1.65;
}

.template-card a {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  margin-top: 8px;
  color: var(--brand);
  font-weight: 850;
}

.template-sample {
  height: 250px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: #fff;
  background-image:
    linear-gradient(var(--sample, var(--brand)), var(--sample, var(--brand))),
    linear-gradient(#d6e0e7, #d6e0e7),
    linear-gradient(#d6e0e7, #d6e0e7),
    linear-gradient(#e9eff3, #e9eff3),
    linear-gradient(#e9eff3, #e9eff3),
    linear-gradient(var(--sample-soft, #e9eff3), var(--sample-soft, #e9eff3));
  background-repeat: no-repeat;
  background-size: 50% 16px, 72% 10px, 36% 10px, 82% 9px, 82% 9px, 62% 9px;
  background-position: 24px 28px, 24px 62px, 24px 82px, 24px 128px, 24px 146px, 24px 164px;
}

.modern-sample {
  background-size: 100% 12px, 26% 100%, 42% 14px, 42% 9px, 42% 9px, 42% 9px;
  background-position: 0 0, 0 0, 36% 36px, 36% 86px, 36% 106px, 36% 126px;
}

.compact-sample {
  background-size: 46% 12px, 84% 8px, 66% 8px, 88% 8px, 88% 8px, 88% 8px;
  background-position: 20px 24px, 20px 54px, 20px 70px, 20px 108px, 20px 126px, 20px 144px;
}

.sidebar-sample {
  background-size: 28% 100%, 20% 42px, 52% 14px, 52% 9px, 52% 9px, 52% 9px;
  background-position: 0 0, 20px 28px, 38% 34px, 38% 86px, 38% 106px, 38% 126px;
}

.accent-sample {
  background-size: 100% 58px, 34% 100%, 42% 12px, 56% 9px, 56% 9px, 40% 9px;
  background-position: 0 0, 0 0, 42% 86px, 42% 132px, 42% 150px, 42% 168px;
}

.editorial-sample {
  background-size: 64% 18px, 80% 1px, 42% 11px, 82% 9px, 82% 9px, 62% 9px;
  background-position: 22px 30px, 22px 68px, 22px 92px, 22px 132px, 22px 150px, 22px 168px;
}

.executive-sample {
  background-size: 100% 20px, 48% 14px, 36% 9px, 80% 9px, 80% 9px, 60% 9px;
  background-position: 0 0, 24px 46px, 24px 76px, 24px 126px, 24px 144px, 24px 162px;
}

.ad-row {
  justify-content: center;
  gap: 18px;
  margin-top: 28px;
}

.ad-row .ad {
  width: min(100%, 340px);
  min-height: 250px;
}

.tips-grid article {
  padding: 26px;
}

.tips-grid span {
  color: var(--accent);
  font-weight: 900;
}

.site-footer {
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(18px, 5vw, 64px);
  color: var(--muted);
  background: white;
  border-top: 1px solid var(--line);
}

.site-footer span:first-child {
  color: var(--ink);
  font-weight: 850;
}

@media (max-width: 1200px) {
  .builder-layout,
  .preview-column {
    grid-template-columns: 1fr;
  }

  .side-ad {
    min-height: 120px;
  }
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .top-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.88rem;
  }

  .ghost-button {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-stats,
  .template-grid,
  .tips-grid,
  .template-picker,
  .three-fields,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    font-size: 2.45rem;
    line-height: 1.08;
  }

  .mini-resume,
  .resume-sheet {
    min-height: 620px;
    padding: 28px;
  }

  .resume-sheet h3 {
    font-size: 2rem;
  }

  .resume-sheet.sidebar {
    display: block;
  }

  .preview-toolbar,
  .site-footer,
  .ad-row,
  .field-row {
    align-items: stretch;
    flex-direction: column;
  }
}

@media print {
  body {
    background: white;
  }

  .site-header,
  .resume-form,
  .preview-toolbar,
  .ad,
  .site-footer {
    display: none !important;
  }

  .page-panel,
  .builder,
  .builder-layout,
  .preview-column {
    display: block;
    padding: 0;
    margin: 0;
    background: white;
    border: 0;
  }

  .resume-sheet {
    width: 100%;
    min-height: auto;
    padding: 0.45in;
    border: 0;
    box-shadow: none;
  }

  .page-panel:not(#builder) {
    display: none;
  }
}
