body { font-family: 'Inter', sans-serif; background: #f8fafc; }

.gradient-bg {
  background:
    radial-gradient(circle at top left, rgba(37,99,235,0.15), transparent 35%),
    radial-gradient(circle at bottom right, rgba(124,58,237,0.12), transparent 35%),
    #f8fafc;
}

.glass-card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}

.floating-card { animation: float 5s ease-in-out infinite; }

@keyframes float {
  0%,100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.hero-grid {
  background-image:
    linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

.upload-box:hover { transform: translateY(-3px); box-shadow: 0 15px 40px rgba(37,99,235,0.15); }

.craft-btn {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  background-size: 200% 200%;
  animation: gradientShift 4s ease infinite;
}
@keyframes gradientShift {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.craft-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(168,85,247,0.3), rgba(59,130,246,0.3));
  opacity: 0;
  transition: opacity 0.3s;
}
.craft-btn:hover::before { opacity: 1; }
.craft-btn .stars {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 20%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 70%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 60%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 10% 80%, rgba(255,255,255,0.4) 0%, transparent 100%);
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle {
  0%,100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.resume-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  transition: transform 0.3s, box-shadow 0.3s;
}
.resume-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.14);
}
.resume-card-header {
  padding: 20px 28px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.resume-content {
  padding: 28px;
  font-size: 13px;
  line-height: 1.7;
  color: #374151;
  white-space: pre-wrap;
  max-height: 600px;
  overflow-y: auto;
}
.resume-content::-webkit-scrollbar { width: 6px; }
.resume-content::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 3px; }
.resume-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.score-ring {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px;
  color: white;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.tab-btn {
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  background: transparent;
  color: #64748b;
}
.tab-btn.active {
  background: white;
  color: #1e1b4b;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.copy-btn {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid #e2e8f0;
  background: white;
  color: #374151;
  transition: all 0.2s;
}
.copy-btn:hover { background: #f8fafc; border-color: #6366f1; color: #6366f1; }

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
.pulse-dot { animation: pulse 1.5s ease infinite; }

.ai-badge {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metric-win { background: #f0fdf4; border-left: 3px solid #22c55e; padding: 8px 12px; border-radius: 0 8px 8px 0; margin: 4px 0; }
.metric-neutral { background: #f8fafc; border-left: 3px solid #94a3b8; padding: 8px 12px; border-radius: 0 8px 8px 0; margin: 4px 0; }

.step-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0;
}
.step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.step-dot.done { background: #dcfce7; color: #16a34a; }
.step-dot.active { background: #dbeafe; color: #2563eb; animation: pulse 1.5s ease infinite; }
.step-dot.pending { background: #f1f5f9; color: #94a3b8; }

/* ===== Forge loading: 2-column layout + cute mascot ===== */
.craft-loading-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  max-width: 980px;
  margin: 0 auto;
  align-items: center;
}
@media (min-width: 900px) {
  .craft-loading-grid { grid-template-columns: 1.05fr 1fr; gap: 48px; }
}

.craft-loading-left { min-width: 0; }

.craft-loading-right {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 10px;
}

.cute-stage {
  position: relative;
  width: 260px; height: 260px;
  display: flex; align-items: center; justify-content: center;
}

.cute-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(124, 58, 237, 0.25);
  animation: cute-ring-pulse 2.6s ease-out infinite;
}
.cute-ring.r1 { width: 110px; height: 110px; animation-delay: 0s; }
.cute-ring.r2 { width: 110px; height: 110px; animation-delay: 0.85s; border-color: rgba(79, 70, 229, 0.25); }
.cute-ring.r3 { width: 110px; height: 110px; animation-delay: 1.7s; border-color: rgba(236, 72, 153, 0.22); }

@keyframes cute-ring-pulse {
  0%   { transform: scale(0.6); opacity: 0.9; }
  80%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

.cute-orbit {
  position: absolute;
  width: 220px; height: 220px;
  animation: cute-orbit-spin 9s linear infinite;
}
@keyframes cute-orbit-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.cute-spark {
  position: absolute;
  font-size: 22px;
  filter: drop-shadow(0 2px 6px rgba(79, 70, 229, 0.25));
  animation: cute-spark-counter 9s linear infinite, cute-spark-bob 2.2s ease-in-out infinite;
}
/* counter-rotate so the emoji stays upright while the orbit spins */
@keyframes cute-spark-counter {
  from { transform: rotate(0deg); }
  to   { transform: rotate(-360deg); }
}
@keyframes cute-spark-bob {
  0%, 100% { translate: 0 -3px; }
  50%      { translate: 0  3px; }
}
.cute-spark.s1 { top: 0;   left: 50%; margin-left: -11px; }
.cute-spark.s2 { top: 50%; right: 0;  margin-top: -11px; animation-delay: 0s, 0.55s; }
.cute-spark.s3 { bottom: 0; left: 50%; margin-left: -11px; animation-delay: 0s, 1.1s; }
.cute-spark.s4 { top: 50%; left: 0;   margin-top: -11px; animation-delay: 0s, 1.65s; }

.cute-center {
  width: 92px; height: 92px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  color: white;
  box-shadow: 0 18px 40px -10px rgba(79, 70, 229, 0.55);
  animation: cute-center-bob 2.6s ease-in-out infinite;
  position: relative; z-index: 1;
}
@keyframes cute-center-bob {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-6px) scale(1.04); }
}

.cute-caption {
  margin-top: 18px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.01em;
}
.cute-subcaption {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}

/* hide the mascot on small screens so the steps stay readable */
@media (max-width: 899px) {
  .craft-loading-right { display: none; }
}

.format-card {
  border: 2px solid #e2e8f0;
  border-radius: 20px;
  padding: 28px 22px;
  background: white;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.format-card:hover {
  border-color: #6366f1;
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(99, 102, 241, 0.15);
}
.format-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; letter-spacing: 0.05em;
  margin-bottom: 18px;
}
.format-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
}
.format-desc {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 22px;
  line-height: 1.5;
  min-height: 40px;
}
.format-btn {
  width: 100%;
  padding: 12px;
  background: #0f172a;
  color: white;
  border-radius: 14px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: background 0.25s ease;
}
.format-card:hover .format-btn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
}

/* =========================================================
   TEMPLATE PICKER  (Download -> Select Template)
   ========================================================= */
#renderFrame {
  position: fixed; left: -9999px; top: 0;
  width: 816px; border: 0; background: #fff;
}

.tcard {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  background: #fbfcfe;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tcard:hover {
  border-color: #6366f1;
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -16px rgba(99,102,241,.5);
}
.tcard .thumb {
  height: 250px;
  overflow: hidden;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
}
.tcard .thumb iframe {
  position: absolute; top: 0; left: 0;
  width: 816px; height: 1056px;
  border: 0; transform-origin: top left; pointer-events: none;
}
.tcard .thumb .thumb-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8; font-size: 12px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}
.tcard .thumb .thumb-loading::before {
  content: ''; width: 22px; height: 22px;
  border: 2.5px solid #cbd5e1; border-top-color: #6366f1;
  border-radius: 50%; animation: tspin .8s linear infinite; margin-right: 8px;
}
/* Subtle hover overlay so the user knows the whole thumbnail is clickable */
.tcard .thumb::after {
  content: 'Click to preview'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.tcard:hover .thumb::after { opacity: 1; }

/* ====== Nav-bar Templates dropdown (mega menu) ====== */
.nav-tpl-wrap { position: relative; }
.nav-tpl-wrap.open #navTplChevron { transform: rotate(180deg); }

.nav-tpl-dropdown {
  position: absolute;
  top: calc(100% + 18px);
  left: 50%;
  transform: translateX(-50%);
  width: min(880px, 90vw);
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 24px 60px -20px rgba(15, 23, 42, .25);
  padding: 16px 18px 18px;
  z-index: 100;
}
.nav-tpl-dropdown::before {
  content: '';
  position: absolute; top: -8px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 16px; height: 16px;
  background: #fff; border-left: 1px solid #e2e8f0; border-top: 1px solid #e2e8f0;
}
.nav-tpl-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 13px; font-weight: 700; color: #0f172a;
  padding: 0 4px 12px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 12px;
}
.nav-tpl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 720px) {
  .nav-tpl-grid { grid-template-columns: repeat(3, 1fr); }
}

.nav-tpl-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  display: flex; flex-direction: column;
}
.nav-tpl-card:hover {
  border-color: #6366f1;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -12px rgba(99, 102, 241, .45);
}
.nav-tpl-card .ntthumb {
  height: 160px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: relative; overflow: hidden;
}
.nav-tpl-card .ntthumb iframe {
  position: absolute; top: 0; left: 0;
  width: 816px; height: 1056px;
  border: 0; transform-origin: top left; pointer-events: none;
}
.nav-tpl-card .ntthumb .thumb-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; color: #94a3b8;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
}
.nav-tpl-card .ntthumb .thumb-loading::before {
  content: ''; width: 14px; height: 14px;
  border: 2px solid #cbd5e1; border-top-color: #6366f1;
  border-radius: 50%; animation: tspin .8s linear infinite; margin-right: 6px;
}
.nav-tpl-card .ntname {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tcard .tbody { padding: 14px 16px 16px; }
.tcard .ats {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; color: #16a34a; margin-bottom: 4px;
}
.tcard .ats::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #16a34a; }
.tcard .tbody h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; color: #1e293b; }
.tcard .use {
  width: 100%;
  background: #4f46e5; color: #fff; border: none; cursor: pointer;
  font-weight: 700; font-size: 13.5px; padding: 11px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s ease;
}
.tcard .use:hover { background: #4338ca; }
.tcard.busy { pointer-events: none; opacity: .85; }
.tcard.busy .use { background: #94a3b8; }
.tcard .spin {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: tspin .7s linear infinite; display: none;
}
.tcard.busy .spin { display: inline-block; }
@keyframes tspin { to { transform: rotate(360deg); } }

/* Card actions: Preview + Use side-by-side (browse mode only) */
.tcard .tcard-actions { display: flex; gap: 8px; }
.tcard .tcard-actions .preview-btn,
.tcard .tcard-actions .use { flex: 1; width: auto; }
.tcard .preview-btn {
  background: #fff; color: #4f46e5; border: 1.5px solid #c7d2fe; cursor: pointer;
  font-weight: 700; font-size: 13.5px; padding: 11px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s ease, border-color .15s ease;
}
.tcard .preview-btn:hover { background: #eef2ff; border-color: #4f46e5; }

.template-toast {
  position: fixed; bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff;
  padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: .25s;
  z-index: 2000; box-shadow: 0 16px 40px -12px rgba(0,0,0,.5);
}
.template-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* highlighted keywords inside generated resume versions */
.resume-content mark.hl-add {
  background: #bbf7d0; color: #065f46;
  padding: 0 3px; border-radius: 3px; font-weight: 600;
}
.resume-content mark.hl-match {
  background: #dbeafe; color: #1e40af;
  padding: 0 3px; border-radius: 3px;
}
.kw-legend { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; font-size: 12px; color: #64748b; }
.kw-legend .dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

.resume-content mark { cursor: help; }

/* ============ START FROM SCRATCH FORM ============ */
.sf-h { font-size: .95rem; font-weight: 800; color: #0f172a; margin-bottom: .5rem; letter-spacing: .01em; }
.sf-sub { font-size: .8rem; font-weight: 700; color: #475569; margin-bottom: .5rem; }
.sf-in { width: 100%; border: 1px solid #e2e8f0; border-radius: 14px; padding: 10px 14px; font-size: .9rem; color: #0f172a; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; font-family: inherit; }
.sf-in:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.sf-in::placeholder { color: #94a3b8; }
textarea.sf-in { resize: vertical; }
.sf-card { border: 1px solid #e2e8f0; border-radius: 18px; padding: 16px; }
.sf-add { font-size: .8rem; font-weight: 700; color: #4f46e5; background: #eef2ff; border-radius: 999px; padding: 6px 14px; transition: background .15s; }
.sf-add:hover { background: #e0e7ff; }
.sf-row-rm { font-size: .8rem; color: #94a3b8; background: none; border: none; cursor: pointer; line-height: 1; padding: 4px; }

/* Start-from-scratch: upload-an-old-resume card */
.sf-upload-card {
  border: 2px dashed #c7d2fe;
  background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
  border-radius: 20px;
  padding: 18px 20px;
  transition: border-color .15s, background .15s;
}
.sf-upload-card.sf-drag-over { border-color: #4f46e5; background: #e0e7ff; }
.sf-upload-icon {
  width: 44px; height: 44px; border-radius: 14px;
  background: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 6px 14px -6px rgba(79, 70, 229, .35);
  flex-shrink: 0;
}
.sf-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid #c7d2fe;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: sf-spin .8s linear infinite;
}
@keyframes sf-spin { to { transform: rotate(360deg); } }

.sf-missing-banner {
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
  padding: 10px 14px;
  border-radius: 0 12px 12px 0;
}
.sf-in.sf-empty-flag { border-color: #fbbf24; background: #fffbf0; }
.sf-row-rm:hover { color: #ef4444; }

/* basic resume preview (normal build) */
.basic-preview { position: relative; width: 100%; padding-top: 129.41%; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
.basic-preview iframe { position: absolute; top: 0; left: 0; width: 816px; height: 1056px; border: 0; transform-origin: top left; }