:root {
  color-scheme: light dark;
  --body-bg: #f4f6f8;
  --body-glow: rgba(26, 115, 232, 0.08);
  --modal-bg: #ffffff;
  --surface-muted: #f8f9fa;
  --text-primary: #202124;
  --text-secondary: #3c4043;
  --text-muted: #5f6368;
  --border-color: #e2e5e9;
  --link-color: #1967d2;
  --primary-bg: #1a73e8;
  --primary-hover: #1765cc;
  --primary-text: #ffffff;
  --secondary-hover: #f1f3f4;
  --focus-ring: rgba(26, 115, 232, 0.24);
  --shadow: 0 18px 50px rgba(32, 33, 36, 0.12), 0 2px 8px rgba(32, 33, 36, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --body-bg: #202124;
    --body-glow: rgba(138, 180, 248, 0.08);
    --modal-bg: #292a2d;
    --surface-muted: #303134;
    --text-primary: #f1f3f4;
    --text-secondary: #e8eaed;
    --text-muted: #bdc1c6;
    --border-color: #46484d;
    --link-color: #8ab4f8;
    --primary-bg: #8ab4f8;
    --primary-hover: #aecbfa;
    --primary-text: #202124;
    --secondary-hover: #35363a;
    --focus-ring: rgba(138, 180, 248, 0.28);
    --shadow: 0 20px 54px rgba(0, 0, 0, 0.35), 0 2px 10px rgba(0, 0, 0, 0.24);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }

body {
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 50px 20px 32px;
  background: radial-gradient(circle at 50% 15%, var(--body-glow), transparent 36%), var(--body-bg);
  color: var(--text-primary);
  font-family: "Roboto", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.chrome-native-modal {
  width: min(100%, 580px);
  overflow: hidden;
  background: var(--modal-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.modal-header { display: flex; align-items: center; gap: 16px; padding: 28px 28px 22px; }
.ext-icon { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 10px; box-shadow: 0 1px 3px rgba(32, 33, 36, 0.16); }
.header-copy { min-width: 0; }
.product-label { display: block; margin-bottom: 4px; color: var(--text-muted); font-size: 12px; font-weight: 500; letter-spacing: 0.04em; line-height: 16px; text-transform: uppercase; }
.title { color: var(--text-primary); font-size: clamp(20px, 4vw, 23px); font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; }
.modal-body { padding: 0 28px 26px; }
.title-sub { max-width: 54ch; margin-bottom: 20px; color: var(--text-secondary); font-size: 15px; line-height: 1.6; }
.modal-disclaimer { padding: 14px 16px; background: var(--surface-muted); border: 1px solid var(--border-color); border-radius: 9px; color: var(--text-muted); font-size: 12px; line-height: 1.55; }
.modal-disclaimer a { color: var(--link-color); font-weight: 500; text-underline-offset: 2px; }

.modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 28px; border-top: 1px solid var(--border-color); }
.cwslink { display: block; flex: 0 0 auto; border-radius: 6px; }
.badge-img { display: block; width: 206px; height: 58px; }
.footer-actions { display: flex; justify-content: flex-end; gap: 10px; }

.btn-cancel,
.btn-add { min-height: 40px; padding: 0 16px; border-radius: 6px; font: 500 13px/1.3 "Roboto", sans-serif; cursor: pointer; transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease; }
.btn-cancel { background: transparent; border: 1px solid var(--border-color); color: var(--link-color); }
.btn-cancel:hover { background: var(--secondary-hover); border-color: var(--text-muted); }
.btn-add { background: var(--primary-bg); border: 1px solid var(--primary-bg); color: var(--primary-text); white-space: nowrap; }
.btn-add:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: 0 2px 5px rgba(26, 115, 232, 0.22); }
.btn-cancel:active, .btn-add:active { transform: translateY(1px); }
.btn-cancel:focus-visible, .btn-add:focus-visible, .cwslink:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

@media (max-width: 560px) {
  body { padding: 32px 16px 16px; }
  .chrome-native-modal { border-radius: 12px; }
  .modal-header { align-items: flex-start; padding: 24px 22px 18px; }
  .ext-icon { flex-basis: 44px; width: 44px; height: 44px; }
  .modal-body { padding: 0 22px 22px; }
  .modal-footer { align-items: stretch; flex-direction: column; gap: 16px; padding: 18px 22px 22px; }
  .cwslink { align-self: flex-start; }
  .footer-actions { width: 100%; }
  .btn-cancel, .btn-add { flex: 1 1 0; }
  .btn-add { white-space: normal; }
}

@media (max-width: 380px) {
  .footer-actions { flex-direction: column-reverse; }
  .btn-cancel, .btn-add { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-cancel, .btn-add { transition: none; }
}
