   :root {
    --brand: #5b52f3;
    --brand-dark: #4338ca;
    --brand-soft: #eef0ff;
    --green: #10b981;
    --green-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --soft-bg: #f3f4f6;
    --white: #ffffff;
    --transition: all 0.28s ease;
  }
  
  .qr-modal-box {
    position: relative;
    width: 100%;
    max-width: 980px;
    background: rgba(255, 255, 255, 0.98);
    padding: 32px 28px 26px;
    box-shadow:
      var(--shadow-lg),
      0 10px 30px rgba(91, 82, 243, 0.10);
    animation: modalFadeUp 0.3s ease;
    isolation: isolate;

  }
  
  .qr-header {
    text-align: center;
    margin-bottom: 26px;
    padding-right: 60px;
  }

  .qr-header-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: nowrap;
    margin-bottom: 12px;
  }

  .qr-title-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(91, 82, 243, 0.12), rgba(67, 56, 202, 0.18));
    color: var(--brand);
    font-size: 24px;
    box-shadow: inset 0 0 0 1px rgba(91, 82, 243, 0.10);
    flex-shrink: 0;
  }

  .qr-header h3 {
    font-size: 32px;
    font-weight: 900;
    line-height: 1.2;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
  }

  .qr-header p {
    max-width: 760px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
  }

  .qr-error-text {
    display: none;
    margin-bottom: 18px;
    text-align: center;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 16px;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 700;
  }

  .qr-input-card,
  .qr-output-card {
      width: 100%;
    border-radius: 28px;
    padding: 22px;
  }

  .qr-input-card {
    background: linear-gradient(180deg, #f7f8fb, #f1f3f7);
    border: 1px solid #e6e9f0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
    margin-bottom: 20px;
  }

  .qr-output-card {
    background: linear-gradient(180deg, #eef8f3, #e8f7ef);
    border: 2px dashed rgba(16, 185, 129, 0.95);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
    margin-top: 20px;
  }

  .qr-section-head {
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
  }

  .qr-section-head span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 800;
    color: #374151;
    background: rgba(255,255,255,0.65);
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(209, 213, 219, 0.75);
  }

  .qr-badge {
    background: linear-gradient(135deg, rgba(91, 82, 243, 0.12), rgba(67, 56, 202, 0.18)) !important;
    color: var(--brand) !important;
    border-color: rgba(91, 82, 243, 0.18) !important;
  }

  #inputLink {
    width: 100%;
    min-height: 140px;
    resize: vertical;
    border: 2px solid #d7dce5;
    border-radius: 20px;
    padding: 18px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: var(--transition);
  }

  #inputLink:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 5px rgba(91, 82, 243, 0.12);
  }

  .qr-input-tip {
    margin-top: 12px;
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.6;
  }

  .qr-mini-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
  }

  .mini-btn,
  .main-generate-btn {
    border: none;
    border-radius: 18px;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
  }

  .mini-btn {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
  }

  .mini-btn:hover {
    transform: translateY(-1px);
  }

  .main-generate-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    box-shadow: var(--shadow-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 54px;
  }

  .main-generate-btn:hover {
    transform: translateY(-2px);
  }

  .main-generate-btn.loading {
    pointer-events: none;
    opacity: 0.95;
  }

  .btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
  }

  .main-generate-btn.loading .btn-loader {
    display: inline-block;
  }

  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  .qr-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
  }

  .qr-setting-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 16px;
  }

  .qr-setting-box label {
    display: block;
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 10px;
    color: #374151;
  }

  .qr-setting-box select,
  .qr-setting-box input[type="color"] {
    width: 100%;
    height: 48px;
    border: 2px solid #d7dce5;
    border-radius: 14px;
    padding: 0 12px;
    font-size: 15px;
    outline: none;
    background: #fff;
  }

  .qr-setting-box input[type="color"] {
    padding: 4px;
    cursor: pointer;
  }

  .qr-output-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
  }

  .qr-output-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }

  #btnCopy,
  .open-link-btn {
    border: none;
    border-radius: 14px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
  }

  #btnCopy {
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    box-shadow: 0 10px 22px rgba(16, 185, 129, 0.22);
  }

  .open-link-btn {
    background: linear-gradient(135deg, #0f172a, #1f2937);
  }

  #btnCopy:hover,
  .open-link-btn:hover {
    transform: translateY(-1px);
  }

  #btnCopy.copied {
    background: linear-gradient(135deg, #059669, #047857);
  }

  #outputLink {
    width: 100%;
    border: 2px solid #cdeede;
    background: #fff;
    border-radius: 18px;
    padding: 15px 16px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    margin-bottom: 24px;
  }

  .qr-preview-box {
    text-align: center;
    margin-bottom: 24px;
  }

  .qr-preview-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 900;
    color: #1f2937;
    margin-bottom: 18px;
  }

  .qr-canvas-wrap {
    position: relative;
    background: linear-gradient(180deg, #ffffff, #f9fafb);
    border: 2px solid #d5f4e5;
    border-radius: 28px;
    padding: 26px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 280px;
    box-shadow:
      inset 0 0 0 1px rgba(16, 185, 129, 0.04),
      0 8px 20px rgba(16, 185, 129, 0.04);
    overflow: hidden;
  }

  .qr-placeholder,
  .qr-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 20px;
  }

  .qr-placeholder {
    color: #9ca3af;
  }

  .qr-placeholder-icon {
    width: 78px;
    height: 78px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(91, 82, 243, 0.08);
    color: var(--brand);
    font-size: 34px;
  }

  .qr-placeholder p {
    font-size: 16px;
    font-weight: 800;
    color: #6b7280;
  }

  .qr-placeholder small {
    font-size: 13px;
    color: #9ca3af;
  }

  .qr-fallback {
    display: none;
    z-index: 3;
  }

  .qr-fallback-icon {
    width: 78px;
    height: 78px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.10);
    color: #ef4444;
    font-size: 34px;
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.08);
  }

  .qr-fallback h4 {
    font-size: 20px;
    font-weight: 900;
    color: #1f2937;
    margin: 0;
  }

  .qr-fallback p {
    max-width: 340px;
    font-size: 14px;
    line-height: 1.8;
    color: #6b7280;
    margin: 0;
  }

#qrCanvas {
  position: relative;
  z-index: 2;
  transform: scale(0.96);
  opacity: 0;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#qrCanvas.show {
  transform: scale(1);
  opacity: 1;
}

#qrCanvas img,
#qrCanvas canvas {
  max-width: 100%;
  height: auto;
  border-radius: 18px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

  .qr-bottom-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .qr-bottom-actions button {
    border: none;
    border-radius: 16px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
  }

  .download-btn {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    box-shadow: 0 12px 24px rgba(91, 82, 243, 0.22);
  }

  .svg-btn {
    background: linear-gradient(135deg, #0f172a, #1f2937);
    color: #fff;
  }

  .clear-btn {
    background: #f8fafc;
    color: #374151;
    border: 1px solid #d1d5db !important;
  }

  .qr-bottom-actions button:hover {
    transform: translateY(-2px);
  }

  .qr-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(20px);
    background: #111827;
    color: #fff;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 16px 32px rgba(0,0,0,0.22);
    opacity: 0;
    visibility: hidden;
    transition: all 0.28s ease;
    z-index: 1000000;
    text-align: center;
    max-width: calc(100% - 24px);
  }

  .qr-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
  }

  @media (max-width: 991px) {
    .qr-modal-box {
      max-width: 760px;
      padding: 28px 20px 22px;
    }

    .qr-header h3 {
      font-size: 26px;
    }
  }

  @media (max-width: 768px) {
    .qr-overlay {
      padding: 10px;
      align-items: center;
    }

    .qr-modal-box {
      border-radius: 24px;
      padding: 22px 14px 18px;
      max-height: calc(100vh - 20px);
    }

    .qr-close-btn {
      top: 12px;
      right: 12px;
      width: 42px;
      height: 42px;
      font-size: 22px;
    }

    .qr-header {
      padding-right: 48px;
    }

    .qr-header-line {
      gap: 10px;
    }

    .qr-title-icon {
      width: 48px;
      height: 48px;
      border-radius: 14px;
      font-size: 20px;
    }

    .qr-header h3 {
      font-size: 18px;
      white-space: nowrap;
    }

    .qr-header p {
      font-size: 13px;
      line-height: 1.7;
    }

    .qr-input-card,
    .qr-output-card {
      padding: 16px;
      border-radius: 22px;
    }

    #inputLink {
      min-height: 120px;
      font-size: 15px;
      border-radius: 16px;
    }

    .qr-mini-actions {
      flex-direction: column;
    }

    .mini-btn,
    .main-generate-btn {
      width: 100%;
    }

    .qr-settings-grid {
      grid-template-columns: 1fr;
    }

    .qr-output-top {
      flex-direction: column;
      align-items: stretch;
    }

    .qr-output-actions {
      width: 100%;
      flex-direction: column;
    }

    #btnCopy,
    .open-link-btn,
    .qr-bottom-actions button {
      width: 100%;
    }

    .qr-bottom-actions {
      flex-direction: column;
    }

    .qr-canvas-wrap {
      min-height: 220px;
      padding: 18px;
      border-radius: 22px;
    }

    .qr-fallback h4 {
      font-size: 18px;
    }

    .qr-fallback p {
      font-size: 13px;
      line-height: 1.7;
    }

    .qr-fallback-icon {
      width: 68px;
      height: 68px;
      font-size: 28px;
      border-radius: 20px;
    }
  }

  @media (max-width: 420px) {
    .open-qr-btn {
      width: 100%;
    }

    .qr-header h3 {
      font-size: 16px;
    }

    .qr-title-icon {
      width: 44px;
      height: 44px;
      font-size: 18px;
    }
  }