/* Preferences dialog: craft-book paper, vermilion rules and seal. */
#preferencesDialog { position: fixed; inset: auto; left: 50%; top: 50%; transform: translate(-50%,-50%); margin: 0; width: min(1180px,96vw); height: min(660px,92vh); max-width: none; max-height: none; padding: 20px 28px; overflow: auto; color: var(--ink); background: var(--paper) var(--grain); border: 0; border-top: var(--rule); border-bottom: var(--rule); font: 18px/1.5 'SerifSC',serif; box-shadow: 14px 16px 0 rgba(30,26,26,.4),0 30px 80px rgba(0,0,0,.6); }
#preferencesDialog:not([open]) { display: none; }
#preferencesDialog::backdrop { background: rgba(11,10,9,.88); }
.pref-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--verm-deep); padding: 0 0 12px; }
.pref-head h2 { font: normal 28px/1.2 'Kai',serif; margin: 0; }
.pref-head p { font-size: 13px; color: var(--ink-soft); margin: 0 0 4px; }
#closePreferences { align-self: flex-start; min-width: 44px; min-height: 44px; font-size: 24px; background: none; border: 1px solid var(--verm-deep); cursor: pointer; }
.pref-grid { display: grid; grid-template-columns: minmax(240px,.8fr) minmax(360px,1.2fr); gap: 32px; padding-top: 16px; }
.pref-grid h3 { font: normal 23px/1.3 'Kai',serif; margin: 0 0 12px; }
.pref-signature { border-right: var(--rule); padding-right: 28px; }
.pref-signature p { margin: 8px 0 18px; }
#prefName { display: block; width: 100%; min-height: 48px; border: 0; border-bottom: 2px solid var(--verm-deep); background: transparent; color: var(--ink); font: 24px/1.4 'Kai',serif; user-select: text; }
.pref-grid button { min-height: 44px; font: 16px/1.4 'Kai',serif; padding: 8px 16px; background: var(--paper-dark); color: var(--ink); border: 1px solid var(--ink-soft); box-shadow: var(--print); cursor: pointer; }
#profileApply { background: var(--verm-deep); color: #F3EBD8; }
.pref-row { display: flex; align-items: center; justify-content: space-between; min-height: 48px; gap: 18px; border-bottom: 1px dotted rgba(30,26,26,.25); padding: 4px 0; }
.pref-row select { min-height: 44px; max-width: 52%; font: inherit; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--ink-soft); }
.pref-row input[type=checkbox] { width: 26px; height: 26px; min-height: 26px; margin: 9px; accent-color: var(--verm-deep); cursor: pointer; }
.pref-volume { display: flex; align-items: center; gap: 10px; width: 52%; }
#prefVolume { width: 100%; min-width: 50px; min-height: 44px; accent-color: var(--verm-deep); }
#prefVolumeValue { min-width: 3.5em; text-align: right; font-size: 16px; }
#scaleLimit, #profileHelp, .pref-note { font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
#preferencesNotice, #profileNotice { font-size: 16px; color: var(--verm-deep); }
#profileSeal { border: 0; background: transparent; padding: 0; min-width: 54px; min-height: 54px; cursor: pointer; aspect-ratio: 1; display: grid; place-items: center; }
#profileSeal img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
#profileSeal span { position: relative; max-width: 76%; font: 18px/1.05 'Kai',serif; color: var(--verm-deep); overflow-wrap: anywhere; white-space: pre-wrap; text-align: center; }
#profileSeal:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
#colophonSignature { position: absolute; left: 68%; top: 18%; bottom: 15%; writing-mode: vertical-rl; font: 24px/1.4 'Kai',serif; color: var(--verm-deep); }
#receiptSignature { font: 18px/1.5 'Kai',serif; margin: 8px 0; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html.reduce-motion .front-title span { opacity: 1; filter: none; transform: none; }
html.reduce-motion #lamp { transition: none; }
.panel-head { pointer-events: none; }
.panel-head b { flex-shrink: 0; white-space: nowrap; }
.panel-head { max-height: calc(100% - 9 * var(--u)); }
html[data-text-scale="1.25"] .panel-head, html[data-text-scale="1.5"] .panel-head { flex-direction: column; }
.yard-book { left: var(--head-space,calc(3vw + 16 * var(--u))); }
.collection-book { width: calc(var(--page) * .95 - var(--head-space,calc(3vw + 16 * var(--u)))); }
#p-store .stock-toolbar, #p-store .stock-tabs { left: max(12%,var(--head-space,0px)); }
#p-store .cabinet, #p-store .render-slip { left: max(12%,var(--head-space,0px)); right: 10%; width: auto; }
#p-store .cabinet { grid-auto-rows: max(88px,calc(88px + 44px * (var(--pref-text,1) - 1))); }
#p-store .drawer .face { height: 100%; }
#p-work { --w: calc(max(14vw,var(--head-space,0px)) + var(--gates) * 30vw); }
#gates { left: max(14vw,var(--head-space,0px)); }
.gate .work-quote > * { max-width: 100%; min-width: 0; }
.gate .wo-out { flex-wrap: wrap; justify-content: center; }
.gate .wo-out b, .gate .wo-meta { overflow-wrap: anywhere; }
#ribbonMarks button { width: 44px; }
#ribbonMarks button span { position: absolute; top: 32px; left: 50%; transform: translateX(-50%); pointer-events: none; }
#tutorialBtn, #workshopJump { min-height: 44px; }
#workOrdersOpen, .orders-book button, .orders-book input, .orders-book select { min-height: 44px; }
@media (max-width: 1100px) {
  #logo span { display: none; }
  #tools { gap: 4px; }
  #tools button { padding-left: 8px; padding-right: 8px; }
  #preferencesDialog { padding: 16px 20px; }
  .pref-grid { grid-template-columns: minmax(220px,.8fr) minmax(320px,1.2fr); gap: 20px; }
  .pref-signature { padding-right: 20px; }
  :lang(en) #tutorialBtn { left: calc(var(--roller) + 2vw + 60px); }
}
@media (max-width: 800px) { .pref-grid { grid-template-columns: 1fr; } .pref-signature { border-right: 0; border-bottom: var(--rule); padding: 0 0 20px; } }
