html body .page-with-app-bar {
  scroll-behavior: auto !important;
  scroll-snap-type: none !important;
  overscroll-behavior-y: auto;
}

html body .document-app-bar {
  scroll-snap-align: none !important;
  scroll-snap-stop: normal !important;
}

html body .document-title-collapse-snap {
  display: none !important;
  scroll-snap-align: none !important;
  scroll-snap-stop: normal !important;
}

body .rail-appearance {
  display: grid;
  gap: 7px;
  padding: 0 8px 4px;
}

.appearance-launcher {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  padding-inline: 10px 4px;
  border-radius: 14px;
  color: var(--on-surface-variant);
}

/*.appearance-launcher:hover {
  background: var(--surface-low);
  color: var(--on-surface);
}*/

.appearance-launcher__label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.appearance-launcher .icon-button {
  width: 36px;
  height: 36px;
}

.appearance-launcher .material-symbols-rounded {
  font-size: 22px;
}

.theme-selector {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--outline-variant);
  border-radius: 14px;
  background: var(--surface-low);
}

.rail-theme-selector {
  width: 100%;
}

.theme-selector__choice {
  display: flex;
  min-width: 0;
  height: 54px;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 5px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
}

.theme-selector__choice:hover,
.palette-choice:hover {
  background: var(--surface-container);
  color: var(--on-surface);
}

.theme-selector__choice.is-selected,
.palette-choice.is-selected {
  background: var(--primary-container);
  color: var(--on-primary-container);
}

.theme-selector__choice[hidden],
.palette-choice[hidden] {
  display: none !important;
}

.theme-selector__choice .material-symbols-rounded {
  font-size: 22px;
}

.theme-selector__label {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-theme-selector {
  width: 100%;
}

.color-scheme-selector,
.dialog-scheme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.palette-choice {
  --preview-primary: #ffb0c5;
  --preview-secondary: #c3c8c3;
  --preview-tertiary: #c6c5d3;
  display: grid;
  min-width: 0;
  min-height: 62px;
  grid-template-columns: 42px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--outline-variant);
  border-radius: 12px;
  background: var(--surface-low);
  color: var(--on-surface-variant);
  cursor: pointer;
  text-align: left;
}

.palette-choice[data-scheme-choice='app'] {
  --preview-primary: var(--primary);
  --preview-secondary: var(--secondary);
  --preview-tertiary: var(--tertiary);
}

.palette-choice[data-scheme-choice='turp'] {
  --preview-primary: #ffb0c5;
  --preview-secondary: #c3c8c3;
  --preview-tertiary: #c6c5d3;
}

.palette-choice[data-scheme-choice='arbor'] {
  --preview-primary: #99d5b1;
  --preview-secondary: #b5ccbc;
  --preview-tertiary: #a5cddd;
}

.palette-choice[data-scheme-choice='graphite'] {
  --preview-primary: #a9c7f8;
  --preview-secondary: #c3c6d0;
  --preview-tertiary: #e5bfa6;
}

.palette-choice[data-scheme-choice='ocean'] {
  --preview-primary: #54d6f2;
  --preview-secondary: #b1cbd2;
  --preview-tertiary: #bec6ea;
}

.palette-choice[data-scheme-choice='violet'] {
  --preview-primary: #d1bcff;
  --preview-secondary: #cbc2db;
  --preview-tertiary: #efb8c8;
}

.palette-choice[data-scheme-choice='sunset'] {
  --preview-primary: #ffb59c;
  --preview-secondary: #e7bdb0;
  --preview-tertiary: #d7c58d;
}

.palette-choice__swatches {
  display: block;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 270deg,
    var(--preview-primary) 0deg 180deg,
    var(--preview-secondary) 180deg 270deg,
    var(--preview-tertiary) 270deg 360deg
  );
  box-shadow: 0 1px 4px rgb(0 0 0 / 20%);
}

.palette-choice__swatches span {
  display: none;
}

.palette-choice__label {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-choice__check {
  visibility: hidden;
  justify-self: end;
  font-size: 20px;
}

.palette-choice.is-selected .palette-choice__check {
  visibility: visible;
}

html .appearance-dialog {
  width: min(460px, calc(100vw - 32px));
  max-height: min(780px, calc(100dvh - 32px));
  overflow-y: auto;
}

.appearance-dialog__section {
  display: grid;
  gap: 8px;
  padding: 6px 12px 16px;
}

.appearance-dialog__section + .appearance-dialog__section {
  padding-top: 14px;
  border-top: 1px solid var(--outline-variant);
}

.appearance-dialog__section-title {
  margin: 0;
  padding: 0 4px;
  color: var(--on-surface-variant);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.appearance-dialog__switch-section {
  padding-bottom: 18px;
}

.appearance-switch-row {
  display: grid;
  min-height: 72px;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--outline-variant);
  border-radius: 14px;
  background: var(--surface-low);
}

.appearance-switch-row__icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-size: 21px;
}

.appearance-switch-row__copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.appearance-switch-row__copy strong {
  color: var(--on-surface);
  font-size: 15px;
  font-weight: 600;
}

.appearance-switch-row__copy small {
  color: var(--on-surface-variant);
  font-size: 12px;
  line-height: 1.35;
}

.material-switch {
  position: relative;
  width: 52px;
  height: 32px;
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid var(--outline);
  border-radius: 999px;
  background: var(--surface-container);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.material-switch__handle {
  position: absolute;
  top: 50%;
  left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--outline);
  transform: translateY(-50%);
  transition: left 150ms ease, width 150ms ease, height 150ms ease, background 150ms ease;
}

.material-switch:hover .material-switch__handle {
  width: 20px;
  height: 20px;
  left: 4px;
}

.material-switch.is-checked {
  border-color: var(--primary);
  background: var(--primary);
}

.material-switch.is-checked .material-switch__handle {
  left: 26px;
  width: 24px;
  height: 24px;
  background: var(--on-primary);
}

.material-switch.is-checked:hover .material-switch__handle {
  left: 28px;
  width: 20px;
  height: 20px;
}

.material-switch:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 42%, transparent);
  outline-offset: 3px;
}

.nav-item__external {
  margin-left: auto;
  font-size: 18px;
}

@media (max-width: 420px) {
  .dialog-scheme-grid {
    grid-template-columns: 1fr;
  }

  .dialog-theme-selector .theme-selector__choice {
    padding-inline: 2px;
  }

  .appearance-switch-row {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 9px;
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .material-switch,
  .material-switch__handle {
    transition: none;
  }
}
