/* ==========================================================================
   Luna Dimmer - Apple macOS 原生风格模态弹窗系统 (Modals & Sheets)
   包含系统偏好设置、开发者赞赏、体验反馈、场景预设管理与危险操作确认
   ========================================================================== */

/* =========================================================
       Apple macOS System Settings Modal (Ventura / Sonoma Style)
       ========================================================= */
    .mac-modal-overlay {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0, 0, 0, 0.65);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      z-index: 10000;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .mac-modal-overlay.active {
      opacity: 1;
      pointer-events: auto;
    }
    .mac-pref-card {
      width: 740px;
      max-width: 95vw;
      height: 520px;
      max-height: 90vh;
      overflow: hidden;
      background: linear-gradient(180deg, rgba(26, 28, 36, 0.98) 0%, rgba(18, 20, 26, 0.98) 50%, rgba(13, 14, 18, 0.99) 100%);
      border: 1px solid rgba(255, 255, 255, 0.10);
      border-top: 1px solid rgba(255, 255, 255, 0.22);
      border-radius: 26px;
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06);
      transform: scale(0.96) translateY(10px);
      transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
      display: flex;
      flex-direction: row;
    }
    .mac-modal-overlay.active .mac-pref-card {
      transform: scale(1) translateY(0);
    }
    #webSponsorModal .mac-pref-card::-webkit-scrollbar {
      display: none;
      width: 0px;
      height: 0px;
    }

    /* 白夜雪山模式：macOS 偏好设置中心原生浅色毛玻璃与高对比度字色 */
    .theme-light .mac-pref-card,
    body.theme-light .mac-pref-card {
      background: linear-gradient(180deg, #FFFFFF 0%, #F5F5F7 100%);
      border: 1px solid rgba(0, 0, 0, 0.10);
      border-top: 1px solid rgba(255, 255, 255, 0.90);
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
      color: #1D1D1F;
    }
    .theme-light .mac-pref-sidebar,
    body.theme-light .mac-pref-sidebar {
      background: rgba(238, 238, 242, 0.95);
      border-right: 1px solid rgba(0, 0, 0, 0.08);
    }
    .theme-light .mac-sidebar-title,
    body.theme-light .mac-sidebar-title {
      color: #1D1D1F;
    }
    .theme-light .mac-sidebar-sep,
    body.theme-light .mac-sidebar-sep {
      background: rgba(0, 0, 0, 0.08);
    }
    .theme-light .mac-nav-item,
    body.theme-light .mac-nav-item {
      color: rgba(60, 60, 67, 0.85);
    }
    .theme-light .mac-nav-item:hover,
    body.theme-light .mac-nav-item:hover {
      background: rgba(0, 0, 0, 0.05);
      color: #1D1D1F;
    }
    .theme-light .mac-nav-item.active,
    body.theme-light .mac-nav-item.active {
      background: rgba(0, 0, 0, 0.08);
      border-color: rgba(0, 0, 0, 0.12);
      color: #1D1D1F;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }
    .theme-light .mac-group-header,
    body.theme-light .mac-group-header {
      color: #1D1D1F;
    }
    .theme-light .mac-inset-group,
    body.theme-light .mac-inset-group {
      background: #FFFFFF;
      border: 1px solid rgba(0, 0, 0, 0.08);
    }
    .theme-light .mac-setting-row,
    body.theme-light .mac-setting-row {
      border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
    }
    .theme-light .mac-setting-title,
    body.theme-light .mac-setting-title {
      color: #1D1D1F;
    }
    .theme-light .mac-setting-sub,
    body.theme-light .mac-setting-sub {
      color: rgba(60, 60, 67, 0.65);
    }
    .theme-light .mac-seg-control,
    body.theme-light .mac-seg-control {
      background: rgba(0, 0, 0, 0.06);
      border: 1px solid rgba(0, 0, 0, 0.08);
    }
    .theme-light .mac-seg-btn,
    body.theme-light .mac-seg-btn {
      color: rgba(60, 60, 67, 0.65);
    }
    .theme-light .mac-seg-btn.active,
    body.theme-light .mac-seg-btn.active {
      background: #FFFFFF;
      color: #1D1D1F;
      border: 1px solid rgba(0, 0, 0, 0.10);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }
    .theme-light .mac-keycap,
    body.theme-light .mac-keycap {
      background: rgba(0, 0, 0, 0.04);
      border: 1px solid rgba(0, 0, 0, 0.10);
      color: #1D1D1F;
    }
    .theme-light .mac-keycap-plus,
    body.theme-light .mac-keycap-plus {
      color: rgba(60, 60, 67, 0.45);
    }
    .theme-light .mac-save-tip,
    body.theme-light .mac-save-tip {
      color: rgba(60, 60, 67, 0.65);
    }
    .theme-light .mac-pref-btn-subtle,
    body.theme-light .mac-pref-btn-subtle {
      background: rgba(0, 0, 0, 0.05);
      border: 1px solid rgba(0, 0, 0, 0.12);
      color: #1D1D1F;
    }
    .theme-light .mac-pref-btn-subtle:hover,
    body.theme-light .mac-pref-btn-subtle:hover {
      background: rgba(0, 0, 0, 0.09);
      border-color: rgba(0, 0, 0, 0.20);
      color: #1D1D1F;
    }

    /* 苹果液态玻璃效果：Apple Liquid Glass / VisionOS Frosted Crystal Aesthetics */
    .luna-card.theme-liquid-glass {
      background: linear-gradient(135deg, rgba(26, 28, 38, 0.92) 0%, rgba(18, 20, 28, 0.94) 50%, rgba(12, 14, 20, 0.96) 100%) !important;
      border: 1px solid rgba(255, 255, 255, 0.20) !important;
      border-top: 1.5px solid rgba(255, 255, 255, 0.55) !important;
      box-shadow: 0 28px 72px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.50) !important;
      backdrop-filter: blur(28px) saturate(180%) !important;
      -webkit-backdrop-filter: blur(28px) saturate(180%) !important;
    }
    .luna-card.theme-liquid-glass .mockup-subtitle {
      color: rgba(235, 235, 245, 0.70) !important;
    }
    .luna-card.theme-liquid-glass .slider-meta-bar span:first-child,
    .luna-card.theme-liquid-glass .presets-title {
      color: rgba(235, 235, 245, 0.85) !important;
    }
    .luna-card.theme-liquid-glass .preset-pill {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.18) !important;
      border-top: 1px solid rgba(255, 255, 255, 0.40) !important;
      color: rgba(235, 235, 245, 0.85) !important;
    }
    .luna-card.theme-liquid-glass .preset-pill.active {
      background: rgba(255, 255, 255, 0.22) !important;
      border: 1px solid rgba(255, 255, 255, 0.40) !important;
      border-top: 1.5px solid rgba(255, 255, 255, 0.80) !important;
      color: #FFFFFF !important;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
      font-weight: 700 !important;
    }
    .luna-card.theme-liquid-glass .btn-mock-reset {
      background: rgba(255, 255, 255, 0.08) !important;
      border: 1px solid rgba(255, 255, 255, 0.20) !important;
      border-top: 1px solid rgba(255, 255, 255, 0.45) !important;
      color: #FFFFFF !important;
    }
    .luna-card.theme-liquid-glass .stealth-btn {
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%) !important;
      border: 1px solid rgba(255, 255, 255, 0.20) !important;
      border-top: 1px solid rgba(255, 255, 255, 0.50) !important;
      color: #FFFFFF !important;
    }
    .theme-liquid-glass .mac-pref-card,
    body.theme-liquid-glass .mac-pref-card {
      background: rgba(20, 22, 30, 0.94) !important;
      border: 1px solid rgba(255, 255, 255, 0.18) !important;
      border-top: 1px solid rgba(255, 255, 255, 0.45) !important;
      box-shadow: 0 28px 72px rgba(0, 0, 0, 0.8) !important;
      backdrop-filter: blur(28px) saturate(180%) !important;
    }
    .theme-liquid-glass .mac-pref-sidebar,
    body.theme-liquid-glass .mac-pref-sidebar {
      background: rgba(14, 16, 22, 0.70) !important;
      border-right: 1px solid rgba(255, 255, 255, 0.10) !important;
    }
    .theme-liquid-glass .mac-inset-group,
    body.theme-liquid-glass .mac-inset-group {
      background: rgba(255, 255, 255, 0.065) !important;
      border: 1px solid rgba(255, 255, 255, 0.16) !important;
      border-top: 1px solid rgba(255, 255, 255, 0.38) !important;
    }
    .theme-liquid-glass .mac-setting-sub,
    body.theme-liquid-glass .mac-setting-sub {
      color: rgba(235, 235, 245, 0.70) !important;
    }
    .theme-liquid-glass .mac-seg-btn.active,
    body.theme-liquid-glass .mac-seg-btn.active {
      background: rgba(255, 255, 255, 0.22) !important;
      border: 1px solid rgba(255, 255, 255, 0.35) !important;
      border-top: 1px solid rgba(255, 255, 255, 0.65) !important;
      color: #FFFFFF !important;
    }
    .mac-pref-sidebar {
      width: 195px;
      min-width: 195px;
      background: rgba(14, 15, 20, 0.65);
      border-right: 1px solid rgba(255, 255, 255, 0.07);
      padding: 16px 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      box-sizing: border-box;
      user-select: none;
    }
    .mac-traffic-lights {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 4px;
      cursor: pointer;
    }
    .mac-dot {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 8px;
      font-weight: bold;
      /* glyphs always visible by default */
      transition: all 0.15s ease;
    }
    .mac-dot-close { background: #FF5F56; border: 0.75px solid #E0443E; color: rgba(74, 0, 2, 0.85); }
    .mac-dot-min { background: #FFBD2E; border: 0.75px solid #DEA123; color: rgba(84, 53, 0, 0.85); }
    .mac-traffic-lights:hover .mac-dot-close { color: #4A0002; }
    .mac-traffic-lights:hover .mac-dot-min { color: #543500; }
    .mac-sidebar-title {
      font-size: 15px;
      font-weight: 700;
      color: #FFFFFF;
      margin-top: 4px;
      margin-bottom: 2px;
      padding-left: 2px;
    }
    .mac-sidebar-sep {
      height: 1px;
      background: rgba(255, 255, 255, 0.08);
      margin: 0 0 4px 0;
    }
    .mac-nav-item {
      display: flex;
      align-items: center;
      gap: 10px;
      height: 40px;
      padding: 0 10px;
      border-radius: 12px;
      background: transparent;
      border: 1px solid transparent;
      color: rgba(235, 235, 245, 0.65);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s ease;
      text-align: left;
      font-family: inherit;
    }
    .mac-nav-item:hover {
      background: rgba(255, 255, 255, 0.06);
      color: #FFFFFF;
    }
    .mac-nav-item.active {
      background: rgba(255, 255, 255, 0.12);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: #FFFFFF;
      font-weight: 600;
    }
    .mac-badge {
      width: 26px;
      height: 26px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      color: #FFFFFF;
      flex-shrink: 0;
      border: 0.6px solid rgba(255, 255, 255, 0.25);
    }
    .mac-badge-blue { background: linear-gradient(180deg, #007AFF 0%, #0062D2 100%); }
    .mac-badge-amber { background: linear-gradient(180deg, #FF9500 0%, #D97706 100%); }
    .mac-badge-indigo { background: linear-gradient(180deg, #5E5CE6 0%, #4B4AC4 100%); }
    .mac-badge-emerald { background: linear-gradient(180deg, #34C759 0%, #28A745 100%); }

    .mac-pref-content {
      flex: 1;
      padding: 18px 22px 14px 22px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      overflow-y: auto;
      box-sizing: border-box;
      scrollbar-width: thin;
      scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
    }
    .mac-pref-top-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 2px;
    }
    .mac-header-title {
      font-size: 16px;
      font-weight: 700;
      color: #FFFFFF;
    }

    /* macOS Inset Grouped Card */
    .mac-inset-card {
      background: rgba(255, 255, 255, 0.035);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 18px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }
    .mac-setting-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      min-height: 48px;
      box-sizing: border-box;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .mac-setting-row:last-child {
      border-bottom: none;
    }
    .mac-setting-info {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .mac-setting-title {
      font-size: 13.5px;
      font-weight: 600;
      color: #F8FAFC;
    }
    .mac-setting-sub {
      font-size: 12px;
      color: #94A3B8;
    }

    /* Apple Switch Control */
    .mac-switch {
      width: 38px;
      height: 22px;
      border-radius: 11px;
      background: rgba(255, 255, 255, 0.16);
      border: 0.8px solid rgba(255, 255, 255, 0.14);
      position: relative;
      cursor: pointer;
      transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      flex-shrink: 0;
      user-select: none;
    }
    .mac-switch.active {
      background: linear-gradient(135deg, #F5B338 0%, #E89E28 100%);
      border-color: rgba(255, 255, 255, 0.35);
    }
    .mac-switch-thumb {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: #FFFFFF;
      position: absolute;
      top: 1.2px;
      left: 2px;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
      transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .mac-switch.active .mac-switch-thumb {
      transform: translateX(16px);
    }

    /* macOS Segmented Control */
    .mac-segmented-control {
      display: flex;
      align-items: center;
      background: rgba(0, 0, 0, 0.32);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 12px;
      padding: 3px;
      gap: 3px;
    }
    .mac-seg-btn {
      height: 28px;
      padding: 0 6px;
      border-radius: 9px;
      font-size: 11.5px;
      font-weight: 500;
      color: #94A3B8;
      background: transparent;
      border: 1px solid transparent;
      cursor: pointer;
      transition: all 0.15s ease;
      font-family: inherit;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .mac-seg-btn.active {
      background: rgba(255, 255, 255, 0.16);
      border: 1px solid rgba(255, 255, 255, 0.20);
      color: #FFFFFF;
      font-weight: 600;
    }


    /* Bottom action bar */
    .mac-pref-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 4px;
      padding: 0 4px;
    }
    .mac-auto-save-hint {
      font-size: 11px;
      color: rgba(235, 235, 245, 0.60);
    }
    .theme-light .mac-auto-save-hint {
      color: rgba(60, 60, 67, 0.65);
    }
    .mac-btn-done {
      background: #0A84FF;
      border: none;
      border-radius: 8px;
      padding: 5px 22px;
      color: #FFFFFF;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s ease;
      font-family: inherit;
    }
    .mac-btn-done:hover {
      background: #0071E3;
    }
    .theme-light .mac-btn-done {
      background: #007AFF;
      color: #FFFFFF;
    }
    .theme-light .mac-btn-done:hover {
      background: #0066D6;
    }

    /* Generic Content Modal for Features, Hotkeys, FAQ */
    .mac-modal-dialog {
      width: 760px;
      max-width: 94vw;
      max-height: 84vh;
      background: linear-gradient(180deg, rgba(28, 28, 30, 0.98) 0%, rgba(18, 18, 20, 0.98) 100%);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-top: 1px solid rgba(255, 255, 255, 0.28);
      border-radius: 20px;
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      box-sizing: border-box;
      transform: scale(0.96) translateY(10px);
      transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .mac-modal-overlay.active .mac-modal-dialog {
      transform: scale(1) translateY(0);
    }
    .mac-dialog-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px 14px 20px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(255, 255, 255, 0.02);
      flex-shrink: 0;
    }
    .mac-dialog-title {
      font-size: 15px;
      font-weight: 700;
      color: #FFFFFF;
    }
    .mac-dialog-body {
      padding: 24px;
      overflow-y: auto;
      flex: 1;
    }
    .mac-dialog-body::-webkit-scrollbar {
      width: 6px;
    }
    .mac-dialog-body::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.16);
      border-radius: 3px;
    }

    body.theme-light .mac-modal-dialog {
      background: #FFFFFF !important;
      border: 1px solid rgba(0, 0, 0, 0.12) !important;
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18) !important;
    }
    body.theme-light .mac-dialog-header {
      border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
      background: rgba(0, 0, 0, 0.02) !important;
    }
    body.theme-light .mac-dialog-title {
      color: #1D1D1F !important;
    }
    .mac-dialog-close {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: #94A3B8;
      font-size: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.18s ease;
    }
    .mac-dialog-close:hover {
      background: rgba(239, 68, 68, 0.2);
      border-color: rgba(239, 68, 68, 0.4);
      color: #EF4444;
    }
    body.theme-light .mac-dialog-close {
      background: rgba(0, 0, 0, 0.06);
      border: 1px solid rgba(0, 0, 0, 0.1);
      color: #64748B;
    }
    body.theme-light .mac-dialog-close:hover {
      background: rgba(239, 68, 68, 0.15);
      border-color: rgba(239, 68, 68, 0.3);
      color: #EF4444;
    }
    body.theme-light .mac-dialog-body::-webkit-scrollbar-thumb {
      background: rgba(0, 0, 0, 0.16) !important;
    }
