:root {
      --bg: #f3f4f6;
      --card-bg: #ffffff;
      --accent: #111827;
      --accent-soft: #e5e7eb;
      --text-main: #111827;
      --text-muted: #6b7280;
      --border: #d1d5db;
      --error: #b91c1c;
      --success: #047857;
    }

    * {
      box-sizing: border-box;
    }

    html {
      height: 100%;
      scrollbar-width: none;
    }

    html::-webkit-scrollbar,
    body::-webkit-scrollbar {
      width: 0;
      height: 0;
    }

    body {
      margin: 0;
      min-height: 100vh;
      min-height: 100dvh;
      background: var(--bg);
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      color: var(--text-main);
      display: flex;
      align-items: stretch;
      justify-content: center;
      padding: 16px;
      overscroll-behavior-y: none;
      scrollbar-width: none;
    }

    .shell {
      width: 100%;
      max-width: 520px;
      margin: auto;
      background: var(--card-bg);
      border-radius: 14px;
      box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
      padding: 26px 22px 22px;
    }

    @media (min-width: 640px) {
      .shell {
        padding: 28px 24px 24px;
      }
    }

    .logo {
      height: 42px;
      width: auto;
      margin-right: 8px;
      display: block;
    }

    @media (min-width: 640px) {
      .logo {
        height: 48px;
      }
    }

    .top-row {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 10px;
      margin-bottom: 12px;
    }

    .brand {
      font-size: 13px;
      color: var(--text-muted);
    }

    h1 {
      margin: 8px 0 14px 0;
      font-size: 22px;
      letter-spacing: -0.03em;
      text-align: center;
    }

    .field-label {
      font-weight: 600;
      font-size: 14px;
      margin-bottom: 6px;
    }

    .field-row {
      margin-top: 4px;
      margin-bottom: 4px;
    }

    input[type='text'],
    input[type='tel'],
    input[type='email'] {
      width: 100%;
      font-size: 15px;
      padding: 10px 11px;
      border-radius: 10px;
      border: 1px solid var(--border);
      outline: none;
      transition: border-color 0.15s ease, box-shadow 0.15s ease,
        background-color 0.15s ease;
      background-color: #ffffff;
    }

    input[type='text']:focus,
    input[type='tel']:focus,
    input[type='email']:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 1px var(--accent-soft);
    }

    #getSqftBtn {
      margin-top: 10px;
      width: 100%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 11px 18px;
      border-radius: 999px;
      border: none;
      background: var(--accent);
      color: #ffffff;
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      transition: background-color 0.15s ease, transform 0.05s ease;
    }

    #getSqftBtn:disabled {
      opacity: 0.55;
      cursor: not-allowed;
    }

    #getSqftBtn:hover:not(:disabled) {
      background: #000000;
    }

    #getSqftBtn:active:not(:disabled) {
      transform: translateY(1px);
    }

    .helper {
      font-size: 12px;
      color: #4b5563;
      margin-top: 6px;
      text-align: center;
      max-width: 90%;
      margin-left: auto;
      margin-right: auto;
    }

    #status {
      margin-top: 16px;
      font-size: 14px;
      white-space: normal;
      text-align: center;
    }

    #status.error {
      color: var(--error);
    }

    #status.success {
      color: var(--success);
    }

    .quote-block {
      display: block;
      width: 100%;
      text-align: left;
      padding: 14px 16px;
      border-radius: 12px;
      background: #ecfdf5;
      border: 1px solid #d1fae5;
      margin-top: 8px;
    }

    .quote-block.warning {
      background: #fff7ed;
      border: 1px solid #fbbf24;
      color: #92400e;
    }

    .quote-main {
      font-weight: 700;
      margin-bottom: 6px;
    }

    .quote-sub {
      margin-bottom: 6px;
    }

    .quote-note {
      margin-top: 6px;
      font-size: 13px;
    }

    .apt-actions {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
      margin-top: 12px;
    }

    .apt-actions .secondary-btn {
      margin-top: 0;
    }

    @media (min-width: 520px) {
      .apt-actions {
        grid-template-columns: 1fr 1fr;
      }
    }

    .section-divider {
      border-top: 1px solid var(--accent-soft);
      margin: 18px 0 12px;
    }

    .section-caption {
      font-size: 12px;
      color: var(--text-muted);
      margin-bottom: 8px;
    }

    #quizStepAddress .helper.address-helper {
      text-align: left;
      max-width: 100%;
      margin-left: 0;
      margin-right: 0;
    }

    .contact-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
    }

    @media (min-width: 600px) {
      .contact-grid {
        grid-template-columns: 1.2fr 1fr;
      }
    }

    .faq {
      margin-top: 16px;
      font-size: 12px;
      color: var(--text-muted);
    }

    .faq-item {
      margin-bottom: 8px;
    }

    .faq-q {
      font-weight: 600;
    }

    .info-section {
      margin-top: 16px;
      font-size: 13px;
      color: var(--text-main);
    }

    .info-title {
      font-weight: 700;
      margin-bottom: 4px;
    }

    .info-list {
      margin: 4px 0 12px 18px;
      padding-left: 18px;
    }

    .info-list li {
      margin-bottom: 4px;
    }

    .post-quiz {
      display: none;
      margin-top: 12px;
    }

    .post-quiz.active {
      display: block;
    }

    .accordion-toggle {
      width: 100%;
      text-align: left;
      padding: 10px 14px;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: #ffffff;
      color: var(--text-main);
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      margin-top: 10px;
    }

    .accordion-preview {
      margin: 6px 14px 0;
      font-size: 12px;
      color: var(--text-muted);
    }

    .accordion-toggle[aria-expanded='true'] + .accordion-preview {
      display: none;
    }

    .accordion-panel {
      margin-top: 8px;
    }

    .footer {
      border-top: 1px solid var(--accent-soft);
      margin-top: 16px;
      padding-top: 10px;
      font-size: 11px;
      color: var(--text-muted);
    }

    .footer a {
      color: inherit;
      text-decoration: underline;
    }

    .loading-overlay {
      position: fixed;
      inset: 0;
      background: rgba(17, 24, 39, 0.45);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 999;
      backdrop-filter: blur(2px);
    }

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

    .loading-card {
      background: #ffffff;
      border-radius: 14px;
      padding: 18px 20px;
      width: min(360px, 90vw);
      box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
      text-align: center;
      color: var(--text-main);
    }

    .spinner {
      width: 32px;
      height: 32px;
      border: 3px solid var(--accent-soft);
      border-top-color: var(--accent);
      border-radius: 50%;
      margin: 0 auto 12px;
      animation: spin 0.8s linear infinite;
    }

    .loading-text {
      font-size: 14px;
      color: var(--text-muted);
    }

    .lookup-progress {
      margin-top: 14px;
      text-align: left;
    }

    .lookup-progress-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
    }

    .lookup-progress-value {
      font-size: 12px;
      font-weight: 700;
      color: var(--accent);
    }

    .lookup-progress-track {
      width: 100%;
      height: 8px;
      background: var(--accent-soft);
      border-radius: 999px;
      overflow: hidden;
      margin-top: 6px;
    }

    .lookup-progress-bar {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, var(--accent), #0f172a);
      transition: width 0.4s ease;
    }

    .lookup-progress-caption {
      margin-top: 6px;
      font-size: 12px;
      color: var(--text-muted);
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    .field-error {
      color: #b91c1c;
      font-size: 12px;
      margin-top: 4px;
      min-height: 14px;
    }

    .field-success {
      color: #047857;
      font-size: 12px;
      margin-top: 4px;
      min-height: 14px;
    }

    /* Submit button spinner + states */
    #sendQuoteBtn {
      position: relative;
    }

    #sendQuoteBtn.is-sending {
      padding-right: 36px;
    }

    #sendQuoteBtn.is-sending::after {
      content: '';
      position: absolute;
      top: 50%;
      right: 14px;
      width: 14px;
      height: 14px;
      margin-top: -7px;
      border-radius: 50%;
      border: 2px solid rgba(255, 255, 255, 0.4);
      border-top-color: #ffffff;
      animation: spin 0.8s linear infinite;
    }

    .success-btn {
      background: #047857;
      color: #ffffff;
      border: 1px solid #047857;
      font-weight: 600;
    }

    /* Success banner */
    .success-banner {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 12px;
      border-radius: 10px;
      background: #ecfdf3;
      border: 1px solid #86efac;
      color: #047857;
      font-size: 13px;
      margin-top: 8px;
      opacity: 0;
      transform: translateY(-4px);
      transition: opacity 0.35s ease, transform 0.35s ease;
      min-height: 20px;
    }

    .success-banner.visible {
      opacity: 1;
      transform: translateY(0);
    }

    .success-banner.fade {
      opacity: 0;
      transform: translateY(-4px);
    }

    .success-check {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: #16a34a;
      color: #ffffff;
      font-size: 12px;
      flex: 0 0 20px;
    }

    #contactSection {
      display: none;
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    #contactSection.visible {
      display: block;
      opacity: 1;
    }

    #calendlySection {
      display: none;
      margin-top: 12px;
      padding: 12px;
      border-radius: 12px;
      background: #f8fafc;
      border: 1px solid var(--accent-soft);
      text-align: left;
    }

    #calendlySection.visible {
      display: block;
    }

    .calendly-title {
      font-weight: 600;
      font-size: 14px;
      margin-bottom: 4px;
    }

    .calendly-note {
      font-size: 12px;
      color: var(--text-muted);
      margin-bottom: 6px;
    }

    .secondary-btn {
      margin-top: 10px;
      width: 100%;
      padding: 10px 16px;
      border-radius: 999px;
      border: 1px solid var(--accent);
      background: #ffffff;
      color: var(--accent);
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    }

    .secondary-btn:hover {
      background: #f9fafb;
      border-color: var(--accent);
    }

    .primary-btn {
      background: var(--accent);
      color: #ffffff;
      border: 1px solid var(--accent);
      font-weight: 600;
    }

    .primary-btn:hover {
      background: #000000;
      border-color: #000000;
    }

    @media (max-width: 540px) {
      body {
        padding: 12px;
        align-items: flex-start;
      }

      .shell {
        padding: 20px 16px 18px;
        margin-top: 8px;
      }

      .top-row {
        align-items: center;
        gap: 8px;
      }

      .brand {
        font-size: 12px;
        line-height: 1.3;
      }

      h1 {
        font-size: 20px;
        margin-bottom: 10px;
      }

      input[type='text'],
      input[type='tel'],
      input[type='email'] {
        font-size: 16px;
      }

      .quiz-grid {
        gap: 8px;
      }

      .quiz-card {
        padding: 10px 8px;
      }

      .quiz-card-media {
        height: 96px;
      }

      #quizStepPest .quiz-card,
      #quizStepScope .quiz-card {
        min-height: 170px;
      }

      #quizStepDwelling .quiz-card {
        min-height: 170px;
      }

      #quizStepPest .quiz-card-footer,
      #quizStepScope .quiz-card-footer,
      #quizStepDwelling .quiz-card-footer {
        padding: 8px 8px;
      }

      #quizStepScope .quiz-grid .quiz-card:last-child {
        width: calc(50% - 4px);
      }

      .quiz-actions {
        margin-top: 10px;
      }
    }

    .quiz-step {
      display: none;
    }

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

    .quiz-progress {
      font-size: 12px;
      color: var(--text-muted);
      text-align: center;
      margin-bottom: 10px;
    }

    .quiz-progress.is-hidden {
      visibility: hidden;
    }

    #quizFlow {
      overflow-anchor: none;
    }

    #quizFlow.is-locked {
      pointer-events: none;
    }

    .shell:has(#quizStepPest.active) .brand,
    .shell:has(#quizStepScope.active) .brand,
    .shell:has(#quizStepDwelling.active) .brand {
      font-size: 12px;
      opacity: 0.85;
    }

    .shell:has(#quizStepPest.active) h1,
    .shell:has(#quizStepScope.active) h1,
    .shell:has(#quizStepDwelling.active) h1 {
      margin-bottom: 18px;
    }

    .shell:has(#quizStepPest.active) .quiz-progress,
    .shell:has(#quizStepScope.active) .quiz-progress,
    .shell:has(#quizStepDwelling.active) .quiz-progress {
      font-size: 11px;
      margin-top: 2px;
      margin-bottom: 4px;
      opacity: 0.8;
    }

    .shell:has(#quizStepPest.active) #quizStepPest .field-label {
      font-size: 15px;
      margin-bottom: 4px;
      text-align: center;
    }

    .shell:has(#quizStepScope.active) #quizStepScope .field-label {
      font-size: 15px;
      margin-bottom: 4px;
      text-align: center;
    }

    .shell:has(#quizStepPest.active) #quizStepPest .section-caption {
      font-size: 11px;
      margin-bottom: 6px;
      opacity: 0.8;
      text-align: center;
    }

    .shell:has(#quizStepDwelling.active) #quizStepDwelling .section-caption {
      font-size: 11px;
      margin-bottom: 6px;
      opacity: 0.8;
      text-align: center;
    }

    .shell:has(#quizStepDwelling.active) #quizStepDwelling .field-label {
      font-size: 15px;
      margin-bottom: 4px;
      text-align: center;
    }

    #quizStepPest .quiz-card,
    #quizStepScope .quiz-card,
    #quizStepDwelling .quiz-card {
      transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
    }

    #quizStepPest .quiz-card:hover,
    #quizStepPest .quiz-card:focus-visible,
    #quizStepScope .quiz-card:hover,
    #quizStepScope .quiz-card:focus-visible,
    #quizStepDwelling .quiz-card:hover,
    #quizStepDwelling .quiz-card:focus-visible {
      border-color: var(--accent);
      box-shadow:
        0 14px 28px rgba(15, 23, 42, 0.16),
        0 0 0 3px rgba(17, 24, 39, 0.18);
      transform: translateY(-3px);
    }

    #quizStepPest .quiz-card:active,
    #quizStepScope .quiz-card:active,
    #quizStepDwelling .quiz-card:active {
      box-shadow:
        0 8px 18px rgba(15, 23, 42, 0.16),
        0 0 0 3px rgba(17, 24, 39, 0.22);
      transform: translateY(-2px);
    }

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

    .quiz-card {
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 12px 10px;
      background: #ffffff;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      text-align: center;
      cursor: pointer;
      font-size: 14px;
      color: var(--text-main);
      appearance: none;
      -webkit-appearance: none;
      touch-action: manipulation;
    }

    .quiz-card.selected {
      border-color: var(--accent);
    }

    .quiz-card-media {
      height: 110px;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
    }

    .quiz-card-media img {
      width: 85%;
      height: 85%;
      object-fit: contain;
      display: block;
    }

    .quiz-card-footer {
      margin-top: 8px;
      padding: 8px 10px;
      border-radius: 10px;
      background: var(--accent-soft);
      color: var(--accent);
      -webkit-text-fill-color: var(--accent);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
    }

    .quiz-card.selected .quiz-card-footer {
      background: var(--accent);
      color: #ffffff;
      -webkit-text-fill-color: #ffffff;
    }

    #quizStepPest .quiz-card,
    #quizStepScope .quiz-card,
    #quizStepPest .quiz-card-footer,
    #quizStepScope .quiz-card-footer,
    #quizStepDwelling .quiz-card-footer {
      padding: 10px 10px;
    }

    #quizStepPest .quiz-card.selected,
    #quizStepScope .quiz-card.selected {
      background: var(--accent-soft);
      box-shadow:
        0 10px 22px rgba(15, 23, 42, 0.12),
        0 0 0 2px rgba(17, 24, 39, 0.14);
    }

    #quizStepDwelling .quiz-card.selected {
      background: var(--accent-soft);
      box-shadow:
        0 10px 22px rgba(15, 23, 42, 0.12),
        0 0 0 2px rgba(17, 24, 39, 0.14);
    }

    #quizStepDwelling .quiz-card {
      min-height: 170px;
    }

    #quizStepDwelling .quiz-card-code {
      font-size: 15px;
    }

    #quizStepDwelling .quiz-card-icon {
      font-size: 28px;
      font-weight: 700;
      letter-spacing: 0.12em;
      color: var(--accent);
      margin-bottom: 0;
    }

    #quizStepDwelling .quiz-card.selected .quiz-card-icon {
      color: #ffffff;
    }

    #quizStepScope .quiz-grid .quiz-card:last-child {
      grid-column: 1 / -1;
      justify-self: center;
      width: calc(50% - 5px);
    }

    .quiz-card-code {
      font-weight: 800;
      font-size: 16px;
      letter-spacing: 0.02em;
      color: var(--accent);
      -webkit-text-fill-color: var(--accent);
    }

    .quiz-card.selected .quiz-card-code {
      color: #ffffff;
      -webkit-text-fill-color: #ffffff;
    }

    .quiz-card-name {
      font-size: 13px;
    }

    .quiz-card-icon {
      font-size: 20px;
      margin-bottom: 6px;
    }


    .quiz-actions {
      display: flex;
      gap: 8px;
      margin-top: 12px;
    }

    .quiz-actions .secondary-btn,
    .quiz-actions .primary-btn {
      flex: 1;
    }

    #quizStepScope .quiz-actions .primary-btn,
    #quizStepDwelling .quiz-actions .primary-btn {
      font-size: 13px;
      padding: 9px 16px;
      opacity: 0.9;
    }

    #quizStepScope .quiz-actions .secondary-btn,
    #quizStepDwelling .quiz-actions .secondary-btn {
      font-size: 13px;
      padding: 9px 16px;
      opacity: 0.85;
    }

    .quiz-skip {
      margin-top: 8px;
      font-size: 12px;
      color: var(--text-muted);
      text-decoration: underline;
      background: none;
      border: none;
      padding: 0;
      cursor: pointer;
    }

    #quizStepPest .quiz-skip {
      display: none;
    }
