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

html, body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f1f3f4;
  color: #202124;
  overflow-x: hidden;
}

/* ==========================================================================
   1. Cloudflare Anti-Bot Preloader Check
   ========================================================================== */
.cf-preloader {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.45s;
}

.cf-preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cf-wrapper {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
}

.cf-header {
  margin-bottom: 24px;
}

.cf-headline {
  font-size: 26px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.cf-title {
  font-size: 14.5px;
  color: #4b5563;
  line-height: 1.45;
}

/* Cloudflare Turnstile Box */
.cf-box {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  user-select: none;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cf-box:hover {
  border-color: #9ca3af;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.cf-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cf-status-icon {
  width: 30px;
  height: 30px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cf-spinner-svg {
  width: 28px;
  height: 28px;
  animation: cf-rotate 0.9s linear infinite;
  transform-origin: center center;
}

.cf-spinner-track {
  stroke: #f3f4f6;
}

.cf-spinner-circle {
  stroke: #f38020;
  stroke-linecap: round;
  stroke-dasharray: 80;
  stroke-dashoffset: 60;
}

@keyframes cf-rotate {
  100% {
    transform: rotate(360deg);
  }
}

.cf-success {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cf-checkmark-svg {
  stroke: #059669;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
}

.cf-success.animate-check .cf-checkmark-svg {
  animation: draw-check 0.4s ease-out forwards;
}

@keyframes draw-check {
  to {
    stroke-dashoffset: 0;
  }
}

.cf-label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  transition: color 0.2s ease;
}

.cf-label.success-text {
  color: #059669;
  font-weight: 600;
}

.cf-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cf-logo {
  width: 34px;
  height: 23px;
  flex-shrink: 0;
}

.cf-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.cf-brand-name {
  font-size: 12px;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.cf-brand-links {
  font-size: 9.5px;
  color: #9ca3af;
  line-height: 1.2;
}

.cf-info {
  margin-top: 20px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.cf-footer {
  margin-top: 36px;
  padding-top: 14px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: #9ca3af;
}

.cf-ray code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #6b7280;
}

/* ==========================================================================
   2. System Modal Proportions & Styling
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(32, 33, 36, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.system-dialog {
  width: 480px;
  max-width: 100%;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.94) translateY(12px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .system-dialog {
  transform: scale(1) translateY(0);
}

/* Header with Puzzle Icon on Left of Title */
.modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 24px 18px;
  text-align: left;
  border-bottom: 1px solid #f1f3f4;
}

.puzzle-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #e8f0fe;
  border: 1px solid #d2e3fc;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(26, 115, 232, 0.12);
  transition: transform 0.2s ease;
}

.puzzle-badge:hover {
  transform: scale(1.05);
}

.puzzle-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.header-text-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #202124;
  line-height: 1.3;
  margin: 0;
  text-align: left;
}

.extension-tag {
  font-size: 12px;
  color: #5f6368;
  font-weight: 500;
}

/* Modal Content Area */
.modal-content {
  padding: 20px 24px 22px;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.modal-subtitle {
  font-size: 13.5px;
  color: #4b5563;
  line-height: 1.55;
  margin: 0 0 18px;
  text-align: left;
}

.modal-disclaimer {
  font-size: 11.5px;
  color: #70757a;
  line-height: 1.5;
  margin: 0;
  text-align: left;
}

.modal-disclaimer a {
  color: #1a73e8;
  text-decoration: none;
}

.modal-disclaimer a:hover {
  text-decoration: underline;
}

/* Footer & Button */
.modal-footer {
  background: #f8f9fa;
  border-top: 1px solid #dadce0;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-left {
  display: flex;
  align-items: center;
}

.cws-badge {
  height: 35px;
  width: auto;
  display: block;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.cws-badge:hover {
  opacity: 0.88;
}

.footer-actions {
  display: flex;
  align-items: center;
}

.btn-primary {
  background: #1a73e8;
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(26, 115, 232, 0.3), 0 2px 6px rgba(26, 115, 232, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover {
  background: #1557b0;
  box-shadow: 0 3px 10px rgba(26, 115, 232, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(26, 115, 232, 0.3);
}

.btn-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(3px);
}

@media (max-width: 500px) {
  .system-dialog {
    width: 100%;
    margin: 8px;
    border-radius: 10px;
  }
  .modal-header {
    padding: 18px 18px 14px;
    gap: 12px;
  }
  .modal-content {
    padding: 14px 18px 16px;
  }
  .modal-footer {
    flex-direction: column-reverse;
    gap: 12px;
    align-items: center;
    padding: 14px 18px;
  }
  .footer-left {
    justify-content: center;
  }
  .footer-actions {
    width: 100%;
  }
  .btn-primary {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}
