:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #5f6c7b;
  --line: #d8e1ea;
  --soft: #f4f8fb;
  --panel: #ffffff;
  --nav: #07111f;
  --cyan: #087f8c;
  --cyan-dark: #075d68;
  --coral: #e05d44;
  --green: #167b55;
  --warning: #fff4e8;
  --focus: #1a73e8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  background: #eef4f7;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: linear-gradient(180deg, #eaf4f5 0, #f8fafc 420px, #fff 100%);
}

button,
input,
output {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 48px;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 66px;
  padding: 8px 12px;
  border: 1px solid #203146;
  border-radius: 8px;
  background: var(--nav);
  box-shadow: 0 12px 30px rgb(16 34 53 / 16%);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  color: white;
  text-decoration: none;
}

.brand img {
  display: block;
  width: min(250px, 38vw);
  height: 48px;
  object-fit: contain;
  object-position: left center;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.nav-link,
.language-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid #3d5169;
  border-radius: 8px;
  color: #edf8ff;
  background: #101e2f;
  text-decoration: none;
  cursor: pointer;
}

.nav-link {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-link:hover,
.language-menu summary:hover {
  border-color: #79d8dd;
  background: #172b42;
}

.language-menu {
  position: relative;
}

.language-menu summary {
  width: 42px;
  padding: 0;
  list-style: none;
}

.language-menu summary::-webkit-details-marker {
  display: none;
}

.language-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  grid-template-columns: 42px;
  gap: 4px;
  width: 50px;
  padding: 4px;
  border: 1px solid #31445c;
  border-radius: 8px;
  background: #0c1828;
  box-shadow: 0 18px 36px rgb(0 0 0 / 28%);
}

.language-menu-list a {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
}

.language-menu-list a:hover,
.language-menu-list a[aria-current="true"] {
  border-color: #77d4da;
  background: #1b3046;
}

.flag-circle {
  display: inline-block;
  width: 27px;
  height: 27px;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgb(0 0 0 / 35%);
}

.flag-en { background: linear-gradient(90deg, transparent 40%, #fff 40% 60%, transparent 60%), linear-gradient(transparent 40%, #fff 40% 60%, transparent 60%), linear-gradient(90deg, transparent 45%, #c8102e 45% 55%, transparent 55%), linear-gradient(transparent 45%, #c8102e 45% 55%, transparent 55%), #21468b; }
.flag-de { background: linear-gradient(#171717 0 33.33%, #d71920 33.33% 66.66%, #f6cf27 66.66%); }
.flag-fr { background: linear-gradient(90deg, #163f8c 0 33.33%, #fff 33.33% 66.66%, #e32636 66.66%); }
.flag-es { background: linear-gradient(#aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75%); }
.flag-zh { background: radial-gradient(circle at 31% 31%, #ffde00 0 8%, transparent 9%), #de2910; }
.flag-ru { background: linear-gradient(#fff 0 33.33%, #1c57a7 33.33% 66.66%, #d52b1e 66.66%); }
.flag-bg { background: linear-gradient(#fff 0 33.33%, #169b62 33.33% 66.66%, #d62612 66.66%); }

.tool-header {
  padding: 52px 0 30px;
  text-align: center;
}

.eyebrow,
.panel-label {
  margin: 0 0 8px;
  color: var(--cyan-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.tool-header h1 {
  max-width: 880px;
  margin: 0 auto;
  color: #0c1728;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.06;
  overflow-wrap: anywhere;
}

.intro {
  max-width: 780px;
  margin: 18px auto 0;
  color: #465567;
  font-size: 18px;
  line-height: 1.65;
}

.privacy-promise {
  max-width: 760px;
  margin: 18px auto 0;
  padding: 12px 16px;
  border: 1px solid #a9d7cf;
  border-radius: 8px;
  color: #174a40;
  background: #edf9f5;
  line-height: 1.5;
}

.app-shell {
  overflow: hidden;
  border: 1px solid #c9d6e0;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 55px rgb(24 48 75 / 12%);
}

.controls-panel,
.results-panel {
  padding: 26px;
}

.controls-panel {
  background: #fff;
}

.results-panel {
  border-top: 1px solid var(--line);
  background: #f7fafc;
}

.section-heading,
.results-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.section-heading h2,
.results-heading h2,
.content-section h2,
.related-tools h2 {
  margin: 0;
  color: #122036;
  font-size: 24px;
  line-height: 1.25;
}

.section-heading > p,
.results-heading > p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.button-row,
.result-actions,
.tabs,
.suggestion-row,
.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid #aebdca;
  border-radius: 6px;
  color: #1c293b;
  background: #fff;
  font-weight: 750;
  line-height: 1.2;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #4a7380;
  background: #eef7f8;
}

button:disabled {
  color: #82909c;
  background: #e9eef2;
  cursor: not-allowed;
  opacity: .76;
}

button.primary {
  border-color: var(--cyan);
  color: white;
  background: var(--cyan);
}

button.primary:hover:not(:disabled) {
  border-color: var(--cyan-dark);
  background: var(--cyan-dark);
}

button.danger {
  border-color: #d8a398;
  color: #8e2f20;
  background: #fff7f4;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(360px, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.threshold-control {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.field-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.field-heading label {
  font-weight: 800;
}

.field-heading output {
  color: var(--cyan-dark);
  font-size: 14px;
  font-weight: 800;
}

.threshold-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.threshold-presets button {
  min-width: 0;
  padding-inline: 8px;
}

.threshold-presets button.is-active {
  border-color: var(--cyan);
  color: #fff;
  background: var(--cyan);
}

#threshold {
  width: 100%;
  accent-color: var(--cyan);
}

.threshold-control p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.metrics > div {
  display: grid;
  min-width: 0;
  place-content: center;
  padding: 15px 10px;
  text-align: center;
}

.metrics > div + div {
  border-left: 1px solid var(--line);
}

.metrics strong {
  color: var(--cyan-dark);
  font-size: 29px;
  line-height: 1;
}

.metrics span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.progress-block {
  margin-top: 20px;
}

.progress-meta {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto 52px;
  gap: 12px;
  align-items: center;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

.progress-meta strong {
  color: var(--ink);
}

.progress-meta span:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.progress-wrap {
  height: 12px;
  overflow: hidden;
  border: 1px solid #b8c8d4;
  border-radius: 6px;
  background: #e5edf2;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), #29a176, #f08b67);
  transition: width .18s ease;
}

.status {
  min-height: 24px;
  margin: 9px 0 0;
  color: #34445a;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.results-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.tabs {
  flex: 1 1 auto;
}

.tab {
  min-width: 105px;
}

.tab.is-active {
  border-color: #192d44;
  color: #fff;
  background: #192d44;
}

.result-actions {
  justify-content: flex-end;
}

.safety-callout {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border-left: 4px solid var(--coral);
  color: #663528;
  background: var(--warning);
  line-height: 1.5;
}

.preview-panel {
  margin-bottom: 14px;
  border: 1px solid #cbd8e3;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.preview-empty,
.empty {
  display: grid;
  min-height: 124px;
  place-content: center;
  gap: 6px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.preview-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.preview-head,
.compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfc;
}

.preview-head strong,
.compare-head strong {
  display: block;
  font-size: 18px;
}

.preview-head span,
.compare-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.preview-body {
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
}

.preview-keep,
.preview-duplicates {
  display: grid;
  min-width: 0;
  gap: 9px;
  align-content: start;
}

.preview-keep > span,
.preview-duplicates > span {
  color: var(--cyan-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.preview-keep .thumb {
  width: 100%;
  height: 180px;
}

.preview-keep strong,
.preview-duplicate strong {
  overflow-wrap: anywhere;
}

.preview-keep small,
.preview-duplicate small {
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.preview-duplicate {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.preview-duplicate .thumb {
  width: 72px;
  height: 72px;
}

.tab-panel {
  display: grid;
  gap: 9px;
}

.group-card {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 11px;
  border: 1px solid #cdd9e3;
  border-radius: 8px;
  background: white;
  cursor: pointer;
}

.group-card:hover,
.group-card.is-previewed {
  border-color: #63a8ae;
  box-shadow: 0 7px 20px rgb(8 127 140 / 10%);
}

.compact-thumb-strip {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 58px;
}

.compact-thumb {
  width: 58px;
  height: 58px;
  margin-right: -13px;
  overflow: hidden;
  border: 2px solid white;
  border-radius: 6px;
  background: #e8eef2;
  box-shadow: 0 2px 7px rgb(23 32 51 / 18%);
}

.compact-thumb.is-keep-thumb {
  border-color: #43b58d;
  z-index: 2;
}

.compact-thumb .thumb {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.thumb-more {
  position: relative;
  z-index: 3;
  margin-left: 18px;
  color: var(--cyan-dark);
  font-size: 13px;
  font-weight: 800;
}

.group-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.group-copy strong {
  overflow-wrap: anywhere;
}

.group-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.mini-action,
.show-more,
.modal-close {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 13px;
}

.show-more {
  justify-self: center;
  margin-top: 8px;
}

.all-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.photo-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.photo-card.is-keep {
  border-color: #75bda4;
  background: #f2fbf7;
}

.photo-card.is-marked {
  border-color: #e2a38f;
  background: #fff8f4;
}

.photo-card .thumb {
  width: 88px;
  height: 88px;
}

.photo-card > div:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
  align-content: start;
}

.photo-card strong,
.photo-card span,
.photo-card small,
.photo-card code,
.photo-card em {
  overflow-wrap: anywhere;
}

.photo-card span,
.photo-card small {
  color: var(--muted);
  font-size: 12px;
}

.photo-card code {
  color: #465567;
  font-size: 10px;
}

.photo-card em {
  color: #9c3d2a;
  font-size: 12px;
}

.keep-pill {
  display: inline-block;
  padding: 2px 5px;
  border-radius: 4px;
  color: #fff !important;
  background: var(--green);
  font-size: 10px !important;
  font-style: normal;
}

.thumb {
  display: block;
  object-fit: cover;
  border-radius: 6px;
  background: #e6edf2;
}

.thumb-placeholder {
  display: grid;
  place-content: center;
  padding: 5px;
  color: #6b7886;
  font-size: 11px;
  text-align: center;
}

.review-shell {
  display: grid;
  gap: 12px;
}

.review-summary {
  display: grid;
  gap: 3px;
  padding: 13px;
  border: 1px solid #d8b9a9;
  border-radius: 8px;
  background: #fff8f4;
}

.review-summary span {
  color: #6e4a3f;
  font-size: 13px;
}

.compare-modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(5 12 22 / 74%);
}

.compare-sheet {
  width: min(1050px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 8px;
  background: white;
  box-shadow: 0 28px 80px rgb(0 0 0 / 38%);
}

.suggestion-row {
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 15px;
}

.compare-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.compare-item.is-keep {
  border-color: #69af95;
  background: #f1faf6;
}

.compare-item.is-marked {
  border-color: #dba18f;
}

.compare-item > .thumb {
  width: 100%;
  height: 220px;
  border-radius: 0;
}

.compare-item > div {
  display: grid;
  gap: 6px;
  padding: 11px;
}

.compare-item strong,
.compare-item small {
  overflow-wrap: anywhere;
}

.has-modal {
  overflow: hidden;
}

.content-section {
  margin-top: 42px;
  border-top: 1px solid var(--line);
}

.content-section > section {
  display: grid;
  grid-template-columns: minmax(220px, 310px) minmax(0, 1fr);
  gap: 26px 46px;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}

.content-section h2 {
  grid-row: 1 / span 20;
}

.content-section p,
.content-section li {
  color: #445367;
  line-height: 1.72;
}

.content-section p {
  margin: 0;
}

.content-section p + p {
  margin-top: 12px;
}

.content-section ul,
.content-section ol {
  margin: 0;
  padding-left: 22px;
}

.content-section li + li {
  margin-top: 8px;
}

.worked-example dl {
  display: grid;
  gap: 8px;
  margin: 6px 0 0;
}

.worked-example dl > div {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid #dbe3e9;
}

.worked-example dt {
  color: var(--cyan-dark);
  font-weight: 800;
}

.worked-example dd {
  margin: 0;
  color: #445367;
  line-height: 1.55;
}

.faq-section details {
  border-top: 1px solid #d6e0e7;
}

.faq-section summary {
  padding: 13px 34px 13px 0;
  color: #17273c;
  font-weight: 800;
  cursor: pointer;
}

.faq-section details p {
  padding: 0 0 14px;
}

.related-tools {
  padding: 38px 0 28px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.related-grid a {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
}

.related-grid a:hover {
  border-color: #6caab0;
  box-shadow: 0 8px 20px rgb(20 73 84 / 9%);
}

.related-grid span {
  color: var(--muted);
  line-height: 1.45;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.footer a {
  color: var(--cyan-dark);
  font-weight: 800;
}

.privacy-settings {
  min-height: 34px;
  margin-left: 8px;
  padding: 6px 9px;
  font-size: 13px;
}

@media (max-width: 960px) {
  .settings-row,
  .preview-body {
    grid-template-columns: 1fr;
  }

  .results-toolbar {
    display: grid;
  }

  .result-actions {
    justify-content: flex-start;
  }

  .group-card {
    grid-template-columns: 190px minmax(0, 1fr) auto;
  }

  .all-list,
  .compare-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 18px, 1180px);
    padding-top: 9px;
  }

  .topbar {
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
  }

  .brand img {
    width: min(185px, 46vw);
    height: 42px;
  }

  .top-actions {
    flex-wrap: wrap;
    gap: 5px;
  }

  .nav-link {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 12px;
  }

  .language-menu summary {
    width: 38px;
    min-height: 36px;
  }

  .language-menu-list {
    grid-template-columns: 38px;
    width: 46px;
  }

  .language-menu-list a {
    width: 38px;
    height: 38px;
  }

  .tool-header {
    padding: 36px 8px 24px;
  }

  .tool-header h1 {
    font-size: 36px;
  }

  .intro {
    font-size: 16px;
  }

  .controls-panel,
  .results-panel {
    padding: 18px 13px;
  }

  .section-heading,
  .results-heading {
    display: grid;
    gap: 8px;
  }

  .button-row > button,
  .result-actions > button {
    flex: 1 1 145px;
  }

  .threshold-presets {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metrics > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .progress-meta {
    grid-template-columns: 1fr auto;
  }

  .progress-meta span:nth-child(2),
  .progress-meta span:nth-child(3) {
    display: none;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tab {
    min-width: 0;
  }

  .group-card {
    grid-template-columns: 1fr auto;
  }

  .compact-thumb-strip {
    grid-column: 1 / -1;
  }

  .all-list,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .content-section > section {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 27px 4px;
  }

  .content-section h2 {
    grid-row: auto;
  }

  .worked-example dl > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .compare-modal {
    padding: 8px;
  }

  .compare-sheet {
    max-height: calc(100vh - 16px);
  }
}

@media (max-width: 430px) {
  .topbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .brand img {
    width: min(220px, 75vw);
  }

  .top-actions {
    justify-content: flex-start;
  }

  .tool-header h1 {
    font-size: 32px;
  }

  .field-heading {
    display: grid;
    gap: 5px;
  }

  .group-card {
    grid-template-columns: 1fr;
  }

  .group-card .mini-action {
    width: 100%;
  }

  .preview-head,
  .compare-head {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .progress-bar {
    transition: none;
  }
}
