/* imgeditoronline — tokens and components per docs/IMGEDITORONLINE_BRAND_STYLE.md */

:root {
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-deep: #14345b;
  --accent: #16b8e6;
  --text: #17263c;
  --text-muted: #5b6b80;
  --page: #f7f9fc;
  --surface: #fff;
  --surface-accent: #ecf4ff;
  --border: #dfe7f0;
  --success: #16845b;
  --error: #c43d4c;
  --focus: #16b8e6;
  --radius-card: 22px;
  --radius-control: 13px;
  --radius-tag: 9px;
  --container: 1200px;
  --gutter: 28px;
  --shadow-card: 0 8px 32px rgba(23, 38, 60, .06);
  --ease: 180ms ease;
  --checker: repeating-conic-gradient(#e3e9f1 0 25%, #fff 0 50%) 0 0 / 16px 16px;
  font-family: "Inter Variable", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 16px; line-height: 1.6; background: var(--page); color: var(--text); }
img, svg, canvas { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { color: var(--text); margin: 0; }
h1 { font-size: clamp(2.1rem, 1.4rem + 2.6vw, 3.25rem); font-weight: 680; line-height: 1.1; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.25rem); font-weight: 650; line-height: 1.18; }
h3 { font-size: clamp(1.1rem, 1rem + .3vw, 1.3rem); font-weight: 600; line-height: 1.25; }
p { margin: 0 0 1em; }
.tnum, output, .file-info, .preview-info { font-variant-numeric: tabular-nums; }
.icon { flex: none; }

.container { max-width: calc(var(--container) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 8px; background: var(--surface); padding: 10px 14px; z-index: 20; border-radius: var(--radius-control); }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: var(--radius-control);
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  font: inherit; font-size: 15.5px; font-weight: 600; line-height: 1.2; text-decoration: none;
  cursor: pointer; transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.button:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.button-large { min-height: 52px; padding: 14px 28px; font-size: 16px; }
.button-small { min-height: 40px; padding: 8px 16px; font-size: 15px; }
.button-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.button-secondary:hover { background: var(--surface); color: var(--brand); border-color: var(--brand); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.link-button { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }
.link-button:hover { color: var(--brand-hover); text-decoration: underline; }
.icon-button {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  background: none; border: 0; border-radius: var(--radius-control);
  font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--text-muted);
}
.icon-button:hover { background: var(--surface-accent); color: var(--text); }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 10; }
.header-row { display: flex; align-items: center; gap: 24px; min-height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 650; font-size: 1.12rem; letter-spacing: -0.01em; }
.logo:hover { color: var(--text); }
.logo img { width: 34px; height: 34px; }
.logo-tld { color: var(--text-muted); font-weight: 500; }
/* Labels never wrap; links that do not fit on one line (long translations) are hidden. */
.main-nav { display: flex; flex-wrap: wrap; gap: 0 2px; height: 44px; overflow: hidden; min-width: 0; flex: 1 1 auto; margin-right: auto; }
.main-nav a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 15px; padding: 10px 10px; border-radius: var(--radius-control); white-space: nowrap; line-height: 24px; }
.main-nav a:hover { background: var(--surface-accent); color: var(--brand); }
.logo { flex: none; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 12px; flex: none; white-space: nowrap; }
.header-actions > a:not(.button) { color: var(--text); text-decoration: none; font-weight: 500; font-size: 15px; }
.header-actions > a:not(.button):hover { color: var(--brand); }
.header-user { color: var(--text-muted); font-size: 14px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.header-user { text-decoration: none; }
a.header-user:hover { color: var(--brand); text-decoration: underline; }
.inline-form { display: inline; }

.lang-switcher { position: relative; }
.lang-switcher summary {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 12px;
  cursor: pointer; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-control);
  font-size: 14px; font-weight: 600; color: var(--text); background: var(--surface);
}
.lang-switcher summary::-webkit-details-marker { display: none; }
.lang-switcher ul {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; margin: 0; padding: 6px;
  list-style: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-card); z-index: 30;
}
.lang-switcher li a { display: block; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-size: 15px; }
.lang-switcher li a:hover { background: var(--surface-accent); }
.lang-switcher li a[aria-current] { font-weight: 650; color: var(--brand); }

/* ---------- Page chrome ---------- */
main { min-height: 60vh; padding-bottom: 88px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 20px 0 0; margin: 0; color: var(--text-muted); font-size: 14px; }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: #a9b7c8; }
.lead { color: var(--text-muted); font-size: clamp(1.02rem, .95rem + .3vw, 1.2rem); line-height: 1.5; max-width: 760px; }
.section { padding: 96px 0 0; }
.section-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; max-width: 760px; }
.section-head p { color: var(--text-muted); margin: 0; }

.messages { list-style: none; padding: 0; margin: 20px 0 0; }
.message { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 12px 16px; margin-bottom: 8px; }
.message-error { border-color: var(--error); color: var(--error); }
.message-success { border-color: var(--success); }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14px; padding: 56px 0 32px; }
.footer-tools { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 28px 24px; }
.footer-col h2 { font-size: 14px; font-weight: 650; margin-bottom: 12px; color: var(--text); }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.footer-col a, .footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-col a:hover, .footer-links a:hover { color: var(--brand); }
.footer-bottom { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand .logo { font-size: 1rem; }
.footer-copy { color: var(--text-muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* ---------- Text pages (legal, about, blog) ---------- */
.prose-page { max-width: 820px; }
.prose { font-size: 16.5px; line-height: 1.7; }
.prose h2 { font-size: 24px; margin: 36px 0 12px; }
.prose h3 { font-size: 19px; margin: 28px 0 10px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 1em; }
.prose li { margin-bottom: 6px; }
.prose code { background: var(--surface-accent); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.prose img { border-radius: 12px; height: auto; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1em; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.contact-email { font-size: 20px; font-weight: 600; }
.page-updated, .article-date { color: var(--text-muted); font-size: 14px; }
.page-updated { margin-top: 40px; }
.article-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.article-card-title { font-size: 19px; }
.article-card-title a { color: var(--text); text-decoration: none; }
.article-card-title a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-card); }
.pagination { display: flex; gap: 12px; margin-top: 28px; }

/* ---------- Home ---------- */
.hero { background: linear-gradient(180deg, var(--surface) 0%, var(--surface-accent) 100%); border-bottom: 1px solid var(--border); padding: 72px 0 64px; }
.hero-inner { max-width: 760px; }
.hero h1 { margin-bottom: 16px; }
.hero .lead { margin-bottom: 28px; }
.tool-search { position: relative; max-width: 620px; }
.tool-search .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.tool-search input {
  width: 100%; min-height: 58px; padding: 14px 18px 14px 52px; font: inherit; font-size: 17px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-card);
}
.tool-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, .15); }
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; padding: 0; list-style: none; }
.quick-action {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control);
  color: var(--text); text-decoration: none; font-weight: 500; font-size: 15px;
  transition: border-color var(--ease), color var(--ease);
}
.quick-action:hover { border-color: var(--brand); color: var(--brand); }
.quick-action .icon { color: var(--brand); }

.catalog-group + .catalog-group { margin-top: 48px; }
.catalog-group-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.catalog-group-title .icon { color: var(--brand); }
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; list-style: none; margin: 0; padding: 0; }
.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 22px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.tool-card:hover { border-color: #bcd0ee; box-shadow: var(--shadow-card); }
.tool-card-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-accent); color: var(--brand); margin-bottom: 6px; }
.tool-card h3 { font-size: 17px; }
.tool-card h3 a { color: var(--text); text-decoration: none; }
.tool-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-card); }
.tool-card h3 a:focus-visible { outline: none; }
.tool-card:has(a:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.tool-card p { color: var(--text-muted); font-size: 14.5px; line-height: 1.45; margin: 0; }
.tag { display: inline-flex; align-self: flex-start; padding: 2px 8px; border-radius: var(--radius-tag); background: var(--page); border: 1px solid var(--border); color: var(--text-muted); font-size: 12.5px; font-weight: 500; }
.catalog-empty { color: var(--text-muted); }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 26px; }
.step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-accent); color: var(--brand); font-weight: 650; margin-bottom: 14px; }
.step h3 { margin-bottom: 6px; }
.step p { color: var(--text-muted); margin: 0; }

/* ---------- Tool page ---------- */
.tool-header { padding: 20px 0 28px; max-width: 820px; }
.tool-header h1 { font-size: clamp(1.9rem, 1.5rem + 1.6vw, 2.6rem); margin-bottom: 10px; }
.tool-header .lead { margin: 0; }
.tool-ui { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; }
.privacy-notice { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 14px; color: var(--text-muted); }
.privacy-notice .icon { color: var(--success); }
.tool-coming-soon { border: 2px dashed var(--border); border-radius: 16px; background: var(--page); padding: 56px 20px; text-align: center; color: var(--text-muted); }
.tool-coming-soon p { margin: 0; }
.seo-block, .related-tools { margin-top: 64px; max-width: 760px; }
.seo-block h2, .related-tools h2 { margin-bottom: 16px; }
.faq details { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.related-tools { max-width: none; }
.related-tools .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- Tool UI (frontend/core/app.js) ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 56px 20px; text-align: center;
  border: 2px dashed #c6d5e8; border-radius: 16px; background: var(--page);
  transition: border-color var(--ease), background var(--ease);
}
.dropzone.is-dragover { border-color: var(--brand); background: var(--surface-accent); }
.dropzone .icon { color: var(--brand); }
.dropzone-hint { margin: 4px 0 0; color: var(--text-muted); }
.dropzone-formats { margin: 0; font-size: 13.5px; color: var(--text-muted); }
label.button { display: inline-flex; }

.tool-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 24px; align-items: start; }
.tool-files { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tool-side { display: flex; flex-direction: column; gap: 16px; background: var(--page); border: 1px solid var(--border); border-radius: 18px; padding: 20px; position: sticky; top: 16px; }
.tool-side > .button { width: 100%; }
.tool-preview:empty { display: none; }
.preview-image { max-width: 100%; max-height: 60vh; display: block; margin: 0 auto; border-radius: 12px; background: var(--checker); }
.preview-info { text-align: center; color: var(--text-muted); margin: 10px 0 0; font-size: 14px; }

.file-list, .result-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.file-item, .result-item { display: flex; align-items: center; gap: 14px; padding: 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.file-item img, .result-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; flex: none; background: var(--checker); }
.file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-info { color: var(--text-muted); font-size: 13.5px; }
.file-item.is-error, .result-item.is-error { border-color: var(--error); }
.file-item.is-error .file-info, .result-error { color: var(--error); }
.file-item.is-error .file-info::before, .result-error::before { content: "⚠ "; }

.tool-settings { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .segmented legend { font-weight: 600; font-size: 14px; color: var(--text); }
.field input[type="number"], .field input[type="text"], .field input[type="password"], .field textarea, .field select {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; font-size: 15px;
  border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--text);
}
.field input[type="number"]:focus, .field input[type="text"]:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.field input[type="color"] { width: 64px; height: 40px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-checkbox { flex-direction: row; align-items: center; gap: 10px; min-height: 28px; }
.field-checkbox input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.field-checkbox label { font-weight: 500; font-size: 15px; }
.field-hint { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.input-unit { position: relative; }
.input-unit span { position: absolute; right: 34px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; font-size: 13.5px; }
.range-wrap { display: flex; align-items: center; gap: 12px; }
.range-wrap input { flex: 1; accent-color: var(--brand); min-height: 28px; }
.range-wrap output { min-width: 3.6em; text-align: right; font-weight: 600; font-size: 14px; }
.segmented { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.segmented legend { margin-bottom: 6px; padding: 0; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label {
  display: inline-flex; align-items: center; min-height: 40px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface); font-size: 14.5px; font-weight: 500;
  transition: border-color var(--ease), background var(--ease);
}
.segmented label:hover { border-color: var(--brand); }
.segmented input:checked + label { background: var(--surface-accent); color: var(--brand); border-color: var(--brand); font-weight: 600; }
.segmented input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.field-details { border-top: 1px solid var(--border); padding-top: 12px; }
.field-details summary { cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--brand); min-height: 28px; }
.field-details-body { display: flex; flex-direction: column; gap: 16px; padding-top: 12px; }

.tool-status { min-height: 1.5em; margin: 14px 0 0; color: var(--text-muted); font-weight: 500; }
.tool-status:empty { display: none; }
.tool-status.is-error { color: var(--error); }
.tool-results { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.tool-results h2 { font-size: 22px; margin-bottom: 16px; }
.result-item img { width: 72px; height: 72px; }
.result-item .button { flex: none; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.register-cta { margin: 20px 0 0; padding: 16px 18px; border-radius: 16px; background: var(--surface-accent); color: var(--text); }

/* ---------- Crop editor ---------- */
.crop-stage { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; touch-action: none; user-select: none; }
.crop-image { display: block; max-width: 100%; max-height: 60vh; border-radius: 12px; }
.crop-shade-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 12px; }
.crop-shade { position: absolute; box-shadow: 0 0 0 9999px rgba(23, 38, 60, .55); }
.crop-box { position: absolute; outline: 2px solid #fff; cursor: move; }
.crop-box:focus-visible { outline: 3px solid var(--focus); }
.crop-box::before, .crop-box::after { content: ""; position: absolute; inset: 0; pointer-events: none; border: 0 solid rgba(255, 255, 255, .5); }
.crop-box::before { left: 33.33%; right: 33.33%; border-left-width: 1px; border-right-width: 1px; }
.crop-box::after { top: 33.33%; bottom: 33.33%; border-top-width: 1px; border-bottom-width: 1px; }
.crop-handle { position: absolute; width: 16px; height: 16px; background: #fff; border: 2px solid var(--brand); border-radius: 5px; z-index: 1; }
.crop-nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-n { left: calc(50% - 8px); top: -8px; cursor: ns-resize; }
.crop-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-e { right: -8px; top: calc(50% - 8px); cursor: ew-resize; }
.crop-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-s { left: calc(50% - 8px); bottom: -8px; cursor: ns-resize; }
.crop-sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-w { left: -8px; top: calc(50% - 8px); cursor: ew-resize; }
@media (pointer: coarse) {
  .crop-handle { width: 26px; height: 26px; margin: -5px; }
}

/* ---------- Live preview (rotate / flip) ---------- */
.live-preview { display: flex; justify-content: center; align-items: center; min-height: 240px; }
.live-preview canvas { max-width: 100%; max-height: 60vh; border-radius: 12px; background: var(--checker); }

/* ---------- Auth pages (allauth) ---------- */
.auth-box { max-width: 460px; margin: 48px auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 32px; }
.auth-box h1 { font-size: 28px; margin-bottom: 16px; }
.auth-box form p, .auth-box form > div { margin-bottom: 14px; }
.auth-box label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.auth-box input:not([type="checkbox"]):not([type="hidden"]) { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-control); font: inherit; }
.auth-box input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.auth-box button[type="submit"] { min-height: 48px; width: 100%; background: var(--brand); color: #fff; border: 0; border-radius: var(--radius-control); padding: 12px 18px; font: inherit; font-weight: 600; cursor: pointer; margin-top: 8px; }
.auth-box button[type="submit"]:hover { background: var(--brand-hover); }
.auth-box .helptext, .auth-box ul.errorlist { font-size: 13px; color: var(--text-muted); }
.auth-box ul.errorlist { color: var(--error); padding-left: 18px; }
.auth-box form ul:not(.errorlist) { font-size: 13.5px; line-height: 1.45; color: var(--text-muted); padding-left: 18px; margin: 6px 0 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .main-nav { display: none; }
  .header-actions { margin-left: auto; }
}
@media (max-width: 860px) {
  :root { --gutter: 18px; }
  .card-grid, .related-tools .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: 1fr; }
  .tool-workspace { grid-template-columns: 1fr; }
  .tool-side { position: static; }
  .footer-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { padding-top: 64px; }
  .hero { padding: 48px 0 44px; }
  .tool-ui { padding: 16px; }
}
@media (max-width: 520px) {
  .card-grid, .related-tools .card-grid { grid-template-columns: 1fr; }
  .logo-text { display: none; }
  .header-row { gap: 12px; min-height: 60px; }
  .header-actions { gap: 8px; }
  .header-user { display: none; }
  .footer-tools, .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-item { flex-wrap: wrap; }
  .result-item .button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Anchor grid (3×3) ---------- */
.anchor-grid { border: 0; padding: 0; margin: 0; }
.anchor-grid legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.anchor-cells { display: grid; grid-template-columns: repeat(3, 36px); gap: 4px; }
.anchor-cells input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.anchor-cells label { display: block; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; position: relative; }
.anchor-cells label::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--border); }
.anchor-cells label:hover { border-color: var(--brand); }
.anchor-cells input:checked + label { border-color: var(--brand); background: var(--surface-accent); }
.anchor-cells input:checked + label::after { background: var(--brand); }
.anchor-cells input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.button-group { display: flex; flex-wrap: wrap; gap: 8px; }
.field-label { font-weight: 600; font-size: 14px; color: var(--text); }
.file-thumb { display: grid; place-items: center; width: 56px; height: 56px; flex: none; border-radius: 10px; background: var(--surface-accent); color: var(--brand); font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.result-item .file-thumb { width: 72px; height: 72px; }
.result-expiry { flex-basis: 100%; margin: 4px 0 0; font-size: 13.5px; color: var(--text-muted); }

.result-note { color: var(--success); }
.result-total { flex-basis: 100%; margin: 0 0 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.field textarea { resize: vertical; min-height: 46px; line-height: 1.4; }
.field input[type="file"] { font: inherit; font-size: 14px; }
.server-notice { border: 1px solid #f0d49a; background: #fff8e8; border-radius: 14px; padding: 12px 14px; font-size: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.server-notice p { margin: 0; }
.file-item.is-fallback { border-color: #f0d49a; }
.field-note { margin: 0; font-size: 13.5px; color: var(--text-muted); padding-left: 22px; position: relative; }
.field-note::before { content: "ℹ"; position: absolute; left: 0; color: var(--brand); }
.sort-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; color: var(--text-muted); }
.file-item[draggable="true"] { cursor: grab; }
.tool-workspace.is-wide { grid-template-columns: minmax(0, 1fr); }
/* Metadata viewer */
.meta-summary, .meta-gps, .meta-toolbar, .tool-preview > .meta-warning, .tool-preview > .field-note { margin-bottom: 16px; }
.meta-summary { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.meta-preview { max-width: 240px; max-height: 240px; border-radius: var(--radius-control); border: 1px solid var(--border); object-fit: contain; background: var(--checker); }
.meta-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; font-size: 14.5px; }
.meta-facts dt { color: var(--text-muted); }
.meta-facts dd { margin: 0; font-weight: 600; }
.meta-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.meta-badge { background: #fdecee; color: var(--error); border-radius: var(--radius-tag); padding: 2px 10px; font-size: 13px; font-weight: 600; }
.meta-gps { border: 1px solid #f0d49a; background: #fff8e8; border-radius: 16px; padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.meta-gps h3 { margin: 0 0 4px; font-size: 16px; }
.meta-gps p { margin: 0; }
.meta-gps .button { align-self: flex-start; margin-top: 8px; }
.meta-warning { color: var(--error); font-size: 14px; }
.meta-toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.meta-filter { flex: 1 1 220px; min-width: 0; min-height: 42px; padding: 8px 12px; font: inherit; font-size: 15px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--text); }
.meta-filter:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.meta-toolbar .field-checkbox { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
@media (max-width: 640px) { .meta-group th { width: 45%; } .meta-group table { font-size: 13px; } .meta-preview { max-width: 100%; } }
.meta-group { border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; background: var(--surface); }
.meta-group summary { font-weight: 700; cursor: pointer; }
.meta-count { color: var(--text-muted); font-weight: 400; }
.meta-group table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; table-layout: fixed; }
.meta-group th { text-align: left; font-weight: 500; color: var(--text-muted); width: 38%; padding: 4px 8px 4px 0; vertical-align: top; overflow-wrap: anywhere; }
.meta-group td { padding: 2px 0; overflow-wrap: anywhere; }
.meta-value { all: unset; cursor: copy; overflow-wrap: anywhere; }
.meta-value:hover, .meta-value:focus-visible { color: var(--brand); outline: none; text-decoration: underline; }
.meta-thumb { max-width: 160px; border-radius: 8px; margin-top: 8px; display: block; }
/* Color picker */
.picker { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.picker-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.picker-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.picker-toolbar .field-checkbox { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
.picker-zoom-label { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.picker-hint { color: var(--text-muted); font-size: 13px; }
.picker-stage-wrap { position: relative; }
.picker-stage { overflow: auto; max-height: 600px; border: 1px solid var(--border); border-radius: 14px; background: var(--checker); }
.picker-stage:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.picker-layer { position: relative; }
.picker-image { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: pinch-zoom; }
.picker-image.is-pixelated { image-rendering: pixelated; }
.picker-marker { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1.5px #17263c; pointer-events: none; }
.picker-loupe { position: absolute; pointer-events: none; border-radius: 12px; border: 2px solid #fff; box-shadow: 0 6px 20px rgba(23, 38, 60, .3); background: #fff; }
.picker-panel { display: flex; flex-direction: column; gap: 14px; background: var(--page); border: 1px solid var(--border); border-radius: 18px; padding: 18px; position: sticky; top: 16px; }
.picker-current { display: flex; gap: 14px; align-items: center; }
.picker-swatch { width: 64px; height: 64px; border-radius: 14px; border: 1px solid var(--border); background: var(--checker); overflow: hidden; flex: none; }
.picker-swatch span { display: block; width: 100%; height: 100%; }
.picker-coords { margin: 0; color: var(--text-muted); font-size: 14px; }
.picker-values { display: flex; flex-direction: column; gap: 6px; }
.picker-value { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.picker-value-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.picker-value code { font-size: 14.5px; overflow-wrap: anywhere; }
.picker-more summary { cursor: pointer; font-size: 14px; color: var(--text-muted); margin-bottom: 6px; }
.picker-section h3 { font-size: 15px; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
.picker-palette-controls { display: flex; gap: 8px; margin-bottom: 8px; }
.picker-history { display: flex; flex-wrap: wrap; gap: 6px; }
.picker-chip { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 62px; }
.picker-chip span { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); }
.picker-chip small { font-size: 11px; color: var(--text-muted); }
.picker-chip:focus-visible span { outline: 3px solid var(--focus); }
@media (max-width: 860px) { .picker { grid-template-columns: 1fr; } .picker-panel { position: static; } .picker-hint { display: none; } }
/* Compare images */
.compare { display: flex; flex-direction: column; gap: 10px; }
.compare-view { background: var(--surface); }
.compare-view:fullscreen { overflow: auto; padding: 16px; }
.compare-cell { position: relative; min-width: 0; }
.compare-stage { overflow: auto; max-height: 640px; border: 1px solid var(--border); border-radius: 14px; background: var(--checker); }
.compare-layer { position: relative; margin: 0 auto; touch-action: pan-x pan-y; }
.compare-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.compare-view.is-pixelated .compare-canvas { image-rendering: pixelated; }
.compare-divider { position: absolute; background: #fff; box-shadow: 0 0 0 1px rgba(23, 38, 60, .45); z-index: 2; }
.compare-divider.is-vertical { top: 0; bottom: 0; width: 3px; margin-left: -1.5px; cursor: ew-resize; }
.compare-divider.is-horizontal { left: 0; right: 0; height: 3px; margin-top: -1.5px; cursor: ns-resize; }
.compare-divider::after { content: ""; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(23, 38, 60, .35); }
.compare-divider:focus-visible { outline: 3px solid var(--focus); }
.compare-layer:has(.compare-divider.is-vertical) { cursor: ew-resize; }
.compare-layer:has(.compare-divider.is-horizontal) { cursor: ns-resize; }
.compare-label { position: absolute; top: 10px; background: rgba(23, 38, 60, .72); color: #fff; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-tag); pointer-events: none; z-index: 3; }
.compare-label.is-a { left: 10px; }
.compare-label.is-b { right: 10px; }
.compare-side { display: grid; gap: 10px; }
.compare-side.is-row { grid-template-columns: 1fr 1fr; }
.compare-empty { padding: 40px 16px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: 14px; margin: 0; }
.compare-stats table { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare-stats th, .compare-stats td { text-align: left; padding: 4px 8px 4px 0; overflow-wrap: anywhere; }
.compare-stats th { color: var(--text-muted); font-weight: 600; }
.compare-stats p { margin: 6px 0 0; font-weight: 600; }
@media (max-width: 640px) { .compare-side.is-row { grid-template-columns: 1fr; } }
.video-preview { display: block; width: 100%; max-height: 420px; border-radius: 14px; background: #000; }
/* Account */
.account-page { max-width: 880px; padding-top: 8px; padding-bottom: 48px; }
.account-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; margin-bottom: 20px; }
.account-section h2 { font-size: 1.3rem; margin: 0 0 12px; }
.history-list { list-style: none; margin: 14px 0 0; padding: 0; }
.history-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.history-main, .history-result { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history-result { align-items: flex-end; text-align: right; }
.history-tool { font-weight: 600; }
.history-meta { color: var(--text-muted); font-size: 14px; overflow-wrap: anywhere; }
.history-meta.is-error { color: var(--error); }
.account-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0 0 16px; }
.account-facts dt { color: var(--text-muted); }
.account-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.account-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: var(--radius-tag); background: #e6f6ee; color: var(--success); font-size: 12.5px; font-weight: 600; }
.account-actions { margin: 0 0 10px; display: inline-flex; gap: 8px; margin-right: 8px; }
.account-delete { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; }
.account-delete summary { cursor: pointer; color: var(--error); font-weight: 600; }
.account-delete input[type="password"] { width: 100%; max-width: 360px; min-height: 44px; padding: 8px 12px; font: inherit; border: 1px solid var(--border); border-radius: var(--radius-control); }
.button-danger { background: var(--error); border-color: var(--error); color: #fff; }
.button-danger:hover { filter: brightness(.92); color: #fff; }
@media (max-width: 640px) { .history-result { align-items: flex-start; text-align: left; } }
/* Cookie consent */
.cookie-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50; max-width: 720px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 10px 40px rgba(23, 38, 60, .18); font-size: 14.5px; }
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; flex: 1 1 320px; }
.cookie-actions { display: flex; gap: 8px; }
.footer-links .link-button { color: inherit; font-size: inherit; }
