/* Both helper windows use the same form. Nine-slice the PC artwork so
   longer action labels keep the original one-pixel edges. */
html body #dialog.pc-assist-native #dialogbody form.assist-settings {
  --helper-tab: url("tab.png");
  --helper-tab-active: url("tab-active.png");
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .assist-tabbar {
  display: flex;
  flex-flow: row wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 1px;
  padding: 1px;
  margin: 0;
  border: 1px solid #443d32;
  background: #100e0e;
  box-shadow: none;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .assist-footer {
  min-height: 24px;
  padding: 1px 0;
  column-gap: 3px;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(.assist-tabbar, .assist-footer, .assist-panel) button:not(:where(.pick-tile, .pc-protection-icon, .pc-buff-icon, .pc-buff-option, .helper-choice, .helper-slot-grid > button)) {
  --face: var(--helper-tab);
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  min-height: 22px;
  margin: 0;
  padding: 0 6px;
  border: 4px solid transparent;
  border-image: var(--face) 4 fill / 4px stretch;
  /* The legacy pressed and hover rules also draw their own stone surface. */
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  transform: none !important;
  font: 12px/14px 'PMingLiU', '新細明體', serif;
  color: #c5b8a5;
  text-shadow: 1px 1px #100a06;
  cursor: pointer;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .assist-tabbar button.assist-tab {
  flex: 0 1 auto;
  min-width: 52px;
  min-height: 20px;
  height: 20px;
  padding: 0 4px;
  font-size: 12px !important; /* Shared dialog sets this with !important. */
  line-height: 12px;
  white-space: nowrap;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .assist-footer > button {
  min-width: 52px;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings button:is(.selected, .on, .recording, [aria-pressed=true], [aria-selected=true], [aria-checked=true], :active):not(:disabled) {
  --face: var(--helper-tab-active);
  color: #fff0d5;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings button:hover:not(:disabled) {
  color: #ffeed2;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings button:disabled {
  opacity: .55;
  cursor: default;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings input[type=checkbox] {
  appearance: none;
  display: inline-block;
  vertical-align: middle;
  flex: 0 0 16px;
  width: 16px;
  height: 15px;
  min-width: 16px;
  min-height: 15px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent url("check.png") center / 16px 15px no-repeat;
  box-shadow: none;
  image-rendering: pixelated;
  cursor: pointer;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings input[type=checkbox]:checked {
  background-image: url("check-on.png");
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings input[type=checkbox]::after {
  content: none;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(.pick-tile, .pc-protection-icon, .pc-buff-icon, .pc-buff-option, .helper-choice, .helper-slot-grid > button, .pc-suite-empty-grid > span) {
  position: relative;
  box-sizing: border-box;
  border: 4px solid transparent;
  border-image: url("slot.png") 4 fill / 4px stretch;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  transform: none !important;
  padding: 0;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .pick-tile.selected .mw-tile-art::after,
html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(.pc-buff-icon, .pc-buff-option, .pc-protection-icon, .helper-slot-grid > button, .helper-choice):is([aria-pressed=true], .selected)::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 16px;
  height: 15px;
  background: url("check-on.png") center / contain no-repeat;
  pointer-events: none;
  image-rendering: pixelated;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings :where(select, textarea, input[type=text], input[type=number], .pc-slider-value) {
  box-sizing: border-box;
  border: 3px solid transparent;
  border-image: url("field.png") 3 fill / 3px stretch;
  border-radius: 0;
  background: #0b0807;
  box-shadow: none;
  color: #eee1c7;
  padding: 1px 4px;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings select {
  appearance: none;
  color-scheme: dark;
  min-height: 22px;
  padding-right: 22px;
  border-image-slice: 3;
  background-color: #0c0908;
  background-image: linear-gradient(45deg, transparent 50%, #b9a587 50%),
                    linear-gradient(135deg, #b9a587 50%, transparent 50%);
  background-position: right 10px center, right 6px center;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .pc-slider-value {
  min-height: 20px;
  padding: 0 2px;
  line-height: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(button, select, textarea, input):focus-visible {
  outline: 1px dotted #e4cda4;
  outline-offset: -2px;
}

/* Interior frames and rules use the edges of the PC panel. The outer window
   carries its own scroll rail and ornaments in the original 562 artwork. */
html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(.assist-body, .assist-tabbar, .hunt-route-info, fieldset, .pc-protection-potions) {
  border: solid transparent;
  border-width: 2px 3px;
  border-image: url("panel-frame.png") 2 3 / 2px 3px stretch;
  border-radius: 0;
  box-shadow: none;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(h3, .pc-suite-row, .assist-stage) {
  border: 0 solid transparent;
  border-bottom-width: 2px;
  border-image: url("divider.png") 0 3 100% / 0 3px 2px stretch;
  box-shadow: none;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(.pc-protection-emergency, .pc-protection-other, .pc-hunt-tips) {
  border: 0 solid transparent;
  border-top-width: 2px;
  border-image: url("divider.png") 100% 3 0 / 2px 3px 0 stretch;
  box-shadow: none;
}

/* Leave the whole 17px control draggable. Only the two-pixel art is painted. */
html body #dialog.pc-assist-native #dialogbody form.assist-settings .pc-value-slider input[type=range] {
  --helper-knob: url("/assets/original-windows/original-hud/461.png");
  appearance: none;
  height: 17px;
  margin: 1px 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: url("range-track.png") left center / var(--pc-slider-fill, 0%) 2px no-repeat,
              url("range-track-rest.png") center / 100% 2px no-repeat;
  box-shadow: none;
  image-rendering: pixelated;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .pc-value-slider input[type=range]:active:not(:disabled) {
  --helper-knob: url("/assets/original-windows/original-hud/462.png");
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .pc-value-slider input[type=range]::-webkit-slider-runnable-track {
  height: 11px;
  border: 0;
  background: transparent;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .pc-value-slider input[type=range]::-webkit-slider-thumb {
  width: 11px;
  height: 11px;
  margin: 0;
  background: transparent var(--helper-knob) center / 11px 11px no-repeat;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .pc-value-slider input[type=range]::-moz-range-track {
  height: 11px;
  border: 0;
  background: transparent;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .pc-value-slider input[type=range]::-moz-range-thumb {
  background: transparent var(--helper-knob) center / 11px 11px no-repeat;
}

html body #dialog.pc-assist-native #dialogbody form.assist-settings .pc-value-slider input:disabled {
  cursor: default;
}

@supports selector(::-webkit-scrollbar) {
  html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(.pc-buff-strip, .pc-healing-menu) {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }

  html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(.pc-buff-strip, .pc-healing-menu)::-webkit-scrollbar {
    width: 9px;
    height: 9px;
  }

  html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(.pc-buff-strip, .pc-healing-menu)::-webkit-scrollbar-track {
    border: 3px solid transparent;
    border-image: url("field.png") 3 fill / 3px stretch;
  }

  html body #dialog.pc-assist-native #dialogbody form.assist-settings :is(.pc-buff-strip, .pc-healing-menu)::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-image: url("tab.png") 3 fill / 3px stretch;
  }
}
