body.settings-open {
  overflow: hidden;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
}

.settings-overlay.hidden {
  display: none !important;
}

.settings-dialog {
  max-height: 92vh;
}

.settings-panel {
  position: relative;
  width: 100%;
}

.settings-close {
  position: absolute;
  cursor: pointer;
  z-index: 3;
}

.settings-close::before,
.settings-close::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 46%;
  height: 10%;
  border-radius: 999px;
  background: #fff6ef;
  transform-origin: center;
}

.settings-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.settings-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.settings-body {
  display: grid;
  align-content: start;
}

.settings-row {
  display: grid;
  align-items: center;
  cursor: pointer;
  text-align: left;
}

.settings-row-icon {
  display: grid;
  place-items: center;
  line-height: 1;
}

/* 音量分段控制 */
.settings-volume-row {
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  cursor: default;
}

.settings-volume-row .settings-row-icon {
  grid-row: 1;
}

.settings-volume-row .settings-row-copy {
  grid-row: 1;
}

.settings-volume-row .volume-segments {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: stretch;
  margin-top: 4px;
}

.volume-segments {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
  width: 100%;
  max-width: 320px;
}

.volume-btn {
  width: 32px;
  height: 32px;
  border: 2px solid #625565;
  border-radius: 6px;
  background: var(--preview-surface-soft, #c7dcd0);
  color: #2e222f;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.16);
  user-select: none;
  transition: transform 80ms ease;
}

.volume-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.16);
}

.volume-bar {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  flex: 1;
}

.volume-segment {
  width: 10px;
  height: 10px;
  border: 2px solid #625565;
  border-radius: 3px;
  background: var(--preview-surface-muted, #9babb2);
  transition: background 120ms ease, transform 80ms ease;
}

.volume-segment.filled {
  background: var(--preview-secondary, #1ebc73);
  transform: scaleY(1);
}

@media (max-width: 420px) {
  .volume-segments {
    gap: 4px;
  }

  .volume-btn {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }

  .volume-segment {
    width: 8px;
    height: 8px;
  }
}

.settings-actions {
  display: grid;
}

.settings-image-button {
  justify-self: center;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  cursor: pointer;
}

/* ----- Preview-inspired settings overrides ----- */

.settings-overlay {
  background: rgba(46, 34, 47, 0.42);
  backdrop-filter: blur(3px);
}

.settings-dialog {
  width: min(460px, 92vw);
}

.settings-panel {
  aspect-ratio: auto;
  padding: 18px;
  background: #ffffff;
  border: 3px solid #625565;
  border-radius: 12px;
  box-shadow: 8px 8px 0 rgba(46, 34, 47, 0.26);
  filter: none;
}

.settings-title-card {
  margin-bottom: 14px;
  padding: 16px 14px;
  background: linear-gradient(180deg, #2e222f, #3e3546);
  border: 3px solid #625565;
  border-radius: 10px;
  box-shadow: 4px 4px 0 rgba(46, 34, 47, 0.18);
  text-align: center;
}

.settings-title {
  position: static;
  transform: none;
  color: #ffffff;
  font-size: 30px;
  font-weight: 900;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.32);
}

.settings-title-subtitle {
  margin-top: 8px;
  color: #c7dcd0;
  font-size: 12px;
  font-weight: 900;
}

.settings-close {
  top: 14px;
  right: 14px;
  width: 34px;
  border-radius: 6px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.24);
}

.settings-body {
  position: static;
  inset: auto;
  padding: 0;
  gap: 10px;
}

.settings-row {
  grid-template-columns: 34px minmax(0, 1fr) 58px;
  min-height: 72px;
  padding: 10px;
  border: 2px solid #9babb2;
  border-radius: 6px;
  background: #c7dcd0;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.1);
  color: #625565;
  font-size: 15px;
}

.settings-row-copy {
  display: grid;
  gap: 4px;
}

.settings-row-label {
  padding-right: 0;
  color: #2e222f;
  font-size: 15px;
  font-weight: 900;
}

.settings-row-desc {
  color: #625565;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 800;
}

.settings-row-icon {
  color: #625565;
  font-size: 20px;
}

.settings-divider {
  height: 2px;
  margin: 2px 0 0;
  background: linear-gradient(90deg, transparent, rgba(98, 85, 101, 0.35), transparent);
}

.settings-actions {
  gap: 10px;
  padding-top: 4px;
}

.settings-image-button {
  width: 100%;
  min-height: 52px;
  aspect-ratio: auto;
  border: 2px solid rgba(0, 0, 0, 0.34);
  border-radius: 6px;
  background: #c7dcd0;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.24);
  filter: none;
}

.settings-return-button {
  background-image: linear-gradient(180deg, #4d9be6, #4d65b4);
}

.settings-return-button::before {
  content: "返回主界面";
  display: block;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
  line-height: 48px;
  text-align: center;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.22);
}

@media (max-width: 420px) {
  .settings-panel {
    padding: 14px;
  }

  .settings-row {
    grid-template-columns: 28px minmax(0, 1fr) 58px;
    min-height: 64px;
    padding: 9px;
  }

  .settings-title {
    font-size: 24px;
  }
}
