/* github:axtk/web-essentials@1.0.0 */
:root {
  --text-color: rgba(0, 0, 0, 0.8);
  --text-background: white;
  --placeholder-color: rgba(0, 0, 0, 0.55);
  --error-color: crimson;
  --link-color: royalblue;
  --link-hover-color: mediumvioletred;
  --border-width: 0.08em;
  --border-color: rgba(0, 0, 0, 0.35);
  --border: var(--border-width) solid var(--border-color);
  --separator-border: var(--border-width) solid rgba(0, 0, 0, 0.25);
  --clickable-cursor: pointer;
  --disabled-cursor: default;
  --disabled-opacity: 0.4;

  --line-height: 1.3em; /* unit: em */
  --ex-height: 0.6em;
  --cap-height: 0.75em;
  --space-width: 0.27em;

  --highlight-color: white;
  --highlight-background: mediumpurple;
  --highlight-border-color: rgba(0, 0, 0, 0.15);
  --highlight-hover-background: rgba(221, 160, 221, 0.2);
  --focus-ring-color: var(--text-color);
  --focused-box-shadow: 0 0 0.08em 0 var(--focus-ring-color);
  --focused-underline-shadow: 0 0.08em 0.08em -0.08em var(--focus-ring-color);
  --tooltip-color: var(--highlight-color);
  --tooltip-background: var(--highlight-background);

  --icon-size: 0.75em;
  --control-line-height: 1.15em;
  --control-border-radius: 0.2em;
  --control-padding-y: 0.2em;
  --control-hover-mask-background: rgba(0, 0, 0, 0.08);
  --control-active-mask-background: rgba(0, 0, 0, 0.25);
  --input-padding-x: 0.35em;
  --button-padding-x: 1em;
  --button-spacing-x: 0.75em;
  --select-button-size: var(--line-height);
  --option-padding-x: 0.35em;
  --tab-border-width: 0.15em;
  --tip-text-size: 0.85em;
  --tip-margin-y: 0.25em;

  --checkbox-size: 1.16em;
  --checkbox-position-y: 0.15em;
  --option-checkbox-size: 1.16em;
  --option-checkbox-position-y: 0.15em;
  --toggle-width: 2em;
  --toggle-height: 1.16em;
  --toggle-position-y: 0.17em;
  --checkbox-image-url: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%20width%3D%22100%22%20height%3D%22100%22%3E%3Cpath%20d%3D%22M20%2C55%20L42%2C80%20L80%2C20%22%20fill%3D%22none%22%20stroke%3D%22rgba(0%2C%200%2C%200%2C%20.8)%22%20stroke-width%3D%229%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E");
  --highlighted-checkbox-image-url: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%20width%3D%22100%22%20height%3D%22100%22%3E%3Cpath%20d%3D%22M20%2C55%20L42%2C80%20L80%2C20%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%229%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E");
  --radio-image-url: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%20width%3D%22100%22%20height%3D%22100%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2220%22%20fill%3D%22rgba(0%2C%200%2C%200%2C%20.8)%22%2F%3E%3C%2Fsvg%3E");
  --highlighted-radio-image-url: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%20width%3D%22100%22%20height%3D%22100%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2220%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E");
  --select-button-image-url: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2092%20100%22%3E%3Cpath%20d%3D%22M21%2C40%20L46%2C70%20L71%2C40%22%20fill%3D%22none%22%20stroke%3D%22rgba(0%2C%200%2C%200%2C%20.8)%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E");
  --highlighted-select-button-image-url: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2092%20100%22%3E%3Cpath%20d%3D%22M21%2C40%20L46%2C70%20L71%2C40%22%20fill%3D%22none%22%20stroke%3D%22white%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%2F%3E%3C%2Fsvg%3E");
  --toggle-image-url: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%20width%3D%22100%22%20height%3D%22100%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2235%22%20fill%3D%22rgba(0%2C%200%2C%200%2C%20.8)%22%2F%3E%3C%2Fsvg%3E");
  --highlighted-toggle-image-url: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20100%20100%22%20width%3D%22100%22%20height%3D%22100%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2235%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E");
}
[disabled]:not([disabled="false"]) {
  opacity: var(--disabled-opacity);
  cursor: var(--disabled-cursor);
  pointer-events: none;
}
[dir="rtl"] svg[data-shape~="rtl-flip"],
[dir="rtl"] img[data-shape~="rtl-flip"] {
  transform: scaleX(-1);
}
::placeholder {
  color: var(--placeholder-color);
}

/* button */
button,
[role="button"],
a[role="button"],
input[type="button"],
input[type="submit"],
input[type="reset"],
[data-shape~="button"],
a[data-shape~="button"] {
  display: inline-block;
  font: inherit;
  line-height: var(--control-line-height);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-color);
  background-color: var(--text-background);
  border: var(--border);
  border-radius: var(--control-border-radius);
  box-shadow: none;
  padding: var(--control-padding-y) var(--button-padding-x);
  margin: 0;
  box-sizing: border-box;
  cursor: var(--clickable-cursor);
  position: relative;
  user-select: none;
  -webkit-user-select: none; /* safari */
}
li[role="button"],
li[data-shape~="button"] {
  list-style: none;
}
button::after,
[role="button"]::after,
a[role="button"]::after,
[data-shape~="button"]::after,
a[data-shape~="button"]::after {
  content: "";
  display: block;
  background-color: transparent;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  transition: background-color 0.3s;
}
a[role="button"]:hover,
a[data-shape~="button"]:hover {
  text-decoration: none;
  color: var(--text-color);
  background-color: var(--text-background);
  border: var(--border);
}
button:focus,
[role="button"]:focus,
a[role="button"]:focus,
input[type="button"]:focus,
input[type="submit"]:focus,
input[type="reset"]:focus,
[data-shape~="button"]:focus,
[data-shape~="button"]:focus-within,
a[data-shape~="button"]:focus {
  box-shadow: var(--focused-box-shadow);
  outline: none;
}
button:hover::after,
[role="button"]:hover::after,
a[role="button"]:hover::after,
input[type="button"]:hover::after,
input[type="submit"]:hover::after,
input[type="reset"]:hover::after,
[data-shape~="button"]:hover::after,
a[role="button"]:hover::after,
a[data-shape~="button"]:hover::after {
  background-color: var(--control-hover-mask-background);
}
button:active::after,
[role="button"]:active::after,
a[role="button"]:active::after,
input[type="button"]:active::after,
input[type="submit"]:active::after,
input[type="reset"]:active::after,
[data-shape~="button"]:active::after,
a[role="button"]:active::after,
a[data-shape~="button"]:active::after {
  background-color: var(--control-active-mask-background);
}

[data-focus-ring="none"] button:focus,
[data-focus-ring="none"] [role="button"]:focus,
[data-focus-ring="none"] a[role="button"]:focus,
[data-focus-ring="none"] input[type="button"]:focus,
[data-focus-ring="none"] input[type="submit"]:focus,
[data-focus-ring="none"] input[type="reset"]:focus,
[data-focus-ring="none"] [data-shape~="button"]:focus,
[data-focus-ring="none"] [data-shape~="button"]:focus-within,
[data-focus-ring="none"] a[data-shape~="button"]:focus {
  box-shadow: none;
}

/* shape boxless */
button[data-shape~="boxless"],
[role="button"][data-shape~="boxless"],
a[role="button"][data-shape~="boxless"],
input[type="button"][data-shape~="boxless"],
input[type="submit"][data-shape~="boxless"],
input[type="reset"][data-shape~="boxless"],
[data-shape~="button"][data-shape~="boxless"],
a[data-shape~="button"][data-shape~="boxless"] {
  background-color: transparent;
  border-color: transparent;
  border-radius: 0;
  padding: var(--control-padding-y);
}
button[data-shape~="boxless"]::after,
[role="button"][data-shape~="boxless"]::after,
a[role="button"][data-shape~="boxless"]::after,
input[type="button"][data-shape~="boxless"]::after,
input[type="submit"][data-shape~="boxless"]::after,
input[type="reset"][data-shape~="boxless"]::after,
[data-shape~="button"][data-shape~="boxless"]::after,
a[data-shape~="button"][data-shape~="boxless"]::after {
  display: none;
}

/* emphasized */
button[data-shape~="emphasized"],
[role="button"][data-shape~="emphasized"],
a[role="button"][data-shape~="emphasized"],
input[type="button"][data-shape~="emphasized"],
input[type="submit"][data-shape~="emphasized"],
input[type="reset"][data-shape~="emphasized"],
[data-shape~="button"][data-shape~="emphasized"],
a[data-shape~="button"][data-shape~="emphasized"] {
  color: var(--highlight-color);
  background-color: var(--highlight-background);
  border-color: var(--highlight-border-color);
}

/* busy */
button[aria-busy="true"],
[role="button"][aria-busy="true"],
a[role="button"][aria-busy="true"],
input[type="button"][aria-busy="true"],
input[type="submit"][aria-busy="true"],
input[type="reset"][aria-busy="true"],
[data-shape~="button"][aria-busy="true"],
a[data-shape~="button"][aria-busy="true"] {
  pointer-events: none;
  overflow: hidden;
}
button[aria-busy="true"]::after,
[role="button"][aria-busy="true"]::after,
a[role="button"][aria-busy="true"]::after,
input[type="button"][aria-busy="true"]::after,
input[type="submit"][aria-busy="true"]::after,
input[type="reset"][aria-busy="true"]::after,
[data-shape~="button"][aria-busy="true"]::after,
a[data-shape~="button"][aria-busy="true"]::after {
  display: block;
  background-color: transparent;
  background-image: repeating-linear-gradient(
    -45deg,
    black,
    black 0.5em,
    transparent 0.5em,
    transparent 1em
  );
  background-repeat: repeat-x;
  animation: progress 25s linear infinite;
  opacity: 0.075;
  left: -1000%;
  right: 0;
}
button::-moz-focus-inner,
input[type="button"]::-moz-focus-inner,
input[type="submit"]::-moz-focus-inner,
input[type="reset"]::-moz-focus-inner {
  border: none;
}
@keyframes progress {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(90%);
  }
}

/* type file */
[data-shape~="button"] [type="file"] {
  width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  z-index: 1;
  cursor: var(--clickable-cursor);
}
[data-shape~="button"] [type="file"] + label[hidden] {
  display: inline;
}
[data-shape~="button"] [type="file"]::-webkit-file-upload-button {
  width: 0;
  cursor: var(--clickable-cursor);
}

/* icon */
button [data-shape~="icon"],
[role="button"] [data-shape~="icon"],
a[role="button"] [data-shape~="icon"],
[data-shape~="button"] [data-shape~="icon"],
a[data-shape~="button"] [data-shape~="icon"] {
  width: auto;
  height: var(--icon-size);
  vertical-align: baseline;
}
button [data-shape~="icon"],
[role="button"] [data-shape~="icon"],
a[role="button"] [data-shape~="icon"],
[data-shape~="button"] [data-shape~="icon"],
a[data-shape~="button"] [data-shape~="icon"] {
  margin: 0 calc(0.7 * var(--button-padding-x) - var(--space-width)) 0
    calc(-0.3 * var(--button-padding-x));
}

/* icon rtl */
[dir="rtl"] button [data-shape~="icon"],
[dir="rtl"] [role="button"] [data-shape~="icon"],
[dir="rtl"] a[role="button"] [data-shape~="icon"],
[dir="rtl"] [data-shape~="button"] [data-shape~="icon"],
[dir="rtl"] a[data-shape~="button"] [data-shape~="icon"],
button[dir="rtl"] [data-shape~="icon"],
[role="button"][dir="rtl"] [data-shape~="icon"],
a[role="button"][dir="rtl"] [data-shape~="icon"],
[data-shape~="button"][dir="rtl"] [data-shape~="icon"],
a[data-shape~="button"][dir="rtl"] [data-shape~="icon"] {
  margin: 0 calc(-0.3 * var(--button-padding-x)) 0
    calc(0.7 * var(--button-padding-x) - var(--space-width));
}

/* caption */
[data-shape~="caption"] {
  display: inline-block;
  line-height: var(--control-line-height);
}
[data-shape~="caption"][data-shape~="textinput"],
[data-shape~="caption"][data-shape~="textarea"],
[data-shape~="caption"][data-shape~="button"],
[data-shape~="caption"][data-shape~="select"],
[data-shape~="caption"][data-shape~="radiogroup"],
[data-shape~="caption"][data-shape~="listbox"],
[data-shape~="caption"][data-shape~="tablist"],
[data-shape~="caption"][data-shape~="menubar"] {
  padding-top: calc(var(--border-width) + var(--control-padding-y));
  padding-bottom: calc(var(--border-width) + var(--control-padding-y));
}
[data-shape~="caption"][data-shape~="checkbox"]::before,
[data-shape~="caption"][data-shape~="radiobutton"]::before {
  content: "";
  display: inline-block;
  width: 0;
  height: var(--checkbox-size);
}
[data-shape~="caption"][data-shape~="toggle"]::before {
  content: "";
  display: inline-block;
  width: 0;
  height: var(--toggle-height);
}

/* checkbox */
input[type="checkbox"] {
  display: inline-block;
  font-size: 1em;
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  background-color: var(--text-background);
  background-position: 50% 50%;
  background-size: contain;
  background-repeat: no-repeat;
  border-radius: var(--control-border-radius);
  border: none;
  box-shadow: inset 0 0 0 var(--border-width) var(--border-color);
  box-sizing: border-box;
  margin: 0;
  vertical-align: baseline;
  position: relative;
  top: var(--checkbox-position-y);
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: var(--clickable-cursor);
  transition:
    background 0.2s,
    box-shadow 0.2s;
}
input[type="checkbox"]:checked {
  background-color: var(--highlight-background);
  background-image: var(--highlighted-checkbox-image-url);
  box-shadow: inset 0 0 0 var(--border-width) var(--highlight-border-color);
}
input[type="checkbox"]:focus {
  box-shadow:
    inset 0 0 0 var(--border-width) var(--border-color),
    var(--focused-box-shadow);
  outline: none;
}
input[type="checkbox"]:checked:focus {
  box-shadow:
    inset 0 0 0 var(--border-width) var(--highlight-border-color),
    var(--focused-box-shadow);
}
[data-focus-ring="none"] input[type="checkbox"]:focus {
  box-shadow: inset 0 0 0 var(--border-width) var(--border-color);
}
[data-focus-ring="none"] input[type="checkbox"]:checked:focus {
  box-shadow: inset 0 0 0 var(--border-width) var(--highlight-border-color);
}
input[type="checkbox"][data-shape~="boxless"],
input[type="checkbox"][data-shape~="boxless"]:checked {
  background-color: transparent;
  border-color: transparent;
}
input[type="checkbox"][data-shape~="boxless"]:checked {
  background-image: var(--checkbox-image-url);
}
input[type="checkbox"][data-shape~="boxless"]:not(:focus) {
  box-shadow: none;
}
input[type="checkbox"][data-shape~="boxless"]:active,
input[type="checkbox"][data-shape~="boxless"]:focus,
input[type="checkbox"][data-shape~="boxless"]:checked:focus {
  box-shadow: var(--focused-box-shadow);
}
[data-focus-ring="none"] input[type="checkbox"][data-shape~="boxless"]:active,
[data-focus-ring="none"] input[type="checkbox"][data-shape~="boxless"]:focus,
[data-focus-ring="none"]
  input[type="checkbox"][data-shape~="boxless"]:checked:focus {
  box-shadow: none;
}
input[type="checkbox"]::-ms-check {
  opacity: 0;
}

/* dialog */
dialog::before,
[role="dialog"]::before {
  content: "";
  display: block;
  background: var(--text-color);
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  opacity: 0.5;
  z-index: 9899;
}
dialog [data-shape~="messagebox"],
[role="dialog"] [data-shape~="messagebox"] {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
}
dialog[hidden]:target,
[role="dialog"][hidden]:target {
  display: block;
}

/* glyph */
img[data-shape~="glyph"],
svg[data-shape~="glyph"],
img[data-shape~="glyph"][data-shape~="em"],
svg[data-shape~="glyph"][data-shape~="em"] {
  width: auto;
  height: 1em;
  vertical-align: text-bottom;
}
img[data-shape~="glyph"][data-shape~="cap"],
svg[data-shape~="glyph"][data-shape~="cap"] {
  height: var(--cap-height);
  vertical-align: baseline;
}
img[data-shape~="glyph"][data-shape~="ex"],
svg[data-shape~="glyph"][data-shape~="ex"] {
  height: var(--ex-height);
  vertical-align: baseline;
}

/* link */
a,
[role="link"],
[data-shape~="link"],
button[role="link"],
button[data-shape~="link"] {
  display: inline;
  font: inherit;
  line-height: inherit;
  color: var(--link-color);
  text-decoration: underline;
  background: transparent none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  cursor: var(--clickable-cursor);
  position: relative;
}
a:hover,
[role="link"]:hover,
[data-shape~="link"]:hover {
  color: var(--link-hover-color);
}
a:focus,
[role="link"]:focus,
[data-shape~="link"]:focus,
[data-shape~="link"]:focus-within {
  box-shadow: var(--focused-box-shadow);
  outline: none;
}
[data-focus-ring="none"] a:focus,
[data-focus-ring="none"] [role="link"]:focus,
[data-focus-ring="none"] [data-shape~="link"]:focus,
[data-focus-ring="none"] [data-shape~="link"]:focus-within {
  box-shadow: none;
}
[data-focus-ring="none"] button[data-shape~="link"]:hover,
[data-focus-ring="none"] button[data-shape~="link"]:active,
[data-focus-ring="none"] button[data-shape~="link"]:focus {
  box-shadow: none;
}
button[role="link"]::after,
button[data-shape~="link"]::after {
  display: none;
}
button[role="link"]::-moz-focus-inner,
button[data-shape~="link"]::-moz-focus-inner {
  border: none;
}
[data-shape~="link"] [type="file"] {
  width: 100%;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  z-index: 1;
  cursor: var(--clickable-cursor);
}
[data-shape~="link"] [type="file"] + label[hidden] {
  display: inline;
}
[data-shape~="link"] [type="file"]::-webkit-file-upload-button {
  width: 0;
  cursor: var(--clickable-cursor);
}

/* listbox */
[role="listbox"] {
  display: inline-block;
  line-height: var(--control-line-height);
  color: var(--text-color);
  background: var(--text-background);
  border: var(--border);
  border-radius: var(--control-border-radius);
  padding: 0;
  margin: 0;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}
[role="listbox"][data-shape~="boxless"] {
  background: transparent none;
  border-color: transparent;
  border-radius: 0;
  padding: 0;
  user-select: auto;
}
[role="listbox"]
  > :not(input):not([role="option"]):not([role="group"]):not(
    [role="separator"]
  ),
[role="listbox"]
  [role="group"]
  > :not(input):not([role="option"]):not([role="group"]):not(
    [role="separator"]
  ) {
  display: block;
  padding: var(--control-padding-y) var(--option-padding-x);
}
[role="listbox"] [role="option"] {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: var(--control-padding-y) var(--option-padding-x);
  cursor: var(--clickable-cursor);
  box-sizing: border-box;
  position: relative;
}
[role="listbox"] a[role="option"],
[role="listbox"] a[role="option"]:visited,
[role="listbox"] a[role="option"]:hover,
[role="listbox"] a[role="option"]:active {
  color: inherit;
  text-decoration: none;
}
[role="listbox"] [role="option"]::before {
  display: block;
  content: "";
  background-color: transparent;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}
@media (hover: hover) {
  [role="listbox"] [role="option"]:hover::before,
  [role="listbox"] [type="radio"]:hover + [role="option"]::before,
  [role="listbox"] [type="checkbox"]:hover + [role="option"]::before {
    background-color: var(--control-hover-mask-background);
  }
}
[role="listbox"]:not([data-shape~="checklist"])
  [type="radio"]:checked
  + [role="option"],
[role="listbox"]:not([data-shape~="checklist"])
  [type="checkbox"]:checked
  + [role="option"] {
  color: var(--highlight-color);
  background: var(--highlight-background);
}
[role="listbox"] [type="radio"][disabled] + [role="option"],
[role="listbox"] [type="checkbox"][disabled] + [role="option"] {
  opacity: var(--disabled-opacity);
  cursor: var(--disabled-cursor);
  pointer-events: none;
}
[role="listbox"] [type="radio"]:focus + [role="option"]::before,
[role="listbox"] [type="checkbox"]:focus + [role="option"]::before {
  background-color: var(--control-hover-mask-background);
}
[data-focus-ring="none"]
  [role="listbox"]
  [type="radio"]:focus
  + [role="option"]::before,
[data-focus-ring="none"]
  [role="listbox"]
  [type="checkbox"]:focus
  + [role="option"]::before {
  background-color: transparent;
}
[role="listbox"] [type="radio"],
[role="listbox"] [type="checkbox"] {
  height: 0;
  position: absolute;
  left: -9999em;
  opacity: 0;
}
[role="listbox"] [role="separator"] {
  display: block;
  height: 0;
  text-align: left;
  text-indent: -9999em;
  border-top: var(--separator-border);
}
/* shape checklist */
[role="listbox"][data-shape~="checklist"] [type="checkbox"] + [role="option"],
[role="listbox"][data-shape~="checklist"] [type="radio"] + [role="option"] {
  padding-left: calc(2 * var(--option-padding-x) + var(--option-checkbox-size));
}
[role="listbox"][data-shape~="checklist"] [type="checkbox"],
[role="listbox"][data-shape~="checklist"] [type="radio"] {
  width: var(--option-checkbox-size);
  height: var(--option-checkbox-size);
  background-color: transparent;
  border: none;
  box-shadow: none;
  margin: var(--control-padding-y) var(--option-padding-x) 0;
  position: absolute;
  top: auto;
  left: 0;
  opacity: 1;
}
[role="listbox"][data-shape~="checklist"] [type="checkbox"][disabled],
[role="listbox"][data-shape~="checklist"] [type="radio"][disabled] {
  opacity: var(--disabled-opacity);
}
[role="listbox"][data-shape~="checklist"] [type="checkbox"]:checked,
[role="listbox"][data-shape~="checklist"] [type="radio"]:checked {
  background-color: transparent;
  background-image: var(--checkbox-image-url);
}
[role="listbox"][data-shape~="checklist"] [type="checkbox"]:focus,
[role="listbox"][data-shape~="checklist"] [type="radio"]:focus,
[role="listbox"][data-shape~="checklist"] [type="checkbox"]:checked:focus,
[role="listbox"][data-shape~="checklist"] [type="radio"]:checked:focus {
  box-shadow: none;
}
/* rtl */
[dir="rtl"]
  [role="listbox"][data-shape~="checklist"]
  [type="checkbox"]
  + [role="option"],
[dir="rtl"]
  [role="listbox"][data-shape~="checklist"]
  [type="radio"]
  + [role="option"],
[role="listbox"][data-shape~="checklist"][dir="rtl"]
  [type="checkbox"]
  + [role="option"],
[role="listbox"][data-shape~="checklist"][dir="rtl"]
  [type="radio"]
  + [role="option"] {
  padding-left: var(--option-padding-x);
  padding-right: calc(
    2 *
    var(--option-padding-x) +
    var(--option-checkbox-size)
  );
}
[dir="rtl"] [role="listbox"][data-shape~="checklist"] [type="checkbox"],
[dir="rtl"] [role="listbox"][data-shape~="checklist"] [type="radio"],
[role="listbox"][data-shape~="checklist"][dir="rtl"] [type="checkbox"],
[role="listbox"][data-shape~="checklist"][dir="rtl"] [type="radio"] {
  left: auto;
  right: 0;
}

/* menubar */
[role="menubar"] {
  display: flex;
  border: var(--border);
  border-color: transparent;
  padding: 0;
  margin: 0;
}
ul[role="menubar"] {
  list-style: none;
}
[role="menubar"] > li {
  display: inline-block;
  padding: 0;
  margin: 0;
}
[role="menubar"] [role="menuitem"] {
  display: block;
  line-height: var(--control-line-height);
  color: var(--text-color);
  text-decoration: none;
  padding: var(--control-padding-y) var(--button-padding-x);
  border: none;
  cursor: var(--clickable-cursor);
  position: relative;
}
[role="menubar"] [role="menuitem"]::after {
  display: block;
  content: "";
  background: transparent;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  transition: background-color 0.2s;
}
@media (hover: hover) {
  [role="menubar"] [role="menuitem"]:hover::after {
    background-color: var(--control-hover-mask-background);
  }
}
[role="menubar"] [role="menuitem"]:focus {
  box-shadow: none;
  outline: none;
}
[role="menubar"] [role="menuitem"]:focus::after {
  background-color: var(--control-hover-mask-background);
}
[data-focus-ring="none"]
  [role="menubar"]
  [role="menuitem"]:not(:hover):focus::after {
  background-color: transparent;
}
[role="menubar"] [role="menuitem"][aria-selected="true"] {
  color: var(--highlight-color);
  background-color: var(--highlight-background);
}
[role="menubar"] [role="separator"] {
  display: none;
}

/* messagebox */
[data-shape~="messagebox"] {
  width: 24em;
  max-width: 96wv;
  color: var(--text-color);
  background: var(--text-background);
  border: var(--border);
  border-radius: var(--control-border-radius);
  padding: 1.25em 1.5em;
  box-sizing: border-box;
}
[data-shape~="messagebox"] h1 {
  margin: 0;
}
[data-shape~="messagebox"] h1 ~ section,
[data-shape~="messagebox"] h1 ~ [role="toolbar"],
[data-shape~="messagebox"] section ~ [role="toolbar"] {
  margin-top: 1em;
}
[data-shape~="messagebox"] section :first-child {
  margin-top: 0;
}
[data-shape~="messagebox"] section :last-child {
  margin-bottom: 0;
}
[data-shape~="messagebox"] [role="toolbar"] {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
}
[data-shape~="messagebox"] [role="toolbar"] button,
[data-shape~="messagebox"] [role="toolbar"] [role="button"],
[data-shape~="messagebox"] [role="toolbar"] [data-shape~="button"] {
  margin-left: 0.75em;
}
/* rtl */
[dir="rtl"] [data-shape~="messagebox"] [role="toolbar"],
[data-shape~="messagebox"][dir="rtl"] [role="toolbar"] {
  justify-content: flex-start;
}
[dir="rtl"] [data-shape~="messagebox"] [role="toolbar"][data-shape~="rtl-flip"],
[data-shape~="messagebox"][dir="rtl"] [role="toolbar"][data-shape~="rtl-flip"] {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

/* radiobutton */
input[type="radio"] {
  display: inline-block;
  font-size: 1em;
  width: var(--checkbox-size);
  height: var(--checkbox-size);
  background-color: var(--text-background);
  background-position: 50% 50%;
  background-size: contain;
  background-repeat: no-repeat;
  border-radius: 50%;
  border: none;
  box-shadow: inset 0 0 0 var(--border-width) var(--border-color);
  box-sizing: border-box;
  margin: 0;
  vertical-align: baseline;
  position: relative;
  top: var(--checkbox-position-y);
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: var(--clickable-cursor);
  transition:
    background 0.2s,
    box-shadow 0.2s;
}
input[type="radio"]:checked {
  background-color: var(--highlight-background);
  background-image: var(--highlighted-radio-image-url);
  box-shadow: inset 0 0 0 var(--border-width) var(--highlight-border-color);
}
input[type="radio"]:focus {
  box-shadow:
    inset 0 0 0 var(--border-width) var(--border-color),
    var(--focused-box-shadow);
  outline: none;
}
input[type="radio"]:checked:focus {
  box-shadow:
    inset 0 0 0 var(--border-width) var(--highlight-border-color),
    var(--focused-box-shadow);
}
[data-focus-ring="none"] input[type="radio"]:focus {
  box-shadow: inset 0 0 0 var(--border-width) var(--border-color);
}
[data-focus-ring="none"] input[type="radio"]:checked:focus {
  box-shadow: inset 0 0 0 var(--border-width) var(--highlight-border-color);
}
input[type="radio"][data-shape~="boxless"],
input[type="radio"][data-shape~="boxless"]:checked {
  background-color: transparent;
  border-color: transparent;
}
input[type="radio"][data-shape~="boxless"]:checked {
  background-image: var(--radio-image-url);
}
input[type="radio"][data-shape~="boxless"]:not(:focus) {
  box-shadow: none;
}
input[type="radio"][data-shape~="boxless"]:active,
input[type="radio"][data-shape~="boxless"]:focus,
input[type="radio"][data-shape~="boxless"]:checked:focus {
  box-shadow: var(--focused-box-shadow);
}
[data-focus-ring="none"] input[type="radio"][data-shape~="boxless"]:active,
[data-focus-ring="none"] input[type="radio"][data-shape~="boxless"]:focus,
[data-focus-ring="none"]
  input[type="radio"][data-shape~="boxless"]:checked:focus {
  box-shadow: none;
}
input[type="radio"][data-shape~="checkbox"] {
  border-radius: var(--control-border-radius);
}
input[type="radio"][data-shape~="checkbox"]:checked {
  background-image: var(--highlighted-checkbox-image-url);
}
input[type="radio"]::-ms-check {
  opacity: 0;
}

/* radiogroup */
[role="radiogroup"] {
  display: inline-block;
  vertical-align: bottom;
  border: none;
  border-radius: var(--control-border-radius);
  padding: 0;
  margin: 0;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}
[role="radiogroup"]::after {
  content: "";
  clear: left;
}
[role="radiogroup"] [type="radio"] {
  position: absolute;
  top: 0;
  right: 0;
  opacity: 0;
}
[role="radiogroup"] [type="radio"]:checked + [role="button"],
[role="radiogroup"] [type="radio"]:checked + [data-shape~="button"] {
  color: var(--highlight-color);
  background-color: var(--highlight-background);
}
[role="radiogroup"] [role="button"] ~ [role="button"],
[role="radiogroup"] [data-shape~="button"] ~ [data-shape~="button"] {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left-width: 0;
}
[role="radiogroup"] [role="button"]:not(:last-child),
[role="radiogroup"] [data-shape~="button"]:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
[role="radiogroup"] [role="button"],
[role="radiogroup"] [data-shape~="button"] {
  float: left;
  box-shadow: none;
}
[role="radiogroup"]:focus-within,
[role="radiogroup"]:active,
/* hover added to avoid blinking where focus-within is unsupported (macos) */
  [role="radiogroup"]:hover {
  box-shadow: var(--focused-box-shadow);
  outline: none;
}
[data-focus-ring="none"] [role="radiogroup"]:focus-within,
[data-focus-ring="none"] [role="radiogroup"]:active,
[data-focus-ring="none"] [role="radiogroup"]:hover {
  box-shadow: none;
}

/* select */
[data-shape~="select"] {
  display: inline-block;
  vertical-align: bottom;
  border: none;
  border-radius: var(--control-border-radius);
  padding: 0;
  margin: 0;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}
[data-shape~="select"] [type="radio"] {
  position: absolute;
  left: -9999em;
  height: 0;
}
[data-shape~="select"] label:not([role="option"]) {
  line-height: var(--control-line-height);
  white-space: nowrap;
  background: var(--text-background);
  border: var(--border);
  border-radius: var(--control-border-radius);
  padding: var(--control-padding-y) var(--option-padding-x);
  padding-right: calc(var(--option-padding-x) + var(--select-button-size));
  cursor: var(--clickable-cursor);
}
[data-shape~="select"] label:not([role="option"])::after {
  content: "";
  display: block;
  width: var(--select-button-size);
  height: var(--select-button-size);
  background: var(--select-button-image-url) 50% 50% / contain no-repeat;
  position: absolute;
  right: calc(0.5 * var(--option-padding-x));
  top: var(--control-padding-y);
}
[data-shape~="select"] label:not([role="option"]),
[data-shape~="select"] :checked ~ label:not([role="option"]):last-of-type {
  display: block;
  visibility: hidden;
  height: 0;
  max-height: 0;
  border-top-width: 0;
  border-bottom-width: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}
[data-shape~="select"] label:not([role="option"]):last-of-type,
[data-shape~="select"] :checked + label:not([role="option"]),
[data-shape~="select"] :checked + label:not([role="option"]):last-of-type {
  height: auto;
  max-height: none;
  visibility: visible;
  color: transparent;
  border-top-width: var(--border-width);
  border-bottom-width: var(--border-width);
  padding-top: var(--control-padding-y);
  padding-bottom: var(--control-padding-y);
}
[data-shape~="select"] :checked + label:not([role="option"]),
[data-shape~="select"] :checked + label:not([role="option"]):last-of-type {
  color: var(--text-color);
}
[data-shape~="select"] [role="listbox"] {
  display: none;
  box-shadow: 0 0.35em 0.5em 0.2em rgba(0, 0, 0, 0.1);
  margin-top: calc(-1 * var(--border-width));
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1;
}
[data-shape~="select"] [role="listbox"]::before {
  content: "a0";
  display: block;
  padding: var(--control-padding-y) var(--option-padding-x);
  cursor: var(--clickable-cursor);
  position: absolute;
  transform: translateY(-100%);
  top: 0;
  left: 0;
  right: 0;
}
[data-shape~="select"]:active [role="listbox"],
[data-shape~="select"] [role="listbox"]:hover {
  display: block;
}
[data-shape~="select"] :focus ~ [role="listbox"]:hover,
/* focus-within will also work when the focused element is not directly adjacent to the listbox */
  [data-shape~="select"]:focus-within
  [role="listbox"]:hover {
  display: none;
}
[data-shape~="select"] :focus + label:not([role="option"]),
[data-shape~="select"]:hover label:not([role="option"]) {
  box-shadow: var(--focused-box-shadow);
}
[data-focus-ring="none"]
  [data-shape~="select"]
  :focus
  + label:not([role="option"]),
[data-focus-ring="none"]
  [data-shape~="select"]:hover
  label:not([role="option"]),
[data-focus-ring="none"] [data-shape~="select"]:focus-within {
  box-shadow: none;
}
@media (hover: hover) {
  [data-shape~="select"] [role="listbox"] [role="option"]:hover {
    color: var(--highlight-color);
    background: var(--highlight-background);
  }
  [data-shape~="select"] [role="listbox"] [role="option"]:hover::before {
    display: none;
  }
}
[data-shape~="select"] [role="listbox"] [data-shape~="scrollable"] {
  display: block;
  overflow: auto;
}
/* shape boxless */
[data-shape~="select"][data-shape~="boxless"] label:not([role="option"]) {
  background: none transparent;
  border-color: transparent;
  border-radius: 0;
}
/* shape underline */
[data-shape~="select"][data-shape~="underline"] label:not([role="option"]) {
  background: none transparent;
  border-top-color: transparent;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 0;
  padding-left: 0;
}
[data-shape~="select"][data-shape~="underline"]
  label:not([role="option"])::after {
  background-position: 100% 50%;
  right: 0;
}
[data-shape~="select"][data-shape~="underline"]
  :focus
  + label:not([role="option"]),
[data-shape~="select"][data-shape~="underline"]:hover
  label:not([role="option"]) {
  box-shadow: var(--focused-underline-shadow);
}
[data-focus-ring="none"]
  [data-shape~="select"][data-shape~="underline"]
  :focus
  + label:not([role="option"]),
[data-focus-ring="none"]
  [data-shape~="select"][data-shape~="underline"]:hover
  label:not([role="option"]),
[data-focus-ring="none"]
  [data-shape~="select"][data-shape~="underline"]:focus-within {
  box-shadow: none;
}
/* rtl */
[dir="rtl"] [data-shape~="select"] label:not([role="option"]),
[data-shape~="select"][dir="rtl"] label:not([role="option"]) {
  padding-right: var(--option-padding-x);
  padding-left: calc(var(--option-padding-x) + var(--select-button-size));
}
[dir="rtl"] [data-shape~="select"] label:not([role="option"])::after,
[data-shape~="select"][dir="rtl"] label:not([role="option"])::after {
  right: auto;
  left: calc(0.5 * var(--option-padding-x));
}
[dir="rtl"]
  [data-shape~="select"][data-shape~="underline"]
  label:not([role="option"])::after,
[data-shape~="select"][data-shape~="underline"][dir="rtl"]
  label:not([role="option"])::after {
  background-position: 0 50%;
  left: 0;
}

/* status.pulse */
[role="status"][data-shape~="pulse"] {
  display: inline-block;
  width: 1em;
  height: 1em;
  overflow: hidden;
  text-align: left;
  text-indent: -9999em;
  border-radius: 50%;
  box-sizing: border-box;
  vertical-align: text-bottom;
  position: relative;
}
[role="status"][data-shape~="pulse"]::after {
  content: "";
  display: block;
  width: 0.5em;
  height: 0.5em;
  background: var(--highlight-background);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: pulse 1.25s linear infinite;
}
@keyframes pulse {
  0% {
    width: 0.6em;
    height: 0.6em;
    opacity: 0.35;
  }
  50% {
    width: 1em;
    height: 1em;
    opacity: 1;
  }
  100% {
    width: 0.6em;
    height: 0.6em;
    opacity: 0.35;
  }
}

/* status.spin */
[role="status"][data-shape~="spin"] {
  display: inline-block;
  width: 1em;
  height: 1em;
  overflow: hidden;
  text-align: left;
  text-indent: -9999em;
  border: 0.16em solid var(--highlight-background);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  box-sizing: border-box;
  vertical-align: text-bottom;
  position: relative;
  animation: spin 1s linear infinite;
}
[role="status"][data-shape~="spin"][data-shape~="dashed"] {
  border: 0.14em dashed var(--highlight-background);
  animation-duration: 1.8s;
}
@keyframes spin {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* tablist */
[role="tablist"] {
  display: flex;
  border: var(--border);
  border-top-color: transparent;
  border-left-color: transparent;
  border-right-color: transparent;
  padding: 0;
  margin: 0;
}
ul[role="tablist"] {
  list-style: none;
}
[role="tablist"] > li {
  display: block;
  padding: 0;
  margin: 0;
}
[role="tablist"] [role="tab"] {
  display: block;
  line-height: var(--control-line-height);
  color: var(--text-color);
  text-decoration: none;
  padding: var(--control-padding-y) var(--button-padding-x);
  padding-bottom: calc(var(--control-padding-y) + var(--tab-border-width));
  border: none;
  cursor: var(--clickable-cursor);
  position: relative;
}
[role="tablist"] [role="tab"]::after {
  display: block;
  content: "";
  background: transparent;
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  transition: background-color 0.2s;
}
@media (hover: hover) {
  [role="tablist"] [role="tab"]:hover::after {
    background-color: var(--control-hover-mask-background);
  }
}
[role="tablist"] [role="tab"]:focus {
  box-shadow: none;
  outline: none;
}
[role="tablist"] [role="tab"]:focus::after {
  background-color: var(--control-hover-mask-background);
}
[data-focus-ring="none"]
  [role="tablist"]
  [role="tab"]:not(:hover):focus::after {
  background-color: transparent;
}
[role="tablist"] [role="tab"][aria-selected="true"]::before {
  content: "";
  display: block;
  height: var(--tab-border-width);
  background-color: var(--highlight-background);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}
[role="tablist"] [role="separator"] {
  display: none;
}

/* textarea */
textarea,
[role="textbox"][aria-multiline="true"] {
  font: inherit;
  line-height: var(--control-line-height);
  color: var(--text-color);
  background: var(--text-background);
  border: var(--border);
  border-radius: var(--control-border-radius);
  padding: var(--control-padding-y) var(--input-padding-x);
  box-sizing: border-box;
}
textarea:focus,
[role="textbox"][aria-multiline="true"]:focus {
  box-shadow: var(--focused-box-shadow);
  outline: none;
}
/* shape underline */
textarea[data-shape~="underline"],
[role="textbox"][aria-multiline="true"][data-shape~="underline"] {
  background-color: transparent;
  border-top-color: transparent;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 0;
  padding-left: 0;
  padding-right: 0;
}
textarea[data-shape~="underline"]:focus,
[role="textbox"][aria-multiline="true"][data-shape~="underline"]:focus {
  box-shadow: var(--focused-underline-shadow);
}

/* textinput */
input:not([type]),
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
[role="textbox"]:not([aria-multiline="true"]) {
  font: inherit;
  line-height: var(--control-line-height);
  color: var(--text-color);
  background: var(--text-background);
  border: var(--border);
  border-radius: var(--control-border-radius);
  padding: var(--control-padding-y) var(--input-padding-x);
  box-sizing: border-box;
}
input[type="search"] {
  -webkit-appearance: textfield;
  -webkit-box-sizing: content-box;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
  display: none;
}
input:not([type]):focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
[role="textbox"]:not([aria-multiline="true"]):focus {
  box-shadow: var(--focused-box-shadow);
  outline: none;
}
/* shape underline */
input[data-shape~="underline"]:not([type]),
input[type="text"][data-shape~="underline"],
input[type="number"][data-shape~="underline"],
input[type="email"][data-shape~="underline"],
input[type="tel"][data-shape~="underline"],
input[type="password"][data-shape~="underline"],
input[type="search"][data-shape~="underline"],
[role="textbox"][data-shape~="underline"]:not([aria-multiline="true"]) {
  background-color: transparent;
  border-top-color: transparent;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 0;
  padding-left: 0;
  padding-right: 0;
}
input[data-shape~="underline"]:not([type]):focus,
input[type="text"][data-shape~="underline"]:focus,
input[type="number"][data-shape~="underline"]:focus,
input[type="email"][data-shape~="underline"]:focus,
input[type="tel"][data-shape~="underline"]:focus,
input[type="password"][data-shape~="underline"]:focus,
input[type="search"][data-shape~="underline"]:focus,
[role="textbox"][data-shape~="underline"]:not([aria-multiline="true"]):focus {
  box-shadow: var(--focused-underline-shadow);
}

/* tip */
[data-shape~="tip"] {
  display: inline-block;
  font-size: var(--tip-text-size);
  line-height: var(--control-line-height);
  margin: var(--tip-margin-y) 0;
}
[data-shape~="tip"][data-shape~="error"] {
  color: var(--error-color);
}

/* toggle */
input[type="radio"][data-shape~="toggle"],
input[type="checkbox"][data-shape~="toggle"] {
  display: inline-block;
  font-size: 1em;
  width: var(--toggle-width);
  height: var(--toggle-height);
  background-color: var(--text-background);
  background-image: var(--toggle-image-url);
  background-position: 0 50%;
  background-size: contain;
  background-repeat: no-repeat;
  border-radius: calc(0.5 * var(--toggle-height));
  border: none;
  box-shadow: inset 0 0 0 var(--border-width) var(--border-color);
  box-sizing: border-box;
  margin: 0;
  vertical-align: baseline;
  position: relative;
  top: var(--toggle-position-y);
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: var(--clickable-cursor);
  transition:
    background-color 0.2s,
    background-position 0.2s,
    box-shadow 0.2s;
}
input[type="radio"][data-shape~="toggle"]:checked,
input[type="checkbox"][data-shape~="toggle"]:checked {
  background-image: var(--highlighted-toggle-image-url);
  background-color: var(--highlight-background);
  background-position: 100% 50%;
  box-shadow: inset 0 0 0 var(--border-width) var(--highlight-border-color);
}
input[type="radio"][data-shape~="toggle"]:focus,
input[type="checkbox"][data-shape~="toggle"]:focus {
  box-shadow:
    inset 0 0 0 var(--border-width) var(--border-color),
    var(--focused-box-shadow);
  outline: none;
}
input[type="radio"][data-shape~="toggle"]:checked:focus,
input[type="checkbox"][data-shape~="toggle"]:checked:focus {
  box-shadow:
    inset 0 0 0 var(--border-width) var(--highlight-border-color),
    var(--focused-box-shadow);
}
[data-focus-ring="none"] input[type="radio"][data-shape~="toggle"]:focus,
[data-focus-ring="none"] input[type="checkbox"][data-shape~="toggle"]:focus {
  box-shadow: inset 0 0 0 var(--border-width) var(--border-color);
}
[data-focus-ring="none"]
  input[type="radio"][data-shape~="toggle"]:checked:focus,
[data-focus-ring="none"]
  input[type="checkbox"][data-shape~="toggle"]:checked:focus {
  box-shadow: inset 0 0 0 var(--border-width) var(--highlight-border-color);
}
input[type="radio"][data-shape~="toggle"]::-ms-check,
input[type="checkbox"][data-shape~="toggle"]::-ms-check {
  opacity: 0;
}

/* tooltip */
[role="tooltip"],
[data-shape~="tooltip"],
[role="status"][data-shape~="messagebox"],
[data-shape~="status"][data-shape~="messagebox"] {
  width: 24em;
  max-width: 96wv;
  font-size: 0.87em;
  color: var(--tooltip-color);
  background-color: var(--tooltip-background);
  border: none;
  padding: 0.75em 1.1em 0.9em;
  box-sizing: border-box;
  position: relative;
}
/* tail */
[data-tail]::after {
  content: "";
  display: block;
  width: 0;
  height: 0;
  border: 0.4em solid var(--tooltip-background);
  border-right-color: transparent;
  border-bottom-color: transparent;
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -48%) rotate(45deg);
  box-sizing: border-box;
}
[data-tail="top-left"]::after {
  left: 1.3em;
  top: 0;
  transform: translate(0, -50%) rotate(45deg);
}
[data-tail="top-right"]::after {
  left: auto;
  right: 1.3em;
  top: 0;
  transform: translate(0, -50%) rotate(45deg);
}
[data-tail="bottom-left"]::after {
  left: 1.3em;
  top: auto;
  bottom: 0;
  transform: translate(0, 50%) rotate(-135deg);
}
[data-tail="bottom-center"]::after {
  left: 50%;
  top: auto;
  bottom: 0;
  transform: translate(-50%, 50%) rotate(-135deg);
}
[data-tail="bottom-right"]::after {
  left: auto;
  right: 1.3em;
  top: auto;
  bottom: 0;
  transform: translate(0, 50%) rotate(-135deg);
}
[data-tail="left-top"]::after {
  left: 0;
  top: 1.05em;
  transform: translate(-50%, 0) rotate(-45deg);
}
[data-tail="left-middle"]::after {
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
}
[data-tail="left-bottom"]::after {
  left: 0;
  top: auto;
  bottom: 1.05em;
  transform: translate(-50%, 0) rotate(-45deg);
}
[data-tail="right-top"]::after {
  left: auto;
  right: 0;
  top: 1.05em;
  transform: translate(50%, 0) rotate(135deg);
}
[data-tail="right-middle"]::after {
  left: auto;
  right: 0;
  top: 50%;
  transform: translate(50%, -50%) rotate(135deg);
}
[data-tail="right-bottom"]::after {
  left: auto;
  right: 0;
  top: auto;
  bottom: 1.05em;
  transform: translate(50%, 0) rotate(135deg);
}
