.app-settings-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(223, 234, 233, 0.28);
  border-radius: 999px;
  background: rgba(4, 38, 44, 0.34);
  color: rgba(237, 243, 242, 0.92);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.app-settings-open:hover,
.app-settings-open:focus-visible {
  background: rgba(237, 243, 242, 0.14);
  border-color: rgba(237, 243, 242, 0.56);
  color: #ffffff;
  outline: 2px solid rgba(237, 243, 242, 0.2);
  outline-offset: 1px;
  transform: translateY(-1px);
}

.library-settings-button.app-settings-open {
  flex: 0 0 auto;
}

.reader-topbar .reader-settings-button.app-settings-open {
  border-color: var(--reader-rule);
  border-radius: 7px;
  background: transparent;
  color: var(--reader-ink);
  backdrop-filter: blur(16px);
}

.reader-topbar .reader-settings-button.app-settings-open:hover,
.reader-topbar .reader-settings-button.app-settings-open:focus-visible {
  background: color-mix(in srgb, var(--reader-control-solid) 72%, transparent);
  border-color: var(--reader-rule);
  transform: none;
}

.app-settings-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-settings-icon svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke: currentColor;
}

.app-settings-icon i {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 18px;
  text-align: center;
}

.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
  font: inherit;
}

.custom-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.custom-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--library-card-line-strong, rgba(247, 251, 252, 0.24));
  border-radius: 3px;
  background: rgba(4, 31, 36, 0.72);
  color: var(--library-card-ink, #f7fbfc);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.custom-select-button:hover,
.custom-select-button:focus-visible,
.custom-select.open .custom-select-button {
  border-color: rgba(237, 243, 242, 0.76);
  background: rgba(237, 243, 242, 0.08);
  outline: 2px solid rgba(237, 243, 242, 0.18);
  outline-offset: 1px;
}

.custom-select-button:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

.custom-select-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-chevron {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.68;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 140ms ease;
}

.custom-select.open .custom-select-chevron {
  transform: translateY(2px) rotate(225deg);
}

.custom-select-list {
  position: absolute;
  inset: calc(100% + 7px) 0 auto;
  z-index: 90;
  display: grid;
  max-height: min(320px, 52vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--library-card-line-strong, rgba(247, 251, 252, 0.24));
  border-radius: 6px;
  background: var(--library-card, #20282a);
  color: var(--library-card-ink, #f7fbfc);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

.custom-select-list[hidden] {
  display: none;
}

.custom-select-option {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: currentColor;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}

.custom-select-option:hover,
.custom-select-option:focus-visible,
.custom-select-option.active,
.custom-select-option[aria-selected="true"] {
  background: rgba(237, 243, 242, 0.1);
  color: #ffffff;
  outline: 0;
  transform: none;
}

.custom-select-option:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.app-settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 12, 14, 0.62);
  backdrop-filter: blur(5px);
}

.app-settings-backdrop[hidden] {
  display: none;
}

.app-settings-panel {
  display: grid;
  gap: 28px;
  width: min(560px, calc(100vw - 22px));
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  padding: 26px 34px 34px;
  border: 2px solid #5eb8b2;
  border-radius: 18px;
  background: #20282a;
  color: #f7fbfc;
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(94, 184, 178, 0.28);
  direction: ltr;
}

.app-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.app-settings-header h2 {
  flex: 1;
  margin: 0;
  color: #f7fbfc;
  font: 800 1.72rem/1.15 Arial, Helvetica, sans-serif;
  text-align: center;
}

.app-settings-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(247, 251, 252, 0.74);
  cursor: pointer;
}

.app-settings-close:hover,
.app-settings-close:focus-visible {
  color: #f7fbfc;
  outline: 0;
}

.app-settings-section {
  display: grid;
  gap: 16px;
}

.app-settings-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-settings-field {
  display: grid;
  gap: 12px;
}

.app-settings-label {
  color: #f7fbfc;
  font: 800 1.18rem/1.2 Arial, Helvetica, sans-serif;
}

.app-settings-field select {
  width: 100%;
  min-height: 52px;
  border: 2px solid rgba(247, 251, 252, 0.24);
  border-radius: 14px;
  padding: 0 44px 0 18px;
  color: #f7fbfc;
  font: 500 1.05rem Arial, Helvetica, sans-serif;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, rgba(247, 251, 252, 0.58) 50%) calc(100% - 22px) 50% / 9px 9px no-repeat,
    linear-gradient(135deg, rgba(247, 251, 252, 0.58) 50%, transparent 50%) calc(100% - 14px) 50% / 9px 9px no-repeat,
    rgba(12, 13, 16, 0.32);
}

.app-settings-field select:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

.app-settings-field select:focus {
  border-color: #58b8b1;
  outline: 0;
}

.app-settings-field .custom-select-button {
  min-height: 52px;
  border: 2px solid rgba(247, 251, 252, 0.24);
  border-radius: 14px;
  padding: 0 18px;
  background: rgba(12, 13, 16, 0.32);
  color: #f7fbfc;
  font: 500 1.05rem Arial, Helvetica, sans-serif;
  box-shadow: none;
}

.app-settings-field .custom-select-button:hover,
.app-settings-field .custom-select-button:focus-visible,
.app-settings-field .custom-select.open .custom-select-button {
  border-color: #58b8b1;
  background: rgba(12, 13, 16, 0.46);
  outline: 0;
}

.app-settings-field .custom-select-list {
  position: static;
  margin-top: 8px;
  max-height: min(230px, 34vh);
  border: 2px solid #5eb8b2;
  border-radius: 14px;
  background: #20282a;
  color: #f7fbfc;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
}

.app-settings-field .custom-select-option {
  min-height: 42px;
  border-radius: 10px;
  color: rgba(247, 251, 252, 0.84);
  font: 700 0.98rem Arial, Helvetica, sans-serif;
}

.app-settings-field .custom-select-option:hover,
.app-settings-field .custom-select-option:focus-visible,
.app-settings-field .custom-select-option.active,
.app-settings-field .custom-select-option[aria-selected="true"] {
  background: rgba(88, 184, 177, 0.2);
  color: #58d1cb;
}

.app-settings-note {
  margin: 0;
  color: rgba(247, 251, 252, 0.72);
  font: 500 0.95rem/1.45 Arial, Helvetica, sans-serif;
}

.app-settings-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(247, 251, 252, 0.2);
  border-radius: 999px;
  color: rgba(247, 251, 252, 0.78);
  font: 700 0.78rem/1 Arial, Helvetica, sans-serif;
}

.app-settings-pill-live {
  border-color: rgba(94, 184, 178, 0.8);
  color: #9be4df;
}

.app-settings-account {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(247, 251, 252, 0.16);
  border-radius: 12px;
  background: rgba(12, 13, 16, 0.24);
}

.app-settings-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex: 0 0 auto;
  object-fit: cover;
}

.app-settings-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #5eb8b2;
  color: #0c1718;
  font: 900 1.1rem/1 Arial, Helvetica, sans-serif;
}

.app-settings-account-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.app-settings-account-text strong,
.app-settings-account-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-settings-account-text strong {
  color: #f7fbfc;
  font: 800 0.98rem/1.1 Arial, Helvetica, sans-serif;
}

.app-settings-account-text span {
  color: rgba(247, 251, 252, 0.68);
  font: 500 0.88rem/1.2 Arial, Helvetica, sans-serif;
}

.app-settings-google-button,
.app-settings-secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  width: fit-content;
  max-width: 100%;
  border-radius: 10px;
  padding: 0 16px;
  text-decoration: none;
  cursor: pointer;
  font: 800 0.98rem/1 Arial, Helvetica, sans-serif;
}

.app-settings-google-button {
  border: 1px solid rgba(247, 251, 252, 0.2);
  background: #f7fbfc;
  color: #1e2729;
}

.app-settings-google-button:hover,
.app-settings-google-button:focus-visible {
  background: #ffffff;
  outline: 2px solid rgba(94, 184, 178, 0.44);
  outline-offset: 2px;
}

.app-settings-google-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  color: #1a73e8;
  font: 900 1rem/1 Georgia, serif;
}

.app-settings-secondary-button {
  border: 1px solid rgba(247, 251, 252, 0.22);
  background: transparent;
  color: #f7fbfc;
}

.app-settings-secondary-button:hover,
.app-settings-secondary-button:focus-visible {
  border-color: rgba(247, 251, 252, 0.54);
  outline: 0;
}

@media (max-width: 720px) {
  .app-settings-panel {
    gap: 22px;
    padding: 22px 20px 24px;
  }

  .app-settings-header h2 {
    font-size: 1.45rem;
  }
}
