:root {
  --page-bg: #e9eef0;
  --paper: #fffdf9;
  --panel: #ffffff;
  --panel-soft: #f5f8f8;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee7;
  --line-strong: #98a2b3;
  --teal: #0f766e;
  --teal-deep: #115e59;
  --teal-soft: #e4f3f1;
  --gold: #c77924;
  --gold-soft: #fff2dc;
  --red: #b42318;
  --red-soft: #fff1f0;
  --blue: #2563eb;
  --shadow: 0 22px 60px rgba(25, 33, 42, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  padding: 28px;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(15, 118, 110, 0.12), transparent 36%),
    linear-gradient(320deg, rgba(199, 121, 36, 0.13), transparent 32%),
    var(--page-bg);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    Arial,
    sans-serif;
  line-height: 1.65;
}

body.dark-theme {
  --page-bg: #121826;
  --paper: #182230;
  --panel: #202b3c;
  --panel-soft: #172033;
  --ink: #edf2f7;
  --muted: #a9b4c2;
  --line: #344054;
  --line-strong: #667085;
  --teal: #5eead4;
  --teal-deep: #2dd4bf;
  --teal-soft: #183c3b;
  --gold: #f7b955;
  --gold-soft: #3d2d18;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}

body[data-accent="blue"] {
  --teal: #2563eb;
  --teal-deep: #1d4ed8;
  --teal-soft: #e8f0ff;
  --gold: #b45309;
  --gold-soft: #fff1db;
}

body[data-accent="wine"] {
  --teal: #be123c;
  --teal-deep: #9f1239;
  --teal-soft: #fff1f4;
  --gold: #8b5e16;
  --gold-soft: #fff5d8;
}

body.dark-theme[data-accent="blue"] {
  --teal: #93c5fd;
  --teal-deep: #60a5fa;
  --teal-soft: #172554;
}

body.dark-theme[data-accent="wine"] {
  --teal: #fda4af;
  --teal-deep: #fb7185;
  --teal-soft: #4c1524;
}

body.preview-mode [contenteditable="true"]:focus {
  background: transparent;
  box-shadow: none;
}

body.preview-mode .resume-page .no-print {
  display: none !important;
}

body.compact-density {
  line-height: 1.48;
}

body.compact-density .resume-page {
  padding: 24px;
}

body.compact-density .resume-hero {
  margin-bottom: 16px;
  padding: 18px;
}

body.compact-density .resume-section {
  margin-top: 12px;
  padding: 16px 18px;
}

body.compact-density .timeline-item,
body.compact-density .video-card,
body.compact-density .link-card {
  padding: 12px 14px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--teal-deep);
  text-decoration: none;
  border-bottom: 1px solid rgba(15, 118, 110, 0.28);
  overflow-wrap: anywhere;
  word-break: break-word;
}

a:hover {
  color: var(--gold);
  border-bottom-color: rgba(199, 121, 36, 0.55);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

[contenteditable="true"] {
  outline: none;
  border-radius: 4px;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

[contenteditable="true"]:focus {
  background: rgba(15, 118, 110, 0.10);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 940px);
  align-items: start;
  justify-content: center;
  gap: 22px;
}

.side-panel {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(152, 162, 179, 0.48);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(25, 33, 42, 0.10);
  backdrop-filter: blur(18px);
}

.dark-theme .side-panel {
  background: rgba(32, 43, 60, 0.86);
}

.brand-block {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--teal-deep), var(--gold));
  border-radius: var(--radius);
  font-size: 22px;
  font-weight: 900;
}

.brand-block strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.eyebrow,
.resume-kicker {
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-nav {
  display: grid;
  gap: 8px;
}

.section-nav a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--panel-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
}

.section-nav a:hover {
  color: var(--teal-deep);
  border-color: var(--line);
}

.tool-box {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.progress-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.progress-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-title strong {
  color: var(--teal-deep);
}

.progress-track {
  height: 8px;
  overflow: hidden;
  background: rgba(152, 162, 179, 0.24);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal-deep), var(--gold));
  border-radius: inherit;
  transition: width 180ms ease;
}

.tool-button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 700;
  line-height: 1.25;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.tool-button:hover,
.mini-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.tool-button.primary {
  color: #ffffff;
  background: var(--teal-deep);
  border-color: var(--teal-deep);
}

.import-button {
  cursor: pointer;
}

.tool-button.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(180, 35, 24, 0.18);
}

.mini-button {
  min-height: 34px;
  font-size: 13px;
}

.mini-button.ghost {
  color: var(--muted);
}

.save-status {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.theme-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.color-dot {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.color-dot.teal {
  background: #0f766e;
}

.color-dot.blue {
  background: #2563eb;
}

.color-dot.wine {
  background: #be123c;
}

.color-dot.active {
  border-color: var(--ink);
}

.resume-page {
  min-width: 0;
  width: min(100%, 940px);
  padding: 34px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.resume-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: end;
  margin-bottom: 24px;
  padding: 24px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.96), rgba(23, 32, 51, 0.94)),
    var(--teal-deep);
  border-radius: var(--radius);
  overflow: hidden;
}

.resume-hero h1 {
  margin-bottom: 8px;
  font-size: 38px;
  line-height: 1.12;
  font-weight: 900;
}

.resume-hero .resume-kicker,
.resume-hero .resume-intention {
  color: rgba(255, 255, 255, 0.82);
}

.resume-intention {
  margin-bottom: 0;
  font-size: 16px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 260px;
}

.hero-tags span,
.skill-tags span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.hero-tags span {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.resume-section {
  position: relative;
  margin-top: 18px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.resume-section::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--teal), var(--gold));
  border-radius: var(--radius) 0 0 var(--radius);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-left: 4px;
}

.section-index {
  display: grid;
  width: 34px;
  height: 28px;
  place-items: center;
  color: var(--teal-deep);
  background: var(--teal-soft);
  border: 1px solid rgba(15, 118, 110, 0.15);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
}

.section-heading h2 {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 10px;
  margin-bottom: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
}

.section-heading h2::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, var(--line), transparent);
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.basic-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 166px;
  gap: 24px;
  align-items: stretch;
}

.basic-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  min-width: 0;
}

.info-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.info-label,
.info-value {
  min-width: 0;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.info-label {
  color: var(--teal-deep);
  background: var(--teal-soft);
  border-right: 1px solid var(--line);
  font-weight: 800;
}

.info-value {
  color: var(--ink);
}

.photo-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-width: 0;
}

.photo-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 142px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  color: var(--muted);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.12), rgba(199, 121, 36, 0.12)),
    var(--panel-soft);
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  font-weight: 800;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.photo-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-frame.is-dragover,
.video-card.is-dragover {
  border-color: var(--teal-deep);
  background: var(--teal-soft);
  transform: translateY(-1px);
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.timeline-list {
  display: grid;
  gap: 14px;
}

.timeline-item {
  position: relative;
  min-width: 0;
  padding: 16px 16px 16px 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 20px;
  left: -8px;
  width: 10px;
  height: 10px;
  background: var(--gold);
  border: 3px solid var(--panel);
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--gold);
}

.item-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.item-meta strong,
.item-meta span {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.item-meta strong {
  color: var(--ink);
  font-size: 17px;
}

.item-meta span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.resume-list,
.link-list {
  margin: 0;
  padding-left: 1.25em;
}

.resume-list li,
.link-list li {
  min-width: 0;
  margin: 8px 0;
  padding-left: 2px;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.resume-list li::marker {
  color: var(--gold);
  font-weight: 900;
}

.media-area {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(230px, 0.75fr);
  gap: 16px;
  margin-top: 16px;
}

.video-card,
.link-card {
  min-width: 0;
  padding: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.video-card h3,
.link-card h3,
.skills-grid h3 {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.card-title-row h3 {
  margin-bottom: 0;
}

video {
  display: block;
  width: 100%;
  max-height: 280px;
  background: #101828;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.link-editor {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.link-editor label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.link-editor input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  overflow-wrap: anywhere;
}

.link-editor input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.skills-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(0, 1.28fr);
  gap: 18px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.skill-tags span {
  color: var(--teal-deep);
  background: var(--teal-soft);
  border: 1px solid rgba(15, 118, 110, 0.18);
}

@media (max-width: 980px) {
  body {
    padding: 16px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    position: static;
  }

  .section-nav {
    grid-template-columns: repeat(5, minmax(92px, 1fr));
    overflow-x: auto;
  }

  .section-nav a {
    justify-content: center;
    white-space: nowrap;
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

  .side-panel,
  .resume-page {
    padding: 16px;
  }

  .resume-hero {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 20px;
  }

  .resume-hero h1 {
    font-size: 30px;
  }

  .hero-tags {
    justify-content: flex-start;
    max-width: none;
  }

  .basic-layout,
  .media-area,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .basic-info {
    grid-template-columns: 1fr;
  }

  .photo-panel {
    justify-items: start;
  }

  .photo-actions {
    justify-content: flex-start;
  }

  .item-meta {
    flex-direction: column;
    gap: 2px;
  }

  .item-meta span {
    text-align: left;
  }

  .section-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .section-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  body {
    padding: 8px;
  }

  .side-panel,
  .resume-page {
    border-radius: 7px;
  }

  .resume-section {
    padding: 18px 14px;
  }

  .section-heading h2::after {
    display: none;
  }

  .info-item {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .info-label,
  .info-value {
    padding: 9px 10px;
  }

  .photo-frame {
    width: 126px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    padding: 0;
    background: #ffffff;
  }

  .app-shell {
    display: block;
  }

  .side-panel,
  .no-print {
    display: none !important;
  }

  .resume-page {
    width: 100%;
    padding: 0;
    background: #ffffff;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }

  .resume-hero {
    color: #111827;
    background: #ffffff;
    border: 2px solid #111827;
  }

  .resume-hero .resume-kicker,
  .resume-hero .resume-intention {
    color: #344054;
  }

  .hero-tags span {
    color: #111827;
    background: #ffffff;
    border-color: #98a2b3;
  }

  .resume-section,
  .timeline-item,
  .video-card,
  .link-card {
    break-inside: avoid;
    background: #ffffff;
  }

  video,
  .link-editor {
    display: none;
  }

  a {
    color: #111827;
    border-bottom: none;
  }
}
