:root {
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans CJK JP", "Yu Gothic", Meiryo, sans-serif;
  font-synthesis: none;
  color: #25352f;
  background: #f3f5f4;
  --accent: #1d6455;
  --line: #dce4df;
  --muted: #5c6b63;
  --warning: #885323;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 1rem; line-height: 1.65; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, select, summary { cursor: pointer; }
button { border: 0; transition: background .15s; }
button:disabled { opacity: .48; cursor: not-allowed; }
button:hover:not(:disabled) { filter: brightness(.95); }
:focus-visible { outline: 3px solid #308a72; outline-offset: 4px; }
[tabindex="-1"]:focus { outline: none; }
a { color: inherit; text-underline-offset: 4px; }
[hidden] { display: none !important; }
.site-header { max-width: 1240px; margin: auto; padding: 20px 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.brand { white-space: nowrap; display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; font-size: 1.5rem; letter-spacing: .04em; }
.brand-en { font-size: .75rem; letter-spacing: .15em; margin-left: 6px; color: var(--muted); font-weight: 600; }
.mark { flex: 0 0 auto; display: grid; place-items: center; background: var(--accent); color: white; width: 36px; height: 36px; border-radius: 11px; font-size: 1.8rem; line-height: 1; }
.private-label { font-size: .8125rem; color: var(--accent); background: #e7eeeb; padding: 6px 10px; border-radius: 6px; }
main { max-width: 1240px; margin: auto; padding: 0 40px; }
.host-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding-top: 14px; color: var(--muted); font-size: .8125rem; }
.host-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.intro { display: flex; justify-content: space-between; align-items: center; gap: 28px; padding: 18px 0 28px; }
.eyebrow { font-size: .75rem; letter-spacing: .14em; font-weight: 700; color: var(--accent); margin: 0 0 6px; }
h1 { font-size: 1.9375rem; line-height: 1.45; letter-spacing: .025em; margin: 0 0 8px; font-weight: 750; }
.intro p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: .875rem; }
.mobile-break { display: none; }
.privacy { display: flex; align-items: center; gap: 12px; }
.privacy svg { width: 28px; height: 28px; flex: 0 0 auto; stroke: var(--accent); stroke-width: 1.5; fill: none; }
.privacy strong { font-size: .875rem; display: block; font-weight: 600; }
.privacy span { display: block; font-size: .8125rem; color: var(--muted); margin-top: 2px; }
/* Reading order remains 01 → 02 → 03 on every screen. */
.workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: white; border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.select-panel { grid-column: 1 / -1; }
.settings-panel { grid-column: 1; }
.results-panel { grid-column: 2; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 20px 22px 0; }
h2 { font-size: 1.0625rem; font-weight: 700; margin: 0; line-height: 1.6; letter-spacing: .015em; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; background: #edf3ef; color: var(--accent); border-radius: 8px; font-size: .75rem; margin-right: 6px; vertical-align: 1px; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: .8125rem; }
.dropzone { margin: 16px 22px 4px; border: 1px dashed #a7bdb1; border-radius: 10px; background: #f7faf8; padding: 22px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 0 16px; align-items: center; }
.dropzone.dragover { background: #dfefe6; border-color: var(--accent); }
.upload-icon { width: 44px; height: 44px; stroke: #488171; stroke-width: 1.5; fill: none; grid-row: 1 / 3; }
.drop-title { font-size: 1rem; font-weight: 600; margin: 0; }
.drop-sub { font-size: .875rem; color: var(--muted); margin: 2px 0 0; grid-column: 2; }
.dropzone .primary { grid-column: 3; grid-row: 1 / 3; }
.primary { background: var(--accent); color: white; font-weight: 600; border-radius: 8px; padding: 12px 22px; min-height: 48px; }
.primary span { margin-left: 20px; font-size: 1.125rem; font-weight: 400; }
.file-hint { font-size: .8125rem; color: var(--muted); margin: 10px 0 0; grid-column: 2 / -1; }
.format-help { padding: 0 22px 14px; font-size: .875rem; color: var(--muted); }
.format-help summary { width: fit-content; min-height: 44px; padding: 10px 0; }
.format-help p { margin: 0 0 6px; line-height: 1.8; max-width: 72ch; }
.selection-note { display: flex; flex-wrap: wrap; gap: 0 8px; margin: 8px 22px 0; font-size: .875rem; font-weight: 600; color: var(--accent); }
.has-files .dropzone { padding: 14px 18px; }
.has-files .upload-icon, .has-files .drop-title, .has-files .drop-sub, .has-files .file-hint { display: none; }
.has-files .dropzone { display: flex; justify-content: flex-start; border-style: solid; background: white; border: 0; padding: 0; margin-bottom: 0; }
.has-files .dropzone .primary { background: #edf3ef; color: var(--accent); }
.selection-errors { color: #953e31; }
.selection-note span { word-break: keep-all; }
.has-files .select-panel { display: grid; grid-template-columns: minmax(0,1fr) auto; }
.has-files .select-panel .section-head { grid-column: 1 / -1; }
.has-files .dropzone { grid-column: 2; grid-row: 2; margin: 12px 22px 0 0; }
.has-files .selection-note { grid-column: 1; grid-row: 2; align-self: center; margin-top: 12px; }
.has-files .format-help { grid-column: 1 / -1; }
fieldset { border: 0; padding: 22px; margin: 0; min-width: 0; }
.field-label { display: block; font-size: .9375rem; font-weight: 600; margin: 0 0 8px; }
select, input[type=number] { background: white; border: 1px solid #bfcfc5; border-radius: 7px; width: 100%; color: #25352f; min-height: 48px; padding: 9px 11px; font-size: 1rem; }
select { padding-right: 22px; }
.help { color: var(--muted); font-size: .875rem; line-height: 1.75; margin: 8px 0 22px; }
.row-label { display: flex; justify-content: space-between; }
.row-label span { font-size: .8125rem; color: var(--muted); font-weight: 400; }
.dimensions { display: flex; align-items: flex-end; gap: 12px; }
.dimensions label { flex: 1; min-width: 0; font-size: .875rem; color: var(--muted); }
.dimensions input { margin-top: 4px; font-variant-numeric: tabular-nums; }
.dimensions > span { padding-bottom: 11px; color: var(--muted); }
.notice { background: #f2f5f3; border-radius: 6px; padding: 10px 12px; }
.quality-label { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.quality-label .field-label { margin: 0; }
.quality-label output { font-size: 1rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
input[type=range] { accent-color: var(--accent); width: 100%; margin: 0; min-height: 44px; cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; font-size: .8125rem; color: var(--muted); }
.process { width: 100%; }
.text-button { background: transparent; color: var(--muted); font-size: .875rem; padding: 9px 4px; min-height: 44px; text-decoration: underline; text-underline-offset: 4px; }
#results-title { scroll-margin-top: 20px; }
.status { margin: 12px 22px 0; color: var(--muted); font-size: .875rem; }
.status.error { color: #953e31; }
#batch-progress { accent-color: var(--accent); display: block; margin: 14px 22px; width: calc(100% - 44px); height: 10px; border: 0; border-radius: 5px; overflow: hidden; }
#batch-progress::-webkit-progress-bar { background: #eaf0ec; }
#batch-progress::-webkit-progress-value { background: var(--accent); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-glyph { font-size: 2.4rem; line-height: 1.3; color: #79988a; }
.empty p { font-size: 1rem; margin: 10px 0 2px; }
.empty span { font-size: .875rem; }
.summary { margin: 18px 22px; border: 1px solid #dce9e0; border-radius: 10px; padding: 16px 18px; background: #f2f7f3; }
.summary-title { font-size: .8125rem; color: var(--muted); margin: 0 0 8px; }
.summary-sizes { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.summary-sizes > div + div { padding-left: 18px; border-left: 1px solid #d3e0d6; }
.summary-sizes span { display: block; font-size: .875rem; color: var(--muted); }
.summary-sizes strong { display: block; font-size: 1.625rem; line-height: 1.5; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -.015em; }
.summary-sizes > div:first-child strong { color: #54675c; font-weight: 500; }
.summary-change { color: var(--accent); font-size: .875rem; font-weight: 600; margin: 10px 0 0; }
.summary[data-increase=true] { background: #fcf7ef; border-color: #eadbc5; }
.summary[data-increase=true] .summary-change { color: var(--warning); }
.save-bar { border-block: 1px solid var(--line); padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: #fbfdfb; position: sticky; top: 0; z-index: 2; }
.save-bar p { font-size: .8125rem; color: var(--muted); margin: 0; }
.dark-button { background: #293e33; color: white; border-radius: 8px; min-height: 48px; padding: 11px 16px; font-size: .9375rem; white-space: nowrap; }
.dark-button span { font-size: .75rem; opacity: .85; border-left: 1px solid #718178; margin-left: 10px; padding-left: 10px; }
.results { padding: 0 22px; }
.image-card { display: grid; grid-template-columns: 64px minmax(0,1fr); gap: 12px 16px; padding: 22px 0; border-bottom: 1px solid var(--line); align-items: start; }
.image-card:last-child { border-bottom: 0; }
.thumb { width: 64px; height: 64px; object-fit: contain; background: repeating-conic-gradient(#e6ece8 0% 25%,#f9faf9 0% 50%) 0/14px 14px; border-radius: 8px; }
.error-thumb { display: grid; place-items: center; font-size: 1.625rem; color: #953e31; background: #fbefeb; }
.file-name { margin: 0 0 8px; overflow-wrap: anywhere; font-size: .9375rem; font-weight: 650; line-height: 1.65; }
.file-meta, .out-meta { color: var(--muted); font-size: .875rem; margin: 3px 0; font-variant-numeric: tabular-nums; }
.out-meta { color: var(--accent); }
.size-change { font-size: .8125rem; font-weight: 600; color: var(--accent); margin: 8px 0 0; }
.size-warning { font-size: .875rem; line-height: 1.7; color: var(--warning); margin: 8px 0 0; }
.increased { color: var(--warning); }
.error-message { color: #953e31; font-size: .875rem; margin: 4px 0; line-height: 1.8; }
.card-actions { grid-column: 2; display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.small-button { background: #edf3ef; color: var(--accent); border-radius: 7px; min-height: 44px; min-width: 76px; padding: 8px 18px; font-size: .875rem; font-weight: 600; }
.remove-button { font-size: .875rem; background: transparent; color: var(--muted); min-height: 44px; min-width: 44px; padding: 8px 12px; margin-left: auto; }
.card-actions .remove-button:only-child { grid-column: 3; justify-self: end; }
.footnotes { margin: 28px 0; color: var(--muted); font-size: .8125rem; line-height: 1.9; }
.footnotes p { margin: 8px 0; }
.host-footer { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 18px 0; font-size: .8125rem; color: var(--muted); }
.host-footer a { display: inline-flex; align-items: center; min-height: 44px; }
footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 0 24px; color: #637569; font-size: .75rem; letter-spacing: .08em; }
.footer-brand { font-size: 1.1875rem; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.noscript-note { border: 1px solid var(--line); background: white; padding: 16px; border-radius: 10px; }
/* A single large comparison viewport on phones, paired images on wider screens. */
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 24px; width: min(960px,calc(100% - 28px)); max-height: calc(100dvh - 28px); color: #25352f; }
dialog::backdrop { background: #18291ed9; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.icon-button { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; background: #edf1ef; font-size: 1.625rem; }
.compare-name { font-size: .875rem; overflow-wrap: anywhere; margin: 16px 0 4px; }
.compare-change { font-size: .9375rem; color: var(--accent); font-weight: 600; margin: 0 0 16px; }
.compare-change.increased { color: var(--warning); }
.compare-switch { display: none; }
.compare-images { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
figure { margin: 0; min-width: 0; }
.checker { background: repeating-conic-gradient(#e4eae6 0% 25%,#f8faf8 0% 50%) 0/20px 20px; border-radius: 10px; height: 300px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.checker img { width: 100%; height: 100%; object-fit: contain; }
figcaption { display: flex; flex-direction: column; font-size: .9375rem; padding-top: 10px; }
figcaption span { color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
dialog .help { margin: 16px 0; }
dialog .primary { display: block; margin-left: auto; }
@media (max-width: 950px) {
  main { padding: 0 24px; }
  .site-header { padding: 18px 24px; }
  .intro { flex-direction: column; align-items: flex-start; gap: 14px; }
  .privacy span { display: none; }
  .workspace { grid-template-columns: 280px minmax(0,1fr); gap: 16px; }
  .section-head { padding: 18px 18px 0; }
  fieldset { padding: 20px 18px; }
  .results { padding: 0 18px; }
  .summary { margin-inline: 18px; }
  .summary-sizes strong { font-size: 1.375rem; }
  .save-bar { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 18px; }
  .image-card { grid-template-columns: 48px minmax(0,1fr); gap: 12px; }
  .thumb { width: 48px; height: 48px; }
  .card-actions { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .site-header { padding: 15px 18px; }
  .brand { font-size: 1.4375rem; gap: 9px; }
  .brand-en { display: none; }
  .private-label { font-size: .75rem; padding: 5px 8px; }
  main { padding: 0 16px; }
  .host-nav { font-size: .8125rem; padding-top: 6px; gap: 0 8px; }
  .intro { padding: 12px 2px 22px; gap: 14px; }
  h1 { font-size: 1.75rem; }
  .mobile-break { display: block; }
  .privacy svg { width: 24px; height: 24px; }
  .workspace { display: flex; flex-direction: column; gap: 16px; }
  .panel { width: 100%; border-radius: 12px; }
  .dropzone { display: block; margin: 16px 18px 4px; padding: 20px 16px; text-align: center; }
  .upload-icon { width: 36px; height: 36px; display: block; margin: 0 auto 8px; }
  .drop-sub { font-size: .8125rem; }
  .dropzone .primary { width: 100%; margin-top: 14px; }
  .file-hint { font-size: .8125rem; margin-top: 10px; }
  .format-help { padding: 0 18px 10px; }
  .has-files .dropzone { margin: 12px 18px 0 0; }
  .has-files .dropzone .primary { width: auto; margin-top: 0; padding-inline: 18px; }
  .selection-note { display: flex; flex-wrap: wrap; gap: 0 8px; margin: 8px 18px 0; }
  .has-files .format-help { padding-bottom: 6px; }
  .dimensions { gap: 14px; }
  .summary-sizes strong { font-size: 1.5rem; }
  .status { margin-inline: 18px; }
  #batch-progress { margin-inline: 18px; width: calc(100% - 36px); }
  .image-card { grid-template-columns: 56px minmax(0,1fr); gap: 12px; padding-block: 20px; }
  .thumb { width: 56px; height: 56px; }
  .file-name { font-size: .9375rem; }
  .card-actions { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
  .small-button { min-width: 0; }
  .remove-button { margin-left: 0; }
  .footnotes { margin: 24px 2px; }
  .host-footer { gap: 2px 20px; }
  footer { font-size: .6875rem; }
  dialog { padding: 18px; width: calc(100% - 24px); }
  .compare-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; border-radius: 9px; background: #edf1ee; padding: 4px; margin: 14px 0; }
  .compare-switch button { background: transparent; border-radius: 6px; min-height: 44px; padding: 8px 12px; color: var(--muted); font-size: .9375rem; }
  .compare-switch button[aria-pressed=true] { background: white; color: var(--accent); font-weight: 700; box-shadow: 0 1px 3px #233d241a; }
  .compare-images { display: block; }
  [data-view=after] .before-figure, [data-view=before] .after-figure { display: none; }
  .checker { height: clamp(180px,32dvh,320px); }
  dialog .help { font-size: .8125rem; }
  dialog .primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
