/* NPC service desks — same 760×366 book page as 委托 / 行囊 (gd29 paper, rim, seal title, brush tabs).
   Existing kit art only: ui_well / ui_card_raise / ui_chip_raise / k29 buttons / tab icons / portraits. */
#panel .pbox.nd-box > .k29.nd29 { gap: 6px; }
.nd29 .k29-h > .nd-purse { font-family: 'Noto Sans SC', sans-serif; }
.nd29 { color: var(--ink); font-family: 'Noto Sans SC', sans-serif; }
/* who you are dealing with: the empty left side of the centred title bar (like the faces in 委托) */
.nd29 .k29-h > .nd-person { grid-column: 1; justify-self: start; display: flex; align-items: center; gap: 5px; min-width: 0; height: 34px; }
/* 半身像：整张 96px 头像（不再裁成小脸），放大到 64px，往标题栏上方的留白里探出一截，不占卡片区高度 */
.nd-portrait { flex: none; width: 64px; height: 64px; margin: -30px 0 0 -4px; box-sizing: border-box; display: flex; align-items: flex-end; justify-content: center; overflow: hidden;
  border: 4px solid transparent; border-image: url(../../assets/v29/ui/ui_well.png) 12 fill stretch; image-rendering: pixelated; }
.nd-portrait img { width: 56px; height: 56px; max-width: none; image-rendering: pixelated; }
.nd-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.nd-who b { font: 400 16px "猫田楷", serif; letter-spacing: 2px; white-space: nowrap; color: var(--ink); }
.nd29 .k29-h .nd-role { font-size: 10px; color: var(--ink-3); white-space: nowrap; overflow: visible; }
.nd-hearts { display: flex; gap: 1px; flex: none; }
.nd-hearts .k29-heart { width: 10px; height: 10px; background-size: 30px 10px; } .nd-hearts .k29-heart.h { background-position: -10px 0; } .nd-hearts .k29-heart.o { background-position: -20px 0; }
#panel .nd29 .nd-chat { flex: none; height: 26px; padding: 0 2px; border-width: 9px; font-size: 12px; letter-spacing: 0; }
/* right: tabs, optional sub-sections, cards */
.nd-page { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.nd-tabs { flex: none; display: flex; gap: 4px; }
#panel .nd-tabs button { flex: 1 1 0; min-width: 0; height: 28px; padding: 0 2px 4px; display: flex; align-items: center; justify-content: center; gap: 3px; white-space: nowrap; cursor: pointer;
  font: 13.5px 'Noto Sans SC', sans-serif; letter-spacing: 1px; color: var(--ink-2); border: 2px solid rgba(140,116,66,.55); border-radius: 10px 10px 4px 4px; background: rgba(251,246,230,.5); box-shadow: none; }
#panel .nd-tabs button.on { color: var(--ink); font-weight: 700; background: #fbf6e6; border-color: var(--line); box-shadow: inset 0 -3px 0 var(--ink); }
.nd-tabs img { width: 18px; height: 18px; object-fit: contain; image-rendering: pixelated; }
.nd-tabs em { font-style: normal; font-size: 11px; color: var(--cinnabar); }
.nd-sub { flex: none; display: flex; gap: 6px; }
#panel .nd-sub button { height: 22px; padding: 0 10px; display: flex; align-items: center; gap: 4px; cursor: pointer; font: 12.5px 'Noto Sans SC', sans-serif; color: var(--ink-2);
  border: 1px solid var(--paper-edge); border-radius: 11px; background: var(--paper-hi); box-shadow: none; }
#panel .nd-sub button.on { color: #fbf6e6; background: var(--line); border-color: var(--line); }
.nd-sub small { font-size: 10.5px; opacity: .75; }
.nd-grid { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 4px 6px;
  padding: 0 2px 2px 0; scrollbar-width: thin; scrollbar-color: #aa986d transparent; touch-action: pan-y; }
.nd-card { min-width: 0; min-height: 46px; box-sizing: border-box; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; column-gap: 5px; padding: 0 1px;
  border: 7px solid transparent; border-image: url(../../assets/v29/ui/ui_card_raise.png) 12 fill stretch; image-rendering: pixelated; filter: drop-shadow(0 1px 0 rgba(42,32,24,.22)); }
.nd-card > * { image-rendering: auto; }
.nd-card.nd-wait { border-image-source: url(../../assets/v29/ui/ui_cell_idle.png); }
.nd-item { width: 32px; height: 32px; box-sizing: border-box; display: grid; place-items: center; border: 5px solid transparent; border-image: url(../../assets/v29/ui/ui_well.png) 12 fill stretch; image-rendering: pixelated; }
.nd-item .ico { --s: 24px !important; width: 24px !important; height: 24px !important; }
.nd-item img { max-width: 24px; max-height: 24px; object-fit: contain; image-rendering: pixelated; }
.nd-stamp { font: 16px "猫田楷", serif; color: var(--cinnabar); }
.nd-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nd-card h4 { margin: 0 !important; font-size: 14px; font-weight: 700; line-height: 16px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nd-status { display: inline-block; font-size: 10.5px; line-height: 13px; vertical-align: 1px; padding: 0 4px; border: 1px solid var(--line); border-radius: 2px; color: var(--ink-2); background: var(--paper-hi); }
.nd-l2 { font-size: 11.5px; line-height: 16px; color: var(--ink-3); overflow-wrap: anywhere; }
.nd-l2 > * + * { margin-left: 4px; }
.nd-l2:empty { display: none; }
.nd-desc { overflow-wrap: anywhere; } .nd-desc .lack { color: var(--cinnabar); } .nd-desc .ok { color: var(--jade); }
.nd-reason { color: var(--cinnabar); } .nd-ready { color: var(--jade); }
.nd-materials { display: contents; }
.nd-material { vertical-align: -3px; margin-right: 3px; display: inline-flex; align-items: center; gap: 1px; height: 16px; padding: 0 3px 0 1px; font-size: 11px; border-radius: 8px; background: rgba(233,223,198,.7); color: var(--ink-2); white-space: nowrap; }
.nd-material > .ico { --s: 14px !important; width: 14px !important; height: 14px !important; }
.nd-material > span { display: inline; } .nd-material b { font-weight: 700; margin-left: 2px; letter-spacing: -.2px; }
.nd-material.missing b { color: var(--cinnabar); } .nd-material.enough b { color: var(--jade); }
.nd-reward { display: contents; color: var(--gold-dk); }
.nd-reward > span { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; color: var(--gold-dk); }
.nd-reward .ico { --s: 14px !important; width: 14px !important; height: 14px !important; }
.nd-dur { height: 5px; margin-top: 2px; background: rgba(181,161,118,.36); border: 1px solid rgba(107,90,66,.5); }
.nd-dur i { display: block; height: 100%; background: var(--cinnabar); }
.nd-btns { display: flex; flex-direction: column; gap: 3px; }
#panel .nd-btns .k29-btn { height: 30px; min-width: 50px; padding: 0 4px; border-width: 10px; font-size: 13.5px; gap: 3px; letter-spacing: 0; }
#panel .nd-btns .k29-btn small { font-size: 11px; }
#panel .nd-btns.nd-multi { flex-direction: row; }
#panel .nd-btns.nd-multi .k29-btn { min-width: 50px; }
.nd-price { font-size: 12px; color: var(--gold-dk); white-space: nowrap; }
.nd-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 18px; color: var(--ink-3); font-size: 13px; }
.nd-empty img { width: 96px; image-rendering: pixelated; } .nd-empty p { margin: 0 !important; }
.nd-note { flex: none; margin: 0 !important; display: flex; gap: 8px; font-size: 11px; line-height: 14px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nd-note em { margin-left: auto; font-style: normal; color: var(--ink-2); }
/* 统一尺寸：每位 NPC、每一页都是同一张 760×366 册页，卡片多了在页内滑动，少了留在页里，不再忽大忽小 */
#panel .pbox.k29box.gd29box.nd-box { align-self: flex-start; height: var(--nd-h, 366px) !important; min-height: 0 !important; max-height: none !important; }
#panel .pbox.k29box.gd29box.nd-box > .k29.nd29 { position: relative; top: auto; right: auto; bottom: auto; left: auto; margin: 24px 28px 26px; height: calc(var(--nd-h, 366px) - 50px); max-height: none; }
/* 田叔水磨 · 饲料加工 (husbandry's own controls and callbacks, laid out on the same paper page) */
#panel .pbox.hs-box.nd-mill { width: 760px !important; height: var(--nd-h, 366px) !important; min-height: 0 !important; max-height: none !important; align-self: flex-start; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 6px; padding: 18px 26px 18px !important; overflow: hidden !important; border: 0 !important; background: none !important; isolation: isolate; color: var(--ink); }
.nd-mill .ink-head { flex: none; margin: 0 !important; padding: 0 26px 4px 0 !important; display: flex; align-items: baseline; gap: 10px; }
.nd-mill .ink-head h3 { font-size: 22px !important; letter-spacing: 4px; margin: 0 !important; }
.nd-mill .ink-head span { font-size: 12px; color: var(--ink-3); }
.nd-mill .pclose { right: 8px !important; top: 8px !important; }
.nd-mill .pbody { flex: 1 1 auto; min-height: 0 !important; display: flex; flex-direction: column; gap: 6px; overflow: hidden !important; padding: 0 !important; font-size: 13px; }
.nd-mill .pbody > label { flex: none; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.nd-mill #hs-grain { height: 26px; font-size: 13px; background: var(--paper-hi); border: 1px solid var(--line); border-radius: 4px; color: var(--ink); }
#panel .nd-mill .hs-recipe-grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) !important; grid-template-rows: none !important; grid-auto-rows: max-content !important;
  align-content: start; gap: 5px 6px !important; overflow-y: auto; padding: 0 2px 2px 0; touch-action: pan-y; }
#panel .nd-mill .hs-recipe-grid > section { min-height: 0 !important; height: auto !important; overflow: visible !important; display: flex; flex-direction: column; gap: 3px; padding: 0 !important; background: none !important; box-shadow: none !important;
  border: 7px solid transparent !important; border-image: url(../../assets/v29/ui/ui_card_raise.png) 12 fill stretch !important; image-rendering: pixelated; filter: drop-shadow(0 1px 0 rgba(42,32,24,.22)); }
.nd-mill .hs-recipe-grid > section > * { image-rendering: auto; }
.nd-mill .hs-recipe-grid > section > b { display: flex; align-items: center; gap: 4px; font: 700 13.5px 'Noto Sans SC', sans-serif !important; color: var(--ink); white-space: nowrap; }
.nd-mill .hs-recipe-grid .hs-icon { width: 24px !important; height: 24px !important; flex: none; image-rendering: pixelated; }
.nd-mill .hs-recipe-grid > section > small { display: none; }
.nd-mill .nd-materials { display: flex; flex-wrap: wrap; gap: 2px 0; min-height: 16px; }
.nd-mill .nd-material .hs-icon { width: 14px !important; height: 14px !important; }
.nd-craft-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 1px; }
#panel .nd-mill .nd-craft-actions button, #panel .nd-mill .nd-mill-foot button { height: 28px; min-height: 0 !important; padding: 0 2px !important; box-sizing: border-box; cursor: pointer;
  font: 13px 'Noto Sans SC', sans-serif !important; letter-spacing: 0; color: #fbf6e6 !important; background: none !important; box-shadow: none !important;
  border: 9px solid transparent !important; border-image: url(../../assets/v29/ui/ui_rb_pri.png) 14 fill stretch !important; image-rendering: pixelated; }
#panel .nd-mill .nd-craft-actions button:disabled { color: var(--ink-3) !important; border-image-source: url(../../assets/v29/ui/ui_rb_off.png) !important; opacity: .85; cursor: default; }
.nd-mill-foot { flex: none; display: flex; justify-content: flex-end; gap: 6px; }
#panel .nd-mill .nd-mill-foot button { width: auto; min-width: 110px; color: var(--ink) !important; border-image-source: url(../../assets/v29/ui/ui_rb_sec.png) !important; }
#panel .nd-mill .nd-craft-actions button, #panel .nd-mill .nd-mill-foot button { display: flex; align-items: center; justify-content: center; line-height: 1; }
.nd-material > i, .nd-material > img { flex: none; --s: 14px !important; width: 14px !important; height: 14px !important; }
.nd-mill .hs-recipe-grid > section > b > :first-child { flex: none; --s: 24px !important; width: 24px !important; height: 24px !important; }
/* portrait */
#panel .pbox.k29box.gd29box.nd-box.nd-tall { width: 400px !important; }
#panel .pbox.k29box.gd29box.nd-box.nd-tall > .k29.nd29 { margin: 22px 18px 20px; height: calc(var(--nd-h, 366px) - 42px); max-height: none; }
.nd-tall .nd-portrait { margin-top: 0; }
#panel .pbox.nd-box.nd-tall .nd29 .k29-h { height: auto; grid-template-columns: auto auto 1fr; row-gap: 4px; padding-bottom: 4px; }
.nd-tall .nd29 .k29-h .k29-seal { grid-column: 1; grid-row: 1; } .nd-tall .nd29 .k29-h h3 { grid-column: 2; grid-row: 1; font-size: 21px; letter-spacing: 5px; }
.nd-tall .nd29 .k29-h > .nd-purse { grid-column: 3; grid-row: 1; }
.nd-tall .nd29 .k29-h > .nd-person { grid-column: 1 / -1; grid-row: 2; }
.nd-tall .nd-tabs { flex-wrap: wrap; } #panel .nd-tall .nd-tabs button { flex: 1 0 22%; }
.nd-tall .nd-grid { grid-template-columns: minmax(0, 1fr); }
.nd-tall .nd-note { white-space: normal; flex-wrap: wrap; }
.nd-tall .nd-tabs img { display: none; }
#panel .pbox.hs-box.nd-mill.nd-tall { width: 400px !important; height: var(--nd-h, 366px) !important; padding: 18px 16px !important; }
#panel .nd-mill.nd-tall .hs-recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.nd-mill.nd-tall .ink-head { flex-wrap: wrap; }
/* ---- v2（2026-10-16）：左栏专门放人物，右栏放标题、页签和卡片 ---- */
#panel .nd29.nd-v2 { display: grid !important; grid-template-columns: 184px minmax(0, 1fr); column-gap: 12px; }
.nd-v2 .nd-side { min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px 2px; box-sizing: border-box;
  border-right: 1px dashed rgba(140,116,66,.5); }
.nd-v2 .nd-col { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.nd-v2 .nd-col > .k29-h { flex: none; }
.nd-v2 .nd-grid { grid-template-columns: minmax(0, 1fr); }
/* 人物：放大半身像（轻微呼吸）或村里干活的那段动画（2 倍像素） */
.nd-stage { flex: none; position: relative; width: 176px; height: 150px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden;
  background: radial-gradient(ellipse 58% 10% at 50% 94%, rgba(60,44,30,.22), transparent 70%), radial-gradient(ellipse at 50% 70%, rgba(251,246,230,.85), rgba(251,246,230,0) 70%); }
.nd-bust { width: 152px; height: 152px; image-rendering: pixelated; transform-origin: 50% 100%; animation: ndBreath 3.2s ease-in-out infinite; }
@keyframes ndBreath { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-2px) scale(1.012, 1.02); } }
.nd-act { position: absolute; left: 50%; bottom: -6px; width: 240px; height: 180px; margin-left: -120px; background-repeat: no-repeat; background-size: 1440px 540px; image-rendering: pixelated;
  animation: ndAct calc(var(--f) * .22s) steps(var(--f)) infinite; }
@keyframes ndAct { from { background-position: 0 0; } to { background-position: calc(var(--f) * -240px) 0; } }
.nd-v2 .nd-name { margin-top: 2px; font: 400 22px/1.1 "猫田楷", serif; letter-spacing: 4px; color: var(--ink); }
.nd-v2 .nd-rolel { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nd-v2 .nd-hearts .k29-heart { width: 12px; height: 12px; background-size: 36px 12px; } .nd-v2 .nd-hearts .k29-heart.h { background-position: -12px 0; } .nd-v2 .nd-hearts .k29-heart.o { background-position: -24px 0; }
/* 气泡：小尾巴指向人物 */
.nd-bubble { position: relative; flex: 1 1 auto; min-height: 0; width: 100%; box-sizing: border-box; margin: 7px 0 4px !important; padding: 5px 8px; overflow: hidden;
  font-size: 12.5px; line-height: 1.5; color: var(--ink-2); background: #fbf6e6; border: 1.5px solid rgba(90,58,38,.55); border-radius: 8px; }
.nd-bubble::before { content: ""; position: absolute; left: 50%; top: -7px; margin-left: -6px; border: 6px solid transparent; border-top: 0; border-bottom: 7px solid rgba(90,58,38,.55); }
.nd-bubble::after { content: ""; position: absolute; left: 50%; top: -5px; margin-left: -5px; border: 5px solid transparent; border-top: 0; border-bottom: 6px solid #fbf6e6; }
.nd-bubble.pop { animation: ndPop .28s ease-out; }
@keyframes ndPop { from { opacity: 0; transform: translateY(4px) scale(.96); } }
#panel .nd-v2 .nd-side .nd-chat { flex: none; width: 100%; height: 30px; font-size: 13px; letter-spacing: 2px; }
/* 竖屏：人物栏移到上面一行 */
#panel .nd-tall .nd29.nd-v2 { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); row-gap: 6px; }
.nd-tall .nd-v2 .nd-side { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px dashed rgba(140,116,66,.5); padding-bottom: 6px; }
.nd-tall .nd-v2 .nd-stage { width: 96px; height: 80px; } .nd-tall .nd-bust { width: 80px; height: 80px; } .nd-tall .nd-act { transform: scale(.5); transform-origin: 50% 100%; }
.nd-tall .nd-v2 .nd-bubble { flex: 1 1 100%; margin: 4px 0 !important; } .nd-tall .nd-v2 .nd-bubble::before, .nd-tall .nd-v2 .nd-bubble::after { display: none; }
/* 左栏各行固定高度：名字、身份、好感心、气泡、按钮在每一页都落在同一位置 */
.nd-v2 .nd-name, .nd-v2m .nd-name { flex: none; height: 24px; }
.nd-v2 .nd-rolel, .nd-v2m .nd-rolel { flex: none; height: 15px; line-height: 15px; }
.nd-v2 .nd-hearts, .nd-v2m .nd-hearts { flex: none; height: 12px; }
/* 卡片：一行能放下的都一样高；放不下的才长出第二行（材料、缺额不截断） */
.nd-v2 .nd-card { min-height: 48px; }
/* 田叔水磨「选择原料」：与事务册页同一版式 */
#panel .pbox.hs-box.nd-mill.nd-v2m { display: grid !important; grid-template-columns: 184px minmax(0, 1fr); column-gap: 6px; padding: 24px 28px 26px !important; }
.nd-v2m > .nd-col { padding-top: 3px; }
.nd-v2m .nd-side { min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px 2px; box-sizing: border-box; border-right: 1px dashed rgba(140,116,66,.5); }
.nd-v2m .nd-name { margin-top: 2px; font: 400 22px/1.1 "猫田楷", serif; letter-spacing: 4px; color: var(--ink); }
.nd-v2m .nd-rolel { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nd-v2m .nd-hearts .k29-heart { width: 12px; height: 12px; background-size: 36px 12px; } .nd-v2m .nd-hearts .k29-heart.h { background-position: -12px 0; } .nd-v2m .nd-hearts .k29-heart.o { background-position: -24px 0; }
#panel .nd-v2m .nd-side .nd-chat { flex: none; width: 100%; height: 30px; font-size: 13px; letter-spacing: 2px; }
.nd-v2m .nd-col { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.nd-v2m .nd-col > .k29-h { flex: none; }
.nd-v2m .nd-col .k29-h h3 { font-size: 25px; }
#panel .nd-mill.nd-v2m .hs-recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
#panel .pbox.nd-mill.nd-v2m .pclose { right: 8px !important; top: 8px !important; width: 40px; height: 40px; border: 0 !important; border-radius: 0 !important; font-size: 0 !important;
  background: url(../../assets/v29/ui/ui_op_close.png) center / 24px 24px no-repeat !important; image-rendering: pixelated; }
.nd-v2m > .nd-side { grid-column: 1; grid-row: 1; } .nd-v2m > .nd-col { grid-column: 2; grid-row: 1; }
/* 水磨页沿用事务册页的字体与「聊两句」按钮（水磨页原有的按钮样式不套到它身上） */
#panel .nd-v2m .nd-side, #panel .nd-v2m .nd-col > .k29-h { font-family: 'Noto Sans SC', sans-serif; }
#panel .nd-v2m .nd-side .nd-bubble { font-family: 'Noto Sans SC', sans-serif !important; }
#panel .nd-v2m .nd-side .nd-chat { display: flex; align-items: center; justify-content: center; padding: 0 6px !important; min-height: 0 !important; box-sizing: border-box; cursor: pointer;
  font: 13px 'Noto Sans SC', sans-serif !important; color: var(--ink) !important; background: none !important; box-shadow: none !important; border-radius: 0 !important;
  border: 12px solid transparent !important; border-image: url(../../assets/v29/ui/ui_rb_sec.png) 14 fill stretch !important; image-rendering: pixelated; }
#panel .nd-v2m .nd-col > .k29-h .nd-purse { font-size: 12px; color: var(--ink-3); }
.nd-mill-more { margin-right: auto; align-self: center; font-style: normal; font-size: 11px; color: var(--ink-2); }
/* 名字与好感心同一行，身份一行；人物区收矮 17px（只裁掉头顶上方的空白），气泡能放下 4 行（台词最长 35 字） */
.nd-namerow { flex: none; display: flex; align-items: center; justify-content: center; gap: 6px; height: 26px; margin-top: 2px; }
.nd-v2 .nd-namerow .nd-name, .nd-v2m .nd-namerow .nd-name { margin: 0; height: auto; }
.nd-v2 .nd-stage, .nd-v2m .nd-stage { height: 133px; }
.nd-v2 .nd-side .nd-bubble, .nd-v2m .nd-side .nd-bubble { padding: 4px 7px; font-size: 12px; line-height: 1.45; overflow-y: auto; scrollbar-width: none; }
#panel .nd-side .nd-chat { outline: none; }
.nd-tall .nd-namerow { margin: 0 6px; }
#panel .nd-v2m .nd-side .nd-chat { border-width: 9px !important; filter: none !important; }
.nd-mill-more { font-family: 'Noto Sans SC', sans-serif !important; }
