:root {
  color-scheme: light;
  --ink: #102536;
  --muted: #5a6c78;
  --line: #cad9dd;
  --paper: #ffffff;
  --page: #eef6f5;
  --soft: #e4f2f0;
  --teal: #087f7b;
  --teal-dark: #075f5d;
  --coral: #e2674f;
  --navy: #102536;
  --green: #267a52;
  --danger: #a83e36;
  --shadow: 0 14px 34px rgba(16, 37, 54, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
}

button,
input,
a { font: inherit; letter-spacing: 0; }

button,
a { -webkit-tap-highlight-color: transparent; }

a { color: var(--teal-dark); }

img { display: block; max-width: 100%; }

[hidden] { display: none !important; }

.page {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 48px;
}

.topbar {
  position: relative;
  z-index: 20;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--navy);
  border: 1px solid #263f50;
  border-radius: 8px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
}

.brand-text { display: grid; line-height: 1.2; }
.brand-name { font-weight: 800; }
.brand-sub { color: #b7d3d4; font-size: 0.78rem; }

.top-actions { display: flex; align-items: center; gap: 8px; }

.nav-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  color: #ffffff;
  text-decoration: none;
  border: 1px solid #4a6574;
  border-radius: 6px;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link:focus-visible { border-color: #ffffff; }

.language-menu { position: relative; }
.language-menu summary { list-style: none; cursor: pointer; }
.language-menu summary::-webkit-details-marker { display: none; }

.language-menu summary,
.language-menu-list a {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #4a6574;
  border-radius: 50%;
  background: #ffffff;
}

.language-menu-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 58px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 8px;
  background: var(--navy);
  border: 1px solid #4a6574;
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.language-menu-list a {
  width: 40px;
  height: 40px;
  border-color: transparent;
}

.language-menu-list a[aria-current="true"] { outline: 3px solid #5ed4cc; }

.flag-circle {
  width: 26px;
  height: 26px;
  display: block;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid rgba(16, 37, 54, 0.18);
  box-shadow: 0 1px 3px rgba(16, 37, 54, 0.2);
}

.flag-en { background: linear-gradient(#21468b 0 30%, #ffffff 30% 39%, #cf142b 39% 61%, #ffffff 61% 70%, #21468b 70%); }
.flag-de { background: linear-gradient(#151515 0 33.33%, #d6262e 33.33% 66.66%, #f3c42f 66.66%); }
.flag-fr { background: linear-gradient(90deg, #1d4f9c 0 33.33%, #ffffff 33.33% 66.66%, #e63946 66.66%); }
.flag-es { background: linear-gradient(#b51f2f 0 25%, #f6c945 25% 75%, #b51f2f 75%); }
.flag-zh { background: #df2935 radial-gradient(circle at 35% 32%, #ffd34d 0 11%, transparent 12%); }
.flag-ru { background: linear-gradient(#ffffff 0 33.33%, #2463a9 33.33% 66.66%, #d73a49 66.66%); }
.flag-bg { background: linear-gradient(#ffffff 0 33.33%, #2f9b63 33.33% 66.66%, #d24a43 66.66%); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 36px;
  min-height: 260px;
  padding: 44px 28px 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { overflow-wrap: anywhere; }

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.lead {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.trust span {
  padding: 5px 10px;
  color: var(--green);
  background: #ffffff;
  border: 1px solid #b7d9c8;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 700;
}

.format-visual {
  width: 220px;
  min-height: 150px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 18px;
  color: #ffffff;
  background: var(--navy);
  border: 1px solid #29485a;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.format-visual img { width: 56px; margin: 0 auto 8px; }
.format-visual strong { display: block; text-align: center; }
.format-arrow { color: #5ed4cc; font-size: 1.6rem; font-weight: 800; }
.format-output { display: grid; gap: 8px; }
.format-output span { padding: 4px 7px; text-align: center; border: 1px solid #5d7481; border-radius: 4px; }

.privacy-callout {
  margin: 0 0 14px;
  padding: 11px 14px;
  color: #185b42;
  background: #e5f5ed;
  border: 1px solid #add7c4;
  border-radius: 6px;
  text-align: center;
}

.converter {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.converter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
}

.upload-panel,
.settings-panel { padding: 24px; }
.settings-panel { border-left: 1px solid var(--line); background: #f8fbfb; }

.section-label {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.converter h2 { margin: 0 0 16px; font-size: 1.3rem; }

.mode-switch,
.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.mode-button,
.segment span {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 750;
  text-align: center;
}

.mode-button.is-active,
.segment input:checked + span {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

.segment { position: relative; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment input:focus-visible + span { outline: 3px solid rgba(8, 127, 123, 0.25); outline-offset: 2px; }

.mode-hint {
  min-height: 42px;
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.mode-hint span { display: none; }
.converter:has([data-input-mode="heic"].is-active) [data-hint="heic"],
.converter:has([data-input-mode="photos"].is-active) [data-hint="photos"] { display: inline; }

.dropzone {
  position: relative;
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: var(--soft);
  border: 2px dashed #87b9b6;
  border-radius: 8px;
  transition: border-color 160ms ease, background 160ms ease;
}

.dropzone.is-over { background: #d8efec; border-color: var(--teal); }
.dropzone img { width: 52px; margin: 0 auto 8px; }
.dropzone strong { display: block; font-size: 1.1rem; }
.dropzone p { margin: 4px 0 0; color: var(--muted); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.upload-actions,
.command-actions,
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.upload-actions { margin-top: 12px; }

.primary,
.secondary,
.danger {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
}

.primary { color: #ffffff; background: var(--teal); border-color: var(--teal); }
.primary:hover:not(:disabled), .primary:focus-visible { background: var(--teal-dark); }
.secondary { color: var(--ink); background: #ffffff; border-color: var(--line); }
.secondary:hover:not(:disabled), .secondary:focus-visible { border-color: var(--teal); }
.danger { color: var(--danger); background: #fff8f6; border-color: #e6bdb6; }
button:disabled { opacity: 0.48; cursor: not-allowed; }

.selected-summary {
  min-height: 28px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 650;
}

.selected-list { display: grid; gap: 7px; margin-top: 10px; }
.selected-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}
.selected-preview {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--teal-dark);
  background: #dceeed;
  border-radius: 4px;
  font-size: 0.64rem;
  font-weight: 900;
}
.selected-preview img { width: 100%; height: 100%; object-fit: cover; }
.selected-item strong,
.selected-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-item span,
.selected-more { color: var(--muted); font-size: 0.78rem; }

.field-label { display: flex; justify-content: space-between; gap: 12px; margin: 14px 0 6px; font-weight: 750; }
.quality-row input[type="range"] { width: 100%; accent-color: var(--teal); }
.limits { margin: 10px 0 16px; color: var(--muted); font-size: 0.82rem; }
.command-actions .primary { flex: 1; }

.progress-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.progress-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 0.82rem; font-weight: 750; }
progress { width: 100%; height: 10px; margin-top: 7px; border: 0; border-radius: 5px; overflow: hidden; }
progress::-webkit-progress-bar { background: #dbe7e8; }
progress::-webkit-progress-value { background: var(--teal); }
progress::-moz-progress-bar { background: var(--teal); }

.status {
  min-height: 48px;
  margin-top: 12px;
  padding: 10px 12px;
  color: #314c5a;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.results-panel { padding: 24px; border-top: 1px solid var(--line); }
.results-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.results-heading h2 { margin-bottom: 4px; }
.results-heading span { color: var(--muted); font-size: 0.86rem; }
.results { display: grid; gap: 10px; margin-top: 14px; }
.results:empty::before { content: attr(data-empty); display: block; padding: 22px; color: var(--muted); background: #f7faf9; border: 1px dashed var(--line); border-radius: 6px; text-align: center; }

.result-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.result-row > img { width: 92px; height: 72px; object-fit: cover; border-radius: 4px; background: var(--soft); }
.result-row strong { display: block; overflow-wrap: anywhere; }
.result-row p { margin: 3px 0 8px; color: var(--muted); font-size: 0.82rem; }
.small-action { min-height: 36px; padding: 6px 10px; font-size: 0.82rem; }
.result-error { border-color: #e6bdb6; background: #fff8f6; }
.result-error-badge { width: 44px; height: 44px; display: grid; place-items: center; color: #ffffff; background: var(--danger); border-radius: 50%; font-weight: 900; }

.content-section {
  margin-top: 28px;
  background: #ffffff;
  border-top: 4px solid var(--teal);
}

.content-section > section {
  padding: 26px 28px;
  border-bottom: 1px solid var(--line);
}

.content-section > section:nth-child(even) { background: #f8fbfb; }
.content-section h2 { margin: 0 0 10px; font-size: 1.45rem; line-height: 1.25; }
.content-section p { margin: 9px 0; color: #334d5a; }
.content-section li { margin: 7px 0; }
.content-section ol,
.content-section ul { padding-left: 22px; }

.example-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 0 0;
  background: var(--line);
  border: 1px solid var(--line);
}
.example-metrics div { padding: 14px; background: #ffffff; }
.example-metrics dt { color: var(--teal-dark); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.example-metrics dd { margin: 4px 0 0; font-weight: 750; }

.faq-list { display: grid; gap: 8px; }
.faq-list details { background: #ffffff; border: 1px solid var(--line); border-radius: 6px; }
.faq-list summary { padding: 13px 15px; cursor: pointer; font-weight: 800; }
.faq-list details p { padding: 0 15px 14px; }

.related-tools { margin-top: 28px; padding: 24px 0; }
.related-tools h2 { margin: 0 0 12px; }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.related-grid a { min-width: 0; padding: 14px; color: var(--ink); background: #ffffff; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.related-grid a:hover { border-color: var(--teal); }
.related-grid strong,
.related-grid span { display: block; }
.related-grid span { margin-top: 4px; color: var(--muted); font-size: 0.86rem; }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}
.privacy-settings { padding: 0; color: var(--teal-dark); background: none; border: 0; text-decoration: underline; cursor: pointer; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 34px 12px 26px; }
  .format-visual { width: 100%; max-width: 360px; }
  .converter-grid { grid-template-columns: 1fr; }
  .settings-panel { border-top: 1px solid var(--line); border-left: 0; }
  .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .page { width: min(100% - 16px, 1160px); padding-top: 8px; }
  .topbar { align-items: flex-start; }
  .brand-text { display: none; }
  .top-actions { align-items: flex-start; }
  .nav-link { max-width: 145px; white-space: normal; text-align: center; line-height: 1.2; }
  .hero { gap: 24px; }
  h1 { font-size: 2.15rem; }
  .upload-panel,
  .settings-panel,
  .results-panel,
  .content-section > section { padding: 18px 14px; }
  .mode-switch,
  .segmented { grid-template-columns: 1fr 1fr; }
  .upload-actions > *,
  .command-actions > * { flex: 1 1 130px; }
  .example-metrics { grid-template-columns: 1fr; }
  .result-row { grid-template-columns: 70px minmax(0, 1fr); }
  .result-row > img { width: 70px; height: 64px; }
  .results-heading { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
