:root {
  --color-primary: #1262d6;
  --color-primary-hover: #0d4fae;
  --color-primary-soft: #eaf2ff;
  --color-text: #172033;
  --color-muted: #5c677d;
  --color-border: #dbe2ed;
  --color-border-soft: #b7c7dd;
  --color-bg: #f6f8fb;
  --color-bg-soft: #f9fbff;
  --color-surface: #ffffff;
  --color-success: #14804a;
  --color-success-soft: #e9f8f0;
  --color-danger: #bd2c3b;
  --color-danger-soft: #fff0f1;
  --radius-sx: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --shadow-card: 0 12px 34px rgba(21, 39, 72, 0.08);
  --content-width: 1080px;
}


::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(92, 103, 125, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(92, 103, 125, 0.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--color-text);
  background: var(--color-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }


a { color: var(--color-primary); text-underline-offset: 3px; transition: color 0.15s ease; }
a:hover { color: var(--color-primary-hover); }

img { max-width: 100%; }

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  padding: 10px 14px;
  color: #fff;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
}

.site-header {
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.97);
}

.nav-wrap {
  width: min(calc(100% - 32px), var(--content-width));
  min-height: 58px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-size: 17px;
  font-weight: 760;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: block;
  flex: 0 0 auto;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-left: auto;
}

.site-nav a {
  padding: 9px 11px;
  color: #344057;
  border-radius: var(--radius-sx);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease-in-out;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--color-primary); background: var(--color-primary-soft); }

.page-shell {
  width: min(calc(100% - 32px), var(--content-width));
  margin: 0 auto;
}

.hero {
  max-width: 800px;
  margin: 0 auto;
  padding: 30px 0 14px;
  text-align: center;
}

.breadcrumb {
  margin: 0 0 18px;
  color: var(--color-muted);
  font-size: 14px;
  text-align: left;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb li:not(:last-child)::after { content: "/"; margin-left: 7px; color: #9aa4b5; }
.breadcrumb a { color: var(--color-muted); }

h1,
h2,
h3 { line-height: 1.2; letter-spacing: -0.025em; }

h1 { margin: 0; font-size: clamp(22px, 3.6vw, 28px); font-weight: 700; letter-spacing: -0.015em;}

.hero-copy {
  max-width: 690px;
  margin: 16px auto 0;
  color: var(--color-muted);
  font-size: clamp(14px, 2vw, 16px);
}

.scanner-app { max-width: 1040px; margin: 0 auto; scroll-margin-top: 20px; }
.scanner-workspace { display: grid; grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.25fr); gap: 16px; align-items: stretch; height: 448px; min-height: 440px; }

.scanner-card,
.scanner-feedback {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}

.scanner-card { display: grid; grid-template-rows: auto minmax(0, 1fr); }

.scanner-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background: #f8fafe;
  border-radius: calc(var(--radius-sm) - 1px) calc(var(--radius-sm) - 1px) 0 0;
}

.scanner-tab {
  min-height: 42px;
  padding: 8px 16px;
  color: var(--color-muted);
  border: 0;
  background: transparent;
  font-weight: 720;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.scanner-tab.is-active {
  color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: inset 0 -2px 0 var(--color-primary);
}
.scanner-tab:not(.is-active):hover {
  color: var(--color-text);
  background: var(--color-surface);
}
.scanner-tab:focus { outline: none; }
.scanner-tab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -4px; }

.scanner-panel { min-height: 0; padding: 14px; background: var(--color-surface);}
#upload-panel { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 0; }

.drop-zone, .camera-placeholder {
  min-height: 0;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 18px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius-md);
  text-align: center;
  transition: all 0.2s ease-in-out;
}

.drop-zone.is-dragging {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  border-style: solid;
}
.drop-content { max-width: 560px; }

.state-icon-wrap {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
}
.state-icon { width: 36px; height: 36px; display: block; object-fit: contain; }
.upload-icon { margin: 0 auto 12px; }

.drop-title { margin: 0; font-size: 16px; font-weight: 760; }
.drop-copy { margin: 5px 0 14px; color: var(--color-muted); }
.drop-title-touch { display: none; }
.drop-zone.is-dragging .drop-title > span { display: none; }
.drop-zone.is-dragging .drop-title::after { content: "Drop image to scan"; }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 720;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.button:disabled { opacity: 0.58; cursor: wait; }
.button-primary { color: #fff; background: var(--color-primary); border-color: var(--color-primary); }
.button-primary:hover { color: #fff; background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.button-secondary { color: #26344d; background: var(--color-surface); border-color: #cfd8e6; }
.button-secondary:hover { color: var(--color-primary); border-color: #9db7dd; background: #f8fbff; }

.file-formats { margin: 10px 0 0; color: #667289; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
.paste-hint { margin: 13px 0 0; color: var(--color-muted); font-size: 13px; }
.paste-hint kbd { padding: 2px 6px; border: 1px solid #cfd6e2; background: var(--color-surface); border-radius: 4px; box-shadow: 0 1px 0 #cfd6e2; font: inherit; font-size: 12px; }
.privacy-line { margin: 10px 0 0; color: #4e5a70; font-size: 12px; font-weight: 650; white-space: nowrap; }

.image-preview {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 68px;
  margin: 8px 0 0 0;
  padding: 7px 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-soft);
}

.image-preview img { width: 54px; height: 54px; object-fit: contain; background: #f2f4f8; border-radius: 6px; }
.preview-label { margin: 2px 0 0; color: var(--color-muted); font-size: 12px; }
.source-name { margin: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 700; }

#camera-panel { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 0; }
#camera-panel[data-camera-state="active"] { gap: 12px; }
.camera-stage { position: relative; min-height: 0; overflow: hidden; }

.camera-placeholder-content { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 17px; text-align: center; }
.camera-placeholder-intro { display: flex; flex-direction: column; align-items: center; gap: 11px; }
.camera-placeholder-icon { margin: 0; }
.camera-placeholder-copy { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.camera-placeholder h2 { margin: 0; font-size: 17px; line-height: 1.25; }
.camera-placeholder-copy p { max-width: 420px; margin: 0; color: var(--color-muted); }
.camera-placeholder .button { min-width: 142px; }
.camera-privacy { margin: 0; color: var(--color-muted); font-size: 12px; }
.camera-live-area { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 12px; background: #101724; }
#camera-panel[data-camera-state="requesting"] .camera-live-area { position: fixed; top: 0; left: -10000px; display: block; width: min(900px, calc(100vw - 32px)); height: min(650px, calc(100vh - 32px)); }
.scanner-mount { width: 100%; height: 100%; }
.scanner-mount > div { width: 100% !important; height: 100% !important; }
.scanner-mount video { width: 100% !important; height: 100% !important; object-fit: cover !important; }
.scan-corners { position: absolute; z-index: 3; top: 50%; left: 50%; width: min(72%, 372px); aspect-ratio: 1 / 0.9; transform: translate(-50%, -50%); pointer-events: none; }
.scan-corners span { position: absolute; width: 34px; height: 34px; border-color: #7db6ff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35)); }
.scan-corners span:nth-child(1) { top: 0; left: 0; border-top: 4px solid; border-left: 4px solid; border-radius: 8px 0 0; }
.scan-corners span:nth-child(2) { top: 0; right: 0; border-top: 4px solid; border-right: 4px solid; border-radius: 0 8px 0 0; }
.scan-corners span:nth-child(3) { right: 0; bottom: 0; border-right: 4px solid; border-bottom: 4px solid; border-radius: 0 0 8px 0; }
.scan-corners span:nth-child(4) { bottom: 0; left: 0; border-bottom: 4px solid; border-left: 4px solid; border-radius: 0 0 0 8px; }
.camera-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin: 0; }

.scanner-feedback { position: relative; display: flex; flex-direction: column; min-height: 0; }
.history-feedback-slot { position: absolute; z-index: 2; top: 10px; right: 10px; }
.history-trigger { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 5px 8px; color: #62708a; border: 1px solid #e5eaf2; border-radius: 7px; background: #f6f8fb; font: inherit; font-size: 13px; font-weight: 680; cursor: pointer; transition: color 0.15s ease-in-out, border-color 0.15s ease-in-out, background-color 0.15s ease-in-out; }
.history-trigger-icon { width: 16px; height: 16px; flex: 0 0 auto; }
.history-trigger-badge { min-width: 17px; height: 17px; display: inline-grid; place-items: center; padding: 0 4px; color: #4f6482; border-radius: 999px; background: #e9eff8; font-size: 11px; font-weight: 750; line-height: 1; }
.history-trigger:hover { color: var(--color-primary); border-color: #cbd8ea; background: #f1f5fb; }
.history-trigger:focus-visible { color: var(--color-primary-hover); outline: 2px solid var(--color-primary); outline-offset: 2px; }
.feedback-empty { display: flex; flex: 1 1 auto; min-height: 0; padding: 34px; flex-direction: column; align-items: center; justify-content: center; color: #536078; text-align: center; }
.feedback-icon { margin-bottom: 10px; }
.feedback-empty h2 { margin: 0; color: var(--color-text); font-size:16px; }
.feedback-detail { margin: 10px 0 0; color: #667289; font-size: 13px; }
.scan-status { display: flex; flex: 1 1 auto; align-items: center; justify-content: center; gap: 7px; min-height: 0; margin: 0; padding: 34px; color: #4f5d73; font-size: 15px; font-weight: 650; text-align: center; }
.scan-status::before { width: 18px; height: 18px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #edf1f7; color: #4f5d73; content: "i"; font-size: 12px; font-weight: 800; font-family: ui-sans-serif, sans-serif; }
.scan-status.is-working { color: var(--color-primary); }
.scan-status.is-working::before { border: 2px solid #bcd6fb; border-top-color: var(--color-primary); background: transparent; content: ""; animation: status-spin 0.85s linear infinite; }
.scan-status.is-success { color: var(--color-success); }
.scan-status.is-success::before { background: var(--color-success-soft); color: var(--color-success); content: "\2713"; }
.scan-status.is-error { color: var(--color-danger); }
.scan-status.is-error::before { background: var(--color-danger-soft); color: var(--color-danger); content: "!"; }
.scan-status.is-info::before { background: var(--color-primary-soft); color: var(--color-primary); content: "i"; }
@keyframes status-spin { to { transform: rotate(360deg); } }

.result-region { min-height: 0; display: flex; flex: 1 1 auto; margin: 0; padding: 16px; overflow: hidden; scroll-margin-top: 20px; }

.result-card { min-height: 0; display: flex; flex: 1 1 auto; flex-direction: column; padding: 0; border: 0; background: var(--color-surface); border-radius: 0; box-shadow: none; }
.result-header { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--color-border); }
.result-check { width: 34px; height: 34px; display: grid; flex: 0 0 auto; place-items: center; color: var(--color-success); background: var(--color-success-soft); border-radius: 50%; font-size: 20px; font-weight: 800; }
.result-title { flex: 1 1 auto; margin: 0; font-size: clamp(18px, 2.5vw, 20px);}
.result-title:focus { outline: none; }
.result-header .history-trigger { flex: 0 0 auto; }
.result-clear { min-height: 32px; padding: 6px 8px; color: #62708a; border: 0; border-radius: 6px; background: transparent; font: inherit; font-size: 13px; font-weight: 680; cursor: pointer; transition: all 0.15s ease-in-out; }
.result-clear:hover { color: var(--color-primary); background: var(--color-primary-soft); }
.result-clear:focus-visible { color: var(--color-primary-hover); outline: 2px solid var(--color-primary); outline-offset: 2px; }
.result-body { min-height: 0; flex: 1 1 auto; padding: 16px 2px 8px 0; overflow-y: auto; scrollbar-gutter: stable; }
.result-kind { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 10px; color: var(--color-primary); font-size: 14px; font-weight: 760; }
.result-kind-icon { width: 17px; height: 17px; flex: 0 0 auto; }
.result-fields { display: grid; gap: 1px; margin: 0; overflow: hidden; border: 1px solid var(--color-border); background: var(--color-border); border-radius: var(--radius-sm); }
.result-field { display: grid; grid-template-columns: minmax(120px, 0.34fr) minmax(0, 1fr); background: var(--color-surface); }
.result-label,
.result-value { margin: 0; padding: 12px 14px; }
.result-label { color: #536078; background: #f8fafd; font-size: 13px; font-weight: 700; }
.result-value { overflow-wrap: anywhere; color: #202b40; }
.preserve-text { white-space: pre-wrap; word-break: break-word; }
.url-result {
  padding: 13px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}
.url-value { margin: 0; overflow-wrap: anywhere; color: #1d2d46; font-weight: 680; line-height: 1.5; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.result-action { flex: 0 1 auto; font-size: 14px; }
.result-action-primary { color: #fff; border-color: var(--color-primary); background: var(--color-primary); }
.result-action-primary:hover { color: #fff; border-color: var(--color-primary-hover); background: var(--color-primary-hover); }
.result-action-quiet { min-height: 32px; padding: 5px 8px; color: #52617a; border-color: transparent; background: transparent; font-size: 13px; font-weight: 650; transition: all 0.15s ease-in-out; }
.result-action-quiet:hover { color: var(--color-primary); border-color: transparent; background: var(--color-primary-soft); }
.button-symbol { min-width: 17px; color: currentColor; font-size: 17px; line-height: 1; }
.raw-details { margin-top: 14px; border-top: 1px solid var(--color-border); padding-top: 10px; }
.raw-summary { color: #52617a; font-size: 13px; font-weight: 680; cursor: pointer; }
.raw-value {
  max-height: 280px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #2b364c;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.security-note { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; padding: 6px 12px; color: #92400e; background: #fffbeb; border-left: 4px solid #f59e0b; border-radius: 4px; font-size: 12px; }
.security-note-icon { width: 14px; height: 14px; flex: 0 0 auto; margin-top: 1px; color: #b45309; }
.error-card { border-color: #f1c6cb; background: #fffdfd; }
.error-card .result-title { color: var(--color-danger); }
.error-card p { color: var(--color-muted); }
.error-card ul { margin: 0 0 20px; padding-left: 22px; }
.error-intro { margin-bottom: 2px; font-weight: 700; }
.clipboard-fallback { position: fixed; left: -9999px; top: 0; }

.history-backdrop { position: fixed; z-index: 1100; inset: 0; background: rgba(20, 31, 49, 0.38); }
.history-drawer { position: fixed; z-index: 1101; top: 0; right: 0; width: min(400px, calc(100vw - 24px)); height: 100dvh; display: flex; flex-direction: column; padding: 20px; color: var(--color-text); background: var(--color-surface); box-shadow: -16px 0 36px rgba(21, 36, 60, 0.2); }
.history-drawer-header { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--color-border); }
.history-drawer-header h2 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 22px; }
#history-drawer-count { color: var(--color-muted); font-weight: 650; }
.history-clear-all,
.history-close,
.history-confirm-button,
.history-cancel-button { min-height: 32px; border: 0; border-radius: 6px; background: transparent; font: inherit; font-size: 13px; font-weight: 680; cursor: pointer; transition: all 0.15s ease-in-out; }
.history-clear-all { padding: 6px 8px; color: #9d4350; }
.history-clear-all:hover { color: #8a2533; background: var(--color-danger-soft); }
.history-close { width: 32px; padding: 0; color: #52617a; font-size: 21px; line-height: 1; }
.history-close:hover { color: var(--color-primary); background: var(--color-primary-soft); }
.history-clear-confirm { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; gap: 7px; margin: 12px 0 4px; padding: 10px; color: #71414a; background: #fff7f8; border: 1px solid #f1d5d9; border-radius: var(--radius-sm); font-size: 13px; }
.history-clear-confirm span { flex: 1 1 100%; }
.history-confirm-button { padding: 5px 8px; color: #fff; background: #a83c4b; }
.history-confirm-button:hover { background: #902b39; }
.history-cancel-button { padding: 5px 8px; color: #52617a; background: var(--color-surface); }
.history-cancel-button:hover { color: var(--color-primary); background: var(--color-primary-soft); }
.history-list { display: grid; flex: 1 1 auto; min-height: 0; gap: 8px; margin: 14px -4px 0; padding: 0 4px; overflow-y: auto; overscroll-behavior: contain; align-content: start; }
.history-list:empty { display: none; }
.history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; padding: 9px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); }
.history-item-main { min-width: 0; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: center; padding: 0; color: inherit; border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.history-item-main:hover .history-item-details strong { color: var(--color-primary); }
.history-item-main:focus-visible { border-radius: 5px; outline: 2px solid var(--color-primary); outline-offset: 2px; }
.history-thumbnail { width: 56px; height: 56px; display: grid; place-items: center; overflow: hidden; color: var(--color-primary); background: var(--color-primary-soft); border-radius: 8px; }
.history-thumbnail .history-item-icon { width: 21px; height: 21px; display: block; }
.history-thumbnail-image { width: 100%; height: 100%; display: block; object-fit: contain; background: #f8fafd; }
.history-item-icon-image { object-fit: contain; }
.history-item-details { min-width: 0; display: grid; gap: 2px; }
.history-item-details strong { overflow: hidden; color: #253650; font-size: 13px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.history-item-value { display: -webkit-box; overflow: hidden; color: #536078; font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.history-item-date { color: #667289; font-size: 11px; line-height: 1.3; }
.history-item-actions { display: flex; align-items: center; gap: 2px; }
.history-icon-button { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; color: #64718a; border: 0; border-radius: 6px; background: transparent; cursor: pointer; transition: all 0.15s ease-in-out; }
.history-icon-button svg { width: 16px; height: 16px; }
.history-icon-button:hover { color: var(--color-primary); background: var(--color-primary-soft); }
.history-icon-button.history-delete:hover { color: var(--color-danger); background: var(--color-danger-soft); }
.history-icon-button:focus-visible,
.history-clear-all:focus-visible,
.history-close:focus-visible,
.history-confirm-button:focus-visible,
.history-cancel-button:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.history-empty { display: flex; flex: 1 1 auto; flex-direction: column; align-items: center; justify-content: center; min-height: 0; padding: 28px 12px; color: var(--color-muted); text-align: center; }
.history-empty-icon { margin-bottom: 10px; }
.history-empty h3 { margin: 0; color: var(--color-text); font-size: 17px; }
.history-empty p { max-width: 260px; margin: 7px 0 0; font-size: 13px; line-height: 1.5; }
.history-privacy { flex: 0 0 auto; margin: 14px 0 0; padding-top: 12px; color: #667289; border-top: 1px solid var(--color-border); font-size: 12px; text-align: center; }
body.history-open { overflow: hidden; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; clip-path: inset(50%) !important; white-space: nowrap !important; }

.ad-slot { min-height: 220px; max-width: 970px; margin: 18px auto; color: #667289;  font-size: 12px; text-align: center; }
.ad-slot > span { display: block; }

.content-section { max-width: 900px; margin: 48px auto; }
.content-section > h2 { margin: 0 0 14px; font-size: clamp(20px, 3.0vw, 22px); }
.content-section > p,
.content-section > ul,
.content-section > ol { color: #3f4d64; }
.content-section p a,
.content-section li a { font-weight: 650; text-decoration-thickness: 1.5px; }
.content-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.info-card { padding: 20px; border: 1px solid var(--color-border); background: var(--color-surface); border-radius: var(--radius-sm); }
.info-card-icon { width: 23px; height: 23px; display: block; margin: 0 0 11px; color: var(--color-primary); }
.info-card h3 { margin: 0 0 8px; font-size: 18px; }
.info-card p { margin: 0; color: #536078; font-size: 14px; }
.tool-directory { max-width: 980px; margin: 56px auto; padding: clamp(22px, 4vw, 34px); border: 1px solid var(--color-border); background: var(--color-surface); border-radius: var(--radius-md); }
.tool-directory > h2 { margin: 0 0 8px; font-size: clamp(20px, 3.0vw, 22px); }
.tool-directory > p { margin: 0 0 24px; color: #536078; }
.tool-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px; }
.tool-group h3 { margin: 0 0 10px; color: #56637a; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.tool-group ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.tool-group a { display: inline; padding: 1px 3px; color: #26364f; border-radius: 4px; font-size: 14px; font-weight: 650; text-decoration: none; text-underline-offset: 3px; }
.tool-group a:hover { color: var(--color-primary-hover); background: #eef5ff; text-decoration: underline; }
.tool-group a:focus-visible { color: var(--color-primary-hover); background: var(--color-primary-soft); outline: 2px solid var(--color-primary); outline-offset: 2px; }

.faq-list { display: grid; gap: 10px; }
.faq-list details { border: 1px solid var(--color-border); background: var(--color-surface); border-radius: var(--radius-sm); }
.faq-list summary { padding: 15px 18px; font-weight: 720; cursor: pointer; }
.faq-list details p { margin: 0; padding: 0 18px 17px; color: var(--color-muted); }

.related-tools { max-width: 900px; margin: 44px auto; }
.related-tools h2 { font-size: 24px; }
.related-links { display: flex; flex-wrap: wrap; gap: 10px; }
.related-links a { padding: 9px 13px; color: #2b3951; border: 1px solid var(--color-border); background: var(--color-surface); border-radius: 7px; font-size: 14px; font-weight: 650; text-decoration: none; }
.related-links a:hover { color: var(--color-primary); border-color: #a8bddd; }

.generator-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr); gap: 24px; align-items: start; max-width: 900px; margin: 0 auto 50px; }
.generator-card { padding: clamp(20px, 4vw, 28px); border: 1px solid var(--color-border); background: var(--color-surface); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.field-group { margin-bottom: 18px; }
.field-group label { display: block; margin-bottom: 6px; color: #344058; font-size: 14px; font-weight: 720; }
.field-group textarea,
.field-group input,
.field-group select { width: 100%; min-height: 46px; padding: 10px 12px; color: var(--color-text); border: 1px solid #c8d2e0; background: var(--color-surface); border-radius: var(--radius-sm); }
.field-group textarea { min-height: 150px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox-group { display: flex; align-items: center; gap: 9px; min-height: 46px; padding-top: 24px; }
.checkbox-group input { width: 18px; height: 18px; accent-color: var(--color-primary); }
.color-input { height: 46px; padding: 4px !important; }
.generator-output { display: grid; place-items: center; min-height: 330px; text-align: center; }
.generator-output canvas,
.generator-output img { width: min(100%, 320px); height: auto; image-rendering: pixelated; }
.generator-placeholder { color: var(--color-muted); }
.generator-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 18px; }
.trust-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 0; margin: 16px 0 0; padding: 0; color: #536078; font-size: 13px; font-weight: 650; list-style: none; }
.trust-row li { display: inline-flex; align-items: center; }
.trust-row li + li::before { margin: 0 10px; color: #8a96aa; content: "\00B7"; }

.legal-page { max-width: 820px; margin: 48px auto 70px; padding: clamp(22px, 5vw, 42px); border: 1px solid var(--color-border); background: var(--color-surface); border-radius: var(--radius-md); }
.legal-page h1 { font-size: clamp(34px, 5vw, 46px); }
.legal-page h2 { margin-top: 34px; font-size: 23px; }
.legal-page p,
.legal-page li { color: #49566d; }

.site-footer { margin-top: 72px; border-top: 1px solid var(--color-border); background: var(--color-surface); }
.footer-wrap { width: min(calc(100% - 32px), var(--content-width)); min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 auto; color: var(--color-muted); font-size: 13px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 16px; }
.footer-links a{color:#4f5b71;text-decoration:none;transition:color .15s ease-in-out}
.footer-links a:hover{color:var(--color-primary)}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #0d4fae;
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .nav-wrap { align-items: flex-start; padding: 15px 0; }
  .site-nav { flex-wrap: wrap; }
  .tool-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
  .scanner-workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; height: auto; min-height: 0; }
  .scanner-card,
  .scanner-feedback { min-height: 0; }
  #upload-panel { min-height: 0; }
  .drop-zone { min-height: 260px; }
  .camera-stage { min-height: 260px; }
  .camera-placeholder { min-height: 260px; }
  .camera-live-area { min-height: 260px; height: auto; aspect-ratio: 1 / 1; }
  .scanner-feedback { min-height: 240px; }
  .feedback-empty,
  .scan-status { min-height: 240px; }
  .result-region { display: block; overflow: visible; }
  .result-card { min-height: 0; display: block; }
  .result-body { overflow: visible; padding-right: 0; }
  .privacy-line { white-space: normal; }
  .result-header { flex-wrap: wrap; gap: 6px; }
  .result-title { min-width: 0; font-size: 15px;flex: 1;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
  .history-drawer { top: auto; right: 0; bottom: 0; left: 0; width: auto; height: auto; max-height: 82dvh; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; box-shadow: 0 -14px 34px rgba(21, 36, 60, 0.2); }
}
	 @media (max-width:680px){.nav-wrap{display:block;text-align:center}
.brand{margin-bottom:1rem}
.site-nav{width:100%;justify-content:center;margin:0}
.site-nav a{padding:8px 7px;font-size:12.5px}
.hero{padding:24px 0 14px}
h1{font-size:clamp(24px, 7vw, 30px)}
.scanner-panel{padding:14px}
.drop-zone{min-height:270px;padding:28px 15px}
.drop-title{font-size:19px}
.drop-title-desktop{display:none}
.drop-title-touch{display:inline}
.ad-slot{min-height:180px;margin:24px auto}
.image-preview{grid-template-columns:56px minmax(0,1fr)}
.image-preview img{width:54px;height:54px}
.result-field{display:block}
.result-label{padding-bottom:3px}
.result-value{padding-top:4px}
.result-actions{display:grid;grid-template-columns:1fr 1fr}
.result-action{width:100%}
.tool-groups{grid-template-columns:1fr;gap:22px}
.generator-grid{grid-template-columns:1fr}
.field-row{grid-template-columns:1fr;gap:0}
.site-footer{margin-top:24px}
.footer-wrap{min-height:auto;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:22px 0;text-align:center}
.footer-links{width:100%;justify-content:center;gap:8px 16px;margin:0}
}

@media (max-width: 430px) {
  .page-shell,
  .nav-wrap,
  .footer-wrap { width: min(calc(100% - 22px), var(--content-width)); }
  .scanner-tab { min-height: 46px; padding: 9px 7px; font-size: 14px; }
  .result-actions { grid-template-columns: 1fr; }
  .result-actions .button,
  .camera-controls .button,
  .camera-placeholder .button,
  .generator-actions .button { width: 100%; }
  .camera-live-area { aspect-ratio: 1 / 1; }
  .camera-placeholder { min-height: 214px; padding: 24px 18px 20px; }
  .scan-corners { width: 76%; aspect-ratio: 1 / 0.94; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
