:root {
  --bg: #f3f8f7;
  --bg-soft: #ffffff;
  --ink: #102a2a;
  --muted: #4f6666;
  --line: #d9e7e7;
  --a1: #0d9488;
  --a2: #f97316;
  --a3: #0f766e;
  --danger: #dc2626;
  --warn: #f59e0b;
  --ok: #16a34a;
  --radius: 18px;
  --shadow: 0 16px 40px rgba(16, 42, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #eef7f6 0%, #fdf6ef 100%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(to right, rgba(13, 148, 136, 0.06) 1px, transparent 1px), linear-gradient(to bottom, rgba(13, 148, 136, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: -3;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.3;
  z-index: -2;
}

.orb-a {
  width: 360px;
  height: 360px;
  top: -100px;
  left: -90px;
  background: #14b8a6;
}

.orb-b {
  width: 300px;
  height: 300px;
  bottom: -80px;
  right: -80px;
  background: #fb923c;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  backdrop-filter: blur(12px);
  background: rgba(243, 248, 247, 0.86);
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--a1), var(--a2));
}

.logo-text {
  font-size: 1.1rem;
}

.topnav {
  display: flex;
  gap: 14px;
}

.topnav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.topnav a:hover {
  color: var(--a3);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.lang-btn {
  border: 0;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
  padding: 6px 11px;
  cursor: pointer;
}

.lang-btn.active {
  background: var(--a1);
  color: #fff;
}

main {
  width: min(1220px, 92vw);
  margin: 22px auto 40px;
  display: grid;
  gap: 22px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.hero-copy,
.hero-card,
.panel {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 24px;
}

.pill {
  display: inline-block;
  margin: 0 0 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ccfbf1;
  color: #115e59;
  font-weight: 700;
  font-size: 0.85rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.1;
}

.hero-copy p {
  color: var(--muted);
  max-width: 58ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.hero-card {
  padding: 24px;
}

.hero-card h3 {
  margin-top: 0;
}

.hero-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.ad-slot {
  border: 2px dashed #8bb7b5;
  border-radius: 14px;
  text-align: center;
  padding: 16px;
  color: #4d7a78;
  background: rgba(204, 251, 241, 0.35);
  font-weight: 600;
}

.panel {
  padding: 20px;
}

.section-head h2,
.section-head p {
  margin: 0;
}

.section-head p {
  margin-top: 8px;
  color: var(--muted);
}

.template-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.template-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(150deg, #ffffff, #f6fbfb);
  padding: 14px;
  text-align: left;
  min-height: 90px;
  cursor: pointer;
  display: grid;
  gap: 8px;
}

.template-card.selected {
  border-color: var(--a1);
  outline: 2px solid #99f6e4;
}

.template-name {
  font-weight: 700;
}

.template-tag {
  justify-self: start;
  font-size: 0.75rem;
  color: #155e75;
  background: #e0f2fe;
  border-radius: 999px;
  padding: 3px 10px;
}

.builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 14px 0 18px;
  gap: 8px;
}

.step {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  font-weight: 700;
  cursor: pointer;
}

.step.active {
  background: #ccfbf1;
  border-color: var(--a1);
  color: #0f766e;
}

#resume-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.subsection {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.ai-assistant-panel {
  background: linear-gradient(180deg, #f0fdfa, #ffffff);
  border: 1px solid #c7eeeb;
  border-radius: 12px;
  padding: 12px;
}

.tiny-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: #155e59;
  background: #ccfbf1;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  padding: 3px 8px;
}

.ai-settings {
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}

.ai-settings summary {
  cursor: pointer;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.ai-runtime-note {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: #155e59;
}

.subsection-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.block-card {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 10px;
  background: #f9fcfc;
}

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chip-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  background: #ccfbf1;
  color: #115e59;
  border: 1px solid #99f6e4;
}

.chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.form-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 9px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-strong {
  color: #fff;
  background: linear-gradient(135deg, var(--a1), var(--a2));
}

.btn-soft {
  color: #155e59;
  background: #ecfeff;
  border-color: #99f6e4;
}

.preview-panel {
  position: sticky;
  top: 86px;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.completion-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfb;
  padding: 12px;
}

.completion-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.completion-track {
  height: 8px;
  background: #dbe8e8;
  border-radius: 999px;
  overflow: hidden;
}

.completion-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #0d9488, #f97316);
  transition: width 0.2s ease;
}

#completion-missing {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

#template-pill {
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  color: #155e59;
  background: #ccfbf1;
  border-radius: 999px;
  padding: 4px 10px;
}

.cv-preview {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.cv-header {
  padding: 18px;
  color: #fff;
  background: var(--template-primary, #0d9488);
}

.cv-header h1,
.cv-header p {
  margin: 0;
}

.cv-header h1 {
  font-size: 1.4rem;
}

.cv-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
}

.cv-layout section {
  padding: 14px;
}

.cv-layout section:first-child {
  background: #f0fdfa;
  border-right: 1px solid var(--line);
}

.cv-layout h3 {
  margin: 0 0 10px;
  color: var(--template-primary, #0d9488);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cv-layout p {
  margin: 0;
  color: #334155;
  line-height: 1.5;
}

.skill-meter {
  margin-bottom: 8px;
}

.skill-meter strong {
  display: block;
  font-size: 0.82rem;
}

.skill-meter-bar {
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: #dbe4e4;
}

.skill-meter-fill {
  height: 100%;
  background: var(--template-secondary, #f97316);
}

.preview-item {
  margin-bottom: 10px;
}

.preview-item h4,
.preview-item p {
  margin: 0;
}

.preview-item h4 {
  font-size: 0.95rem;
}

.preview-item p {
  font-size: 0.85rem;
  color: #475569;
}

.tips-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
}

.tips-panel h3 {
  margin-top: 0;
}

.tips-panel ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.tip-good {
  color: var(--ok);
}

.tip-warn {
  color: #a16207;
}

.tip-bad {
  color: var(--danger);
}

.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.features article {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.features h3,
.features p {
  margin: 0;
}

.features p {
  margin-top: 6px;
  color: var(--muted);
}

.footer {
  width: min(1220px, 92vw);
  margin: 0 auto 28px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.spinner {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  z-index: 40;
}

.spinner.hidden {
  display: none;
}

.spinner-dot {
  width: 38px;
  height: 38px;
  border: 4px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
  }

  .topnav {
    order: 3;
    width: 100%;
  }

  .hero,
  .builder {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .template-grid,
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .template-grid,
  .features,
  .steps,
  .grid-2,
  .cv-layout {
    grid-template-columns: 1fr;
  }

  .footer {
    display: grid;
    gap: 6px;
  }
}
