rtc_prd/fix_css.py
2026-02-04 15:33:02 +08:00

199 lines
6.9 KiB
Python

import os
css_path = r"d:\Airhub\styles.css"
try:
with open(css_path, "rb") as f:
content_bytes = f.read()
content = content_bytes.decode("utf-8", errors="ignore")
# Cutoff at .custom-toast.active
idx = content.find(".custom-toast.active")
if idx == -1:
print("Could not find anchor point.")
exit(1)
cutoff_idx = content.find("}", idx)
if cutoff_idx == -1: cutoff_idx = idx + 100
else: cutoff_idx += 1
clean_content = content[:cutoff_idx]
new_css = """
/* --- Settings Page (V5 - Modals & Fixes) --- */
.settings-view {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
/* Warm Capybara Theme Background */
background: linear-gradient(135deg, #FEF5EC 0%, #FDF2F8 100%);
z-index: 2000;
display: flex; flex-direction: column;
animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
overflow: hidden;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
/* Header - Transparent & Gradient Mask Logic */
.settings-header {
background: transparent !important;
backdrop-filter: none !important;
-webkit-backdrop-filter: none !important;
border-bottom: none !important;
height: 44px !important;
padding-top: max(32px, env(safe-area-inset-top, 20px)) !important;
position: absolute !important;
top: 0; left: 0; right: 0;
z-index: 9999;
display: flex !important;
align-items: center !important;
justify-content: space-between !important;
padding-left: 16px !important;
padding-right: 16px !important;
}
.settings-title {
font-size: 16px !important;
font-weight: 600 !important;
color: #1F2937 !important;
}
/* Content Area - Gradient Fading Mask */
.settings-content {
flex: 1;
overflow-y: auto;
padding-top: calc(max(32px, env(safe-area-inset-top, 20px)) + 50px) !important;
padding-left: 20px; padding-right: 20px; padding-bottom: 100px;
background: transparent;
scrollbar-width: none;
-webkit-mask-image: linear-gradient(to bottom, transparent 0px, transparent 60px, black 90px, black 100%);
mask-image: linear-gradient(to bottom, transparent 0px, transparent 60px, black 90px, black 100%);
}
.settings-content::-webkit-scrollbar { display: none; }
/* Settings Group */
.settings-group-title {
font-size: 12px; color: #8B5E3C;
margin-bottom: 8px; margin-left: 16px; margin-top: 24px;
font-weight: 500;
}
.settings-group {
background: rgba(255, 255, 255, 0.8);
border-radius: 20px;
margin-bottom: 20px;
box-shadow: 0 4px 16px rgba(139, 94, 60, 0.04);
overflow: hidden;
}
.settings-item {
display: flex; align-items: center; justify-content: space-between;
padding: 12px 16px; min-height: 48px;
background: transparent;
border-bottom: 1px solid rgba(0,0,0,0.05);
}
.settings-item:last-child { border-bottom: none; }
.settings-item.clickable { cursor: pointer; }
.settings-item.clickable:active { background: rgba(255,255,255,0.5); }
/* Typography */
.item-label { font-size: 15px; color: #4B5563; font-weight: 400; }
.item-value { font-size: 14px; color: #9CA3AF; display: flex; align-items: center; gap: 6px; }
.arrow { font-size: 18px; color: #D1D5DB; }
.item-text-col { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.item-desc { font-size: 11px; color: #9CA3AF; line-height: 1.3; }
.settings-item.warning .item-label { color: #EF4444; }
/* Toggle */
.toggle-switch {
width: 50px; height: 30px;
background: #E5E7EB; border-radius: 15px;
position: relative; cursor: pointer; transition: background 0.3s;
}
.toggle-switch.active { background: #FFB088; }
.toggle-knob {
width: 26px; height: 26px; background: white; border-radius: 50%;
position: absolute; top: 2px; left: 2px;
transition: transform 0.3s; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.toggle-switch.active .toggle-knob { transform: translateX(20px); }
/* Volume Slider */
.settings-item.column { flex-direction: column; align-items: stretch; gap: 12px; padding-bottom: 16px; }
.volume-row { display: flex; align-items: center; width: 100%; height: 32px; }
.volume-slider {
flex: 1; -webkit-appearance: none; appearance: none;
height: 24px; margin: 0 8px; background: transparent; cursor: grab;
width: 100%;
}
.volume-slider::-webkit-slider-runnable-track { width: 100%; height: 4px; background: #E5E5EA; border-radius: 2px; }
.volume-slider::-webkit-slider-thumb {
-webkit-appearance: none; height: 24px; width: 24px;
background: white; border-radius: 50%; box-shadow: 0 2px 6px rgba(139,94,60,0.2);
margin-top: -10px; /* (4-24)/2 = -10 */
}
.vol-icon { font-size: 16px; color: #9CA3AF; width: 24px; text-align: center; }
/* --- MODALS (FIXED Z-INDEX) --- */
.modal-overlay {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(4px);
z-index: 2200 !important; /* Must be > settings-view (2000) */
display: none;
justify-content: center; align-items: center;
animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.glass-modal {
background: rgba(255, 255, 255, 0.95);
border-radius: 20px; padding: 24px;
width: 80%; max-width: 320px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
text-align: center;
transform: scale(1);
animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: #1F2937; }
.modal-desc { font-size: 14px; color: #6B7280; margin-bottom: 24px; line-height: 1.5; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.modal-btn {
flex: 1; padding: 12px 0; border-radius: 12px; border: none; font-size: 16px; font-weight: 500; cursor: pointer;
}
.modal-btn.cancel { background: #F3F4F6; color: #6B7280; }
.modal-btn.confirm { background: linear-gradient(135deg, #FFB088 0%, #FF8E53 100%); color: white; }
.modal-btn.danger { background: #EF4444; color: white; }
.modal-btn.secondary { background: #F3F4F6; color: #4B5563; }
.modal-input {
width: 100%; padding: 12px; margin-bottom: 20px; box-sizing: border-box;
border: 1px solid #E5E7EB; border-radius: 12px;
font-size: 16px; background: #F9FAFB; outline: none;
}
.modal-input:focus { border-color: #FFB088; background: white; }
/* Unbind Styles */
.unbind-header { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; }
.warn-icon svg { width: 24px; color: #EF4444; }
.unbind-title { font-size: 18px; font-weight: 600; color: #1F2937; }
.highlight-text { color: #EF4444; font-weight: 600; }
"""
final_content = clean_content + "\n" + new_css
with open(css_path, "w", encoding="utf-8") as f:
f.write(final_content)
print("Success: CSS Repaired with Modals")
except Exception as e:
print(f"Error: {e}")