:root {
  --bg: #f2f2ea;
  --surface: #ffffff;
  --ink: #1d2a25;
  --muted: #58675f;
  --line: #d9dfd2;
  --primary: #177245;
  --primary-dark: #0f5f39;
  --chip-bg: #eef4ec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Source Sans 3", "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 6% 4%, #dcead5 0%, transparent 28%),
    radial-gradient(circle at 95% 2%, #d9eaf4 0%, transparent 22%),
    var(--bg);
}

.topbar {
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.92);
}

.brand-mini {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip-bg);
  font-size: 0.82rem;
  white-space: nowrap;
}

.chip.pro {
  background: #e8f2ff;
  border-color: #c5d8ee;
  color: #1d4a7a;
}

.hero-card,
.editor-card,
.seo-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.hero-card h1 {
  font-size: clamp(1.45rem, 2.6vw, 2.2rem);
}

.toolbar {
  margin-bottom: 10px;
}

.toolbar-bottom {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #d7dfd2;
}

.icon-btn {
  border: 1px solid #c5d1df;
  background: #fff;
  color: #2a4d75;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.icon-btn:hover {
  background: #f2f7fd;
}

.btn-grammar {
  color: #fff;
  background: #1f7a8c;
  border-color: #1f7a8c;
}

.btn-grammar:hover,
.btn-grammar:focus,
.btn-grammar:active {
  color: #fff;
  background: #186a79;
  border-color: #186a79;
}

#open-language-picker,
#open-language-picker-bottom {
  min-width: 168px;
  height: calc(1.5em + 0.5rem + 2px);
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  justify-content: space-between;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-color: #c8d3c0;
  background: #f9fcf8;
  color: #1f3a2b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

#open-language-picker::after,
#open-language-picker-bottom::after {
  content: "▾";
  font-size: 11px;
  line-height: 1;
  opacity: 0.8;
}

#open-language-picker:hover,
#open-language-picker-bottom:hover {
  background: #f2f8f0;
  border-color: #b8c9b2;
}

#open-language-picker:focus-visible,
#open-language-picker-bottom:focus-visible {
  outline: 2px solid #b8d8c3;
  outline-offset: 1px;
}

.review-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #e4b2b2;
  background: #fff0f0;
  color: #8f2222;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.checking-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #b7cce6;
  background: #eff6ff;
  color: #1f4f85;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.checking-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2a78c2;
  box-shadow: 0 0 0 0 rgba(42, 120, 194, 0.5);
  animation: checkingPulse 1s ease-out infinite;
}

.review-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cf2f2f;
  box-shadow: 0 0 0 0 rgba(207, 47, 47, 0.6);
  animation: reviewPulse 1.3s ease-out infinite;
}

@keyframes reviewPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(207, 47, 47, 0.6);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(207, 47, 47, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(207, 47, 47, 0);
  }
}

@keyframes checkingPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(42, 120, 194, 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(42, 120, 194, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(42, 120, 194, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .review-badge::before {
    animation: none;
  }

  .checking-badge::before {
    animation: none;
  }

  .issue-ai-loading-btn {
    animation: none;
  }

  .main-editor.is-checking {
    animation: none;
  }

  .main-editor.is-success {
    animation: none;
  }

  .status.status-success-flash {
    animation: none;
  }

  .status.status-success-flash::before,
  .status.status-success-flash::after {
    animation: none;
  }

  .btn-success-pop {
    animation: none;
  }

  .clipboard-toast-success,
  .clipboard-toast-success::before {
    animation: none;
  }
}

.lang-select {
  width: auto;
  min-width: 170px;
}

.quick-languages {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.quick-lang-btn {
  border: 1px solid #c4d2c0;
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  line-height: 1.2;
}

.quick-lang-btn.active {
  border-color: #8bb89a;
  background: #edf8f0;
  color: #1e5e36;
  font-weight: 700;
}

.language-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  max-height: 45vh;
  overflow: auto;
}

.language-list-item {
  width: 100%;
  text-align: center;
  border: 1px solid #d3ddce;
  background: #fff;
  border-radius: 10px;
  padding: 9px 10px;
}

.language-list-item.active {
  border-color: #8bb89a;
  background: #edf8f0;
  color: #1e5e36;
}

.main-editor {
  border: 1px solid #c8d3c0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.main-editor.is-checking {
  animation: editorCheckingGlow 1.2s ease-in-out infinite;
}

.main-editor.is-success {
  animation: editorSuccessGlow 520ms ease-out 1;
}

@keyframes editorCheckingGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(55, 129, 209, 0.14);
    border-color: #c8d3c0;
  }
  50% {
    box-shadow: 0 0 0 4px rgba(55, 129, 209, 0.2);
    border-color: #8fb9e8;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(55, 129, 209, 0.14);
    border-color: #c8d3c0;
  }
}

@keyframes editorSuccessGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(33, 150, 83, 0.12);
    border-color: #c8d3c0;
  }
  50% {
    box-shadow: 0 0 0 6px rgba(33, 150, 83, 0.2);
    border-color: #6ec497;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(33, 150, 83, 0);
    border-color: #c8d3c0;
  }
}

.main-editor .ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid #dbe3d5;
  background: #f9fbf8;
}

.main-editor .ql-container.ql-snow {
  border: 0;
}

.main-editor .ql-editor {
  min-height: 520px;
  font-size: 1rem;
  line-height: 1.45;
}

.main-editor .ql-editor.ql-blank::before {
  color: #7d8b83;
  font-style: normal;
}

.main-editor .ql-toolbar .ql-table::before {
  content: "Tbl";
  font-size: 11px;
  font-weight: 700;
}

.status {
  min-height: 24px;
  font-size: 0.96rem;
}

.status.ok {
  color: #156f3f;
}

.status.status-success-flash {
  position: relative;
  animation: statusSuccessFlash 520ms ease-out 1;
}

.status.status-success-flash::before {
  content: "✦ ✧";
  position: absolute;
  right: -8px;
  top: -12px;
  font-size: 0.8rem;
  letter-spacing: 1px;
  color: #f3b43f;
  text-shadow: 0 0 8px rgba(243, 180, 63, 0.45);
  pointer-events: none;
  animation: statusSparkleBurst 560ms ease-out 1;
}

.status.status-success-flash::after {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: #1f9254;
  animation: statusSuccessBadge 520ms ease-out 1;
}

.status.warn {
  color: #9f6400;
}

.status.err {
  color: #a12929;
}

.btn-success-pop {
  animation: successButtonPop 320ms cubic-bezier(0.2, 0.8, 0.2, 1) 1;
}

@keyframes statusSuccessFlash {
  0% {
    transform: translateY(0);
    filter: saturate(1);
  }
  45% {
    transform: translateY(-1px);
    filter: saturate(1.2);
  }
  100% {
    transform: translateY(0);
    filter: saturate(1);
  }
}

@keyframes statusSuccessBadge {
  0% {
    transform: scale(0.65);
    opacity: 0;
  }
  65% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes statusSparkleBurst {
  0% {
    transform: translateY(2px) scale(0.7);
    opacity: 0;
  }
  35% {
    transform: translateY(-2px) scale(1.06);
    opacity: 1;
  }
  100% {
    transform: translateY(-6px) scale(0.94);
    opacity: 0;
  }
}

@keyframes successButtonPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

.muted {
  color: var(--muted);
}

#char-counter.char-warn {
  color: #8c5a00;
  font-weight: 600;
}

#char-counter.char-over {
  color: #9b2424;
  font-weight: 700;
}

.limit-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d5c9a4;
  background: linear-gradient(180deg, #fff9ec 0%, #fff4de 100%);
  color: #5f4a12;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
}

.limit-cta-btn {
  border: 1px solid #b78c1a;
  background: #ffce4e;
  color: #4a3500;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.limit-cta-btn:hover {
  background: #ffc337;
}

.issues {
  margin: 0;
  padding-left: 18px;
}

.issues li {
  margin-bottom: 7px;
}

.issues-spacer {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.issue-row {
  background: #f9fbf8;
  border: 1px solid #dbe4d7;
  border-radius: 10px;
  padding: 8px;
  list-style: none;
}

.issue-row.reviewed {
  background: #eef9f1;
  border-color: #b9dcbf;
}

.issue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.issue-word-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.issue-word {
  color: #902d2d;
}

.issue-word-ai-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b6caef;
  background: #eef4ff;
  color: #1f4f8a;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.03em;
}

.issue-context {
  color: #5c6b63;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.issue-context mark {
  background: #ffe39d;
  color: #613500;
  border-radius: 4px;
  padding: 0 4px;
}

.issue-jump {
  border: 1px solid #c4d0c0;
  background: #fff;
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 2px 10px;
}

.issue-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.issue-suggestion-btn {
  border: 1px solid #bfd1bc;
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.86rem;
  line-height: 1.2;
}

.issue-ok-btn {
  border-color: #9fcea8;
  background: #ecf9ef;
  color: #1f6a35;
  font-weight: 700;
}

.issue-ok-btn:hover {
  background: #e0f4e5;
}

.issue-restore-btn {
  border-color: #cfc9dd;
  background: #f6f3fb;
  color: #5c4f80;
  font-weight: 700;
}

.issue-restore-btn:hover {
  background: #eee9f8;
}

.issue-ai-suggestion-btn {
  position: relative;
  border-color: #b7caea;
  background: #f5f9ff;
  color: #1d467f;
  font-weight: 700;
  padding-right: 28px;
}

.issue-ai-floating-badge {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 7px;
  top: -6px;
  border: 1px solid #b6caef;
  background: #eef4ff;
  color: #1f4f8a;
  border-radius: 999px;
  padding: 0 4px;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.35;
}

.issue-ai-loading-btn {
  position: relative;
  min-width: 88px;
  height: 28px;
  border-color: #c7d6f4;
  background: linear-gradient(90deg, #edf3ff 0%, #dae8ff 50%, #edf3ff 100%);
  background-size: 200% 100%;
  animation: aiSuggestionSlotPulse 1.2s ease-in-out infinite;
}

.issue-go-pro-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d8b769;
  background: linear-gradient(180deg, #fff5df 0%, #ffeec9 100%);
  color: #6a4a08;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

.issue-go-pro-btn:hover {
  background: linear-gradient(180deg, #ffefcb 0%, #ffe4a8 100%);
}

.issue-go-pro-btn::before {
  content: "🔒";
  font-size: 0.82rem;
  line-height: 1;
}

.issue-go-pro-footer {
  display: flex;
  justify-content: center;
}

.issue-ai-limit-note {
  display: inline-flex;
  align-items: center;
  color: #6b5b2f;
  background: #fff8e8;
  border: 1px solid #e9d39d;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.78rem;
  line-height: 1.3;
}

.issue-row.active {
  border-color: #8bb89a;
  box-shadow: 0 0 0 2px #e8f3eb;
}

.spell-issue {
  background: #ffd8d8;
  border-bottom: 2px solid #c24141;
  border-radius: 2px;
}

.spell-issue[data-issue-state="edited"] {
  background: #fff2c9;
  border-bottom-color: #af7d00;
}

.issue-popover {
  position: fixed;
  z-index: 1100;
  width: min(360px, calc(100vw - 20px));
  border: 1px solid #cfd8cb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 25px rgba(20, 32, 25, 0.18);
  padding: 10px;
}

.issue-popover.d-none {
  display: none;
}

.issue-popover-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.issue-popover-head strong {
  color: #8f2f2f;
}

.issue-popover-word-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

@keyframes aiSuggestionSlotPulse {
  0% {
    background-position: 0% 50%;
    opacity: 0.85;
  }
  50% {
    background-position: 100% 50%;
    opacity: 1;
  }
  100% {
    background-position: 0% 50%;
    opacity: 0.85;
  }
}

.issue-popover-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #4f5f57;
  text-decoration: underline;
  font-size: 0.82rem;
}

.issue-popover-sub {
  color: #56665e;
  font-size: 0.83rem;
  margin-bottom: 6px;
}

.issue-popover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seo-block h2 {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  margin-bottom: 10px;
}

.seo-block p,
.seo-block li {
  color: #36463f;
}

.ads-wrap {
  border: 1px dashed #c6d2c1;
  border-radius: 12px;
  background: #fafcf8;
  padding: 10px;
}

.ad-slot {
  min-height: 110px;
}

.lang-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lang-links a {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: #fff;
}

.footer {
  margin: 14px 0 24px;
}

.footer-note {
  color: var(--muted);
  margin: 0 0 8px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.9rem;
}

.footer-links a {
  color: #2f5c47;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.register-terms {
  font-size: 0.85rem;
  color: #365046;
}

.register-terms a {
  color: #2f5c47;
}

.clipboard-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(26, 41, 34, 0.92);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  z-index: 1200;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.clipboard-toast-success {
  background: linear-gradient(180deg, rgba(31, 146, 84, 0.98) 0%, rgba(24, 118, 68, 0.98) 100%);
  box-shadow: 0 10px 22px rgba(24, 118, 68, 0.28);
  animation: toastSuccessPop 360ms ease-out 1;
}

.clipboard-toast-success::before {
  content: "✦";
  margin-right: 7px;
  display: inline-block;
  color: #ffe29a;
  text-shadow: 0 0 8px rgba(255, 226, 154, 0.45);
  animation: toastSparklePulse 620ms ease-out 1;
}

@keyframes toastSuccessPop {
  0% {
    transform: translateX(-50%) translateY(4px) scale(0.96);
    opacity: 0;
  }
  60% {
    transform: translateX(-50%) translateY(-1px) scale(1.02);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes toastSparklePulse {
  0% {
    transform: scale(0.7) rotate(-12deg);
    opacity: 0;
  }
  45% {
    transform: scale(1.12) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(4deg);
    opacity: 1;
  }
}

#proModal .modal-dialog {
  max-width: 980px;
}

#proModal .modal-body {
  padding-top: 14px;
}

.paywall-intro {
  margin: 0 0 8px;
  color: #294236;
  font-size: 0.92rem;
}

.paywall-support {
  margin: 0 0 12px;
  color: #4c6558;
  font-size: 0.8rem;
}

.paywall-currency-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

.paywall-currency-label {
  font-size: 0.76rem;
  color: #4c6558;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.paywall-currency-switch {
  display: inline-flex;
  border: 1px solid #cddad0;
  border-radius: 999px;
  padding: 2px;
  background: #f3f8f4;
}

.paywall-currency-btn {
  border: 0;
  background: transparent;
  color: #456053;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
  line-height: 1;
}

.paywall-currency-btn.active {
  background: #1f7a4f;
  color: #fff;
}

.paywall-grid {
  display: grid;
  gap: 10px;
}

.paywall-grid-monthly {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.paywall-grid-onetime {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.paywall-section-title {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4c6558;
}

.paywall-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid #d3dcd0;
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faf5 100%);
  box-shadow: 0 5px 14px rgba(22, 47, 33, 0.07);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.paywall-card-pro {
  border-color: #80b89a;
  background: linear-gradient(180deg, #f5fffa 0%, #e9f8f0 100%);
  box-shadow: 0 10px 22px rgba(35, 105, 70, 0.18);
}

.paywall-card.is-selected {
  border-color: #2d7a52;
  box-shadow: 0 0 0 2px rgba(45, 122, 82, 0.16);
}

.paywall-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #14603b;
  background: #dff3e7;
  border: 1px solid #b8dfc8;
}

.paywall-plan {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: #1a3326;
}

.paywall-price {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  color: #123524;
}

.paywall-price span {
  font-size: 0.72rem;
  font-weight: 600;
  color: #4c6558;
}

.paywall-fit {
  margin: 0;
  color: #3f5a4d;
  font-size: 0.78rem;
}

.paywall-features {
  margin: 0;
  padding-left: 18px;
  color: #31483d;
  font-size: 0.83rem;
}

.paywall-features li + li {
  margin-top: 4px;
}

.paywall-checkout-btn {
  margin-top: auto;
  font-weight: 600;
  font-size: 0.88rem;
  padding-top: 7px;
  padding-bottom: 7px;
}

@media (max-width: 768px) {
  .brand-mini {
    width: 34px;
    height: 34px;
  }

  .chip {
    font-size: 0.76rem;
  }

  .lang-select {
    min-width: 130px;
  }

  .main-editor .ql-editor {
    min-height: 410px;
  }

  .paywall-grid {
    grid-template-columns: 1fr;
  }

  .paywall-currency-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .paywall-card-pro {
    box-shadow: 0 7px 16px rgba(35, 105, 70, 0.16);
  }
}
