.notebook-settings {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 0.5rem);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 0.5rem);
  z-index: 50;
}

.notebook-settings__button {
  width: 2rem;
  height: 2rem;
  border: 1px solid color-mix(in srgb, var(--md-default-fg-color) 18%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--md-default-bg-color) 88%, transparent);
  color: var(--md-default-fg-color);
  box-shadow: var(--md-shadow-z2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, transform 0.18s ease;
  backdrop-filter: blur(10px);
}

.notebook-settings__button:hover,
.notebook-settings__button:focus-visible,
.notebook-settings.is-open .notebook-settings__button {
  background: color-mix(in srgb, var(--md-accent-fg-color) 16%, var(--md-default-bg-color));
  border-color: color-mix(in srgb, var(--md-accent-fg-color) 45%, transparent);
  box-shadow: var(--md-shadow-z3);
  color: var(--md-accent-fg-color);
}

.notebook-settings__button:focus-visible,
.notebook-settings__option:focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 2px;
}

.notebook-settings__button svg {
  width: 0.96rem;
  height: 0.96rem;
  stroke-width: 2;
}

.notebook-settings__button::before,
.notebook-settings__option::before {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 0.5rem);
  bottom: 50%;
  transform: translateY(50%) translateX(0.18rem);
  width: max-content;
  max-width: calc(100vw - 4rem);
  border: 1px solid color-mix(in srgb, var(--md-default-fg-color) 14%, transparent);
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--md-default-bg-color) 94%, transparent);
  color: var(--md-default-fg-color);
  box-shadow: var(--md-shadow-z2);
  font-family: var(--md-text-font-family, inherit);
  font-size: 0.58rem;
  line-height: 1;
  opacity: 0;
  padding: 0.42rem 0.55rem;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
  backdrop-filter: blur(12px);
}

.notebook-settings__button:hover::before,
.notebook-settings__button:focus-visible::before,
.notebook-settings__option:hover::before,
.notebook-settings__option:focus-visible::before {
  opacity: 1;
  transform: translateY(50%);
}

.notebook-settings__options {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.45rem);
  display: grid;
  gap: 0.38rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.25rem);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.notebook-settings.is-open .notebook-settings__options {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.notebook-settings__option {
  position: relative;
  width: 2rem;
  height: 2rem;
  border: 1px solid color-mix(in srgb, var(--md-default-fg-color) 16%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--md-default-bg-color) 92%, transparent);
  color: var(--md-default-fg-color);
  box-shadow: var(--md-shadow-z2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(10px);
}

.notebook-settings__option:hover,
.notebook-settings__option:focus-visible {
  color: var(--md-accent-fg-color);
  border-color: color-mix(in srgb, var(--md-accent-fg-color) 42%, transparent);
}

.notebook-settings__option svg {
  width: 0.95rem;
  height: 0.95rem;
  stroke-width: 2;
}
