/* ═══════════════════════════════════════════════════════════════════
   MDMS 设置弹层 — v3.0.0-alpha.5
   ───────────────────────────────────────────────────────────────────
   玻璃宪法: 全部 backdrop-filter:blur + glass-bg, 0 渐变
   功能:    6 主题 + 字体大小 + 字体族 + 账号占位 + 账单/余额跳转
   作者:    DeGao
   ═══════════════════════════════════════════════════════════════════ */

/* 背板 */
.mdms-settings-bg {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgb(0 0 0 / .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
}
.mdms-settings-bg.visible {
  display: flex;
}

/* 主体 (玻璃) */
.mdms-settings {
  width: 90%;
  max-width: 820px;
  height: 75vh;
  background: var(--ae-sidebar-bg);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--ae-glass-border);
  border-radius: 16px;
  display: flex;
  overflow: hidden;
  box-shadow: 0 24px 80px rgb(0 0 0 / .5);
}

/* 左栏 */
.ms-sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: 24px 12px;
  border-right: 1px solid var(--ae-glass-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ms-sidebar-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ae-text-1);
  padding: 0 12px 16px;
}
.ms-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.875rem;
  color: var(--ae-text-2);
  cursor: pointer;
  transition: all .15s;
  font-weight: 500;
}
.ms-nav-item:hover {
  background: var(--ae-glass-bg-hover);
  color: var(--ae-text-1);
}
.ms-nav-item.active {
  background: var(--ae-glass-bg-active);
  color: var(--ae-text-1);
}
.ms-nav-item i {
  width: 18px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ae-text-3);
  flex-shrink: 0;
}
.ms-nav-item.active i {
  color: var(--ae-text-1);
}

/* 右栏 */
.ms-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ms-content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 0;
  flex-shrink: 0;
}
.ms-content-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ae-text-1);
  margin: 0;
}
.ms-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ae-text-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all .15s;
}
.ms-close-btn:hover {
  background: var(--ae-glass-bg-hover);
  color: var(--ae-text-1);
}
.ms-content-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 28px;
}

/* Section */
.ms-section {
  margin-bottom: 28px;
}
.ms-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ae-text-1);
  margin: 0 0 16px 0;
}

/* ═══ 6 主题卡 ═══ */
.ms-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.ms-theme-card {
  cursor: pointer;
  border-radius: 14px;
  border: 2px solid transparent;
  padding: 4px;
  transition: all .2s;
}
.ms-theme-card:hover {
  border-color: var(--ae-glass-border-hover);
}
.ms-theme-card.active {
  border-color: var(--ae-accent);
}
.ms-theme-preview {
  height: 90px;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  padding: 14px;
}
.ms-theme-preview.light    { background: #f5f5f5; }
.ms-theme-preview.dim      { background: #15202B; }
.ms-theme-preview.dark     { background: #1f1f1f; }
.ms-theme-preview.eyecare  { background: #262624; }
.ms-theme-preview.dotgrid  {
  background: #000;
  background-image: radial-gradient(circle, rgb(255 255 255 / .12) 1px, transparent 1px);
  background-size: 12px 12px;
}
.ms-theme-preview.custom   {
  background: rgb(40 40 50);
}
.ms-tp-bar {
  height: 8px;
  width: 60%;
  border-radius: 4px;
  margin-bottom: 8px;
}
.ms-tp-line {
  height: 6px;
  width: 80%;
  border-radius: 3px;
}
.ms-theme-preview.light    .ms-tp-bar { background: #ddd; }
.ms-theme-preview.light    .ms-tp-line { background: #e8e8e8; }
.ms-theme-preview.dim      .ms-tp-bar { background: #253341; }
.ms-theme-preview.dim      .ms-tp-line { background: #1e2d3d; }
.ms-theme-preview.dark     .ms-tp-bar { background: #333; }
.ms-theme-preview.dark     .ms-tp-line { background: #2a2a2a; }
.ms-theme-preview.eyecare  .ms-tp-bar { background: #3a3832; }
.ms-theme-preview.eyecare  .ms-tp-line { background: #32302c; }
.ms-theme-preview.dotgrid  .ms-tp-bar { background: #222; }
.ms-theme-preview.dotgrid  .ms-tp-line { background: #1a1a1a; }
.ms-theme-preview.custom   .ms-tp-bar { background: rgb(255 255 255 / .15); }
.ms-theme-preview.custom   .ms-tp-line { background: rgb(255 255 255 / .10); }

.ms-tp-foot {
  position: absolute;
  bottom: 8px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ms-tp-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ae-text-3);
  opacity: .4;
}
.ms-tp-btn {
  font-size: 0.5rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: .3px;
}
.ms-theme-preview.light    .ms-tp-btn { background: #222; color: #fff; }
.ms-theme-preview.dark     .ms-tp-btn { background: #fff; color: #222; }
.ms-theme-preview.dim      .ms-tp-btn { background: #fff; color: #15202B; }
.ms-theme-preview.eyecare  .ms-tp-btn { background: #e0dcd4; color: #262624; }
.ms-theme-preview.dotgrid  .ms-tp-btn { background: #fff; color: #000; }
.ms-theme-preview.custom   .ms-tp-btn { background: rgb(255 255 255 / .8); color: #222; }
.ms-tp-upload-icon {
  font-size: 1.375rem;
  color: rgb(255 255 255 / .25);
}
.ms-theme-label {
  text-align: center;
  padding: 10px 0 4px;
  font-size: 0.75rem;
  color: var(--ae-text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.ms-theme-card.active .ms-theme-label {
  color: var(--ae-accent);
}

/* ═══ 字体大小滑块 ═══ */
.ms-fs-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}
.ms-fs-label {
  font-weight: 700;
  color: var(--ae-text-3);
  flex-shrink: 0;
}
.ms-fs-sm { font-size: 0.8125rem; }
.ms-fs-lg { font-size: 1.375rem; }
.ms-fs-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--ae-accent);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.ms-fs-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ae-accent);
  border: 3px solid var(--ae-bg-base);
  box-shadow: 0 0 0 2px var(--ae-accent);
  cursor: pointer;
}
.ms-fs-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ae-accent);
  border: 3px solid var(--ae-bg-base);
  box-shadow: 0 0 0 2px var(--ae-accent);
  cursor: pointer;
}

/* ═══ 字体族 4 卡 ═══ */
.ms-font-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.ms-font-card {
  cursor: pointer;
  border-radius: 14px;
  border: 2px solid var(--ae-glass-border);
  padding: 2px;
  transition: all .2s;
  text-align: center;
}
.ms-font-card:hover {
  border-color: var(--ae-glass-border-hover);
}
.ms-font-card.active {
  border-color: var(--ae-accent);
}
.ms-font-preview {
  height: 80px;
  border-radius: 10px;
  background: var(--ae-glass-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 400;
  color: var(--ae-text-1);
}
.ms-font-label {
  text-align: center;
  padding: 8px 0 4px;
  font-size: 0.6875rem;
  color: var(--ae-text-3);
}
.ms-font-card.active .ms-font-label {
  color: var(--ae-accent);
}

/* ═══ 通用占位行 ═══ */
.ms-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.ms-row-text {
  font-size: 0.8125rem;
  color: var(--ae-text-2);
  line-height: 1.5;
  flex: 1;
}
.ms-link-btn {
  border: 1px solid var(--ae-glass-border);
  background: transparent;
  color: var(--ae-text-1);
  font-size: 0.8125rem;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 500;
  transition: all .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ms-link-btn:hover {
  background: var(--ae-glass-bg-hover);
  border-color: var(--ae-glass-border-hover);
}

/* 余额显示 */
.ms-balance-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 20px 0;
}
.ms-balance-num {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--ae-text-1);
  letter-spacing: -.5px;
}
.ms-balance-unit {
  font-size: 0.875rem;
  color: var(--ae-text-3);
  font-weight: 500;
}

/* 占位空状态 */
.ms-empty {
  text-align: center;
  color: var(--ae-text-3);
  font-size: 0.8125rem;
  padding: 60px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.ms-empty i {
  font-size: 1.75rem;
  opacity: .3;
}

/* 移动端 */
@media (max-width: 768px) {
  .mdms-settings {
    width: 95%;
    height: 90vh;
    flex-direction: column;
  }
  .ms-sidebar {
    width: 100%;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--ae-glass-border);
    padding: 12px;
    overflow-x: auto;
  }
  .ms-sidebar-title { display: none; }
  .ms-nav-item { white-space: nowrap; flex-shrink: 0; }
  .ms-theme-grid { grid-template-columns: repeat(2, 1fr); }
  .ms-font-grid { grid-template-columns: repeat(2, 1fr); }
}
