/* ============ Variables ============ */
:root {
  --brand: #2f8f83;
  --brand-dark: #237268;
  --brand-light: #e8f4f1;
  --accent: #a4c639;
  --ink: #1a2b33;
  --ink-soft: #4a5c64;
  --line: #dfe8e9;
  --bg: #f4f7f7;
  --white: #fff;
  --shadow: 0 12px 40px rgba(25, 60, 60, .10);
  --radius: 14px;

  /* --- Spacing scale (4px base) --- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* --- Type scale --- */
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 15px; --fs-lg: 18px;
  --fs-xl: 24px; --fs-2xl: 30px; --fs-3xl: 40px;

  /* --- Radius scale --- */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;

  /* --- Elevation scale --- */
  --sh-sm: 0 4px 16px rgba(25,60,60,.07);
  --sh-md: 0 12px 30px rgba(25,60,60,.14);
  --sh-lg: 0 24px 54px rgba(25,60,60,.22);

  /* Motion */
  --t-fast: 150ms ease;
  --t-normal: 280ms ease;
}

* { margin: 0; padding:0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
img { display: block; }
.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;
}
/* Visible keyboard focus for every interactive element. */
:focus-visible {
  outline: 2px solid var(--brand-dark);
  outline-offset: 2px;
}
/* Honour reduced-motion: stop pulses and collapse transitions. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============ Screens ============ */
.screen { display: none; width: 100%; height: 100vh; height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }

/* ============ Home ============ */
#home { position: relative; overflow-y: auto; background: linear-gradient(160deg, #f7fbfa 0%, #eaf3f1 100%); }
.home-bg {
  position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: repeating-linear-gradient(115deg, transparent 0 38px, rgba(47,143,131,.07) 38px 39px);
}
.home-header {
  position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  padding:28px 6% 0;
}
.brand { display: flex; align-items: center; }
.brand-logo {
  height: 48px; width: auto; max-width: 100%; object-fit: contain;
}
.home-header-right { font-size: var(--fs-sm); color: var(--ink-soft); }
.lang-switch { display: inline-flex; align-items: center; gap: 10px; letter-spacing: normal; }
.lang-btn {
  font: inherit; font-size: var(--fs-sm); letter-spacing: .3px; white-space: nowrap;
  color: var(--ink-soft); background: transparent; border: 0; padding: 4px 2px;
  cursor: pointer; opacity: .6; transition: opacity .2s ease, color .2s ease;
}
.lang-btn:hover { opacity: 1; }
.lang-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
.lang-btn.is-active { color: var(--brand); font-weight: 700; opacity: 1; }
.lang-divider { opacity: .35; font-size: var(--fs-sm); }
/* Slightly tighter tracking for Chinese UI copy */
html[lang="zh-CN"] .eyebrow { letter-spacing: 2px; }
html[lang="zh-CN"] .home-intro h1 { letter-spacing: 0; }
html[lang="zh-CN"] .card-label { letter-spacing: 1px; }

.home-main { position: relative; z-index: 2; max-width: 1280px; margin: 0 auto; padding:46px var(--sp-6) 60px; width: 100%; }
.home-intro { text-align: center; margin-bottom:var(--sp-10); }
.eyebrow { font-size: var(--fs-xs); letter-spacing: 4px; color: var(--brand); font-weight: 700; margin-bottom:14px; }
.home-intro h1 { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: 1px; margin-bottom:var(--sp-3); }
.home-sub { font-size: var(--fs-md); color: var(--ink-soft); }

.manual-grid { display: flex; flex-wrap: wrap; justify-content: center; gap:var(--sp-10); }
.manuals-empty { width: 100%; text-align: center; color: var(--ink-soft); font-size: var(--fs-md); padding:var(--sp-10) 0; }
.manual-card {
  position: relative; width: 362px; aspect-ratio: 1 / 1.44; border-radius: var(--r-md);
  overflow: hidden; cursor: pointer; background: #fff;
  box-shadow: var(--shadow); transition: transform .28s ease, box-shadow .28s ease;
}
.manual-card:hover { transform: translateY(-10px); box-shadow: var(--sh-lg); }
.card-cover { position: absolute; inset: 0; }
.card-cover img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  transition: transform .5s ease;
}
.manual-card:hover .card-cover img { transform: scale(1.05); }
.card-label {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding:34px var(--sp-4) 18px; text-align: center;
  font-size: 16.5px; font-weight: 800; letter-spacing: 3px; color: #fff;
  background: linear-gradient(to top, rgba(12,40,40,.85), rgba(12,40,40,.45) 55%, transparent);
}

/* ============ Viewer ============ */
#viewer { background: #eef2f2; }
.viewer-header {
  display: flex; align-items: center; gap:var(--sp-5); height: 64px; flex-shrink: 0;
  background: #fff; border-bottom: 1px solid var(--line); padding:0 var(--sp-6); z-index: 10;
}
.btn-back { font-size: 14px; color: var(--ink-soft); padding:var(--sp-2) var(--sp-3); border-radius: var(--r-sm); white-space: nowrap; }
.btn-back:hover { background: var(--brand-light); color: var(--brand); }
.viewer-title { display: flex; flex-direction: column; min-width: 200px; }
.viewer-title strong { font-size: var(--fs-md); }
/* The header shows one full manual title; the subtitle was removed. */
.viewer-tabs { display: flex; gap:var(--sp-1); background: #f0f4f4; padding:var(--sp-1); border-radius: 10px; margin-left: auto; }
.tab { padding:var(--sp-2) 18px; font-size: var(--fs-sm); border-radius: 7px; color: var(--ink-soft); font-weight: 600; }
.tab.active { background: #fff; color: var(--brand); box-shadow: 0 2px 8px rgba(25,60,60,.08); }
.viewer-actions { display: flex; gap:var(--sp-2); align-items: center; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--r-sm); color: var(--ink-soft); font-size: var(--fs-lg); display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--brand-light); color: var(--brand); }
.toc-btn {
  display: flex; align-items: center; gap:var(--sp-2); height: 36px; padding:0 var(--sp-3);
  border-radius: var(--r-sm); color: var(--brand); font-size: var(--fs-sm); font-weight: 700;
  border: 1px solid var(--brand); background: #fff; white-space: nowrap;
  transition: background .18s, color .18s;
}
.toc-btn:hover, .toc-btn[aria-expanded="true"] { background: var(--brand); color: #fff; }
.toc-btn-icon { font-size: 16px; line-height: 1; }

/* ============ Table of contents drawer ============ */
.toc-overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(12,24,26,.34);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.toc-overlay.open { opacity: 1; pointer-events: auto; }
.toc-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: 340px; max-width: 88vw; display: flex; flex-direction: column;
  background: #fff; box-shadow: -12px 0 40px rgba(12,40,40,.18);
  transform: translateX(102%); transition: transform .3s cubic-bezier(.22,.61,.36,1);
  visibility: hidden;
}
.toc-drawer.open { transform: translateX(0); visibility: visible; }
.toc-drawer-header {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  padding:var(--sp-5) var(--sp-5) var(--sp-4); border-bottom: 1px solid var(--line);
}
.toc-drawer-title { display: flex; flex-direction: column; gap:2px; }
.toc-drawer-title strong { font-size: var(--fs-lg); color: var(--brand-dark); }
.toc-drawer-title span { font-size: var(--fs-xs); color: var(--ink-soft); }
.toc-close { width: 32px; height: 32px; border-radius: var(--r-sm); font-size: 15px; color: var(--ink-soft); }
.toc-close:hover { background: var(--brand-light); color: var(--brand); }
.toc-list { flex: 1; overflow-y: auto; padding:var(--sp-2) var(--sp-3) var(--sp-6); }
.toc-group { margin-top:var(--sp-4); }
.toc-group-title {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
  color: var(--brand); padding:var(--sp-2) var(--sp-2) var(--sp-2);
  border-bottom: 1px solid var(--line); margin-bottom: var(--sp-1);
}
.toc-item {
  display: flex; align-items: center; justify-content: space-between; gap:var(--sp-3);
  width: 100%; text-align: left; padding:9px var(--sp-2); border-radius: var(--r-sm);
  font-size: var(--fs-sm); color: var(--ink); line-height: 1.35;
}
.toc-item:hover { background: var(--brand-light); }
.toc-item.active { background: var(--brand-light); color: var(--brand-dark); font-weight: 700; }
.toc-item.active::before { content: ''; width: 3px; align-self: stretch; border-radius: 2px; background: var(--brand); margin-right: 2px; }
.toc-item-label { flex: 1; }
.toc-empty { padding: var(--sp-6) var(--sp-3); text-align: center; color: var(--ink-soft); font-size: var(--fs-sm); }

.tab-panel { display: none; flex: 1; min-height: 0; flex-direction: column; }
.tab-panel.active { display: flex; }

/* ============ Two-page flip book ============ */
.book-stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  position: relative; padding:18px 60px; perspective: 1600px; perspective-origin: 50% 45%; overflow: hidden;
  background: radial-gradient(ellipse at center, #e4ebeb 0%, #d3dede 100%);
  user-select: none; -webkit-user-select: none;
  touch-action: none; -webkit-touch-callout: none;
}
/* Spread aspect ratio: page scans are 3877x5594 (0.6931), so two pages are
   1.386:1. Width drives the size and the height follows through aspect-ratio:
   a fixed height plus max-width would squash the ratio on narrow screens and
   object-fit would then stretch every page image. */
.book-wrap {
  position: relative;
  aspect-ratio: 1.386 / 1;
  width: min(calc(100% - 20px), calc(min(72vh, 660px) * 1.386));
  max-width: calc(100% - 20px);
  flex: 0 0 auto;
  transform-style: preserve-3d;   /* keep the 3D context from .book-stage alive */
  /* No will-change here: it forces the browser to rasterise the book at fit size
     and then stretch that bitmap when zoomed, making 100% zoom look blurred. */
}
.book-wrap.zoomed { cursor: grab; }
.book-wrap.zoomed.panning { cursor: grabbing; }

/* ============ turn.js flipbook ============ */
.turn-book { position: relative; width: 100%; height: 100%; }
.turn-book .page {
  background: #fff; overflow: hidden;
  box-shadow: 0 0 20px rgba(0,0,0,.16);
}
.turn-book .page img {
  /* contain (never fill): page boxes are rounded to whole pixels, so a tiny
     ratio mismatch must letterbox instead of stretching the scan. */
  width: 100%; height: 100%; display: block; object-fit: contain;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* page-edge gradients: soft shading along the bound edge, like turn.js */
.turn-book .even .gradient {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,0) 94%, rgba(0,0,0,.14) 100%);
}
.turn-book .odd .gradient {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none;
  background: linear-gradient(to left, rgba(0,0,0,0) 94%, rgba(0,0,0,.11) 100%);
}
/* turn.js owns the perspective; remove the stage-level one so zoom is clean */
.book-stage { perspective: none; }

.nav-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px;
  border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 4px 14px rgba(0,0,0,.10);
  font-size: 28px; color: var(--brand); z-index: 8; display: flex; align-items: center; justify-content: center;
  transition: transform .2s, background .2s;
}
.nav-arrow:hover { background: #fff; transform: translateY(-50%) scale(1.08); }
.nav-arrow.prev { left: 12px; }
.nav-arrow.next { right: 12px; }
.nav-arrow:disabled { opacity: .3; cursor: not-allowed; }

.book-controls {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  padding:var(--sp-3) 28px; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.page-control { display: flex; align-items: center; gap:var(--sp-2); }
.ctrl-btn { width: 32px; height: 32px; border-radius: 7px; background: #f0f4f4; color: var(--ink-soft); font-size: 14px; }
.ctrl-btn:hover { background: var(--brand-light); color: var(--brand); }
.page-indicator { display: flex; align-items: center; gap:6px; margin: 0 8px; font-size: var(--fs-sm); color: var(--ink-soft); }
.page-indicator input { width: 52px; height: 32px; text-align: center; border: 1px solid var(--line); border-radius: 7px; font-size: var(--fs-sm); color: var(--ink); }
/* Reset-view button in the book controls. */
.text-btn { font-size: var(--fs-sm); color: var(--brand); font-weight: 600; padding:var(--sp-2) var(--sp-3); border-radius: 7px; }
.text-btn:hover { background: var(--brand-light); }
.zoom-hint { display: flex; align-items: center; gap:var(--sp-3); }
.zoom-tip { font-size: var(--fs-xs); color: var(--ink-soft); }
.zoom-hint .zoom-level { font-size: var(--fs-xs); min-width: 44px; }

.thumbnail-bar {
  display: flex; gap:var(--sp-2); padding:var(--sp-3) var(--sp-5); overflow-x: auto; flex-shrink: 0; background: #fff; height: 92px;
}
.thumb {
  flex-shrink: 0; height: 66px; aspect-ratio: 1/1.44; border-radius: 4px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; opacity: .65; transition: opacity .2s, border .2s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb:hover { opacity: 1; }
.thumb.active { border-color: var(--brand); opacity: 1; }

/* ============ Product gallery ============ */
#panel-products { background: #f4f7f7; overflow-y: auto; }
.products-toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  padding:var(--sp-4) 28px; background: #fff; border-bottom: 1px solid var(--line);
}
.products-info { display: flex; align-items: baseline; gap:14px; }
.products-info strong { font-size: 16px; }
.products-info span { font-size: var(--fs-xs); color: var(--ink-soft); }
.products-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap:18px; padding:var(--sp-6) 28px var(--sp-10);
}
.product-card {
  background: #fff; border-radius: var(--r-md); overflow: hidden; cursor: pointer;
  box-shadow: var(--sh-sm); transition: transform var(--t-fast), box-shadow var(--t-fast);
  border: 1px solid var(--line); position: relative;
}
.product-card:hover { transform: translateY(-5px); box-shadow: var(--sh-md); }
.product-thumb { height: 180px; background: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.product-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-info { padding:14px var(--sp-4); }
.product-info strong { display: block; font-size: 14px; }
.product-link {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px;
  border-radius: 50%; background: var(--brand); color: #fff; display: flex;
  align-items: center; justify-content: center; text-decoration: none;
  box-shadow: 0 3px 10px rgba(0,0,0,.18); z-index: 2; transition: background var(--t-fast), transform var(--t-fast);
}
.product-link:hover { background: var(--brand-dark); transform: scale(1.08); }
.product-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lb-site-link { color: #fff; background: var(--brand); text-decoration: none; padding: 6px 12px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.lb-site-link:hover { background: var(--brand-dark); }
.lb-site-link[hidden] { display: none; }
.products-empty { grid-column: 1/-1; text-align: center; padding:80px var(--sp-5); color: var(--ink-soft); }
.products-empty .empty-icon { font-size: 48px; opacity: .3; margin-bottom:var(--sp-4); }

/* ============ Image viewer ============ */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(12,24,26,.94);
  display: none; flex-direction: column;
}
.lightbox.active { display: flex; }
.lightbox-header {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  height: 56px; padding:0 var(--sp-6); color: #fff; border-bottom: 1px solid rgba(255,255,255,.12);
}
.lightbox-title { font-size: 14px; font-weight: 600; }
.lightbox-tools { display: flex; align-items: center; gap:10px; }
.lb-btn { width: 34px; height: 34px; border-radius: var(--r-sm); color: #fff; font-size: var(--fs-lg); background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; }
.lb-btn:hover { background: rgba(255,255,255,.2); }
.zoom-level { font-size: var(--fs-sm); min-width: 54px; text-align: center; }
.lb-divider { width: 1px; height: 20px; background: rgba(255,255,255,.2); margin: 0 6px; }
.lightbox-stage { flex: 1; min-height: 0; overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; cursor: grab; touch-action: none; }
.lightbox-stage:active { cursor: grabbing; }
.lightbox-stage img {
  max-width: 100%; max-height: 100%; object-fit: contain; user-select: none;
  transform-origin: center center;
  /* No will-change: it makes the browser stretch a low-res layer on zoom. */
}
.lightbox-footer {
  display: flex; justify-content: space-between; flex-shrink: 0; height: 40px; padding:0 var(--sp-6); align-items: center; color: rgba(255,255,255,.72); font-size: var(--fs-xs); border-top: 1px solid rgba(255,255,255,.12);
}

/* ============ Toast ============ */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding:var(--sp-3) var(--sp-6); border-radius: var(--r-sm); font-size: var(--fs-sm);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Responsive ============ */

/* --- Tablets & smaller desktops --- */
@media (max-width: 1024px) {
  .home-main { padding-top: 30px; }
  .home-intro h1 { font-size: 34px; }
  .manual-card { width: 320px; }
  /* Keep the full manual title readable on tablets. */
  .viewer-title { min-width: 0; }
  .viewer-title strong { font-size: var(--fs-sm); line-height: 1.25; }
}

/* Phone portrait: the header is short, so the long manual title must stay
   within two lines. The full name remains available via the title tooltip. */
@media (max-width: 600px) {
  .viewer-title strong {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    overflow: hidden; font-size: var(--fs-xs); line-height: 1.3;
  }
}

/* ---------- PORTRAIT (phones / tablets held upright) ----------
   The two catalog covers stack vertically. */
@media (orientation: portrait) {
  .home-header { padding:18px 6% 0; }
  .brand-logo { height: 38px; }
  .home-main { padding:26px var(--sp-5) 48px; }
  .home-intro { margin-bottom:26px; }
  .home-intro h1 { font-size: var(--fs-2xl); }
  .home-sub { font-size: var(--fs-sm); }
  .manual-grid { flex-direction: column; align-items: center; gap:22px; }
  .manual-card { width: min(80vw, 340px); }
  .card-label { font-size: var(--fs-md); padding:26px var(--sp-3) 14px; }

  .viewer-header { height: 54px; padding:0 var(--sp-3); gap:10px; }
  .btn-back { font-size: var(--fs-sm); padding:6px var(--sp-2); }
  .tab { padding:7px var(--sp-3); font-size: var(--fs-xs); }
  .toc-btn { padding:0 10px; }
  .toc-btn-label { display: none; }
  .book-stage { padding:var(--sp-3) var(--sp-2); }
  .book-wrap {
    height: auto; width: min(98vw, 620px); aspect-ratio: 1.386 / 1;
    max-width: calc(100% - 16px);
  }
  .nav-arrow { width: 36px; height: 36px; font-size: 22px; }
  .nav-arrow.prev { left: 4px; }
  .nav-arrow.next { right: 4px; }
  .book-controls { flex-direction: column; gap:var(--sp-2); padding:10px var(--sp-3); }
  .zoom-tip { display: none; }
  .thumbnail-bar { height: 76px; padding:var(--sp-2) var(--sp-3); }
  .thumb { height: 58px; }

  .products-toolbar { padding:var(--sp-3) var(--sp-4); }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap:var(--sp-3); padding:var(--sp-4); }
  .product-thumb { height: 140px; }
}

/* ---------- LANDSCAPE TOUCH (phones / tablets held sideways) ----------
   The two catalog covers sit side by side. Scope to touch pointers so a wide
   desktop window (also "landscape") keeps the full-size 362px covers. */
@media (orientation: landscape) and (pointer: coarse) {
  .manual-grid { flex-direction: row; align-items: center; }
  .manual-card { width: min(34vw, 340px); }
}

/* Short viewports: phone landscape and small laptops */
@media (max-height: 560px) {
  .home-header { padding:10px 6% 0; }
  .brand-logo { height: 30px; }
  .home-main { padding:var(--sp-3) var(--sp-5) var(--sp-6); }
  .home-intro { margin-bottom:14px; }
  .home-intro h1 { font-size: var(--fs-xl); }
  .home-sub { font-size: var(--fs-xs); }
  .card-label { font-size: var(--fs-xs); padding:18px 10px 10px; }

  .viewer-header { height: 46px; }
  .book-stage { padding:var(--sp-2) var(--sp-10); }
  .book-wrap { width: min(calc(100% - 20px), calc(min(78dvh, 520px) * 1.386)); }
  .nav-arrow { width: 34px; height: 34px; font-size: 20px; }
  .book-controls { padding:6px 14px; }
  .zoom-tip { display: none; }
  .thumbnail-bar { height: 66px; padding:6px var(--sp-3); }
  .thumb { height: 50px; }
}

/* Short + touch: shrink covers only on landscape phones, not short desktop windows */
@media (max-height: 560px) and (pointer: coarse) {
  .manual-card { width: min(34vw, calc((100dvh - 150px) / 1.44)); }
}

/* Small phones in portrait: keep both covers visible with a little scroll */
@media (orientation: portrait) and (max-width: 420px) {
  .home-intro h1 { font-size: 26px; }
  .manual-card { width: min(86vw, 320px); }
  .card-label { letter-spacing: 2px; }
  .viewer-tabs { gap:2px; padding:3px; }
  .tab { padding:6px 9px; font-size: var(--fs-xs); }
  .btn-back { font-size: 0; }
  .btn-back::after { content: '\2039 Back'; font-size: var(--fs-sm); }
  /* The label above lives in a pseudo-element, so the DOM translator cannot
     reach it - localise it here. */
  html[lang="zh-CN"] .btn-back::after { content: '\2039 返回'; }
  .page-indicator input { width: 44px; }
}

/* Touch devices: no hover lift (avoids sticky hover), larger tap targets */
@media (hover: none) {
  .manual-card:hover { transform: none; box-shadow: var(--shadow); }
  .manual-card:hover .card-cover img { transform: none; }
  .product-card:hover { transform: none; box-shadow: var(--sh-sm); }
  .nav-arrow:hover { transform: translateY(-50%); }
  /* Expand hit area to 44px without changing the visual size. */
  .ctrl-btn, .icon-btn, .lb-btn, .tab, .text-btn { position: relative; }
  .ctrl-btn::after, .icon-btn::after, .lb-btn::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 44px; height: 44px; transform: translate(-50%, -50%);
  }
  .tab { min-height: 44px; }
}
