/* YU.IS — 域名目录柜：柜面检字，抽屉里是索引卡，抽出一张看登记。 */
/* 只在本机没有 American Typewriter 时才会下载，作为记录字体的兜底。 */
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("fonts/jetbrains-mono.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bg: var(--sand-2); --wood: var(--sand-4); --wood-in: var(--sand-5); --inside: var(--sand-3);
  --front: var(--sand-1); --front-hi: var(--sand-2); --front-edge: var(--sand-7); --handle: var(--brown-9); --guide: var(--brown-3);
  --ink: var(--sand-12); --soft: var(--sand-11); --muted: var(--sand-11);
  --line: var(--sand-6); --line-2: var(--sand-7);
  --accent: var(--green-11); --accent-fill: var(--green-9); --on-accent: var(--sand-1); --accent-soft: var(--green-3);
  --focus: var(--green-8); --warn: var(--red-11); --rule: var(--red-7);
  --scrim: color-mix(in srgb, var(--sand-12) 56%, transparent);
  --dialog-shadow: 0 8px 24px color-mix(in srgb, var(--sand-12) 14%, transparent);
  --text-small: 12px; --text-body: 14px; --text-title: 20px; --text-display: 32px;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", Cambria, Georgia, "Noto Serif", "Songti SC", "Noto Serif SC", "Source Han Serif SC", SimSun, serif;
  --type: "American Typewriter", "JetBrains Mono", "Courier New", monospace;
  --zh: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  --r: 2px; --container-r: 3px;
  --pad: 16px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--sand-1); --wood: var(--sand-4); --wood-in: var(--sand-5); --inside: var(--sand-2);
  --front: var(--sand-2); --front-hi: var(--sand-3); --front-edge: var(--sand-7); --handle: var(--brown-9); --guide: var(--brown-3);
  --ink: var(--sand-12); --soft: var(--sand-11); --muted: var(--sand-11);
  --line: var(--sand-6); --line-2: var(--sand-7);
  --accent: var(--green-11); --accent-fill: var(--green-9); --on-accent: var(--sand-1); --accent-soft: var(--green-3);
  --focus: var(--green-8); --warn: var(--red-11); --rule: var(--red-7);
  --scrim: color-mix(in srgb, var(--sand-12) 64%, transparent);
  --dialog-shadow: 0 8px 24px color-mix(in srgb, var(--sand-12) 32%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--ink); font: var(--text-body)/1.5 var(--zh); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }

/* ---------- 外壳：顶部常驻，下面一块舞台放柜面或抽屉 ---------- */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; max-width: 1240px; margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(var(--pad), env(safe-area-inset-right)) 0 max(var(--pad), env(safe-area-inset-left)); }
/* 页首：DOM 顺序是 标识 → 查词 → 主题切换（即键盘顺序）；手机上用网格把查词排到第二行。 */
.top { flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 28px 24px auto; grid-template-areas: "brand links" "count links" "search search"; align-items: center; column-gap: 14px; row-gap: 6px; padding-bottom: 12px; }
/* 标识：柜面上拉开的「Y」抽屉 + Charter 粗体字标；悬停时抽屉面变亮。 */
.wordmark { grid-area: brand; flex: none; display: inline-flex; align-items: center; gap: 9px; color: var(--ink); }
.brand-mark { flex: none; width: 28px; height: 28px; }
.bm-edge, .bm-letter { fill: var(--ink); }
.bm-face { fill: var(--front); }
.bm-pull { fill: none; stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-word { font: 700 var(--text-title)/1 var(--serif); letter-spacing: .03em; }
.brand-word span { color: var(--accent); }
.wordmark:hover .bm-face { fill: var(--front-hi); }
.top-links { grid-area: links; justify-self: end; margin-right: -8px; display: flex; align-items: center; gap: 2px; }
/* 总量带可见单位；窄屏放在标识下方，给主题按钮留下完整点击区域。 */
.top-count { grid-area: count; justify-self: start; padding: 5px 8px; border: .5px solid var(--line-2); border-radius: var(--r); background: var(--front); font: 400 var(--text-small)/1 var(--type); color: var(--soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: var(--r); background: none; color: var(--soft); transition: background-color 250ms ease-out, color 250ms ease-out; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }

/* 查词框：目录柜旁的检索台，细边框与卡面底色。 */
.search { grid-area: search; position: relative; min-width: 0; height: 48px; display: flex; align-items: center; gap: 10px; margin: 0; padding: 0 2px 0 12px; background: var(--front); border: .5px solid var(--line-2); border-radius: var(--r); transition: border-color 250ms ease-out; }
.search:focus-within { border-color: var(--focus); }
.search-icon { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--soft); stroke-width: 1.8; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; font: 400 var(--text-body)/1 var(--type); letter-spacing: .01em; }
.search input::placeholder { font: 400 var(--text-body)/1 var(--zh); color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: var(--r); background: none; color: var(--muted); }
.search-clear:hover { color: var(--ink); background: var(--accent-soft); }
.search-clear svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.kbd { flex: none; min-width: 24px; height: 24px; margin-right: 6px; display: grid; place-items: center; border: .5px solid var(--line-2); border-radius: var(--r); font: 400 var(--text-small)/1 var(--type); color: var(--muted); }
.search:focus-within .kbd { display: none; }
@media (hover: none) { .kbd { display: none; } }

.stage { position: relative; flex: 1; min-height: 0; }

/* ---------- 柜面 ---------- */
.cabinet { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.cabinet::-webkit-scrollbar { display: none; }
.cabinet-body { display: flex; flex-direction: column; gap: 10px; padding: 10px; background: var(--wood); border: .5px solid var(--line-2); border-radius: var(--container-r); }
.shelf-title { display: flex; align-items: baseline; gap: 8px; margin: 2px 2px -2px; font: 600 var(--text-small)/1.2 var(--zh); color: var(--soft); }
.shelf-title span { font: 400 var(--text-small)/1 var(--type); color: var(--soft); font-variant-numeric: tabular-nums; }
/* 分类签后拉出一条细规矩线，把这一层抽屉归成一组。 */
.shelf-title::after { content: ""; flex: 1; align-self: center; border-top: .5px solid var(--line-2); }
/* 抽屉正面：Radix Sand 卡面、细描边与 Brown 拉手；当前格用强调色识别。 */
.front { position: relative; display: grid; place-items: center; align-content: center; gap: 4px; min-width: 0; padding: 6px 4px 20px; border: .5px solid var(--front-edge); border-radius: var(--r); background: var(--front); color: var(--ink); transition: background-color 250ms ease-out, border-color 250ms ease-out; }
.front::after { content: ""; position: absolute; bottom: 8px; left: 50%; width: 18px; height: 7px; margin-left: -9px; border: .5px solid var(--handle); border-top: 0; border-radius: 0 0 10px 10px; }
.front:hover { background: var(--front-hi); }
.front:hover::after { border-color: var(--accent); }
.front.is-open { background: var(--front-hi); border-color: var(--accent); z-index: 1; }
.front.is-open .k { color: var(--accent); }
.front.is-open::after { border-color: var(--accent); }
.front:disabled { opacity: .45; cursor: default; }
.front .k { font: 700 var(--text-title)/1 var(--serif); }
.front .n { font: 400 var(--text-small)/1 var(--type); color: var(--muted); font-variant-numeric: tabular-nums; }
.front.lead { min-height: 128px; gap: 10px; padding: 14px 14px 26px; }
.front.lead .label { display: flex; align-items: baseline; gap: 8px; font: 600 var(--text-small)/1 var(--zh); color: var(--accent); }
.front.lead .label .n { color: var(--accent); }
.front.lead .peek { min-width: 0; max-width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font: 700 var(--text-title)/1.1 var(--serif); }
.front.lead .peek > span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.front.lead .peek .tail { white-space: normal; }
.letters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.letters .front { height: 72px; }
.digits { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 1.35fr; gap: 6px; }
.digits .front { height: 70px; }
.digits .k { font-size: var(--text-body); }
/* 「其他」不属于数字，和前四格隔开一点。 */
.digits .front:last-child { margin-left: 8px; }
.front.skeleton { color: transparent; background: var(--front); }
.front.skeleton::after { opacity: .3; }
.front.skeleton .k, .front.skeleton .n { visibility: hidden; }

.domain-suffix { font-weight: 400; color: var(--muted); }
/* 末几字符和后缀绑成一个整体，长名换行时后缀不会单独甩到一行。 */
.tail { white-space: nowrap; }

/* ---------- 拉开的抽屉 ---------- */
.drawer { container: drawer / inline-size; position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; background: var(--inside); border: .5px solid var(--line-2); border-bottom: 0; border-radius: var(--container-r) var(--container-r) 0 0; }
.drawer-head { flex: none; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 8px 8px 6px; background: var(--front); border-bottom: .5px solid var(--line-2); border-radius: var(--container-r) var(--container-r) 0 0; }
.drawer-back { flex: none; height: 44px; display: inline-flex; align-items: center; gap: 4px; padding: 0 10px 0 6px; border: 0; border-radius: var(--r); background: none; font: 600 var(--text-body)/1 var(--zh); color: var(--soft); }
.drawer-back svg, .step svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drawer-back:hover { background: var(--accent-soft); color: var(--accent); }
.drawer-label { min-width: 0; display: flex; align-items: baseline; gap: 10px; padding-left: 4px; }
.drawer-label h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 var(--text-title)/1.1 var(--serif); }
.drawer-label h2 small { font: 600 var(--text-small)/1 var(--zh); color: var(--muted); margin-left: 6px; }
.drawer-label span { flex: none; font: 400 var(--text-small)/1 var(--type); color: var(--muted); }
.drawer-steps { margin-left: auto; display: flex; gap: 0; }
.step { flex: none; min-width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 2px; padding: 0 8px; margin-left: -1px; border: .5px solid var(--line-2); border-radius: 0; background: var(--front); font: 700 var(--text-body)/1 var(--serif); color: var(--soft); white-space: nowrap; transition: background-color 250ms ease-out, border-color 250ms ease-out; }
.drawer-steps .step:first-child { margin-left: 0; border-radius: var(--r) 0 0 var(--r); }
.drawer-steps .step:last-child { border-radius: 0 var(--r) var(--r) 0; }
.step:hover, .step:focus-visible { position: relative; z-index: 1; }
.step:hover { border-color: var(--ink); background: var(--front-hi); }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 10px max(24px, env(safe-area-inset-bottom)); }

/* 导卡：比索引卡高出一截的标签，位置左右错开，像真正的分隔卡。 */
.guide { position: relative; height: 30px; margin: 22px 0 -2px; background: var(--guide); border: .5px solid var(--line-2); border-radius: var(--r); }
.guide:first-child { margin-top: 8px; }
.guide .tab { position: absolute; top: -15px; left: var(--x, 10px); max-width: calc(100% - 20px); height: 26px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--guide); border: .5px solid var(--line-2); border-bottom: 0; border-radius: var(--r) var(--r) 0 0; font: 700 var(--text-body)/1 var(--serif); white-space: nowrap; }
/* 导卡数量压在导卡色上，用 --soft 保证对比 ≥4.5:1（--muted 只有 3.86:1）。 */
.guide .tab b { font: 400 var(--text-small)/1 var(--type); color: var(--soft); font-variant-numeric: tabular-nums; }
.guide:nth-of-type(3n+2) { --x: 34%; }
.guide:nth-of-type(3n) { --x: 62%; }
/* 索引卡：叠放只露上沿，悬停反馈不改变布局。 */
.card { container: index-card / inline-size; position: relative; width: 100%; min-width: 0; height: max-content; display: flex; align-items: center; min-height: 62px; margin-top: -5px; padding: 8px 14px; border: .5px solid var(--line); border-radius: var(--r); background: var(--front); color: var(--ink); text-align: left; transition: background-color 250ms ease-out, border-color 250ms ease-out; }
.card-content { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; }
.guide + .card { margin-top: 0; }
.card:hover { background: var(--front-hi); border-color: var(--line-2); z-index: 2; }
.card:active { background: var(--accent-soft); }
.card:focus-visible { z-index: 3; }
.card.is-pulled { visibility: hidden; }
.hw { min-width: 0; white-space: normal; overflow-wrap: anywhere; font: 700 var(--text-title)/1.2 var(--serif); letter-spacing: -.005em; }
/* 索引卡完整显示身份，窄列自然换行，不依赖脚本测量和缩字。 */
.hw .tail { white-space: normal; }
.card .rec { min-width: 0; max-width: 140px; justify-self: end; overflow-wrap: anywhere; font: 400 var(--text-small)/1.35 var(--type); color: var(--soft); text-align: right; font-variant-numeric: tabular-nums; }
.card .rec-warn { color: var(--warn); font-weight: 700; }
.card .rec-exp.warn { color: var(--warn); }
.card.featured .hw::after { content: "精"; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 8px; vertical-align: 3px; border: .5px solid var(--accent); border-radius: 50%; font: 700 var(--text-small)/1 var(--zh); color: var(--accent); }
.drawer-empty { margin: 48px 12px; text-align: center; color: var(--soft); }
.drawer-empty p { margin: 0 0 6px; font: 700 var(--text-title)/1.3 var(--serif); color: var(--ink); }
.drawer-empty small { display: block; margin-bottom: 18px; font: 400 var(--text-body)/1.5 var(--type); }
.drawer-empty > small:only-child { margin-bottom: 0; }
/* 空态下的两个按钮并排居中，窄了自动换行。 */
.empty-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-line { height: 44px; padding: 0 18px; border: .5px solid var(--line-2); border-radius: var(--r); background: var(--front); font-size: var(--text-body); font-weight: 600; transition: background-color 250ms ease-out; }
.btn-line:hover { background: var(--front-hi); }
.state { height: 100%; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); text-align: center; }
.state p { margin: 0; font: 700 var(--text-title)/1.3 var(--serif); color: var(--ink); }

.marketplace-notice { flex: none; margin: 0 0 12px; color: var(--soft); font-size: var(--text-small); line-height: 1.5; }
.marketplace-notice a { text-decoration: underline; text-underline-offset: 3px; }
.marketplace-notice a:hover { color: var(--accent); }

/* ---------- 抽出的一张卡：完整登记 ---------- */
.sheet { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0; border: .5px solid var(--line-2); border-radius: var(--container-r); background: var(--front); color: var(--ink); box-shadow: var(--dialog-shadow); overflow: auto; overscroll-behavior: contain; }
.sheet::backdrop { background: var(--scrim); }
.sheet-inner { position: relative; padding: 0 22px 30px; }
/* 抽屉名和关闭键浮在卡头上方，不占高度，词头才能在红线以上的整块区域里上下居中。 */
.sheet-top { position: absolute; z-index: 1; top: 10px; left: 22px; right: 12px; display: flex; align-items: center; gap: 10px; }
.sheet-drawer { font: 400 var(--text-small)/1 var(--type); color: var(--muted); }
.sheet-close { margin-left: auto; }
.sheet-head { position: relative; }
.sheet-name { position: relative; margin: 0; padding: 50px 0; font: 700 var(--text-display)/1.05 var(--serif); letter-spacing: -.015em; overflow-wrap: anywhere; }
.sheet-name a { transition: color 250ms ease-out; }
.sheet-name a[href]:hover { color: var(--accent); }
/* 索引卡的红色横线：词头写在线上，下面才是登记。 */
.sheet-name::after { content: ""; position: absolute; left: -22px; right: -22px; bottom: 0; height: .5px; background: var(--rule); }
.sheet-stamp { position: absolute; top: calc(50% - 25px); right: -2px; width: 50px; height: 50px; display: grid; place-items: center; border: .5px solid var(--accent); border-radius: 50%; font: 700 var(--text-small)/1 var(--zh); color: var(--accent); }
.sheet-stamp::before { content: ""; position: absolute; inset: 3px; border: .5px solid var(--accent); border-radius: 50%; opacity: .6; }
/* 盖了精品章时，词头文字给印章让出安全位（红线仍通长）。 */
.sheet.stamped .sheet-name { padding-right: 68px; }
.sheet-desc { margin: 14px 0 0; font-size: var(--text-body); color: var(--soft); }
.sheet-meta { margin: 16px 0 8px; }
.sheet-meta div { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; font: 400 var(--text-body)/1.3 var(--type); }
.sheet-meta dt { flex: none; color: var(--muted); }
/* 点线连接登记标签与取值。 */
.sheet-meta div::after { content: ""; order: 1; flex: 1; min-width: 16px; border-bottom: .5px dotted var(--line-2); transform: translateY(-3px); }
.sheet-meta dd { order: 2; margin: 0; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sheet-meta dd.warn { color: var(--warn); }
.cta, .btn2 { height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--r); font-size: var(--text-body); font-weight: 600; transition: background-color 250ms ease-out, border-color 250ms ease-out; }
.cta { background: var(--accent-fill); color: var(--on-accent); border: .5px solid var(--accent-fill); }
.cta:hover { background: var(--accent); }
.btn2 { border: .5px solid var(--line-2); background: var(--front); }
.btn2:hover { background: var(--front-hi); }
.cta svg, .btn2 svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* 底部打孔：目录卡穿杆用的孔。 */
.sheet-hole { position: absolute; left: 50%; bottom: 10px; width: 14px; height: 8px; margin-left: -7px; border-radius: 50%; background: var(--inside); }

/* ---------- 桌面：左柜面，右边固定拉开一个抽屉 ---------- */
@media (min-width: 960px) {
  :root { --pad: 28px; }
  .app { padding-top: 18px; }
  .top { grid-template-columns: auto minmax(0, 560px) auto auto; grid-template-rows: auto; grid-template-areas: "brand search count links"; gap: 20px; padding-bottom: 18px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-word { font-size: var(--text-title); }
  .top-links { gap: 6px; }
  /* 行高锁定为舞台高度，柜面和抽屉各自在内部滚动，不被内容撑高。 */
  .stage { display: grid; grid-template-columns: 440px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 22px; }
  .cabinet, .drawer { min-height: 0; }
  .cabinet { padding-bottom: 24px; }
  .drawer { position: relative; inset: auto; z-index: auto; }
  .drawer-back { display: none; }
  .drawer-label { padding-left: 10px; }
  .drawer-body { padding: 18px 18px 32px; }
  .letters .front { height: 70px; }
  .card { min-height: 64px; }
  .hw { font-size: var(--text-title); }
}
/* 按抽屉实际可用宽度排两摞，而不是只看视口是否达到桌面断点。 */
@container drawer (min-width: 680px) {
  .drawer-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; align-content: start; }
  .drawer-body > .guide, .drawer-body > .drawer-empty { grid-column: 1 / -1; }
  .drawer-body > .guide + .card + .card { margin-top: 0; }
}
@container drawer (max-width: 320px) {
  .drawer-head { flex-wrap: wrap; row-gap: 0; padding-block: 4px; }
  .drawer-label { flex: 1; }
  .drawer-steps { flex-basis: 100%; justify-content: flex-end; }
  .drawer-steps:not(:has(.step:not([hidden]))) { display: none; }
}
/* 看每张卡的内容宽度：桌面双列里的窄卡也要把记录移到词头下面。 */
@container index-card (max-width: 360px) {
  .card-content { grid-template-columns: minmax(0, 1fr); }
  .card .rec { display: flex; flex-wrap: wrap; gap: 0 10px; max-width: none; justify-self: stretch; text-align: left; }
  .card .rec br { display: none; }
}
@media (max-width: 959px) {
  .stage { max-width: 620px; width: 100%; margin: 0 auto; }
  .top { max-width: 620px; width: 100%; margin: 0 auto; }
}
/* 手机横屏：宽度够就恢复柜面+抽屉双栏，栏宽收窄。 */
@media (min-width: 700px) and (max-width: 959px) and (orientation: landscape) {
  .top { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-rows: auto; grid-template-areas: "brand search count links"; gap: 16px; max-width: none; }
  .stage { display: grid; grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 16px; max-width: none; }
  .cabinet, .drawer { min-height: 0; }
  .drawer { position: relative; inset: auto; z-index: auto; }
  .drawer-back { display: none; }
  .front.lead .peek { font-size: var(--text-title); column-gap: 10px; }
}
/* 手机：抽出的卡从底部升起，占满宽度。 */
@media (max-width: 640px) {
  .sheet { width: calc(100vw - 12px); max-width: none; margin: auto auto 6px; }
  .sheet-inner { padding: 0 18px 30px; }
  .sheet-top { top: 8px; left: 18px; right: 8px; }
  .sheet-name { padding: 48px 0; font-size: var(--text-display); }
  .sheet-name::after { left: -18px; right: -18px; }
  .sheet-stamp { top: calc(50% - 22px); right: -2px; width: 44px; height: 44px; font-size: var(--text-small); }
  .sheet.stamped .sheet-name { padding-right: 58px; }
  .letters .front .k { font-size: var(--text-title); }
}
@media (max-width: 360px) {
  .letters { grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 5px; }
  .letters .front { height: 64px; padding-bottom: 18px; }
  .front.lead .peek { font-size: var(--text-title); column-gap: 12px; }
}
@media (max-height: 700px) and (max-width: 959px) {
  .letters .front { height: 60px; padding-bottom: 17px; gap: 2px; }
  .digits .front { height: 58px; padding-bottom: 17px; }
  .front.lead { min-height: 100px; }
}
/* 矮屏（手机横屏等）：登记卡收紧卡头、记录排两栏，域名资料在矮屏下也便于查看；词头仍上下居中。 */
@media (max-height: 520px) {
  .sheet-name { padding: 48px 0; font-size: var(--text-display); }
  .sheet-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; margin: 10px 0 16px; }
  .sheet-meta div { padding: 5px 0; }
  .sheet-inner { padding-bottom: 26px; }
}
/* 触屏：页首、抽屉步进和弹层关闭键的点击区域不小于 44px。 */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .step { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
