/* Shared control geometry: form fields are filled; navigation and menu actions
   use quiet surfaces. Selection behavior does not change a field's chrome. */
html:root {
  --control-fill: var(--color-surface-raised);
}
/* Links used as buttons share the button chrome, including its text treatment. */
a.btn {
  text-decoration: none;
}
/* The count and its clear action share the filters control's perimeter. */
html:root
  body
  #book-stage
  .collection-toolbar-more-control
  .collection-toolbar-more-trigger.is-active {
  border-radius: var(--radius-control) 0 0 var(--radius-control);
  border-color: var(--color-line);
}
html:root .collection-toolbar-more-control .collection-toolbar-more-clear {
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  border-color: var(--color-line);
}
html:root
  :is(
    .btn,
    .icon-btn,
    .rune-close,
    .ms-trigger,
    .field-input,
    .search-input,
    .scope-option,
    .sync-chip,
    .fab-action,
    .mobile-bottom-nav-item
  ) {
  border-radius: var(--radius-control);
}
/* The book frame has ID-scoped navigation rules; apply the same geometry there. */
html:root
  body
  #book-stage
  :is(.btn, .icon-btn, .rune-close, .ms-trigger, .scope-option, .sync-chip, .search-input),
html:root .mobile-bottom-nav .mobile-bottom-nav-item {
  border-radius: var(--radius-control);
}
/* One dropdown style everywhere: every single-value select matches the filters
   menu's multiselect trigger. Component rules may only change width or use the
   compact size below. */
html:root
  :is(
    .field,
    .detail-field,
    .grid-control-field,
    .collection-toolbar-popover,
    .bulk-edit-panel,
    .add-details
  )
  input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='hidden']):not(
    :is(.price-input, .container-editor-name-group) > .field-group-control
  ),
html:root
  input.field-group-control:not(
    :is(.price-input, .container-editor-name-group) > .field-group-control
  ),
html:root .container-editor-name-group,
html:root select:not([multiple]):not([size]),
html:root :is(.ms-trigger, .printing-filter-input, .location-combobox > input) {
  box-sizing: border-box;
  min-height: var(--control-height);
  background-color: var(--control-fill);
  color: var(--color-text);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-control);
  padding: 0 10px;
  box-shadow: none;
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: 1.25;
}
/* Identity fields own one input frame, including the icon segment. Keep the
   inner input free of chrome even inside detail, deck, and import forms. */
html:root .container-editor-name-group {
  padding: 0;
  overflow: hidden;
}
html:root .container-editor-name-group:focus-within {
  outline: 2px solid var(--color-line-focus);
  outline-offset: 2px;
}
html:root .container-editor-name-group > .field-group-control {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: 0;
  padding: 0 10px;
  color: inherit;
  font: inherit;
}
/* The price group owns the frame; its input fits inside that perimeter. */
html:root .price-input {
  box-sizing: border-box;
  height: var(--control-height);
}
html:root .price-input > .field-group-control {
  height: 100%;
  min-height: 0;
  border: 0;
}
html:root .container-editor-name-group .container-editor-emoji-btn {
  width: 36px;
  min-width: 36px;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--color-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: 0;
}
@media (hover: hover) and (pointer: fine) {
  html:root .container-editor-name-group .container-editor-emoji-btn:is(:hover, :focus-visible) {
    background: var(--color-surface-hover);
  }
}
html:root .container-editor-name-group .container-editor-emoji-btn:is(:focus-visible) {
  background: var(--color-surface-hover);
}
html:root select:not([multiple]):not([size]),
html:root .location-combobox > input {
  appearance: none;
  padding-right: 30px;
  background-image: var(--control-chevron);
  background-position: right 11px center;
  background-repeat: no-repeat;
  background-size: 10px 6px;
  text-overflow: ellipsis;
}
/* Toolbar fields use the shared control height. */
html:root :is(.deck-toolbar-field, .control-compact) select:not([multiple]):not([size]),
html:root :is(.deck-toolbar-field, .control-compact) .single-select-trigger,
html:root .ms-trigger.control-compact {
  min-height: var(--control-height);
  padding-block: 0;
  font-size: var(--font-size-sm);
}
html:root {
  --control-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%23746f60' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
}
html:root .ms-trigger::after {
  border: 0;
  width: 10px;
  height: 6px;
  background: var(--control-chevron) center / contain no-repeat;
  transform: none;
}
html:root
  body
  :is(.ui-popover, .collection-toolbar-popover, .ui-modal-card, .deck-details-modal-card),
html:root[data-frame]
  body
  :is(.ui-popover, .collection-toolbar-popover, .ui-modal-card, .deck-details-modal-card) {
  border-radius: var(--radius-panel);
}
html:root body :is(#detailDrawer, .detail-drawer, .ui-drawer),
html:root[data-frame] body :is(#detailDrawer, .detail-drawer, .ui-drawer) {
  border-radius: var(--radius-panel);
}
html:root
  :is(.field, .detail-field, .collection-toolbar-popover, .bulk-edit-panel, .add-details)
  input:not(:is(.price-input, .container-editor-name-group) > .field-group-control):focus-visible,
html:root
  input.field-group-control:not(
    :is(.price-input, .container-editor-name-group) > .field-group-control
  ):focus-visible,
html:root select:focus-visible,
html:root .ms-trigger:focus-visible {
  outline: 2px solid var(--color-line-focus);
  outline-offset: 2px;
}
/* A grouped input's complete outline must clear the composite's clipped edge. */
html:root
  .field-group:not(.price-input, .container-editor-name-group):has(
    > .field-group-control:focus-visible
  ) {
  overflow: visible;
}
html:root :is(.language-toggle, .condition-toggle) {
  display: inline-flex;
  width: fit-content;
  align-items: stretch;
  overflow: hidden;
  border-radius: var(--radius-control);
  background: var(--control-fill);
}
html:root :is(.language-toggle, .condition-toggle) > label {
  display: flex;
  margin: 0;
  padding: 0;
}
html:root :is(.language-toggle, .condition-toggle) > label > span {
  display: grid;
  place-items: center;
  min-height: calc(var(--control-height) - 4px);
  box-sizing: border-box;
  padding: 0 8px;
}
html:root #addEditor :is(.language-row, .language-options, .language-select-wrap) {
  width: 100%;
}
html:root #addEditor .field > label {
  display: block;
  margin: 0 0 6px;
}
html:root .location-combobox {
  display: block;
  width: 100%;
}
html:root .location-combobox > input {
  width: 100%;
}
html:root #addTagsRow {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-control);
  background: var(--control-fill);
  min-height: var(--control-height);
  box-sizing: border-box;
  padding: 5px 10px;
  gap: 6px;
}
html:root #addTagsRow:focus-within {
  outline: 2px solid var(--color-line-focus);
  outline-offset: 2px;
}
html:root #addTagsRow .tag-input {
  background: transparent;
  min-height: 24px;
  outline: none;
  box-shadow: none;
  border-radius: 0;
}
.quantity-input {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-control);
  background: var(--control-fill);
  overflow: hidden;
  width: 132px;
}
html:root #addQty {
  border: 0;
  border-radius: 0;
  width: 52px;
  min-width: 0;
  padding: 6px 0;
  text-align: center;
  appearance: textfield;
}
.quantity-input input::-webkit-inner-spin-button,
.quantity-input input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}
.quantity-input > button {
  width: 38px;
  border: 0;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  font: inherit;
}
@media (hover: hover) and (pointer: fine) {
  .quantity-input > button:hover {
    background: var(--color-surface-hover);
  }
}
.quantity-input:focus-within {
  outline: 2px solid var(--color-line-focus);
  outline-offset: 2px;
}
html:root .quantity-input > input:focus-visible {
  outline: none;
}
/* One drawer surface, with a single scrolling content area below its header. */
html:root body .app-right-layer .app-right.ui-drawer {
  padding: 0;
  gap: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
html:root body .app-right-layer .app-right-drawer-handle {
  position: static;
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 16px;
  background: var(--color-bg);
}
html:root body .app-right-layer #addDetails {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 0 16px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  scroll-padding-block: 12px 130px;
}
html:root #addDetails > .details-body {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
html:root .add-tabs {
  margin-top: 0;
  padding: 2px;
}
/* Keep the printing identity and entry controls together in the add drawer. */
html:root #addPreview.active {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}
html:root #addPreview .add-preview-img {
  width: 88px;
}
html:root #addPrintingList {
  max-height: min(24dvh, 180px);
}
html:root #addPreview .add-preview-info {
  min-height: 0;
}
html:root #addEditor .add-actions {
  background: var(--color-bg);
  position: sticky;
  top: 0;
  bottom: auto;
  z-index: 3;
  display: flex;
  flex-wrap: nowrap;
  margin: 0;
  padding: 8px 0;
  border: 0;
}
html:root #addCardBtn {
  min-width: 0;
  height: auto;
  white-space: normal;
}
html:root #addCardActionLabel {
  overflow-wrap: anywhere;
}
html:root #addCardBtn .btn-shortcut {
  display: none;
}
html:root #addEditor .field-qty {
  max-width: 140px;
}

/* Top-layer popovers remain attached in the DOM for focus and event ownership. */
html:root .sync-menu[popover] {
  margin: 0;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow: auto;
  border-radius: var(--radius-panel);
}
/* The popover is the positioned surface and carries the caret that points at
   the actions button; its body is the scrolling grid. */
html:root .bulk-edit-panel[popover] {
  margin: 0;
  inset: auto;
  transform: none;
  width: min(640px, calc(100vw - 16px));
  max-height: none;
  border-radius: var(--radius-panel);
  display: block;
  overflow: visible;
  padding: 0;
}
html:root .bulk-edit-panel-body {
  border-radius: inherit;
  box-sizing: border-box;
  display: grid;
  gap: 12px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: calc(100dvh - 112px);
  overflow: auto;
  padding: 16px;
}
html:root .bulk-edit-panel[popover]::after {
  background: inherit;
  border: solid var(--color-line);
  border-width: 0 var(--border-width) var(--border-width) 0;
  content: '';
  height: 12px;
  left: calc(var(--bulk-caret-x, 50%) - 6px);
  position: absolute;
  transform: rotate(45deg);
  width: 12px;
}
html:root .bulk-edit-panel[data-placement='above']::after {
  bottom: -7px;
}
html:root .bulk-edit-panel[data-placement='below']::after {
  top: -7px;
  transform: rotate(225deg);
}
@media (prefers-reduced-motion: no-preference) {
  html:root .bulk-edit-panel[popover]:popover-open {
    animation: bulk-panel-in var(--motion-fast, 140ms) var(--vui-ease-out, ease-out);
    transform-origin: var(--bulk-caret-x, 50%) 100%;
  }
}
@keyframes bulk-panel-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}
html:root .bulk-edit-menu[open] > .bulk-edit-trigger {
  background: color-mix(in srgb, var(--color-text-strong) 12%, var(--color-surface-raised));
  color: var(--color-text-strong);
}
html:root .bulk-edit-panel-header {
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
html:root .bulk-edit-panel-header > span {
  font-weight: 600;
}
html:root .bulk-edit-dismiss {
  margin: -6px -6px -6px 0;
}
html:root .bulk-action-group {
  border: 0;
  padding: 6px 0;
}
html:root .bulk-action-group-primary,
html:root .bulk-action-group-corrections {
  grid-column: 1 / -1;
}

html:root .fab-cluster > details .fab-action {
  border-radius: var(--radius-control);
}
/* In the phone More panel the actions are rows of one list, not pills. */
@media (max-width: 900px) {
  html:root .fab-cluster > details .mobile-utility-menu-item {
    border-radius: 0;
  }
}
/* Collection segments only own their width; chrome comes from the shared track. */
.collection-toolbar-view .collection-display-mode .segment-btn {
  min-width: 0;
  width: auto;
  flex: 1 1 0;
}

html:root .card-scan-qr-slot {
  position: relative;
  padding: 30px;
  box-sizing: border-box;
  background: #f7efd9;
}
html:root .card-scan-qr-slot .card-scan-qr {
  background: #f7efd9;
  border: 0;
  border-radius: 0;
}
.card-scan-ivy {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: #496358;
  pointer-events: none;
}
.printing-stamp {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Navigation uses one row and one leading slot for headings and destinations. */
html:root #scopeSelector .scope-option-group {
  gap: 4px;
}
html:root #scopeSelector .scope-option-group + .scope-option-group {
  border: 0;
  margin-top: 4px;
  padding-top: 0;
}
html:root #scopeSelector .scope-option-group-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 28px;
  gap: 0;
  padding: 0;
  min-height: var(--control-height);
}
html:root #scopeSelector .scope-option-group-flat .scope-option-group-heading {
  grid-template-columns: minmax(0, 1fr);
}
html:root
  #scopeSelector
  :is(.scope-option, .scope-option-group-toggle, .scope-option-group-destination) {
  align-items: center;
  display: flex;
  gap: 8px;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 4px 8px;
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  letter-spacing: 0;
  line-height: 24px;
  text-align: left;
  justify-content: flex-start;
}
html:root #scopeSelector .scope-option-group-toggle {
  font-weight: 600;
}
html:root #scopeSelector .scope-option-group-body {
  position: relative;
  gap: 4px;
  padding: 0;
}
html:root #scopeSelector :is(.entity-label, .scope-option-group-identity) {
  align-items: center;
  gap: 8px;
  min-width: 0;
}
html:root #scopeSelector :is(.entity-label-mark, .scope-option-group-chevron) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 0;
}
html:root #scopeSelector .entity-label-glyph {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  font-size: var(--font-size-display);
  object-fit: contain;
}
html:root #scopeSelector .entity-label-mark {
  overflow: visible;
}
html:root #scopeSelector :is(.scope-option-group-menu, .scope-option-group-add) {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: var(--radius-control);
  width: 26px;
  height: 26px;
  padding: 0;
  font: var(--font-size-heading)/1 var(--font-body);
  cursor: pointer;
  opacity: 1;
  visibility: inherit;
  pointer-events: auto;
}
html:root #scopeSelector :is(.scope-option-group-menu, .scope-option-group-add) .app-icon {
  display: block;
  flex: none;
}
@media (hover: hover) and (pointer: fine) {
  html:root #scopeSelector :is(.scope-option-group-menu, .scope-option-group-add):hover {
    background: color-mix(in srgb, currentColor 14%, transparent);
  }
}
html:root #scopeSelector :is(.scope-option-group-menu, .scope-option-group-add):active {
  background: color-mix(in srgb, currentColor 14%, transparent);
}
html:root #scopeSelector :is(.scope-option-group-menu, .scope-option-group-add):focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}
@media (hover: hover) and (pointer: fine) {
  html:root #scopeSelector .scope-option-group-menu {
    opacity: 0;
    pointer-events: none;
  }
  html:root
    #scopeSelector
    .scope-option-group-heading:is(:hover, :has(:focus-visible))
    .scope-option-group-menu,
  html:root #scopeSelector .scope-option-group-menu[aria-expanded='true'] {
    opacity: 1;
    pointer-events: auto;
  }
}
@media (pointer: coarse) {
  /* M-11: rows are 32px tall here. Growing the row itself (rather than a
     hit-slop overlay) is fine -- there's nothing tight beside it. This must
     match the `html:root #scopeSelector ...` selector shape above to win:
     plain `.scope-option` rules elsewhere lose this cascade. */
  html:root
    #scopeSelector
    :is(.scope-option, .scope-option-group-toggle, .scope-option-group-destination) {
    height: auto;
    min-height: 44px;
  }
  /* The group-level "+" and "..." sort trigger stay visually small (26x26)
     and get hit slop instead of growing. */
  html:root #scopeSelector :is(.scope-option-group-menu, .scope-option-group-add) {
    position: relative;
  }
  html:root #scopeSelector :is(.scope-option-group-menu, .scope-option-group-add)::before {
    content: '';
    position: absolute;
    inset: 50% auto auto 50%;
    width: max(44px, 100%);
    height: max(44px, 100%);
    transform: translate(-50%, -50%);
  }
}
/* A reorder targets a gap, never another location's whole surface. */
html:root #scopeSelector[data-reordering] .scope-option {
  background: transparent !important;
  box-shadow: none !important;
  color: inherit !important;
  --color-text: inherit;
  --color-text-strong: inherit;
  --color-text-muted: inherit;
  --color-accent: inherit;
}
html:root #scopeSelector[data-reordering] .scope-option * {
  color: inherit !important;
}
html:root .scope-sort-menu {
  position: fixed;
  margin: 0;
  inset: auto;
  width: max-content;
  min-width: 0;
  max-width: calc(100vw - 16px);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: 400;
  z-index: var(--z-popover, 1000);
}
html:root .scope-sort-menu[hidden] {
  display: none;
}
html:root .scope-sort-menu .floating-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
}
.scope-sort-check {
  width: 16px;
  flex: 0 0 16px;
}
.scope-reorder-gap {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 4px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: currentColor;
  pointer-events: none;
  z-index: 1;
}

.deck-card-ownership-status {
  margin: 4px 8px 8px;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}
@media (max-width: 600px) {
  html:root .bulk-edit-panel-body {
    grid-template-columns: minmax(0, 1fr);
  }
  /* M-16: three 120px-minimum selects don't fit the panel's ~354px of content
     width on a phone — stack them instead of overflowing. */
  html:root .bulk-correction-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Keep selected-card actions compact without repeating the controls' labels. */
html:root .bulk-edit-panel .bulk-action-group:has(#bulkTagAdd) {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}
html:root .bulk-edit-panel .bulk-action-group:has(#bulkTagAdd) h3 {
  grid-column: 1 / -1;
}
html:root .bulk-edit-panel .bulk-action-footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--color-line);
}
html:root .printing-dropdown-trigger {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
html:root .printing-dropdown-trigger > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html:root .printing-dropdown-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 8px;
  box-sizing: border-box;
  overflow: auto;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-control);
  box-shadow: 0 6px 20px #0002;
}
html:root .printing-dropdown-menu .printing-filter-input {
  width: 100%;
  box-sizing: border-box;
}
html:root .printing-dropdown-menu .printing-list {
  max-height: none;
}

/* Shared Book controls. The track includes its inset in the control height;
   dense row icons and existing 44px touch targets retain their own geometry. */
html[data-theme='book'] {
  --vui-color-input-bg: var(--book-paper-light);
  --vui-color-surface-sunken: var(--book-selected);
  --color-surface-sunken: var(--book-selected);
  --vui-input-bevel: none;
}
html[data-theme='book']
  :is(
    .btn,
    .fab-btn,
    .sync-chip,
    .ms-trigger,
    .field-chrome,
    input[type='text'],
    input[type='search'],
    input[type='number'],
    input[type='email'],
    input[type='url'],
    input[type='tel'],
    input[type='password'],
    input:not([type]),
    select
  ) {
  box-sizing: border-box;
  height: var(--control-height);
  min-height: var(--control-height);
  padding-block: 0;
  border-radius: var(--radius-control);
}
html[data-theme='book']
  :is(
    .btn-secondary,
    .fab-btn:not(.fab-btn-primary),
    .ms-trigger,
    .field-chrome,
    input[type='text'],
    input[type='search'],
    input[type='number'],
    input[type='email'],
    input[type='url'],
    input[type='tel'],
    input[type='password'],
    input:not([type]),
    select,
    textarea
  ) {
  background-color: var(--book-paper-light);
  color: var(--book-ink);
}
html[data-theme='book']
  .app-left
  :is(.scope-option, .scope-option-group-heading, .scope-option-group-destination) {
  min-height: var(--control-height);
  height: var(--control-height);
  padding-block: 0;
  border-radius: var(--radius-control);
}
html[data-theme='book'] :is(.segmented, .condition-toggle, .language-toggle) {
  --color-text: var(--book-ink);
  --color-text-muted: color-mix(in srgb, #665c46 85%, var(--book-ink));
  align-items: center;
  box-sizing: border-box;
  gap: 2px;
  padding: 2px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--book-paper-light);
  box-shadow: none;
}
html[data-theme='book'] .segmented .segment-btn,
html[data-theme='book'] :is(.condition-toggle, .language-toggle) label > span {
  box-sizing: border-box;
  justify-content: center;
  min-height: calc(var(--control-height) - 4px);
  height: calc(var(--control-height) - 4px);
  margin: 0;
  padding: 0 var(--control-pad-x);
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  box-shadow: none;
  color: var(--book-ink);
  white-space: nowrap;
}
html[data-theme='book'] .segmented {
  border: var(--border-width) solid var(--color-line);
}
@media (max-width: 900px) {
  /* Phone segments are 44px touch targets; draw the track edge inside so the
     border does not grow the track. */
  html[data-theme='book'] .segmented {
    border: 0;
    box-shadow: inset 0 0 0 var(--border-width) var(--color-line);
  }
}
html[data-theme='book'] .segmented .segment-btn {
  min-height: calc(var(--control-height) - 6px);
  height: calc(var(--control-height) - 6px);
  border-radius: calc(var(--radius-control) - 2px);
}
html[data-theme='book']
  .segmented
  .segment-btn:is(.active, [aria-pressed='true'], [aria-selected='true']),
html[data-theme='book'] .single-select-option[aria-selected='true'],
html[data-theme='book'] .ms-option[aria-selected='true'],
html[data-theme='book'] .floating-menu-item[aria-checked='true'],
html[data-theme='book'] :is(.condition-toggle, .language-toggle) input:checked + span {
  background: var(--book-selected);
  color: var(--book-ink);
}
@media (hover: hover) and (pointer: fine) {
  html[data-theme='book']
    .segmented
    .segment-btn:not(.active):not([aria-pressed='true']):not([aria-selected='true']):hover {
    background: var(--book-hover);
  }
}
html[data-theme='book'] .segmented .segment-btn:focus-visible {
  outline: var(--focus-ring);
  outline-offset: -2px;
}
html[data-theme='book'] :is(.single-select-option, .floating-menu-item) {
  min-height: var(--control-height);
  border-radius: var(--radius-control);
}
@media (max-width: 900px) {
  /* Preserve the established touch minimum inside segmented tracks. */
  html[data-theme='book'] .segmented .segment-btn,
  html[data-theme='book'] :is(.condition-toggle, .language-toggle) label > span {
    min-height: var(--vui-touch-target, 44px);
  }
  html[data-theme='book'] :is(.drawer-actions, .add-actions) .btn {
    min-height: var(--vui-touch-target, 44px);
  }
}

/* Primary touch controls keep a real 44px box, including compact picker variants. */
@media (pointer: coarse) {
  html:root
    body
    :is(
      .btn,
      .fab-btn,
      .rune-close,
      .ms-trigger,
      .floating-menu-item,
      .mcp-chat-empty-example,
      .segment-btn
    ),
  html:root body select:not([multiple]):not([size]) {
    min-height: 44px;
  }
  html:root body :is(.rune-close, .container-editor-swatch, .color-swatch) {
    min-width: 44px;
    min-height: 44px;
  }
  html:root body #detailPriceLink,
  html:root body .deck-summary-ownership,
  html:root body .deck-hero-more {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}
@media (max-width: 359px) {
  body .ui-modal-actions {
    flex-wrap: wrap;
  }
  body .ui-modal-actions .container-edit-delete {
    flex: 1 0 100%;
    margin-right: 0;
  }
  body .container-editor-view-toggle {
    flex-wrap: wrap;
  }
  body .container-editor-view-option {
    flex: 1 1 100%;
  }
}
@media (pointer: coarse) {
  html:root body :is(.deck-commander-hero-name, .deck-description-toggle) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

@media (pointer: coarse) {
  html:root body .deck-summary-ownership-button {
    display: inline-block;
    min-height: 44px;
    padding-block: 6px;
    text-align: left;
  }
}

@media (pointer: coarse) {
  body .storage-create-form .container-editor-swatch-row {
    flex-wrap: wrap;
    min-width: 0;
  }
}

@media (pointer: coarse) {
  html:root
    body
    :is(.deck-toolbar-field, .control-compact)
    :is(select:not([multiple]):not([size]), .single-select-trigger, .ms-trigger, .btn) {
    min-height: 44px;
  }
}
