:root {
  color-scheme: dark;
  --bg: #090909;
  --surface: #121212;
  --surface-2: #191919;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f8f5ef;
  --muted: #aaa49b;
  --accent: #ff9d32;
  --accent-2: #ffbf67;
  --success: #67c58f;
  --danger: #ff7b70;
  --radius: 26px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html {
  min-height: 100%;
  background: #090909;
  scrollbar-color: var(--accent) #0d0d0d;
  scrollbar-width: thin;
  touch-action: pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar { width: 12px; height: 12px; }
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
*::-webkit-scrollbar-track { background: #0d0d0d; }
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
  border: 3px solid #0d0d0d;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
}
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover { background: var(--accent-light); }
html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
*::-webkit-scrollbar-corner { background: #0d0d0d; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  touch-action: pan-y;
  overscroll-behavior-x: none;
  color: var(--text);
  background:
    radial-gradient(circle at 9% 5%, rgba(255, 126, 24, 0.18), transparent 36rem),
    radial-gradient(circle at 88% 100%, rgba(255, 187, 79, 0.08), transparent 31rem),
    var(--bg);
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.16;
  background-image: radial-gradient(circle, #fff 0 1px, transparent 1.2px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to top, #000, transparent 75%);
  animation: drift 18s linear infinite;
}
button, input, textarea { font: inherit; }
button, a, input, textarea, label { touch-action: manipulation; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img, canvas { display: block; max-width: 100%; }
button { color: inherit; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: #111;
  translate: 0 -160%;
}
.skip-link:focus { translate: 0; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  isolation: isolate;
  display: flex;
  overflow: hidden;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: max(14px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 14px max(22px, env(safe-area-inset-left));
  border-bottom: 0;
  background: linear-gradient(180deg, rgba(9, 9, 9, 0.96) 0%, rgba(9, 9, 9, 0.58) 48%, rgba(9, 9, 9, 0) 100%);
  backdrop-filter: none;
  transition: background 280ms ease;
}
.site-header.is-condensed { background: linear-gradient(180deg, rgba(9,9,9,.98) 0%, rgba(9,9,9,.68) 54%, rgba(9,9,9,0) 100%); }
.brand {
  display: inline-flex;
  column-gap: 11px;
  align-items: center;
  text-decoration: none;
  font-weight: 760;
  letter-spacing: -0.02em;
  transition: column-gap 300ms cubic-bezier(.2,.8,.2,1);
}
.brand > span { position: relative; z-index: 1; display: inline-block; overflow: hidden; max-width: 92px; opacity: 1; white-space: nowrap; transform: translateX(0) scaleX(1); transform-origin: left center; transition: max-width 300ms cubic-bezier(.2,.8,.2,1), opacity 180ms ease, transform 300ms cubic-bezier(.2,.8,.2,1); }
.site-header.is-condensed .brand { column-gap: 0; }
.site-header.is-condensed .brand > span { max-width: 0; opacity: 0; transform: translateX(-30px) scaleX(.72); }
.brand-logo {
  position: relative;
  z-index: 2;
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: transparent;
  filter: none;
}
.desktop-nav { position: absolute; left: 50%; display: flex; min-width: 0; gap: 4px; align-items: center; translate: -50% 0; }
.desktop-nav a { display: inline-flex; gap: 7px; align-items: center; padding: 9px 11px; border: 1px solid transparent; border-radius: 12px; color: var(--muted); font-size: .8rem; font-weight: 720; text-decoration: none; white-space: nowrap; }
.desktop-nav a:hover, .desktop-nav a[aria-current="page"] { border-color: var(--line); background: var(--surface-2); color: var(--text); }
.desktop-nav img { width: 19px; height: 19px; flex: 0 0 auto; object-fit: contain; opacity: .86; }
.desktop-nav a[aria-current="page"] img { opacity: 1; }
#menu-button { display: none; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.icon-button:hover { border-color: rgba(255, 157, 50, 0.5); background: rgba(255, 157, 50, 0.08); }
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}
.menu-icon::before { translate: 0 -6px; }
.menu-icon::after { translate: 0 4px; }

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  width: min(360px, 88vw);
  height: 100dvh;
  padding: max(22px, env(safe-area-inset-top)) 22px max(22px, env(safe-area-inset-bottom));
  border-left: 1px solid var(--line);
  background: #111;
  box-shadow: -30px 0 80px rgba(0, 0, 0, 0.5);
  translate: 105% 0;
  transition: translate 220ms ease;
}
.nav-drawer.open { translate: 0; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 34px; }
.nav-links { display: grid; gap: 10px; }
.nav-links a {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: var(--muted);
  text-decoration: none;
}
.nav-icon { width: 23px; height: 23px; flex: 0 0 auto; object-fit: contain; opacity: .82; }
.nav-links a[aria-current="page"] .nav-icon { opacity: 1; }
.nav-links a:hover, .nav-links a[aria-current="page"] { border-color: var(--line); background: var(--surface-2); color: var(--text); }
.scrim {
  position: fixed;
  inset: 0;
  z-index: 25;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.page-shell { width: min(1320px, calc(100% - 40px)); margin: 0 auto; padding: clamp(46px, 7vw, 94px) 0 max(110px, env(safe-area-inset-bottom)); }
.hero { max-width: 880px; margin-bottom: clamp(38px, 6vw, 74px); }
.eyebrow { margin: 0 0 12px; color: var(--accent-2); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(2.75rem, 8vw, 6.5rem); line-height: 0.94; letter-spacing: -0.065em; }
.hero p:not(.eyebrow) { max-width: 680px; color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.28rem); line-height: 1.65; }

.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.tool-card {
  position: relative;
  display: flex;
  min-height: 260px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease;
}
.tool-card::after { position: absolute; right: -20px; bottom: -28px; width: 180px; height: 180px; background: center / contain no-repeat; content: ""; opacity: .065; pointer-events: none; transform: rotate(-7deg); transition: opacity 180ms ease, transform 180ms ease; }
.tool-card[href="/qr"]::after { background-image: url("/assets/icons/qr-tool.svg"); }
.tool-card[href="/isbn"]::after { background-image: url("/assets/icons/isbn-tool.svg"); }
.tool-card[href="/barcode"]::after { background-image: url("/assets/icons/scanner-tool.svg"); }
.tool-card[href="/"]::after { background-image: url("/assets/icons/refresh-tool.svg"); }
.tool-card:hover::after { opacity: .105; transform: rotate(-4deg) scale(1.04); }
.tool-card > * { position: relative; z-index: 1; }
.tool-card:hover { transform: translateY(-5px); border-color: rgba(255, 157, 50, 0.55); }
.tool-icon { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 18px; background: rgba(255, 157, 50, 0.12); color: var(--accent-2); font-size: 1.55rem; font-weight: 900; }
.tool-icon-image { width: 38px; height: 38px; object-fit: contain; }
.tool-icon-image.barcode { width: 44px; }
.tool-card h2 { margin: 48px 0 8px; font-size: 1.38rem; letter-spacing: -0.025em; }
.tool-card p { margin: 0; color: var(--muted); line-height: 1.5; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 17, 17, 0.9);
  box-shadow: var(--shadow);
}
.qr-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr); overflow: hidden; }
.qr-controls, .qr-preview { padding: clamp(22px, 4vw, 42px); }
.qr-controls { display: flex; flex-direction: column; }
.qr-preview { border-left: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); }
.field { display: grid; gap: 8px; margin-bottom: 20px; }
.field > span, .field > label { font-size: 0.84rem; font-weight: 740; }
.url-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input, textarea {
  width: 100%;
  min-height: 52px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #0d0d0d;
  color: var(--text);
}
textarea { min-height: 150px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible, a:focus-visible, .color-wheel:focus-visible { outline: 3px solid rgba(255, 157, 50, 0.28); outline-offset: 2px; border-color: var(--accent); }
.primary-button {
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #17100a;
  font-weight: 820;
  cursor: pointer;
}
.primary-button:disabled { cursor: not-allowed; filter: grayscale(0.7); opacity: 0.48; }
.helper, .message { margin: 9px 0 0; color: var(--muted); font-size: 0.85rem; line-height: 1.45; }
.message:empty { display: none; }
.message[data-state="error"] { color: var(--danger); }
.message[data-state="success"] { color: var(--success); }
.control-title { display: flex; gap: 18px; align-items: center; justify-content: space-between; margin: 30px 0 17px; }
.control-title h2 { margin: 0; font-size: 1.3rem; }
.native-picker-shell {
  --picker-color: #000000;
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255,255,255,.035);
  cursor: pointer;
}
.native-picker-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--picker-color);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
  pointer-events: none;
}
.native-picker {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 48px;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.native-picker-shell:focus-within { outline: 3px solid rgba(255,157,50,.3); outline-offset: 2px; border-color: var(--accent); }
.color-area { display: grid; grid-template-columns: 190px 1fr; gap: 22px; align-items: center; }
.wheel-wrap { position: relative; width: 180px; height: 180px; margin: 0 auto; }
.color-wheel {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0, transparent 70%),
    conic-gradient(#f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.32), 0 10px 32px rgba(0,0,0,.35);
  cursor: crosshair;
  touch-action: none;
}
.wheel-marker { position: absolute; top: 50%; left: 50%; width: 15px; height: 15px; margin: -7px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px #111, 0 2px 8px #000; pointer-events: none; }
.color-fields { display: grid; gap: 12px; }
.preset-row { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.preset-row .native-picker-shell { margin-left: auto; }
.preset {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.preset.active { border-color: var(--accent); background: rgba(255,157,50,.1); }
.rgb-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rgb-row label { color: var(--muted); font-size: .76rem; }
.rgb-row input { min-height: 46px; margin-top: 5px; }
.toggle-row { display: flex; gap: 18px; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 21px; border-top: 1px solid var(--line); }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { margin-top: 4px; color: var(--muted); }
.toggle-row input { width: 24px; min-height: 24px; accent-color: var(--accent); }
.preview-head { display: flex; width: min(100%, 420px); align-items: center; justify-content: space-between; gap: 12px; margin: 0 auto 14px; }
.preview-label { width: auto; margin: 0; text-align: left; }
.style-switch { display: inline-grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: rgba(0,0,0,.25); }
.style-button { min-width: 68px; min-height: 34px; padding: 0 11px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: .74rem; font-weight: 820; cursor: pointer; }
.style-button.active { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #17100a; box-shadow: 0 5px 18px rgba(255,157,50,.18); }
.preview-square {
  --preview-pad: 34px;
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  padding: var(--preview-pad);
  border: 1px dashed rgba(255,255,255,.17);
  border-radius: 22px;
  background-color: #111;
  background-image: linear-gradient(45deg,#1e1e1e 25%,transparent 25%),linear-gradient(-45deg,#1e1e1e 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#1e1e1e 75%),linear-gradient(-45deg,transparent 75%,#1e1e1e 75%);
  background-position: 0 0,0 9px,9px -9px,-9px 0;
  background-size: 18px 18px;
}
.preview-square canvas {
  position: absolute;
  inset: var(--preview-pad);
  width: calc(100% - 68px) !important;
  height: calc(100% - 68px) !important;
  object-fit: contain;
}
.empty-state { max-width: 210px; color: #918b82; text-align: center; }
.empty-state b { display: block; margin-bottom: 8px; color: #c2bbb1; font-size: 2rem; }
.save-button { width: 100%; margin-top: 14px; }

.content-panel { max-width: 760px; padding: clamp(24px, 5vw, 48px); }
.content-panel h2 { margin-top: 34px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.status-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); }
[hidden] { display: none !important; }

.isbn-page { min-height: 100vh; min-height: 100dvh; }
.isbn-shell { width: min(1320px, calc(100% - 40px)); padding-top: clamp(42px,6vw,80px); }
.scanner-page-heading { width: min(1060px,100%); margin: 0 auto 22px; }
.scanner-page-heading .eyebrow { margin-bottom: 8px; }
.scanner-page-title { width: 100%; margin: 0; font-size: clamp(2.35rem,4.5vw,4.3rem); line-height: .96; letter-spacing: -.055em; }
.isbn-entry-layout { position: relative; display: grid; grid-template-columns: minmax(0,680px) minmax(280px,360px); gap: 20px; width: min(1060px,100%); margin-inline: auto; align-items: stretch; }
.isbn-entry-main { display: grid; min-width: 0; gap: 20px; }
.isbn-scan-panel, .isbn-manual-panel { padding: clamp(24px,4vw,38px); }
.isbn-scan-panel { display: flex; min-height: 210px; flex-direction: column; align-items: center; justify-content: center; }
.isbn-scan-panel .isbn-scan-actions { width: min(100%,360px); margin: 0 auto; }
.isbn-scan-panel .isbn-scan-actions > * { width: 100%; }
.isbn-scan-panel .primary-button { min-height: 64px; }
.isbn-manual-panel { display: flex; min-height: 200px; align-items: center; }
.isbn-lookup-form { width: 100%; padding: 0; }
.isbn-mobile-handoff { position: absolute; inset: 0; grid-column: 2; display: flex; min-height: 0; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; padding: 32px 28px; text-align: center; }
.isbn-mobile-handoff .eyebrow { margin-bottom: 10px; }
.isbn-mobile-handoff h2 { margin: 0 0 12px; font-size: clamp(1.65rem,2.4vw,2.25rem); line-height: 1.02; letter-spacing: -.04em; }
.isbn-mobile-handoff > p:not(.eyebrow) { max-width: 300px; margin: 0 0 24px; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.isbn-mobile-handoff canvas { display: block; width: 170px !important; height: 170px !important; max-width: 100%; flex: 0 0 auto; border-radius: 18px; background: var(--accent); }
.isbn-field { margin: 0; }
.isbn-field > span:first-child { display: block; margin-bottom: 7px; font-size: .79rem; font-weight: 760; }
.isbn-search-row { display: grid; grid-template-columns: minmax(180px,1fr) auto; gap: 10px; margin-top: 0; align-items: end; }
.isbn-search-row .primary-button { min-width: 132px; }
.isbn-search-row .search-icon-button { width: 64px; min-width: 64px; padding: 0; }
.search-icon-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; }
.isbn-scan-actions { display: flex; gap: 10px; flex-direction: column; flex-wrap: nowrap; margin-top: 12px; }
.isbn-scan-actions .secondary-button { min-height: 48px; }
.isbn-scan-button { gap: 9px; }
.isbn-scan-button img { width: 22px; height: 22px; }
.isbn-camera-stage { position: relative; min-height: 260px; margin-top: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #090909; }
.isbn-camera-stage video { width: 100%; height: 100%; min-height: 260px; max-height: 390px; object-fit: cover; }
.isbn-scan-frame { position: absolute; top: 50%; left: 50%; width: 78%; height: 34%; translate: -50% -50%; border: 2px solid var(--accent-2); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0,0,0,.28), 0 0 26px rgba(255,157,50,.2); pointer-events: none; }
.isbn-scan-frame span { position: absolute; right: 8px; left: 8px; height: 2px; border-radius: 2px; background: linear-gradient(90deg,transparent,var(--accent-2),transparent); box-shadow: 0 0 10px var(--accent); animation: isbn-scan-line 2s ease-in-out infinite alternate; }
.isbn-camera-hint { position: absolute; right: 12px; bottom: 12px; left: 12px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(8,8,8,.75); color: var(--text); font-size: .74rem; font-weight: 760; text-align: center; backdrop-filter: blur(10px); }
.isbn-status { display: block; min-height: 18px; margin: 7px 2px 0; color: var(--muted); font-size: .74rem; line-height: 1.45; }
@keyframes isbn-scan-line { to { top: calc(100% - 2px); } }
.book-result {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  margin-top: 22px;
  padding: clamp(24px, 4vw, 48px);
  scroll-margin-top: 94px;
}
.book-media { min-width: 0; }
.book-cover {
  position: sticky;
  top: 104px;
  display: grid;
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 34%, rgba(255,157,50,.16), transparent 58%),
    #0d0d0d;
  box-shadow: 0 28px 60px rgba(0,0,0,.42);
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover-fallback { color: var(--muted); font-weight: 780; letter-spacing: .08em; text-transform: uppercase; }
.book-content { min-width: 0; }
.book-topline { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.book-isbn, .book-format {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 780;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.book-format { color: var(--accent-2); }
.book-title { margin-bottom: 7px; font-size: clamp(2rem, 4.3vw, 4rem); line-height: 1; letter-spacing: -.055em; }
.book-subtitle { margin-bottom: 9px; color: var(--muted); font-size: 1.05rem; line-height: 1.5; }
.book-authors { margin-bottom: 15px; color: var(--accent-2); font-weight: 720; }
.book-rating-row { display: flex; gap: 9px; align-items: center; min-height: 28px; margin-bottom: 18px; color: var(--muted); font-size: .88rem; }
.book-rating-row strong { color: var(--text); }
.book-stars { color: var(--accent); font-size: 1.15rem; letter-spacing: .08em; }
.book-stars-empty { color: #635d55; }
.book-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.book-chip { padding: 7px 10px; border-radius: 999px; background: rgba(255,157,50,.1); color: #e8c79f; font-size: .76rem; }
.book-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 30px; }
.book-fact { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.book-fact-highlight { border-color: rgba(255,157,50,.33); background: rgba(255,157,50,.08); }
.book-fact-label, .book-fact-value { display: block; }
.book-fact-label { margin-bottom: 6px; color: var(--muted); font-size: .72rem; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.book-fact-value { overflow-wrap: anywhere; font-size: .94rem; line-height: 1.35; }
.book-description { padding-top: 24px; border-top: 1px solid var(--line); }
.book-description > p:last-child { color: #ccc5ba; line-height: 1.72; white-space: pre-line; }
.book-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; margin-top: 24px; }
.book-details p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.5; overflow-wrap: anywhere; }
.book-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.book-sources { margin: 24px 0 0; color: #7f786f; font-size: .75rem; line-height: 1.5; }
.site-footer { position: fixed; right: 0; bottom: 0; left: 0; z-index: 8; display: flex; width: 100%; max-width: none; align-items: center; justify-content: space-between; gap: 18px; margin: 0; padding: 16px max(20px,calc((100vw - 1320px)/2)) max(18px,env(safe-area-inset-bottom)); border: 0; background: rgba(9,9,9,.94); color: var(--muted); font-size: .82rem; backdrop-filter: blur(18px); }
.site-footer::before { position: absolute; top: 0; right: max(20px,calc((100vw - 1320px)/2)); left: max(20px,calc((100vw - 1320px)/2)); height: 1px; background: var(--line); content: ""; }
.github-link { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; color: var(--muted); font-weight: 700; text-decoration: none; transition: color 160ms ease; }
.github-link:hover { color: var(--accent-2); }
.github-link svg { width: 19px; height: 19px; fill: currentColor; }
.footer-links { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 20px; margin-left: auto; }
.footer-links > a:not(.github-link) { color: var(--muted); font-weight: 700; text-decoration: none; transition: color 160ms ease; }
.footer-links > a:hover, .footer-links > a[aria-current="page"] { color: var(--accent-2); }

.legal-shell { padding-top: clamp(44px, 7vw, 86px); }
.legal-hero { max-width: 930px; margin: 0 auto clamp(36px, 5vw, 62px); text-align: center; }
.legal-hero h1 { font-size: clamp(2.8rem, 6.5vw, 6rem); }
.legal-hero > p:last-child { max-width: 690px; margin: 0 auto; color: var(--muted); font-size: 1.06rem; line-height: 1.65; }
.legal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.legal-card { padding: clamp(24px, 3vw, 36px); }
.legal-card h2 { margin-bottom: 14px; font-size: clamp(1.35rem, 2.5vw, 1.9rem); letter-spacing: -.03em; }
.legal-card p:not(.eyebrow) { color: var(--muted); line-height: 1.68; }
.legal-card p:last-child { margin-bottom: 0; }
.legal-card-wide { grid-column: 1 / -1; }
.legal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.legal-button, .secondary-button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; padding: 0 18px; text-decoration: none; }
.secondary-button { border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); font-weight: 760; }
.secondary-button:hover { border-color: rgba(255,157,50,.5); }

.home-page, .qr-page, .contact-page { display: flex; min-height: 100vh; min-height: 100dvh; flex-direction: column; }
.qr-page {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}
.home-page .site-header, .qr-page .site-header, .contact-page .site-header { flex: 0 0 auto; }
.home-page .page-shell, .qr-page .page-shell, .contact-page .page-shell { flex: 1 0 auto; }
.qr-page .page-shell { min-height: 0; flex: 1 1 auto; scroll-margin-bottom: 96px; }
.home-page .site-footer, .qr-page .site-footer, .contact-page .site-footer { flex: 0 0 auto; margin-top: auto; }

@media (min-width: 981px) {
  .home-page { overflow: hidden; }
}

.qr-page .page-shell { padding-top: clamp(18px, 2.8vh, 30px); padding-bottom: 112px; }
.qr-page .hero {
  display: flex;
  max-width: none;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 34px;
}
.qr-page .hero h1 { margin: 0; font-size: clamp(2.45rem, 4.7vw, 4.7rem); line-height: .96; white-space: nowrap; }
.qr-page .hero p:not(.eyebrow) { max-width: none; margin: 10px 0 0; font-size: .98rem; text-align: left; white-space: nowrap; }
.qr-page .qr-controls, .qr-page .qr-preview { padding: clamp(20px, 2.5vw, 30px); }
.qr-page .message { margin-top: 4px; }
.qr-page .control-title { margin: 8px 0 10px; }
.qr-page .color-area { grid-template-columns: 164px 1fr; gap: 18px; }
.qr-page .wheel-wrap, .qr-page .color-wheel { width: 154px; height: 154px; }
.qr-page .field { margin-bottom: 0; }
.qr-page .toggle-row { padding-top: 15px; }
.qr-page .preview-square { width: min(100%, 420px); margin-inline: auto; }
.qr-page .save-button { display: block; width: 168px; margin: 12px auto 0; }

.contact-page .page-shell { padding-top: clamp(22px, 3.5vh, 42px); padding-bottom: 22px; }
.contact-page .hero {
  display: block;
  max-width: 980px;
  margin-right: auto;
  margin-bottom: 46px;
  margin-left: auto;
  text-align: center;
}
.contact-page .hero .eyebrow { margin-bottom: 12px; }
.contact-page .hero h1 { margin: 0; font-size: clamp(2.7rem, 5vw, 4.8rem); line-height: .96; white-space: nowrap; }
.contact-page .hero p:not(.eyebrow) { max-width: 520px; margin-bottom: 4px; font-size: .96rem; text-align: right; }
.contact-page .content-panel { max-width: 980px; margin-inline: auto; padding: clamp(22px, 3vw, 34px); }
.contact-page textarea { min-height: 108px; }
.contact-page .field { margin-bottom: 0; }

@keyframes drift { to { background-position: 0 -152px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
@media (max-width: 980px) {
  .desktop-nav { display: none; }
  #menu-button { display: grid; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .qr-layout { grid-template-columns: 1fr; }
  .qr-preview { border-top: 1px solid var(--line); border-left: 0; }
  .qr-page .hero { display: block; }
  .qr-page .hero h1 { white-space: normal; }
  .qr-page .hero p:not(.eyebrow) { margin-top: 12px; text-align: left; }
  .qr-page .hero p:not(.eyebrow) { white-space: normal; }
  .isbn-entry-layout { grid-template-columns: 1fr; }
  .isbn-mobile-handoff { display: none; }
  .book-result { grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); }
  .book-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 981px) and (max-height: 1180px) {
  .home-page .page-shell { min-height: 0; flex: 1 1 auto; padding-top: clamp(76px, 8.5vh, 86px); padding-bottom: 24px; }
  .home-page .hero { margin-bottom: clamp(42px, 6vh, 56px); }
  .home-page .hero .eyebrow { margin-bottom: 10px; }
  .home-page .hero h1 { margin-bottom: 15px; font-size: clamp(3.9rem, 6.8vw, 6rem); line-height: .91; }
  .home-page .hero p:not(.eyebrow) { margin-bottom: 0; font-size: clamp(1rem, 1.55vw, 1.16rem); line-height: 1.55; }
  .home-page .tool-card { min-height: clamp(232px, 27vh, 250px); padding: 24px; }
  .home-page .tool-card h2 { margin-top: 36px; margin-bottom: 7px; font-size: 1.3rem; }
  .home-page .tool-card p { font-size: .92rem; }
  .home-page .site-footer { padding-top: 18px; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}
@media (min-width: 981px) and (max-height: 820px) {
  .home-page .site-header { min-height: 62px; padding-top: 8px; padding-bottom: 8px; }
  .home-page .brand-logo { width: 40px; height: 40px; }
  .home-page .page-shell { padding-top: 20px; padding-bottom: 10px; }
  .home-page .hero { margin-bottom: 26px; }
  .home-page .hero .eyebrow { margin-bottom: 7px; }
  .home-page .hero h1 { margin-bottom: 12px; font-size: clamp(3.25rem, 6.4vw, 5rem); line-height: .9; }
  .home-page .hero p:not(.eyebrow) { margin-bottom: 0; font-size: .98rem; line-height: 1.5; }
  .home-page .tool-card { min-height: 205px; padding: 22px; }
  .home-page .tool-icon { width: 52px; height: 52px; border-radius: 16px; }
  .home-page .tool-card h2 { margin-top: 22px; margin-bottom: 5px; font-size: 1.24rem; }
  .home-page .tool-card p { font-size: .88rem; }
  .home-page .site-footer { padding-top: 10px; padding-bottom: 10px; }
  .qr-page .site-header { min-height: 62px; padding-top: 8px; padding-bottom: 8px; }
  .qr-page .brand-logo { width: 40px; height: 40px; }
  .qr-page .page-shell { padding-top: 10px; padding-bottom: 62px; }
  .qr-page .hero { margin-bottom: 14px; }
  .qr-page .hero .eyebrow { margin-bottom: 5px; }
  .qr-page .hero h1 { font-size: clamp(2.35rem, 4vw, 3.4rem); }
  .qr-page .hero p:not(.eyebrow) { margin-bottom: 2px; font-size: .88rem; }
  .qr-page .qr-controls, .qr-page .qr-preview { padding: 18px 22px; }
  .qr-page input { min-height: 46px; padding-top: 10px; padding-bottom: 10px; }
  .qr-page .primary-button { min-height: 46px; }
  .qr-page .field { margin-bottom: 8px; }
  .qr-page .message { min-height: 1.25em; margin-top: 3px; font-size: .76rem; }
  .qr-page .control-title { margin: 10px 0 8px; }
  .qr-page .control-title .eyebrow { margin-bottom: 4px; }
  .qr-page .control-title h2 { font-size: 1.13rem; }
  .qr-page .native-picker-shell { width: 40px; height: 40px; flex-basis: 40px; }
  .qr-page .native-picker { min-height: 40px; }
  .qr-page .native-picker-swatch { width: 26px; height: 26px; }
  .qr-page .color-area { grid-template-columns: 132px 1fr; gap: 14px; }
  .qr-page .wheel-wrap, .qr-page .color-wheel { width: 126px; height: 126px; }
  .qr-page .color-fields { gap: 7px; }
  .qr-page .preset { min-height: 34px; padding-inline: 12px; }
  .qr-page .rgb-row input { min-height: 38px; margin-top: 3px; }
  .qr-page .toggle-row { padding-top: 10px; }
  .qr-page .toggle-row small { margin-top: 2px; font-size: .75rem; }
  .qr-page .preview-head { width: min(100%, 252px); margin: 0 auto 6px; }
  .qr-page .preview-label { width: auto; margin: 0; text-align: left; }
  .qr-page .preview-square { --preview-pad: 18px; width: min(100%, 252px); }
  .qr-page .preview-square canvas { width: calc(100% - 36px) !important; height: calc(100% - 36px) !important; }
  .qr-page .save-button { width: 150px; min-height: 44px; margin: 8px auto 0; }
  .qr-page + .site-footer, .qr-page .site-footer { padding-top: 10px; padding-bottom: 10px; }
  .qr-page .site-footer { padding-top: 10px; padding-bottom: 10px; }
  .contact-page .site-header { min-height: 62px; padding-top: 8px; padding-bottom: 8px; }
  .contact-page .brand-logo { width: 40px; height: 40px; }
  .contact-page .page-shell { padding-top: 10px; padding-bottom: 10px; }
  .contact-page .hero { margin-bottom: 32px; }
  .contact-page .hero .eyebrow { margin-bottom: 8px; }
  .contact-page .hero h1 { font-size: clamp(2.35rem, 4vw, 3.4rem); }
  .contact-page .hero p:not(.eyebrow) { margin-bottom: 2px; font-size: .86rem; line-height: 1.45; }
  .contact-page .content-panel { max-width: 920px; padding: 18px 22px; }
  .contact-page .form-grid { gap: 10px 14px; }
  .contact-page input { min-height: 42px; padding-top: 9px; padding-bottom: 9px; }
  .contact-page textarea { min-height: 78px; padding-top: 9px; padding-bottom: 9px; }
  .contact-page .primary-button { min-height: 42px; }
  .contact-page .site-footer { padding-top: 10px; padding-bottom: 10px; }
}
@media (max-width: 620px) {
  .site-header { min-height: 66px; padding-bottom: 10px; }
  .brand-logo { width: 42px; height: 42px; }
  .page-shell { width: min(100% - 24px, 1320px); padding-top: 38px; }
  h1 { font-size: clamp(2.55rem, 15vw, 4.2rem); }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 195px; }
  .tool-card h2 { margin-top: 30px; }
  .panel { border-radius: 20px; }
  .url-row { grid-template-columns: 1fr; }
  .color-area { grid-template-columns: 1fr; }
  .wheel-wrap, .color-wheel { width: 210px; height: 210px; }
  .preview-square { --preview-pad: 18px; }
  .preview-square canvas { width: calc(100% - 36px) !important; height: calc(100% - 36px) !important; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .contact-page .hero { display: block; }
  .contact-page .hero h1 { white-space: normal; }
  .contact-page .hero p:not(.eyebrow) { margin-top: 12px; text-align: left; }
  .site-footer { width: 100%; align-items: center; flex-direction: row; gap: 10px; padding: 10px 12px max(10px,env(safe-area-inset-bottom)); font-size: .72rem; }
  .site-footer::before { right: 12px; left: 12px; }
  .site-footer > span { display: none; }
  .footer-links { width: 100%; justify-content: space-between; }
  .legal-grid { grid-template-columns: 1fr; }
  .legal-card-wide { grid-column: auto; }
  .legal-hero { text-align: left; }
  .qr-page .site-header { min-height: 58px; padding-top: max(7px, env(safe-area-inset-top)); padding-bottom: 7px; }
  .qr-page .brand-logo { width: 36px; height: 36px; }
  .qr-page .icon-button { width: 38px; height: 38px; border-radius: 12px; }
  .qr-page .page-shell { width: calc(100% - 18px); padding-top: 7px; padding-bottom: 6px; }
  .qr-page .hero { margin-bottom: 8px; }
  .qr-page .hero .eyebrow { margin-bottom: 3px; font-size: .62rem; }
  .qr-page .hero h1 { font-size: clamp(1.65rem, 8vw, 2.15rem); line-height: .95; }
  .qr-page .qr-layout { border-radius: 17px; }
  .qr-page .qr-controls, .qr-page .qr-preview { padding: 11px 12px; }
  .qr-page .field { gap: 4px; margin-bottom: 5px; }
  .qr-page .field > span { font-size: .72rem; }
  .qr-page .url-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .qr-page input { min-height: 42px; padding: 8px 10px; border-radius: 10px; font-size: .88rem; }
  .qr-page .primary-button { min-height: 44px; padding-inline: 16px; border-radius: 11px; font-size: .86rem; }
  .qr-page .message { margin-top: 3px; font-size: .68rem; }
  .qr-page .control-title { margin: 5px 0; }
  .qr-page .control-title .eyebrow { margin-bottom: 2px; font-size: .58rem; }
  .qr-page .control-title h2 { font-size: .95rem; }
  .qr-page .native-picker-shell { width: 42px; height: 42px; flex-basis: 42px; }
  .qr-page .native-picker { min-height: 42px; }
  .qr-page .native-picker-swatch { width: 28px; height: 28px; }
  .qr-page .color-area { grid-template-columns: 88px minmax(0, 1fr); gap: 10px; }
  .qr-page .wheel-wrap, .qr-page .color-wheel { width: 84px; height: 84px; }
  .qr-page .wheel-marker { width: 12px; height: 12px; margin: -6px; }
  .qr-page .color-fields { gap: 4px; }
  .qr-page .preset-row { gap: 5px; }
  .qr-page .preset { min-height: 40px; padding-inline: 14px; font-size: .78rem; }
  .qr-page .rgb-row { gap: 5px; }
  .qr-page .rgb-row label { font-size: .62rem; }
  .qr-page .rgb-row input { min-height: 40px; margin-top: 2px; padding: 6px 8px; }
  .qr-page #hex-color { min-height: 40px; }
  .qr-page .toggle-row { padding-top: 7px; }
  .qr-page .toggle-row strong { font-size: .78rem; }
  .qr-page .toggle-row small { display: none; }
  .qr-page .toggle-row input { width: 24px; min-height: 24px; }
  .qr-page .qr-preview { display: flex; flex-direction: column; align-items: center; gap: 9px; }
  .qr-page .preview-head { width: 100%; margin: 0; }
  .qr-page .preview-label { width: auto; margin: 0; font-size: .64rem; text-align: left; }
  .qr-page .style-button { min-width: 52px; min-height: 30px; padding-inline: 7px; font-size: .64rem; }
  .qr-page .preview-square { --preview-pad: 12px; width: clamp(136px, 39vw, 174px); margin: 0 auto; border-radius: 14px; }
  .qr-page .preview-square canvas { width: calc(100% - 24px) !important; height: calc(100% - 24px) !important; }
  .qr-page .empty-state { font-size: .68rem; }
  .qr-page .empty-state b { margin-bottom: 3px; font-size: 1.25rem; }
  .qr-page .save-button { width: min(100%, 280px); min-height: 44px; margin: 0 auto; }
  .qr-page .site-footer { width: calc(100% - 18px); align-items: center; flex-direction: row; padding-top: 5px; padding-bottom: max(6px, env(safe-area-inset-bottom)); font-size: .66rem; }
  .qr-page .site-footer > span { display: none; }
  .qr-page .footer-links { justify-content: space-between; }
  .isbn-shell { width: calc(100% - 24px); }
  .isbn-shell { padding-top: 24px; }
  .scanner-page-title { margin-bottom: 16px; font-size: clamp(2.25rem,12vw,3.5rem); }
  .isbn-scan-panel, .isbn-manual-panel { padding: 20px; border-radius: 20px; }
  .isbn-search-row { grid-template-columns: 1fr; }
  .isbn-search-row .primary-button { width: 100%; }
  .isbn-scan-actions > * { width: 100%; }
  .isbn-camera-stage, .isbn-camera-stage video { min-height: 220px; }
  .book-result { grid-template-columns: 1fr; }
  .book-cover { position: relative; top: auto; width: min(74vw, 280px); margin-inline: auto; }
  .book-content { text-align: left; }
  .book-facts, .book-details { grid-template-columns: 1fr 1fr; }
  .book-actions > a { width: 100%; }
}

@media (max-width: 620px) and (max-height: 720px) {
  .qr-page .site-header { min-height: 52px; }
  .qr-page .brand-logo { width: 32px; height: 32px; }
  .qr-page .page-shell { padding-top: 4px; }
  .qr-page .hero { margin-bottom: 5px; }
  .qr-page .hero .eyebrow { display: none; }
  .qr-page .hero h1 { font-size: 1.55rem; }
  .qr-page .qr-controls, .qr-page .qr-preview { padding-top: 8px; padding-bottom: 8px; }
  .qr-page .control-title { margin-block: 3px; }
  .qr-page .color-area { grid-template-columns: 76px minmax(0, 1fr); gap: 8px; }
  .qr-page .wheel-wrap, .qr-page .color-wheel { width: 72px; height: 72px; }
  .qr-page .preset { min-height: 34px; }
  .qr-page .rgb-row input, .qr-page #hex-color { min-height: 34px; }
  .qr-page .toggle-row { padding-top: 5px; }
  .qr-page .preview-square { width: clamp(112px, 31vw, 132px); }
  .qr-page .save-button { min-height: 40px; }
  .qr-page .site-footer { padding-top: 3px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
}

@media (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }
}

/* Canonical Mango footer: identical on every page and transparent over the page background. */
.site-footer { position: fixed; right: 0; bottom: 0; left: 0; z-index: 18; display: flex; width: 100%; max-width: none; align-items: center; justify-content: space-between; gap: 18px; margin: 0; padding: 16px max(20px,calc((100vw - 1320px)/2)) max(18px,env(safe-area-inset-bottom)); border: 0; background: transparent; color: var(--muted); font-size: .82rem; backdrop-filter: none; }
.site-footer::before { position: absolute; top: 0; right: max(20px,calc((100vw - 1320px)/2)); left: max(20px,calc((100vw - 1320px)/2)); height: 1px; background: var(--line); content: ""; }
.site-footer > span { display: block; }
.footer-links { display: inline-flex; width: auto; flex: 0 0 auto; align-items: center; justify-content: flex-start; gap: 20px; margin-left: auto; }
.github-link svg { width: 19px; height: 19px; }
@media (max-width: 620px) {
  html:has(body.scanner-active), body.scanner-active { width: 100%; height: 100%; height: 100dvh; overflow: hidden; overscroll-behavior: none; touch-action: none; }
  body.scanner-active { position: fixed; inset: 0; }
  body.scanner-active .isbn-manual-panel { display: none; }
  body.scanner-active .isbn-shell { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  body.scanner-active .isbn-entry-main { gap: 0; }
  body.scanner-active .isbn-scan-panel { min-height: 0; flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
  body.scanner-active .isbn-camera-stage { order: 1; width: 100%; height: clamp(230px,38dvh,360px); min-height: 0; margin: 0; }
  body.scanner-active .isbn-camera-stage video { width: 100%; height: 100%; min-height: 0; max-height: none; }
  body.scanner-active .isbn-scan-actions { order: 2; width: 100%; margin: 0; }
  body.scanner-active .isbn-scan-actions > .mobile-scan-identity { display: none; }
  body.scanner-active #isbn-scan-stop { width: 100%; min-height: 54px; margin: 0; }
  .site-footer { width: 100%; align-items: center; flex-direction: row; gap: 10px; padding: 10px 12px max(10px,env(safe-area-inset-bottom)); font-size: .72rem; }
  .site-footer::before { right: 12px; left: 12px; }
  .site-footer > span { display: none; }
  .footer-links { width: 100%; justify-content: space-between; }
}

/* Mobile-only footer stability and tool identity. Desktop remains unchanged. */
.isbn-scan-panel .mobile-scan-identity { display: block; width: 92px; height: 92px; margin: 0 auto 18px; padding: 10px; border: 1px solid rgba(255,157,50,.2); border-radius: 20px; background: rgba(255,157,50,.08); object-fit: contain; }
.isbn-scan-panel:has(.isbn-camera-stage.active) .mobile-scan-identity { display: none; }
.usb-scanner-help { width: min(100%,520px); margin: 18px auto 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); color: var(--muted); font-size: .76rem; line-height: 1.5; }
.usb-scanner-help summary { color: var(--text); font-weight: 780; cursor: pointer; }
.usb-scanner-help p { margin: 9px 0 0; color: var(--success); }
.usb-scanner-help ol { margin: 8px 0 0; padding-left: 19px; }
.usb-scanner-help li + li { margin-top: 3px; }
.isbn-scan-panel:has(.isbn-camera-stage.active) .usb-scanner-help { display: none; }
@media (max-width: 620px) {
  .site-footer {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(38px + env(safe-area-inset-bottom));
    min-height: calc(38px + env(safe-area-inset-bottom));
    padding: 0 16px env(safe-area-inset-bottom);
    overflow: hidden;
    background: rgba(9,9,9,.98);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    transform: translateZ(0);
    contain: layout paint;
  }
  .site-footer::before { right: 16px; left: 16px; }
  .qr-page .site-footer {
    right: 0;
    left: 0;
    width: 100%;
    height: calc(38px + env(safe-area-inset-bottom));
    min-height: calc(38px + env(safe-area-inset-bottom));
    padding: 0 16px env(safe-area-inset-bottom);
    font-size: .68rem;
  }
  .qr-page .site-footer::before { right: 16px; left: 16px; }
  .qr-page {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .qr-page .page-shell { padding-bottom: calc(52px + env(safe-area-inset-bottom)); }
  .home-page .page-shell,
  .isbn-page .page-shell,
  .legal-page .page-shell { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .isbn-scan-panel { min-height: 270px; }
  .isbn-scan-panel .isbn-scan-actions > .mobile-scan-identity {
    display: block;
    width: 92px;
    height: 92px;
    margin: 0 auto 20px;
    padding: 10px;
    border: 1px solid rgba(255,157,50,.2);
    border-radius: 20px;
    background: rgba(255,157,50,.08);
    object-fit: contain;
  }
  .usb-scanner-help { display: none; }
}

/* Desktop QR workbench: one viewport, with breathing room above the fixed footer. */
@media (min-width: 981px) {
  html:has(body.qr-page) { height: 100%; overflow: hidden; }
  body.qr-page { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .qr-page .page-shell { min-height: 0; overflow: hidden; padding-bottom: 78px; }
  .qr-page .qr-layout { margin-bottom: 18px; }
}

@media (min-width: 981px) and (max-height: 1100px) {
  .qr-page .site-header { min-height: 62px; padding-top: 8px; padding-bottom: 8px; }
  .qr-page .brand-logo { width: 40px; height: 40px; }
  .qr-page .page-shell { padding-top: 12px; padding-bottom: 70px; }
  .qr-page .hero { margin-bottom: 16px; }
  .qr-page .hero .eyebrow { margin-bottom: 5px; }
  .qr-page .hero h1 { font-size: clamp(2.35rem,4vw,3.6rem); }
  .qr-page .hero p:not(.eyebrow) { margin-top: 7px; font-size: .88rem; }
  .qr-page .qr-controls, .qr-page .qr-preview { padding: 18px 22px; }
  .qr-page input, .qr-page .primary-button { min-height: 46px; }
  .qr-page .control-title { margin: 7px 0; }
  .qr-page .color-area { grid-template-columns: 138px 1fr; gap: 14px; }
  .qr-page .wheel-wrap, .qr-page .color-wheel { width: 132px; height: 132px; }
  .qr-page .toggle-row { padding-top: 10px; }
  .qr-page .preview-head { width: min(100%,310px); margin-bottom: 8px; }
  .qr-page .preview-square { --preview-pad: 22px; width: min(100%,310px); }
  .qr-page .preview-square canvas { width: calc(100% - 44px) !important; height: calc(100% - 44px) !important; }
  .qr-page .save-button { width: 150px; min-height: 44px; margin-top: 8px; }
  .qr-page .site-footer { padding-top: 10px; padding-bottom: 10px; }
}

@media (min-width: 981px) and (max-height: 820px) {
  .qr-page .page-shell { padding-top: 8px; padding-bottom: 60px; }
  .qr-page .hero { margin-bottom: 10px; }
  .qr-page .qr-controls, .qr-page .qr-preview { padding: 15px 19px; }
  .qr-page .color-area { grid-template-columns: 126px 1fr; gap: 12px; }
  .qr-page .wheel-wrap, .qr-page .color-wheel { width: 120px; height: 120px; }
  .qr-page .preview-head { width: min(100%,246px); }
  .qr-page .preview-square { --preview-pad: 18px; width: min(100%,246px); }
  .qr-page .preview-square canvas { width: calc(100% - 36px) !important; height: calc(100% - 36px) !important; }
}
