* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
body {
    background-color: var(--sgc-bg-main);
    color: var(--sgc-text-primary);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.page-container {
    position: relative;
    flex: 1;
    overflow: hidden;
}
.page {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    pointer-events: none;
    z-index: 1;
}
.page.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    z-index: 2;
}
.page.slide-left {
    transform: translateX(-30px);
}
.apk-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
    padding-bottom: 100px;
}
@media (min-width: 480px) {
    .apk-grid { gap: 14px; padding: 20px; padding-bottom: 100px; }
}
@media (min-width: 640px) {
    .apk-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (min-width: 1024px) {
    .apk-grid { grid-template-columns: repeat(4, 1fr); max-width: 1200px; margin: 0 auto; }
}
.apk-card {
    background: linear-gradient(145deg, var(--sgc-surface) 0%, var(--sgc-surface-elevated) 100%);
    border-radius: 16px;
    border: 1px solid var(--sgc-border);
    padding: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: cardEnter 0.4s cubic-bezier(0.32, 0.72, 0, 1) backwards;
}
.apk-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--sgc-primary), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}
.apk-card:hover::before, .apk-card:active::before { opacity: 0.6; }
.apk-card:hover {
    border-color: var(--sgc-border-active);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.12);
}
.apk-card:active {
    transform: translateY(-1px) scale(0.97);
    background: var(--sgc-border);
    transition-duration: 0.1s;
}
.apk-card.configured {
    border-color: rgba(99, 102, 241, 0.35);
    background: linear-gradient(145deg, var(--sgc-surface) 0%, var(--sgc-surface-elevated) 50%, rgba(99,102,241,0.06) 100%);
}
.apk-card.configured .status-badge {
    color: var(--sgc-primary);
    font-weight: 600;
}
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.file-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--sgc-primary) 0%, var(--sgc-primary-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    margin-bottom: 12px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    position: relative;
}
.file-icon::after {
    content: 'APK';
    position: absolute;
    bottom: 3px;
    right: 3px;
    font-size: 6.5px;
    font-weight: 800;
    background: rgba(0,0,0,0.35);
    padding: 1px 3px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    line-height: 1;
}
.fab-plus {
    position: fixed;
    right: 20px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sgc-primary) 0%, var(--sgc-primary-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35), 0 0 0 1px rgba(255,255,255,0.08) inset;
    z-index: 40;
    transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    border: none;
    outline: none;
    cursor: pointer;
}
.fab-plus::before, .fab-plus::after {
    content: "";
    position: absolute;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}
.fab-plus::before { width: 22px; height: 2.5px; }
.fab-plus::after { width: 2.5px; height: 22px; }
.fab-plus:hover {
    transform: scale(1.06) rotate(90deg);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.45);
}
.fab-plus:active { transform: scale(0.92) rotate(90deg); }
.fab-plus.hidden-fab {
    transform: scale(0) rotate(45deg);
    opacity: 0;
    pointer-events: none;
}
.list-item {
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.list-item > div:first-child {
    flex: 1;
    min-width: 0;
}
.list-item .custom-checkbox {
    margin-left: 12px;
    flex-shrink: 0;
    align-self: center;
    position: relative;
    top: 0;
}
.list-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--sgc-primary), var(--sgc-primary-hover));
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 0 3px 3px 0;
}
.list-item:hover { background-color: rgba(99, 102, 241, 0.04); }
.list-item:hover::after { opacity: 1; }
.list-item:active { background-color: rgba(99, 102, 241, 0.08); }

.custom-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--sgc-border-active);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.custom-checkbox:hover { border-color: var(--sgc-border-hover); }
.custom-checkbox.checked {
    background: linear-gradient(135deg, var(--sgc-primary) 0%, var(--sgc-primary-hover) 100%);
    border-color: var(--sgc-primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.custom-checkbox.checked::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}
.custom-checkbox:active { transform: scale(0.88); }

/* 单选样式（Res混淆/字符串加密/引擎选择） */
.custom-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--sgc-border-active);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.custom-radio:hover { border-color: var(--sgc-border-hover); }
.custom-radio.checked { border-color: var(--sgc-primary); }
.custom-radio.checked::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sgc-primary) 0%, var(--sgc-primary-hover) 100%);
}
.custom-radio:active { transform: scale(0.88); }
body.light-theme .custom-radio { border-color: var(--sgc-border-active); }
body.light-theme .custom-radio:hover { border-color: var(--sgc-text-tertiary); }

/* SO/Assets 扫描列表弹窗加宽 */
#subConfigModal.wide .modal-sheet {
    width: min(94vw, 560px) !important;
    max-width: 560px !important;
}

/* 子配置弹窗中的选项样式 */
.sub-config-body label {
    transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.sub-config-body label:hover {
    border-color: rgba(99, 102, 241, 0.3) !important;
    transform: translateX(2px);
}
.sub-config-body label:active {
    transform: scale(0.99);
}
body.light-theme .sub-config-body label:hover {
    border-color: rgba(99, 102, 241, 0.2) !important;
}

.modal-root {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.modal-root.open {
    opacity: 1;
    pointer-events: auto;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
}
.modal-sheet {
    position: relative;
    width: 100%;
    background: var(--sgc-surface-elevated);
    border-radius: 24px 24px 0 0;
    border: 1px solid var(--sgc-border);
    border-bottom: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
}
.modal-root.open .modal-sheet { transform: translateY(0); }
@media (min-width: 640px) {
    .modal-root {
        align-items: center;
        padding: 20px;
    }
    .modal-sheet {
        max-width: 520px;
        width: 92%;
        border-radius: 20px;
        border: 1px solid var(--sgc-border-active);
        max-height: 80vh;
        transform: translateY(20px) scale(0.96);
    }
    .modal-root.open .modal-sheet {
        transform: translateY(0) scale(1);
    }
}
.modal-tip { align-items: center; }
.modal-tip .modal-sheet {
    max-width: 340px;
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
    transform: scale(0.9) translateY(10px);
    transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-tip.open .modal-sheet { transform: scale(1) translateY(0); }

/* ===== 输入框（设置页） ===== */
.login-input-wrap { position: relative; margin-top: 8px; }
.login-input {
    margin-top: 0;
}
/* 设置页输入框：固定高度 + 去除纵向内边距，杜绝密码圆点/文本因行高继承溢出框线 */
#settingsPage .login-input {
    height: 42px;
    padding-top: 0;
    padding-bottom: 0;
    line-height: normal;
}

.log-entry {
    padding: 3px 0;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.7;
    opacity: 0;
    animation: logFadeIn 0.25s ease forwards;
}
@keyframes logFadeIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}
.log-system { color: var(--sgc-primary); }
.log-progress { color: var(--sgc-text-secondary); }
.log-success { color: var(--sgc-success); }
.log-warning { color: var(--sgc-warning); }
.log-error { color: var(--sgc-danger); }

.progress-track {
    background: var(--sgc-border);
    border-radius: 999px;
    overflow: hidden;
    height: 6px;
    position: relative;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sgc-primary), var(--sgc-primary-soft));
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    animation: shimmer 1.8s infinite;
}
@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.task-card {
    background: var(--sgc-surface);
    border: 1px solid var(--sgc-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
/* 仅首次渲染播放入场动画, 避免打开任务列表时已完成卡片重复"闪一下" */
.task-card.entering {
    animation: cardEnter 0.3s cubic-bezier(0.32, 0.72, 0, 1) backwards;
}
.task-card:hover {
    border-color: var(--sgc-border-active);
    transform: translateX(3px);
}
.task-card:active { transform: translateX(1px) scale(0.99); }

.status-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.status-tag::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}
.status-done {
    background: rgba(16, 185, 129, 0.1);
    color: var(--sgc-success);
}
.status-running {
    background: rgba(99, 102, 241, 0.12);
    color: var(--sgc-primary-soft);
}
.status-pending {
    background: rgba(245, 158, 11, 0.12);
    color: var(--sgc-warning);
}
.status-stopped {
    background: rgba(239, 68, 68, 0.1);
    color: var(--sgc-danger);
}
.status-failed {
    background: rgba(239, 68, 68, 0.12);
    color: var(--sgc-danger-soft);
}
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}
.empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--sgc-border) 0%, var(--sgc-border-active) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #475569;
    margin-bottom: 16px;
    border: 1px solid var(--sgc-border-active);
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.dropdown-wrap { position: relative; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--sgc-surface-elevated);
    border: 1px solid var(--sgc-border-active);
    border-radius: 12px;
    min-width: 180px;
    z-index: 60;
    padding: 6px;
    transform-origin: top right;
    transform: scale(0.92) translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    overflow: hidden;
}
.dropdown-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}
.menu-item {
    padding: 11px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #e2e8f0;
}
.menu-item:hover { background: rgba(99, 102, 241, 0.08); }
.menu-item:active { background: rgba(99, 102, 241, 0.15); }
.menu-divider {
    height: 1px;
    background: var(--sgc-border);
    margin: 5px 8px;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sgc-border-active); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--sgc-border-hover); }

/* ===== 浅色主题变量 ===== */
body.light-theme .glass-header {
    background: var(--sgc-glass-bg);
    border-bottom: 1px solid var(--sgc-glass-border);
}
body.light-theme .apk-card {
    background: linear-gradient(145deg, var(--sgc-surface) 0%, var(--sgc-bg-main) 100%);
    border: 1px solid var(--sgc-border);
}
body.light-theme .apk-card:hover {
    border-color: var(--sgc-border-active);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.08);
}
body.light-theme .apk-card.configured {
    border-color: rgba(99, 102, 241, 0.3);
    background: linear-gradient(145deg, var(--sgc-surface) 0%, var(--sgc-bg-main) 50%, rgba(99,102,241,0.04) 100%);
}
body.light-theme .task-card {
    background: var(--sgc-surface);
    border: 1px solid var(--sgc-border);
}
body.light-theme .task-card:hover {
    border-color: var(--sgc-border-active);
}
body.light-theme .list-item:hover {
    background-color: rgba(99, 102, 241, 0.03);
}
body.light-theme .list-item:active {
    background-color: rgba(99, 102, 241, 0.06);
}
body.light-theme .empty-icon {
    background: linear-gradient(135deg, var(--sgc-surface-highlight) 0%, var(--sgc-border) 100%);
    border: 1px solid var(--sgc-border);
    color: var(--sgc-text-tertiary);
}
body.light-theme .custom-checkbox {
    border-color: var(--sgc-border-active);
}
body.light-theme .custom-checkbox:hover {
    border-color: var(--sgc-text-tertiary);
}
body.light-theme .modal-sheet {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
}
body.light-theme .modal-backdrop {
    background: rgba(0,0,0,0.4);
}
body.light-theme .dropdown-menu {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.12);
}
body.light-theme .menu-item:hover {
    background: rgba(99, 102, 241, 0.05);
}
body.light-theme .menu-item:active {
    background: rgba(99, 102, 241, 0.1);
}
body.light-theme .sub-config-input {
    background: var(--sgc-bg-main);
    border-color: var(--sgc-border);
    color: var(--sgc-text-primary);
}
body.light-theme .sub-config-input:focus {
    border-color: var(--sgc-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
body.light-theme .sub-config-input::placeholder {
    color: var(--sgc-text-tertiary);
}
body.light-theme .config-summary {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.1);
}
body.light-theme .progress-track {
    background: var(--sgc-border);
}
body.light-theme .log-window {
    background: var(--sgc-surface);
}
body.light-theme #logContent {
    background: var(--sgc-bg-main);
}
body.light-theme .btn-secondary {
    background: var(--sgc-surface-highlight);
    color: #475569;
    border-color: var(--sgc-border);
}
body.light-theme .btn-secondary:hover {
    background: var(--sgc-border);
    border-color: var(--sgc-border-active);
}
body.light-theme .btn-danger {
    background: rgba(239, 68, 68, 0.06);
    color: var(--sgc-danger);
    border-color: rgba(239, 68, 68, 0.15);
}
body.light-theme .btn-danger:hover {
    background: rgba(239, 68, 68, 0.12);
}
body.light-theme .toast {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
    color: var(--sgc-text-primary);
    box-shadow: 0 20px 50px rgba(0,0,0,0.12);
}
body.light-theme .hamburger span {
    background: var(--sgc-text-secondary);
}
body.light-theme .hamburger.active span {
    background: var(--sgc-text-primary);
}
body.light-theme #menuBtnWrap:hover {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.1);
}
body.light-theme ::-webkit-scrollbar-thumb {
    background: var(--sgc-border-active);
}
body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: var(--sgc-text-tertiary);
}

/* ===== 浅色主题 - 保护功能配置弹窗适配 ===== */
body.light-theme #configModal .modal-sheet {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
}
body.light-theme #configModal .text-textPrimary {
    color: var(--sgc-text-primary) !important;
}
body.light-theme #configModal .text-textSecondary {
    color: var(--sgc-text-secondary) !important;
}
body.light-theme #configModal .text-textTertiary {
    color: var(--sgc-text-tertiary) !important;
}
body.light-theme #configModal .bg-surface {
    background: var(--sgc-surface) !important;
}
body.light-theme #configModal .border-borderLine {
    border-color: var(--sgc-border) !important;
}
body.light-theme #configModal .bg-surfaceHighlight {
    background: var(--sgc-surface-highlight) !important;
}
body.light-theme #configModal .group-header {
    color: var(--sgc-text-primary);
}
body.light-theme #configModal .config-summary {
    background: rgba(99, 102, 241, 0.04);
    border-color: rgba(99, 102, 241, 0.1);
}
body.light-theme #configModal .config-summary .text-textSecondary {
    color: var(--sgc-text-secondary) !important;
}
body.light-theme #configModal .config-summary .text-primary {
    color: var(--sgc-primary) !important;
}

/* ===== 浅色主题 - 运行日志弹窗适配 ===== */
body.light-theme #logModal .modal-sheet {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
}
body.light-theme #logModal .bg-bgMain {
    background: var(--sgc-bg-main) !important;
}
body.light-theme #logModal .text-textPrimary {
    color: var(--sgc-text-primary) !important;
}
body.light-theme #logModal .text-textSecondary {
    color: var(--sgc-text-secondary) !important;
}
body.light-theme #logModal .text-textTertiary {
    color: var(--sgc-text-tertiary) !important;
}
body.light-theme #logModal .bg-surface {
    background: var(--sgc-surface) !important;
}
body.light-theme #logModal .border-borderLine {
    border-color: var(--sgc-border) !important;
}
body.light-theme #logModal .log-entry {
    color: #475569;
}
body.light-theme #logModal .log-system {
    color: var(--sgc-primary);
}
body.light-theme #logModal .log-progress {
    color: var(--sgc-text-secondary);
}
body.light-theme #logModal .log-success {
    color: #059669;
}
body.light-theme #logModal .log-warning {
    color: #d97706;
}
body.light-theme #logModal .log-error {
    color: #dc2626;
}
body.light-theme #logModal .progress-track {
    background: var(--sgc-border);
}

/* ===== 浅色主题 - 任务列表适配 ===== */
body.light-theme #taskPage .task-card {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
}
body.light-theme #taskPage .task-card:hover {
    border-color: var(--sgc-border-active);
}
body.light-theme #taskPage .text-textPrimary {
    color: var(--sgc-text-primary) !important;
}
body.light-theme #taskPage .text-textSecondary {
    color: var(--sgc-text-secondary) !important;
}
body.light-theme #taskPage .text-textTertiary {
    color: var(--sgc-text-tertiary) !important;
}
body.light-theme #taskPage .bg-surfaceHighlight {
    background: var(--sgc-surface-highlight) !important;
}
body.light-theme #taskPage .border-borderLine {
    border-color: var(--sgc-border) !important;
}

/* ===== 浅色主题 - 删除按钮适配 ===== */
body.light-theme .task-card button.bg-surfaceHighlight {
    background: var(--sgc-surface-highlight) !important;
    border-color: var(--sgc-border) !important;
    color: var(--sgc-text-secondary) !important;
}
body.light-theme .task-card button.bg-surfaceHighlight:hover {
    background: var(--sgc-border) !important;
}

/* ===== 浅色主题 - 确认弹窗适配 ===== */
body.light-theme #confirmModal .modal-sheet {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
}
body.light-theme #confirmModal .text-textPrimary {
    color: var(--sgc-text-primary) !important;
}
body.light-theme #confirmModal .text-textSecondary {
    color: var(--sgc-text-secondary) !important;
}
body.light-theme #confirmModal .btn-secondary {
    background: var(--sgc-surface-highlight);
    color: #475569;
    border-color: var(--sgc-border);
}
body.light-theme #confirmModal .btn-secondary:hover {
    background: var(--sgc-border);
}
/* 任务删除确认弹窗：按钮本身使用的是 Tailwind 工具类而不是 .btn-secondary/.btn-danger，单独适配浅色主题 */
body.light-theme #confirmModal button[onclick="closeConfirmModal()"] {
    background: var(--sgc-surface-highlight) !important;
    color: #475569 !important;
    border-color: var(--sgc-border) !important;
}
body.light-theme #confirmModal button[onclick="closeConfirmModal()"]:hover {
    background: var(--sgc-border) !important;
}
body.light-theme #confirmModal button[onclick="confirmAction()"] {
    background: var(--sgc-danger) !important;
    color: var(--sgc-surface) !important;
    border-color: var(--sgc-danger) !important;
}
body.light-theme #confirmModal button[onclick="confirmAction()"]:hover {
    background: #dc2626 !important;
}

/* ===== 浅色主题 - 二级配置弹窗适配 ===== */
body.light-theme #subConfigModal .modal-sheet {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
}
body.light-theme #subConfigModal .bg-surface {
    background: var(--sgc-surface) !important;
}
body.light-theme #subConfigModal .border-borderLine {
    border-color: var(--sgc-border) !important;
}
body.light-theme #subConfigModal .sub-config-body label {
    border-color: var(--sgc-border) !important;
    background: var(--sgc-surface) !important;
}
body.light-theme #subConfigModal .sub-config-body label:hover {
    border-color: rgba(99, 102, 241, 0.2) !important;
    background: var(--sgc-bg-main) !important;
}
body.light-theme #subConfigModal .sub-config-input {
    background: var(--sgc-bg-main);
    border-color: var(--sgc-border);
    color: var(--sgc-text-primary);
}
body.light-theme #subConfigModal .sub-config-input:focus {
    border-color: var(--sgc-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
body.light-theme #subConfigModal .sub-config-input::placeholder {
    color: var(--sgc-text-tertiary);
}
body.light-theme #subConfigModal .sub-config-label {
    color: var(--sgc-text-secondary);
}
body.light-theme #subConfigModal .text-textSecondary {
    color: var(--sgc-text-secondary) !important;
}
body.light-theme #subConfigModal .text-textPrimary {
    color: var(--sgc-text-primary) !important;
}

/* ===== 浅色主题 - 提示弹窗适配 ===== */
body.light-theme #tipModal .modal-sheet {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
}
body.light-theme #tipModal .text-textSecondary {
    color: var(--sgc-text-secondary) !important;
}
body.light-theme #tipModal button {
    background: var(--sgc-surface-highlight);
    color: #475569;
    border-color: var(--sgc-border);
}
body.light-theme #tipModal button:hover {
    background: var(--sgc-border);
}

/* ===== 浅色主题 - 设置页面适配 ===== */
body.light-theme #settingsPage .bg-surface {
    background: var(--sgc-surface) !important;
}
body.light-theme #settingsPage .border-borderLine {
    border-color: var(--sgc-border) !important;
}
body.light-theme #settingsPage .bg-surfaceHighlight {
    background: var(--sgc-bg-main) !important;
}
body.light-theme #settingsPage .text-textPrimary {
    color: var(--sgc-text-primary) !important;
}
body.light-theme #settingsPage .text-textSecondary {
    color: var(--sgc-text-secondary) !important;
}
body.light-theme #settingsPage .text-textTertiary {
    color: var(--sgc-text-tertiary) !important;
}
/* 浅色下 wrap 必须透明：wrap 无圆角，一旦给底色会在圆角输入框外成方形灰块外露（上下/四角）；盒子样式由 input 自身承担 */
body.light-theme #settingsPage .login-input-wrap {
    background: transparent;
    border-color: transparent;
}
body.light-theme #settingsPage .login-input-wrap:focus-within {
    box-shadow: none;
}
body.light-theme #settingsPage .login-input {
    color: var(--sgc-text-primary);
}
body.light-theme #settingsPage .login-input::placeholder {
    color: var(--sgc-text-tertiary);
}
body.light-theme #settingsPage .text-danger {
    color: var(--sgc-danger) !important;
}

/* ===== 浅色主题 - Toast 适配 ===== */
body.light-theme .toast {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
    color: var(--sgc-text-primary);
    box-shadow: 0 20px 50px rgba(0,0,0,0.12);
}

/* ===== 浅色主题 - 菜单栏适配 ===== */
body.light-theme .dropdown-menu {
    background: var(--sgc-surface);
    border-color: var(--sgc-border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.12);
}
body.light-theme .menu-item {
    color: var(--sgc-text-primary);
}
body.light-theme .menu-item:hover {
    background: rgba(99, 102, 241, 0.05);
}
body.light-theme .menu-item:active {
    background: rgba(99, 102, 241, 0.1);
}
body.light-theme .menu-divider {
    background: var(--sgc-border);
}

/* ===== 浅色主题 - 添加APK按钮适配 ===== */
body.light-theme .fab-plus {
    background: linear-gradient(135deg, var(--sgc-primary) 0%, #4f46e5 100%);
}

/* ===== 浅色主题 - 空状态适配 ===== */
body.light-theme .empty-state h3 {
    color: var(--sgc-text-primary);
}
body.light-theme .empty-state p {
    color: var(--sgc-text-secondary);
}
/* ===== 浅色主题 - APK卡片文字颜色修复 ===== */
body.light-theme .apk-card .text-textPrimary {
    color: var(--sgc-text-primary) !important;
}
body.light-theme .apk-card .text-textSecondary {
    color: var(--sgc-text-secondary) !important;
}
body.light-theme .apk-card .text-textTertiary {
    color: var(--sgc-text-tertiary) !important;
}


.glass-header {
    background: var(--sgc-glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--sgc-glass-border);
    z-index: 30;
}

/* Hamburger */
.hamburger {
    width: 18px;
    height: 14px;
    position: relative;
    cursor: pointer;
}
.hamburger span {
    position: absolute;
    left: 0;
    display: block;
    height: 2px;
    width: 100%;
    background: var(--sgc-text-secondary);
    border-radius: 1px;
    transition: all 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    transform-origin: center;
}
.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 6px; }
.hamburger span:nth-child(3) { top: 12px; }
.hamburger.active span {
    background: var(--sgc-text-primary);
}
.hamburger.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}
#menuBtnWrap {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
}
#menuBtnWrap:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.12);
}
#menuBtnWrap:active {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.2);
    transform: scale(0.95);
}


.config-summary {
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    padding: 14px;
    margin-top: 20px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--sgc-primary) 0%, var(--sgc-primary-hover) 100%);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
}
.btn-primary:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}
.btn-secondary {
    background: var(--sgc-border);
    color: #e2e8f0;
    border: 1px solid var(--sgc-border-active);
    padding: 10px 22px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-secondary:hover {
    background: var(--sgc-surface-highlight);
    border-color: var(--sgc-border-hover);
}
.btn-secondary:active { transform: scale(0.97); }
.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--sgc-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 10px 22px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.18); }
.btn-danger:active { transform: scale(0.97); }
.group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    margin-top: 24px;
    font-size: 15px;
    font-weight: 700;
    color: var(--sgc-text-primary);
    letter-spacing: 0.2px;
}
.group-header::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, var(--sgc-primary), var(--sgc-primary-hover));
    border-radius: 2px;
}
.group-header:first-of-type { margin-top: 0; }
#fileInput { display: none; }
.tip-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--sgc-primary);
    font-size: 22px;
    animation: tipPop 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes tipPop {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toast fix */
.toast {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: var(--sgc-surface-elevated);
    border: 1px solid var(--sgc-border-active);
    color: var(--sgc-text-primary);
    padding: 10px 20px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    animation: toastIn 0.35s cubic-bezier(0.32, 0.72, 0, 1) forwards;
    pointer-events: none;
    white-space: nowrap;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.toast.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
    transition: all 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}
.task-list-area {
    padding: 16px;
    padding-bottom: 40px;
    max-width: 720px;
    margin: 0 auto;
}
@media (min-width: 640px) {
    .task-list-area { padding: 24px; }
}
@media (max-width: 380px) {
    .apk-grid { grid-template-columns: 1fr; }
    .apk-card { padding: 14px; }
    .file-icon { width: 40px; height: 40px; font-size: 16px; }
}
.log-window { height: 85dvh; }
@media (min-width: 640px) {
    .log-window { height: 72dvh; }
}
.sub-config-body { padding: 20px; }
.sub-config-input {
    width: 100%;
    background: var(--sgc-surface);
    border: 1px solid var(--sgc-border-active);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--sgc-text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    margin-top: 8px;
}
.sub-config-input:focus {
    border-color: var(--sgc-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.sub-config-input::placeholder { color: #475569; }
.sub-config-label {
    font-size: 13px;
    color: var(--sgc-text-secondary);
    font-weight: 500;
}

/* 保护功能卡片：移动端紧凑布局 */
#configModal .list-item {
    min-height: 58px;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100%;
    box-sizing: border-box;
}
#configModal .list-item > div:first-child {
    display: flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    align-items: center !important;
}
#configModal .list-item > div:first-child > div:last-child {
    min-width: 0 !important;
    overflow: hidden;
}
#configModal .list-item .custom-checkbox {
    display: flex !important;
    flex: 0 0 22px !important;
    width: 22px !important;
    height: 22px !important;
    margin: 0 0 0 12px !important;
    align-self: center !important;
    position: static !important;
    top: auto !important;
}
#configModal .list-item .w-8.h-8 {
    width: 30px !important;
    height: 30px !important;
}
@media (max-width: 480px) {
    #configModal .flex-1.overflow-y-auto { padding-left: 12px !important; padding-right: 12px !important; }
    #configModal .list-item { min-height: 54px; }
}

/* v5：保护功能配置弹窗手机端紧凑适配 */
#configModal {
    padding: 10px;
}
#configModal .modal-sheet {
    width: min(94vw, 500px);
    max-height: 78vh;
    border-radius: 18px;
}
#configModal .modal-sheet > div:first-child {
    padding: 12px 14px !important;
}
#configModal .modal-sheet > div:nth-child(2) {
    padding: 12px 14px !important;
}
#configModal .modal-sheet > div:last-child {
    padding: 10px 14px !important;
}
#configModal .group-header {
    margin-top: 8px;
    margin-bottom: 6px;
}
#configModal .config-summary {
    margin: 10px 0 0 !important;
    padding: 8px 10px !important;
}
#configModal .config-summary > div:first-child {
    margin-bottom: 0;
}
#configModal .config-summary .w-full {
    margin-top: 6px !important;
}
@media (max-width: 639px) {
    #configModal { padding: 8px; }
    #configModal .modal-sheet {
        width: 96vw;
        max-height: 74vh;
        border-radius: 16px;
    }
    #configModal .list-item {
        min-height: 52px;
    }
}

/* v6：保护配置弹窗居中 + 二级配置弹窗紧凑化 */
#configModal {
    align-items: center !important;
    justify-content: center !important;
    padding: 10px !important;
}
#configModal .modal-sheet {
    width: min(92vw, 480px) !important;
    max-height: 72vh !important;
    margin: 0 auto !important;
    border-radius: 18px !important;
    transform: translateY(10px) !important;
}
#configModal.open .modal-sheet {
    transform: translateY(0) !important;
}

#subConfigModal {
    align-items: center !important;
    justify-content: center !important;
    padding: 12px !important;
}
#subConfigModal .modal-sheet {
    width: min(90vw, 360px) !important;
    max-width: 360px !important;
    max-height: 62vh !important;
    margin: 0 auto !important;
    border-radius: 18px !important;
    transform: translateY(10px) scale(.98) !important;
    padding: 0 !important;
}
#subConfigModal.open .modal-sheet {
    transform: translateY(0) scale(1) !important;
}
#subConfigModal .modal-sheet > div:first-child {
    padding: 12px 14px !important;
}
#subConfigModal .sub-config-body {
    padding: 12px 14px !important;
    overflow-y: auto;
    max-height: 44vh;
}
#subConfigModal .sub-config-body > p {
    margin-bottom: 10px !important;
    font-size: 12px !important;
    line-height: 1.55 !important;
}
#subConfigModal .sub-config-body > div {
    margin-bottom: 10px !important;
}
#subConfigModal .sub-config-body label {
    padding: 9px 10px !important;
    margin-bottom: 6px !important;
    border-radius: 10px !important;
}
#subConfigModal .sub-config-body .rounded-xl.bg-primaryGlow {
    padding: 10px !important;
    border-radius: 10px !important;
}
#subConfigModal .sub-config-body .text-xs {
    line-height: 1.5 !important;
}
#subConfigModal .modal-sheet > div:last-child {
    padding: 10px 14px !important;
}
@media (max-width: 639px) {
    #configModal .modal-sheet {
        width: 94vw !important;
        max-height: 70vh !important;
    }
    #subConfigModal .modal-sheet {
        width: 90vw !important;
        max-width: 350px !important;
        max-height: 60vh !important;
    }
    #subConfigModal .sub-config-body {
        max-height: 42vh;
    }
}

/* Mobile dialog typography and component density */
@media (max-width: 640px) {
  .modal, [role="dialog"] {
    font-size: 14px !important;
  }

  .modal h1, .modal h2, .modal h3, .modal h4,
  [role="dialog"] h1, [role="dialog"] h2, [role="dialog"] h3, [role="dialog"] h4 {
    font-size: 1.05rem !important;
    line-height: 1.35 !important;
  }

  .modal p, .modal label, .modal span,
  [role="dialog"] p, [role="dialog"] label, [role="dialog"] span {
    line-height: 1.4;
  }

  .modal button, [role="dialog"] button {
    min-height: 36px !important;
    padding: 7px 12px !important;
    font-size: 13px !important;
  }

  .modal input, .modal select, .modal textarea,
  [role="dialog"] input, [role="dialog"] select, [role="dialog"] textarea {
    min-height: 36px !important;
    font-size: 13px !important;
    padding: 7px 10px !important;
  }

  .modal .p-6, [role="dialog"] .p-6 { padding: 14px !important; }
  .modal .p-5, [role="dialog"] .p-5 { padding: 12px !important; }
  .modal .p-4, [role="dialog"] .p-4 { padding: 10px !important; }

  .modal .gap-6, [role="dialog"] .gap-6 { gap: 12px !important; }
  .modal .gap-5, [role="dialog"] .gap-5 { gap: 10px !important; }
  .modal .gap-4, [role="dialog"] .gap-4 { gap: 8px !important; }

  .modal .rounded-2xl, [role="dialog"] .rounded-2xl {
    border-radius: 14px !important;
  }
}
/* Run-log dialog: match the compact mobile density of the protection dialog */
@media (max-width: 640px) {
  #logModal,
  #runningLogModal,
  .log-modal,
  .running-log-modal {
    width: 94% !important;
    max-width: 94% !important;
    max-height: 82vh !important;
    margin: auto !important;
  }

  #logModal .modal-content,
  #runningLogModal .modal-content,
  .log-modal .modal-content,
  .running-log-modal .modal-content {
    max-height: 82vh !important;
    overflow: hidden !important;
  }

  #logModal .log-content,
  #runningLogModal .log-content,
  .log-modal .log-content,
  .running-log-modal .log-content {
    max-height: 58vh !important;
    overflow-y: auto !important;
  }

  #logModal h1, #logModal h2, #logModal h3, #logModal h4,
  #runningLogModal h1, #runningLogModal h2, #runningLogModal h3, #runningLogModal h4,
  .log-modal h1, .log-modal h2, .log-modal h3, .log-modal h4,
  .running-log-modal h1, .running-log-modal h2, .running-log-modal h3, .running-log-modal h4 {
    font-size: 1.05rem !important;
    line-height: 1.35 !important;
  }

  #logModal, #runningLogModal, .log-modal, .running-log-modal {
    font-size: 13px !important;
  }

  #logModal button, #runningLogModal button,
  .log-modal button, .running-log-modal button {
    min-height: 34px !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
  }

  #logModal .p-6, #runningLogModal .p-6,
  .log-modal .p-6, .running-log-modal .p-6 { padding: 12px !important; }

  #logModal .p-5, #runningLogModal .p-5,
  .log-modal .p-5, .running-log-modal .p-5 { padding: 10px !important; }

  #logModal .gap-6, #runningLogModal .gap-6,
  .log-modal .gap-6, .running-log-modal .gap-6 { gap: 10px !important; }

  #logModal .gap-4, #runningLogModal .gap-4,
  .log-modal .gap-4, .running-log-modal .gap-4 { gap: 7px !important; }
}
/* All dialog text: reduce font size by 20% on mobile */
@media (max-width: 640px) {
  .modal,
  [role="dialog"],
  #logModal,
  #runningLogModal,
  .log-modal,
  .running-log-modal {
    font-size: 80% !important;
  }

  .modal h1, .modal h2, .modal h3, .modal h4, .modal h5, .modal h6,
  [role="dialog"] h1, [role="dialog"] h2, [role="dialog"] h3, [role="dialog"] h4, [role="dialog"] h5, [role="dialog"] h6,
  #logModal h1, #logModal h2, #logModal h3, #logModal h4,
  #runningLogModal h1, #runningLogModal h2, #runningLogModal h3, #runningLogModal h4,
  .log-modal h1, .log-modal h2, .log-modal h3, .log-modal h4,
  .running-log-modal h1, .running-log-modal h2, .running-log-modal h3, .running-log-modal h4 {
    font-size: 80% !important;
  }

  .modal button, .modal input, .modal select, .modal textarea,
  [role="dialog"] button, [role="dialog"] input, [role="dialog"] select, [role="dialog"] textarea,
  #logModal button, #runningLogModal button,
  .log-modal button, .running-log-modal button {
    font-size: 80% !important;
  }
}
/* Running-log backdrop: full-viewport coverage on mobile */
#logModal {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  overflow: hidden !important;
}
#logModal .modal-backdrop {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  z-index: 0 !important;
  background: rgba(0,0,0,0.75) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  backdrop-filter: blur(8px) !important;
}
body.light-theme #logModal .modal-backdrop {
  background: rgba(0,0,0,0.40) !important;
}
#logModal .modal-sheet {
  position: relative !important;
  z-index: 1 !important;
}
/* Smooth dialog backdrop: avoid the abrupt clear -> blur jump */
.modal-backdrop,
#logModal .modal-backdrop,
[role="dialog"]::before {
  transition:
    opacity 180ms ease,
    backdrop-filter 180ms ease,
    -webkit-backdrop-filter 180ms ease !important;
}

/* Keep the backdrop itself responsible for blur; don't animate the dialog content. */
#logModal .modal-backdrop {
  opacity: 0;
  -webkit-backdrop-filter: blur(0) !important;
  backdrop-filter: blur(0) !important;
  transition:
    opacity 220ms ease,
    -webkit-backdrop-filter 220ms ease,
    backdrop-filter 220ms ease !important;
}

#logModal.show .modal-backdrop,
#logModal.active .modal-backdrop,
#logModal.open .modal-backdrop {
  opacity: 1;
  -webkit-backdrop-filter: blur(8px) !important;
  backdrop-filter: blur(8px) !important;
}

/* If the modal uses a generic visibility class, animate opacity while the
   backdrop-filter ramps up instead of appearing at full blur instantly. */
.modal-backdrop {
  will-change: opacity, backdrop-filter;
}
/* Center the running-log dialog precisely in the mobile viewport */
@media (max-width: 640px) {
  #logModal {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px !important;
    box-sizing: border-box !important;
  }

  #logModal .modal-sheet,
  #logModal > .modal-sheet,
  #logModal .modal-content {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin: 0 auto !important;
    max-height: 82dvh !important;
  }
}
/* Instant backdrop activation on the trigger click, followed by a very short settle. */
html.modal-opening::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: rgba(0,0,0,0.18);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 1;
}

html.modal-opening {
  overflow: hidden;
}

.modal-backdrop,
#logModal .modal-backdrop {
  transition:
    opacity 120ms ease-out,
    -webkit-backdrop-filter 120ms ease-out,
    backdrop-filter 120ms ease-out !important;
}
/* Disable background blur for every modal/dialog. Keep only a simple overlay. */
.modal-backdrop,
#logModal .modal-backdrop,
[role="dialog"]::before,
html.modal-opening::before {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  filter: none !important;
  transition: opacity 120ms ease-out !important;
}

/* Remove the temporary instant-blur opening layer completely. */
html.modal-opening::before {
  background: transparent !important;
  opacity: 0 !important;
}
/* Running-log panel: keep rounded corners on all four sides. */
@media (max-width: 640px) {
  #logModal .modal-sheet,
  #logModal > .modal-sheet,
  #logModal .modal-content {
    border-radius: 16px !important;
    overflow: hidden !important;
    clip-path: inset(0 round 16px) !important;
  }

  #logModal .modal-sheet::before,
  #logModal .modal-content::before {
    border-radius: inherit !important;
  }
}