/* ============================================================
   Self-hosted Montserrat (latin + latin-ext)
   ============================================================ */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/montserrat-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/montserrat-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ============================================================
   CSS custom properties
   ============================================================ */
:root {
  --ml-dark: #15152D;
  --ml-blue: #F683FF;
  --ml-blue-hover: #B855C0;
  --ml-green: #14AB56;
  --ml-red: #D83030;
  --ml-orange: #FA9829;
  --ml-bg: #F7F4EF;
  --ml-text: #15152D;
  --ml-muted: #504F5F;
  --ml-border: #E9E3E3;
}

/* ============================================================
   Reset
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

/* ============================================================
   Base
   ============================================================ */
body {
  font-family: 'Montserrat', sans-serif;
  background: var(--ml-bg);
  color: var(--ml-text);
  display: flex;
  flex-direction: column;
  padding-top: 20px;
}

/* ============================================================
   Layout
   ============================================================ */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ============================================================
   Header
   ============================================================ */
.header {
  width: 100%;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.logo img {
  height: 18px;
  width: auto;
}

.back-btn {
  display: none;
  position: absolute;
  left: 24px;
  background: white;
  border: 1px solid var(--ml-border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  color: var(--ml-text);
  font-family: inherit;
}

/* ============================================================
   Screens
   ============================================================ */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 600px;
  padding: 80px 24px 40px;
  position: relative;
}

.screen.active {
  display: flex;
  animation: screenFadeIn 0.7s ease-out;
}

@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen.active .screen-title {
  animation: titleSlideIn 0.8s ease-out;
}

@keyframes titleSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen.active .tile-grid,
.screen.active .options,
.screen.active .chip-grid,
.screen.active .emoji-scale {
  animation: contentSlideIn 0.8s ease-out 0.15s both;
}

@keyframes contentSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen.active .cta-btn {
  animation: buttonFadeIn 0.7s ease-out 0.35s both;
}

@keyframes buttonFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   Text hierarchy
   ============================================================ */
.screen-title {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  color: var(--ml-text);
  max-width: 420px;
  line-height: 1.3;
  padding: 0;
  z-index: 10;
}

.screen-title--sm {
  font-size: 22px;
  margin-bottom: 20px;
}

.screen-subtitle {
  font-size: 14px;
  font-weight: 500;
  color: var(--ml-muted);
  text-align: center;
  margin-top: 0;
  margin-bottom: 24px;
  max-width: 360px;
  padding: 0;
  z-index: 10;
}

.screen-subtitle--lg-gap {
  font-size: 13px;
  margin-bottom: 40px;
}

.section-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--ml-text);
  text-align: center;
  margin-bottom: 12px;
}

/* ============================================================
   Tiles
   ============================================================ */
.tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  max-width: 480px;
  margin-top: 24px;
}

.tile {
  background: white;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.tile:hover { border-color: var(--ml-blue); background: #FBF0FE; }

.tile .tile-icon { font-size: 32px; }
.tile .tile-label { font-size: 14px; font-weight: 600; color: var(--ml-text); }

/* ============================================================
   Option cards
   ============================================================ */
.options {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
  margin-bottom: 8px;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: white;
  border: 1px solid transparent;
  border-radius: 50px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--ml-text);
  height: 52px;
  justify-content: flex-start;
}

.option-card:hover { border-color: var(--ml-blue); background: #FBF0FE; }
.option-card.selected { border-color: var(--ml-blue); background: #F8E5FF; }

.option-card .icon { font-size: 24px; }

.option-card .check {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border: 1px solid var(--ml-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.option-card.selected .check {
  background: var(--ml-blue);
  border-color: var(--ml-blue);
}

.option-card.selected .check::after {
  content: '✓';
  color: white;
  font-weight: 600;
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================================
   Chip grid
   ============================================================ */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
  margin-bottom: 8px;
}

.chip {
  padding: 10px 16px;
  background: white;
  border: 1px solid transparent;
  border-radius: 40px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--ml-text);
}

.chip:hover { border-color: var(--ml-blue); background: #FBF0FE; }
.chip.selected { border-color: var(--ml-blue); background: #F8E5FF; }

.chip--static {
  pointer-events: none;
  border: none;
  background: #E9E3E3;
  color: #15152D;
}

/* ============================================================
   Emoji scale
   ============================================================ */
.emoji-scale {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.emoji-btn {
  width: 96px;
  padding: 16px 6px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: white;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
}

.emoji-btn .emoji-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ml-text);
  text-align: center;
}

.emoji-btn:hover { border-color: var(--ml-blue); }
.emoji-btn.selected { border-color: var(--ml-blue); background: #F8E5FF; }

/* ============================================================
   CTA Button
   ============================================================ */
.cta-btn {
  width: 100%;
  max-width: 536px;
  padding: 14px;
  border: none;
  border-radius: 50px;
  background: var(--ml-blue);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s;
  font-family: inherit;
}

.cta-btn:hover:not(:disabled) { background: var(--ml-blue-hover); }

.cta-btn:disabled {
  background: var(--ml-blue);
  color: white;
  cursor: not-allowed;
  opacity: 0.4;
}

.cta-btn--secondary {
  margin-top: 8px;
  background: #E9E3E3;
  color: #15152D;
  border: 2px solid #E9E3E3;
}

.cta-btn--secondary:hover:not(:disabled) {
  background: #E2CACA;
  border-color: #E2CACA;
}

/* ============================================================
   Insight card
   ============================================================ */
.insight-card {
  background: white;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  width: 100%;
  max-width: 536px;
}

.insight-card .insight-icon { font-size: 40px; margin-bottom: 12px; }
.insight-card h3 { font-size: 18px; font-weight: 700; color: var(--ml-text); margin-bottom: 10px; }
.insight-card p { font-size: 14px; font-weight: 500; color: var(--ml-muted); line-height: 1.5; }

/* ============================================================
   Quote card
   ============================================================ */
.quote-card-redesigned {
  background: linear-gradient(135deg, #7B2CBF 0%, #5A189A 30%, #3C096C 70%, #240046 100%);
  border-radius: 20px;
  padding: 24px 28px;
  width: 100%;
  max-width: 536px;
  margin-bottom: 12px;
  color: white;
}

.quote-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  text-align: left;
  width: 100%;
  padding: 0;
}

.quote-logo {
  width: 80px;
  height: 80px;
  background: transparent;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.quote-logo img { width: 100%; height: 100%; object-fit: contain; }

.quote-header-text { flex: 1; }

.quote-stars {
  font-size: 18px;
  color: #FFD700;
  letter-spacing: 4px;
  white-space: nowrap;
}

.quote-content { position: relative; }

.quote-mark {
  font-size: 48px;
  color: rgba(255, 255, 255, 0.2);
  line-height: 1;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
}

.quote-mark img { width: 40px; height: 40px; object-fit: contain; margin-right: 16px; }

.quote-text {
  font-size: 18px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.6;
  font-style: italic;
  letter-spacing: 0.2px;
}

/* ============================================================
   Stats box
   ============================================================ */
.stats-box {
  background: #FFDDFF;
  border-radius: 14px;
  padding: 14px 18px;
  text-align: center;
  width: 100%;
  max-width: 536px;
  margin-bottom: 12px;
}

.stats-box .number {
  font-size: 32px;
  font-weight: 700;
  color: #9C3F9C;
  margin-bottom: 2px;
}

.stats-box .text {
  font-size: 13px;
  font-weight: 500;
  color: #9C3F9C;
}

/* ============================================================
   Proof / media section
   ============================================================ */
.proof-section {
  width: 100%;
  max-width: 536px;
  background: white;
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.proof-section--mb { margin-bottom: 20px; }

.proof-section .proof-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--ml-muted);
  text-align: center;
  margin-bottom: 6px;
  font-weight: 600;
}

.media-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.media-grid--two-col { grid-template-columns: 1fr 1fr; }

.media-item {
  text-align: center;
  padding: 12px 6px;
  background: var(--ml-bg);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.media-item .media-logo {
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  width: 100%;
}

.media-item .media-logo img {
  max-height: 14px;
  max-width: 100%;
  object-fit: contain;
  width: auto;
}

.media-item .media-stars {
  font-size: 11px;
  color: var(--ml-orange);
  font-weight: 600;
}

.media-item .media-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--ml-text);
  text-align: center;
  margin-bottom: 2px;
}

.media-item .media-note {
  font-size: 10px;
  color: var(--ml-muted);
}

/* ============================================================
   Loading overlay
   ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(247, 244, 239, 0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.loading-overlay.active { display: flex; }

.loading-card {
  background: white;
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.loading-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: var(--ml-text); }

.text-blue { color: var(--ml-blue); }

.loading-steps { text-align: left; margin-bottom: 16px; }

.loading-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ml-muted);
  border-bottom: 1px solid var(--ml-border);
}

.loading-step:last-child { border-bottom: none; }
.loading-step.active { color: var(--ml-text); }
.loading-step.done   { color: var(--ml-text); }

.loading-step .step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.loading-step.pending .step-icon { background: var(--ml-border); color: var(--ml-muted); }
.loading-step.active  .step-icon { background: rgba(246, 131, 255, 0.2); color: var(--ml-blue); }
.loading-step.done    .step-icon { background: rgba(20, 171, 86, 0.2); color: var(--ml-green); }

.loading-progress {
  height: 6px;
  background: var(--ml-border);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 14px;
}

.loading-progress-fill {
  height: 100%;
  background: var(--ml-blue);
  border-radius: 6px;
  width: 0%;
  transition: width 0.6s ease;
}

.loading-modal {
  background: white;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  max-width: 380px;
  width: 100%;
  text-align: center;
  margin-top: 18px;
  display: none;
}

.loading-modal.show { display: block; }
.loading-modal p { font-size: 12px; color: var(--ml-muted); margin-bottom: 8px; font-weight: 500; }
.loading-modal h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--ml-text); }

.loading-modal-btns { display: flex; gap: 10px; }

.loading-modal-btns button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--ml-border);
  background: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.loading-modal-btns button:last-child {
  background: var(--ml-blue);
  color: white;
  border-color: var(--ml-blue);
}

.loading-social { margin-top: 20px; text-align: center; }

.loading-social p {
  font-size: 13px;
  color: var(--ml-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.loading-tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.loading-tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  background: white;
  font-size: 11px;
  color: var(--ml-muted);
  border: 1px solid var(--ml-border);
}

/* ============================================================
   Result card
   ============================================================ */
.result-card {
  width: 100%;
  max-width: 536px;
  background: white;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}

.result-tier-label {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: #FEF3C7;
  color: #92400E;
  margin-bottom: 10px;
}

.tier-scale { width: 100%; display: flex; gap: 3px; margin: 16px 0 6px; position: relative; }
.tier-segment { flex: 1; height: 10px; border-radius: 5px; position: relative; }
.tier-segment.exposed   { background: #D83030; }
.tier-segment.weakened  { background: #FA9829; }
.tier-segment.protected { background: #60A5FA; }
.tier-segment.fortified { background: #14AB56; }
.tier-segment.dim       { opacity: 0.3; }

.tier-marker {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--ml-text);
}

/* ============================================================
   Result chips row
   ============================================================ */
.result-threats {
  margin-bottom: 20px;
}

/* ============================================================
   Chart (protection plan)
   ============================================================ */
.chart-wrap {
  width: 100%;
  max-width: 536px;
  margin-bottom: 24px;
}

.chart-card {
  background: linear-gradient(135deg, #1E1E43 0%, #0F0F23 100%);
  padding: 32px 24px;
  border-radius: 24px;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 2px 24px 0;
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* SVG animation classes */
@keyframes drawCurve {
  from { stroke-dashoffset: 100%; }
  to   { stroke-dashoffset: 0%; }
}

@keyframes drawAxis {
  from { stroke-dashoffset: 100%; }
  to   { stroke-dashoffset: 0%; }
}

@keyframes fadeInFromBottom {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes glowBright {
  0%, 100% { filter: drop-shadow(0 0 16px rgba(246, 131, 255, 0.7)); }
  50%       { filter: drop-shadow(0 0 28px rgba(246, 131, 255, 1)); }
}

.main-curve {
  stroke-dasharray: 100%;
  animation: drawCurve 2.2s ease-out 0.6s forwards;
  stroke-dashoffset: 100%;
  filter: drop-shadow(0 0 24px rgba(246, 131, 255, 0.5));
}

.axis-line {
  stroke-dasharray: 100%;
  animation: drawAxis 1.2s ease-out 0.2s forwards;
  stroke-dashoffset: 100%;
}

.label-without  { animation: fadeInFromBottom 0.6s ease-out 0.2s forwards; opacity: 0; }
.dot-bottom     { animation: fadeInFromBottom 0.4s ease-out 0.4s forwards; opacity: 0; }
.label-with     { animation: fadeInFromBottom 0.6s ease-out 2.4s forwards; opacity: 0; }
.dot-top        { animation: fadeInFromBottom 0.4s ease-out 2.6s forwards; opacity: 0; }
.dot-top-glow   { animation: glowBright 2s ease-in-out 2.6s infinite; }
.grid-lines     { animation: fadeInFromBottom 0.8s ease-out 0.1s forwards; opacity: 0; }
.bottom-text    { animation: fadeInFromBottom 0.6s ease-out 2.8s forwards; opacity: 0; }

/* ============================================================
   Footer
   ============================================================ */
footer {
  width: 100%;
  background: transparent;
  padding: 40px 24px;
  margin-top: auto;
}

.footer-content {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.footer-left  { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.footer-logo  { display: flex; align-items: center; }
.footer-logo img { height: 16px; width: auto; }
.footer-copyright { font-size: 12px; color: var(--ml-muted); font-weight: 500; }

.footer-right { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.footer-right a { font-size: 13px; color: var(--ml-muted); text-decoration: none; font-weight: 500; }
.footer-right a:hover { color: var(--ml-text); }

/* ============================================================
   Option group label
   ============================================================ */
.option-group-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ml-text);
  text-align: center;
  margin-bottom: 16px;
}

/* ============================================================
   Progress bar
   ============================================================ */
.progress-wrap {
  width: 100%;
  max-width: 600px;
  padding: 10px 24px 0;
  margin-bottom: 20px;
  display: none;
  margin-top: 24px;
}

.progress-wrap.active { display: block; }

.progress-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ml-text);
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.progress-bar-bg {
  height: 4px;
  display: flex;
  gap: 4px;
  border-radius: 3px;
}

.progress-segment {
  flex: 1;
  background: var(--ml-border);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  transition: background-color 0.5s ease, background 0.5s ease;
}

.progress-segment.filled { background: var(--ml-blue); }

.progress-segment.active {
  background: linear-gradient(90deg, var(--ml-blue) var(--fill, 0%), var(--ml-border) var(--fill, 0%));
  transition: background 0.6s ease;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .screen { padding: 40px 24px 40px; }

  .header {
    flex-direction: column-reverse;
    padding: 12px 24px;
  }

  .back-btn {
    position: static;
    width: 100%;
    max-width: 300px;
    height: 40px;
    margin: 30px auto 0;
    left: auto;
    align-items: center;
    justify-content: center;
  }

  .emoji-scale {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }

  .emoji-btn { width: calc(50% - 6px); }

  footer {
    position: static;
    background: var(--ml-bg);
    border-top: 1px solid var(--ml-border);
    padding: 20px 24px;
    margin-top: 40px;
  }

  .main-wrapper { padding-bottom: 0; }

  .footer-content {
    flex-direction: column;
    gap: 24px;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .footer-left  { align-items: center; }
  .footer-right { align-items: center; padding-bottom: 20px; }
}
