:root {
  --bg: #ffffff;
  --panel: rgba(255, 255, 255, 0.85);
  --panel-solid: #ffffff;
  --line: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #5b4ef5;
  --primary-strong: #4338ca;
  --primary-soft: rgba(91, 78, 245, 0.12);
  --success: #10b981;
  --shadow: 0 24px 58px rgba(79, 70, 229, 0.14);
}

html.dark {
  --bg: #020817;
  --panel: rgba(15, 23, 42, 0.9);
  --panel-solid: #0f172a;
  --line: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #8b5cf6;
  --primary-strong: #a78bfa;
  --primary-soft: rgba(139, 92, 246, 0.18);
  --shadow: 0 24px 58px rgba(15, 23, 42, 0.55);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(91, 78, 245, 0.08), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--text);
}

html:not(.dark) body {
  background:
    radial-gradient(circle at top left, rgba(91, 78, 245, 0.08), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--text);
}

html.dark body {
  background:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.18), transparent 25%),
    linear-gradient(180deg, #020817 0%, #0f172a 100%);
  color: var(--text);
}

html.dark .hero p,
html.dark .panel-hint,
html.dark .preview-head strong,
html.dark .resume-item small,
html.dark .resume-contact,
html.dark .template-preview p,
html.dark .template-chip {
  color: var(--muted);
}

html.dark .template-card.selected {
  border-color: rgba(167, 139, 250, 0.9);
}

html.dark .step-link,
html.dark .step-link.active,
html.dark .step-badge,
html.dark .preview-tag {
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg) !important;
  color: var(--text) !important;
}

.app-shell main {
  flex: 1 1 auto;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1rem 1.15rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(248, 250, 252, 0.8);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

html.dark .app-footer {
  background: rgba(2, 8, 23, 0.8);
  border-color: rgba(148, 163, 184, 0.2);
  color: var(--muted);
}

html:not(.dark) .app-shell,
html:not(.dark) .landing-page,
html:not(.dark) .builder-screen,
html:not(.dark) .panel-card,
html:not(.dark) .template-card,
html:not(.dark) .preview-shell,
html:not(.dark) .field input,
html:not(.dark) .field textarea,
html:not(.dark) .secondary-btn,
html:not(.dark) .ghost-btn {
  background-color: var(--panel-solid) !important;
  color: var(--text) !important;
}

html:not(.dark) .topbar {
  background: rgba(255, 255, 255, 0.8) !important;
  border-color: var(--line) !important;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.74);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(12px);
}

html.dark .topbar,
html.dark .secondary-btn,
html.dark .ghost-btn,
html.dark .panel-card,
html.dark .template-card,
html.dark .preview-shell,
html.dark .field input,
html.dark .field textarea,
html.dark .builder-screen,
html.dark .landing-page {
  background-color: var(--panel-solid) !important;
  color: var(--text);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.03em;
  cursor: pointer;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: white;
  box-shadow: 0 12px 24px rgba(91, 78, 245, 0.35);
}

.brand-text {
  font-size: 1.2rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.developer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--text);
  border-radius: 9999px;
  padding: 0.5rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  transition: all 0.2s ease;
}

.developer-toggle.active {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  color: #15803d;
}

.developer-toggle__dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.secondary-btn,
.primary-btn,
.ghost-btn,
.carousel-btn {
  border: 0;
  border-radius: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.secondary-btn,
.ghost-btn {
  padding: 0.8rem 1.2rem;
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid var(--line);
}

.primary-btn {
  padding: 0.9rem 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 14px 24px rgba(91, 78, 245, 0.24);
}

.carousel-btn {
  width: 2.8rem;
  height: 2.8rem;
  background: rgba(91, 78, 245, 0.08);
  color: var(--primary);
  font-size: 1.5rem;
}

.secondary-btn:hover,
.primary-btn:hover,
.ghost-btn:hover,
.carousel-btn:hover {
  transform: translateY(-1px);
}

.landing-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.hero {
  text-align: center;
  padding: 2rem 0 1rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(91, 78, 245, 0.08);
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 1rem auto 0.9rem;
  max-width: 760px;
  font-size: clamp(2.5rem, 4vw, 4.5rem);
  line-height: 1.04;
  letter-spacing: -0.06em;
}

.hero h1 span {
  color: var(--primary);
}

.hero p {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.carousel-section {
  margin-top: 3rem;
}

.carousel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.carousel-header h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
}

.carousel {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) 3rem;
  gap: 1rem;
  align-items: center;
}

.carousel-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 0.25rem;
  padding: 0.5rem 0.25rem 1rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.template-card {
  flex: 0 0 100%;
  max-width: 100%;
  min-width: 0;
  background: var(--panel-solid);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.5rem;
  padding: 1.15rem;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.04);
  scroll-snap-align: start;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

@media (min-width: 640px) {
  .template-card {
    flex-basis: min(70vw, 340px);
  }
}

@media (min-width: 980px) {
  .template-card {
    flex-basis: min(34vw, 340px);
  }
}

.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.carousel-dot {
  width: 0.7rem;
  height: 0.7rem;
  border: 0;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.5);
  transition: all 0.2s ease;
}

.carousel-dot.active {
  width: 1.8rem;
  background: var(--primary);
}

.template-meta {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.template-meta strong {
  font-size: 1rem;
}

.template-meta button {
  width: 100%;
  justify-content: center;
  border: 0;
  background: rgba(91, 78, 245, 0.08);
  color: var(--primary);
  padding: 0.7rem 1rem;
  border-radius: 0.75rem;
  font-weight: 700;
}

html.dark .template-card {
  box-shadow: 0 18px 35px rgba(2, 8, 23, 0.45);
}

.template-card.selected {
  border-color: rgba(91, 78, 245, 0.8);
  background: linear-gradient(180deg, rgba(91, 78, 245, 0.06), var(--panel-solid));
  box-shadow: var(--shadow);
}

.template-preview {
  min-height: 200px;
  border-radius: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f8faff);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

html.dark .template-preview,
html.dark .preview-shell,
html.dark .panel-card,
html.dark .field input,
html.dark .field textarea {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.9));
  border-color: var(--line);
}

.template-preview.modern {
  background: linear-gradient(135deg, #ece8ff, #f5f3ff);
}

.template-preview.classic {
  background: linear-gradient(135deg, #f8fafc, #eef6ff);
}

.template-preview.minimal {
  background: linear-gradient(135deg, #f9fafb, #eef2ff);
}

.template-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.template-chip {
  display: inline-flex;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: rgba(91, 78, 245, 0.12);
  color: var(--primary-strong);
  font-size: 0.7rem;
  font-weight: 700;
}

.template-color {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: #7c3aed;
}

.template-preview h3 {
  margin: 0 0 0.45rem;
  font-size: 1.2rem;
}

.template-preview p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.8rem;
}

.template-lines {
  margin-top: 1rem;
  display: grid;
  gap: 0.4rem;
}

.template-lines span {
  display: block;
  height: 0.55rem;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.35);
}

.template-lines span:nth-child(2) {
  width: 75%;
}

.template-lines span:nth-child(3) {
  width: 90%;
}

.template-meta {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.template-meta strong {
  font-size: 1rem;
}

.template-meta button {
  border: 0;
  background: rgba(91, 78, 245, 0.08);
  color: var(--primary);
  padding: 0.6rem 1rem;
  border-radius: 0.75rem;
  font-weight: 700;
}

.template-actions {
  display: flex;
  justify-content: center;
  margin-top: 1.25rem;
}

.builder-screen {
  display: none;
  max-width: 1500px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.builder-screen.visible {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1.2fr);
  grid-template-areas:
    'stepper stepper'
    'content preview';
  gap: 1.25rem;
  align-items: start;
}

.builder-screen.review-mode {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 900px;
}

.builder-screen.review-mode .builder-sidebar,
.builder-screen.review-mode .builder-content {
  display: none;
}

.builder-screen.review-mode .preview-panel {
  max-width: 860px;
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 0;
}

.builder-screen.review-mode .preview-shell {
  width: min(100%, 860px);
  margin: 0 auto;
}

.builder-screen.review-mode .preview-body {
  width: 100%;
}

.builder-screen.review-mode .preview-body #a4-paper {
  width: 100%;
  max-width: 100%;
  min-height: 600px;
}

.panel-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.5rem;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.04);
}

.preview-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-height: 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.4rem;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.05);
  padding: 1rem 1rem 0.5rem;
}

.preview-body {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

html.dark .panel-card {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 18px 30px rgba(2, 8, 23, 0.4);
}

.builder-sidebar {
  grid-area: stepper;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand {
  display: none;
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 4rem;
  flex-wrap: nowrap;
}

.step-nav {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.step-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.step-link {
  background: rgba(148, 163, 184, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 999px;
  padding: 0.55rem 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  line-height: 1.1;
  transition: all 0.2s ease;
  min-width: 0;
  flex: 1 1 0;
  max-width: 220px;
}

.step-link.active {
  background: rgba(91, 78, 245, 0.08);
  border-color: rgba(91, 78, 245, 0.18);
  color: var(--primary-strong);
  box-shadow: 0 8px 18px rgba(91, 78, 245, 0.08);
}

.step-link:not(.active) {
  opacity: 0.75;
}

.step-badge {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.12);
  color: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-link.active .step-badge {
  background: var(--primary);
  color: white;
}

@media (max-width: 767px) {
  .builder-sidebar {
    padding: 0.75rem;
  }

  .stepper {
    gap: 0.4rem;
    justify-content: space-between;
  }

  .step-nav {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.1rem;
  }

  .step-link {
    padding: 0.5rem 0.7rem;
    font-size: 0.64rem;
    max-width: none;
    flex: 1 1 100%;
  }

  .step-link span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .step-link {
    flex: 1 1 0;
    min-width: 0;
  }
}

.sidebar-actions {
  margin-top: 1.75rem;
  display: grid;
  gap: 0.7rem;
}

.builder-content {
  grid-area: content;
  padding: 1.6rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9));
  border-color: rgba(91, 78, 245, 0.18);
  box-shadow: 0 24px 48px rgba(91, 78, 245, 0.08);
  min-height: 640px;
}

.preview-panel {
  grid-area: preview;
  padding: 1rem;
  max-width: 440px;
  width: 100%;
  justify-self: end;
}

.preview-trigger {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  margin-bottom: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.9rem;
  background: rgba(91, 78, 245, 0.06);
  color: var(--primary-strong);
  padding: 0.8rem 1rem;
  font-weight: 700;
}

.preview-trigger__icon {
  width: 1.8rem;
  height: 1.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  background: rgba(91, 78, 245, 0.08);
}

.preview-trigger__icon svg {
  width: 1rem;
  height: 1rem;
}

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  line-height: 1.2;
  letter-spacing: -0.05em;
}

.panel-hint {
  color: var(--muted);
  font-size: clamp(0.74rem, 1.4vw, 0.9rem);
  line-height: 1.5;
  text-align: right;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field.full {
  grid-column: 1 / -1;
}

.experience-current-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.experience-current-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  cursor: pointer;
  user-select: none;
  color: var(--text);
  font-weight: 600;
  font-size: clamp(0.78rem, 1.4vw, 0.92rem);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(91, 78, 245, 0.04);
  border: 1px solid rgba(91, 78, 245, 0.12);
}

.experience-current-toggle input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  appearance: auto;
  -webkit-appearance: checkbox;
  accent-color: var(--primary);
}

.field label {
  color: var(--text);
  font-weight: 600;
  font-size: clamp(0.78rem, 1.4vw, 0.92rem);
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: #fff;
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
  color: var(--text);
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input[data-month-year] {
  appearance: textfield;
  -webkit-appearance: textfield;
}

.field input[type='checkbox'] {
  appearance: auto;
  -webkit-appearance: checkbox;
}

.builder-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.step-action {
  flex: 1;
  min-height: 2.9rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-weight: 700;
  font-size: 0.92rem;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.step-action:hover:not(:disabled) {
  transform: translateY(-1px);
}

.step-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.step-action--secondary {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
}

.step-action--primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 20px rgba(91, 78, 245, 0.2);
}

html.dark .field input,
html.dark .field textarea {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.35);
  color: var(--text);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(91, 78, 245, 0.8);
  box-shadow: 0 0 0 4px rgba(91, 78, 245, 0.12);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.step-footer {
  margin-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.preview-panel {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 520px;
}

.preview-footer {
  width: 100%;
  margin-top: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.75rem 0.15rem 0;
  background: transparent;
  position: relative;
  z-index: 2;
}

.preview-footer .primary-btn {
  width: min(100%, 220px);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  box-shadow: 0 14px 28px rgba(91, 78, 245, 0.28), 0 4px 12px rgba(15, 23, 42, 0.12);
}

html.dark .preview-footer {
  background: transparent;
}

@media (min-width: 1024px) {
  .preview-footer {
    position: sticky;
    bottom: 0.75rem;
    z-index: 8;
    background: transparent;
  }

  .preview-body #a4-paper {
    height: clamp(760px, 72vh, 1040px);
  }
}

.preview-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-height: 100%;
  max-width: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #fff, #f8fafc);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1.4rem;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.05);
  padding: 1rem 1rem 0.5rem;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.preview-head strong {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.preview-tag {
  display: inline-flex;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(91, 78, 245, 0.08);
  color: var(--primary-strong);
  font-size: 0.7rem;
  font-weight: 700;
}

.preview-body #a4-paper {
  width: min(100%, 820px);
  max-width: 100%;
  min-height: 560px;
  height: clamp(720px, 76vh, 1060px);
  flex: 1 1 auto;
  background: white;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.9rem;
  padding: clamp(1.1rem, 2vw, 1.5cm);
  padding-bottom: 3rem;
  box-sizing: border-box;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8);
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.preview-body #a4-paper * {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

html.dark #a4-paper {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.2);
  color: #e2e8f0;
}

.resume-header {
  border-bottom: 2px solid rgba(91, 78, 245, 0.9);
  padding-bottom: 0.9rem;
  margin-bottom: 1.1rem;
}

.resume-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2vw, 2.2rem);
  letter-spacing: -0.06em;
  line-height: 1.08;
}

.resume-header h2 {
  margin: 0.45rem 0 0;
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.resume-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem 0.8rem;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.resume-link {
  display: inline-flex;
  align-items: center;
  margin-top: 0.85rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(91, 78, 245, 0.08);
  color: var(--primary-strong);
  font-size: 0.72rem;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.resume-section {
  margin-top: 1.2rem;
  padding-top: 0.2rem;
}

.resume-section h3 {
  margin: 0 0 0.7rem;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  font-weight: 800;
}

.resume-section p,
.resume-section li {
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.7;
}

.resume-section:not(:first-of-type) {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding-top: 0.9rem;
}

.resume-skill-list,
#preview-skills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.45rem;
  margin: 0;
  padding: 0.45rem 0;
  list-style: none;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.skill-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.56rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  font-size: 0.74rem;
  line-height: 1.4;
  white-space: nowrap;
}

.skill-divider {
  color: var(--muted);
  font-weight: 700;
  user-select: none;
}

.skill-chip--empty {
  background: rgba(148, 163, 184, 0.04);
  color: var(--muted);
}

.resume-item {
  margin-bottom: 1rem;
}

.resume-item strong {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 0.82rem;
  line-height: 1.35;
}

.resume-item small {
  color: var(--muted);
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.builder-screen.review-mode .preview-panel {
  max-width: 760px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 0;
}

.builder-screen.review-mode .preview-shell {
  width: min(100%, 760px);
  margin: 0 auto;
}

.builder-screen.review-mode .preview-body {
  width: 100%;
}

.builder-screen.review-mode .preview-body #a4-paper {
  width: 100%;
  max-width: 100%;
  min-height: 600px;
}

@media (max-width: 1100px) {
  .builder-screen.visible {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1023px) {
  .preview-trigger {
    display: flex;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-hint {
    text-align: left;
  }

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

  .builder-actions {
    flex-direction: row;
  }

  .preview-footer {
    position: sticky !important;
    bottom: 0 !important;
    left: 0;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0.76) 22%,
      rgba(255, 255, 255, 0.96) 100%
    );
    backdrop-filter: blur(2px);
    z-index: 20;
  }

  html.dark .preview-footer {
    background: linear-gradient(
      180deg,
      rgba(15, 23, 42, 0) 0%,
      rgba(15, 23, 42, 0.72) 24%,
      rgba(15, 23, 42, 0.94) 100%
    );
  }

  .preview-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 60;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(2px);
  }

  .preview-panel.modal-open {
    display: flex;
  }

  .preview-panel.modal-open .preview-shell {
    width: min(100%, 680px);
    max-height: 92vh;
    overflow: hidden;
    padding: 0.85rem 0.85rem 0;
    border-radius: 1.1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  .preview-panel.modal-open .preview-shell .preview-body {
    width: 100%;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.1rem;
    -webkit-overflow-scrolling: touch;
  }

  .preview-panel.modal-open {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .preview-panel.modal-open .preview-shell .preview-footer {
    position: sticky !important;
    bottom: 0 !important;
    left: 0;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 0.75rem 0 0.15rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.92) 26%, rgba(255, 255, 255, 1) 100%);
    backdrop-filter: blur(3px);
    z-index: 30 !important;
    box-sizing: border-box;
  }

  html.dark .preview-panel.modal-open .preview-shell .preview-footer {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.82) 26%, rgba(15, 23, 42, 1) 100%);
  }

  .preview-panel.modal-open .preview-shell .preview-footer .primary-btn {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  .preview-panel.modal-open .preview-body #a4-paper {
    width: 100%;
    min-height: 420px;
    max-width: 100%;
    flex: 1 1 auto;
    box-sizing: border-box;
    padding: 1rem 0.85rem 1.25rem;
    border-radius: 0.9rem;
  }

  .preview-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    z-index: 70;
  }

  body.preview-modal-open {
    overflow: hidden;
  }
}

@media (min-width: 1024px) {
  .preview-modal-close {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .panel-header {
    gap: 0.5rem;
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
  }

  .panel-header h3 {
    font-size: clamp(1.1rem, 5vw, 1.5rem);
  }

  .panel-hint {
    font-size: 0.74rem;
  }

  .field-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .experience-current-wrap {
    justify-content: center;
  }

  .experience-current-toggle {
    width: auto;
    justify-content: center;
  }

  .field input,
  .field textarea {
    padding: 0.8rem 0.9rem;
  }

  .builder-actions {
    flex-direction: row;
    gap: 0.65rem;
  }

  .step-action {
    min-height: 2.7rem;
    font-size: 0.86rem;
  }

  .preview-footer .primary-btn {
    width: 100%;
    max-width: 100%;
  }
}

@media (min-width: 640px) {
  .topbar {
    padding: 1rem 1.5rem;
  }

  .landing-page {
    padding-inline: 1.5rem;
  }

  .hero-actions {
    gap: 1rem;
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .landing-page {
    padding-inline: 2rem;
  }

  .builder-screen.visible {
    grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1.15fr);
    grid-template-areas:
      'stepper stepper'
      'content preview';
  }

  .preview-panel {
    max-width: 540px;
  }
}

#builder-screen.builder-screen.review-mode {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: none;
  max-width: 900px;
  width: min(100%, 900px);
}

#builder-screen.builder-screen.review-mode .preview-panel {
  max-width: 860px;
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 0;
  justify-self: center;
}

#builder-screen.builder-screen.review-mode .preview-shell {
  width: min(100%, 860px);
  margin: 0 auto;
}

#builder-screen.builder-screen.review-mode .preview-body {
  width: 100%;
}

#builder-screen.builder-screen.review-mode .preview-body #a4-paper {
  width: 100%;
  max-width: 100%;
  min-height: 600px;
}
