.settings-btn {
    position: fixed;
    top: 1.2em;
    left: 1.6em;
    right: auto;
    z-index: 20;
    background: rgba(255,255,255,0.18);
    border: none;
    border-radius: 50%;
    width: 2.5em;
    height: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    cursor: pointer;
    transition: background 0.2s;
}
.settings-btn:hover {
    background: rgba(255,255,255,0.32);
}
.settings-btn img {
    width: 1.4em;
    height: 1.4em;
}
.settings-panel {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.98);
    min-width: 320px;
    max-width: 90vw;
    min-height: 180px;
    max-height: 90vh;
    background: rgba(255,255,255,0.55);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border-radius: 1.5em;
    padding: 1.2em 1.5em 1em 1.5em;
    z-index: 1001;
    backdrop-filter: blur(30px) saturate(1.5);
    -webkit-backdrop-filter: blur(30px) saturate(1.5);
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(.4,2,.6,1), transform 0.35s cubic-bezier(.4,2,.6,1);
}
.settings-panel.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}
.settings-panel.hide {
    display: block;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.98);
    transition: opacity 0.35s cubic-bezier(.4,2,.6,1), transform 0.35s cubic-bezier(.4,2,.6,1);
}
.settings-panel::-webkit-scrollbar {
    width: 10px;
    background: transparent;
}
.settings-panel::-webkit-scrollbar-thumb {
    background: rgba(180, 200, 255, 0.22);
    border-radius: 8px;
    backdrop-filter: blur(8px) saturate(1.2);
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
    border: 1.5px solid rgba(255,255,255,0.32);
    transition: background 0.3s;
}
.settings-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(80, 120, 255, 0.32);
}
.settings-panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(180,200,255,0.22) transparent;
}
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 1em;
}
.settings-content label {
    font-weight: 500;
    margin-right: 0.5em;
}
#settings-bg-mask {
    display: none;
    position: fixed;
    left: 0; top: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.18);
    z-index: 1000;
}
#settings-bg-mask.open {
    display: block;
}
.lang-toggle {
    background: var(--theme-color, #0099ff);
    color: #fff;
    border: none;
    border-radius: 0.7em;
    padding: 0.3em 1.2em;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}
.lang-toggle:hover {
    background: #005fa3;
}
.mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.5em;
}
.mode-toggle-top {
    background: rgba(255,255,255,0.18);
    border-radius: 1.2em;
    padding: 0.2em 0.8em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 18px;
    margin: 0 0.3em;
    vertical-align: middle;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    border-radius: 18px;
    transition: .4s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}
input:checked + .slider {
    background-color: var(--theme-color, #0099ff);
}
input:checked + .slider:before {
    transform: translateX(18px);
}


body.settings-open .container,
body.settings-open .footer {
    display: none !important;
}
body.settings-open #settings-panel,
body.settings-open #settings-bg-mask {
    filter: none;
    pointer-events: auto;
    user-select: auto;
}

body.night .settings-panel {
    background: rgba(30,30,40,0.92) !important;
    color: #fff !important;
}
body.night .settings-panel * {
    color: #fff !important;
}
body.night .settings-panel input,
body.night .settings-panel select,
body.night .settings-panel button {
    background: rgba(60,60,80,0.95) !important;
    color: #fff !important;
    border-color: #444 !important;
}

.lang-select-custom {
    position: relative;
    width: 18em;
    user-select: none;
    font-size: 1em;
}
.lang-current {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: rgba(255,255,255,0.85);
    border-radius: 0.7em;
    padding: 0.3em 1.2em;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: border 0.2s, box-shadow 0.2s;
}
.lang-current:hover, .lang-select-custom.open .lang-current {
    border: 1.5px solid var(--theme-color, #0099ff);
    box-shadow: 0 4px 16px rgba(0,153,255,0.08);
}
.lang-flag {
    width: 1.8em;
    height: 1.2em;
    border-radius: 0.6em;
    object-fit: cover;
}
.lang-arrow {
    margin-left: auto;
    font-size: 1.1em;
    transition: transform 0.25s;
}
.lang-select-custom.open .lang-arrow {
    transform: rotate(180deg);
}
.lang-list {
    position: absolute;
    left: 0; right: 0; top: 110%;
    background: rgba(255,255,255,0.98);
    border-radius: 0.7em;
    box-shadow: 0 8px 32px rgba(0,0,0,0.13);
    z-index: 100;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.35s cubic-bezier(.4,2,.6,1), opacity 0.25s;
    min-width: 18em;
}
.lang-select-custom.open .lang-list {
    max-height: 600px;
    opacity: 1;
    pointer-events: auto;
    transition: max-height 0.35s cubic-bezier(.4,2,.6,1), opacity 0.25s;
}
.lang-item {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 1.2em;
    cursor: pointer;
    font-size: 1em;
    border-radius: 0.5em;
    transition: background 0.18s;
}
.lang-item.selected {
    background: var(--theme-color, #0099ff);
    color: #fff;
}
.lang-item:hover {
    background: #f0f7ff;
}
body.night .lang-current,
body.night .lang-list {
    background: rgba(30,30,40,0.98);
    color: #fff;
    border: 1px solid #444;
}
body.night .lang-item:hover {
    background: #222;
}
body.night .lang-item.selected {
    background: var(--theme-color, #0099ff);
    color: #fff;
}
body[lang="ar"] .settings-panel,
body[lang="ar"] .settings-panel * {
    direction: rtl !important;
    text-align: right !important;
}
.settings-content > div {
    display: flex;
    align-items: center;
    gap: 1em;
    min-height: 2.4em;
}

.wallpaper-select-custom {
    position: relative;
    width: 18em;
    user-select: none;
    font-size: 1em;
    margin-top: 0.2em;
}
.wallpaper-current {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: rgba(255,255,255,0.85);
    border-radius: 0.7em;
    padding: 0.3em 1.2em;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: border 0.2s, box-shadow 0.2s;
}
.wallpaper-current:hover, .wallpaper-select-custom.open .wallpaper-current {
    border: 1.5px solid var(--theme-color, #0099ff);
    box-shadow: 0 4px 16px rgba(0,153,255,0.08);
}
.wallpaper-arrow {
    margin-left: auto;
    font-size: 1.1em;
    transition: transform 0.25s;
}
.wallpaper-select-custom.open .wallpaper-arrow {
    transform: rotate(180deg);
}
.wallpaper-list {
    position: absolute;
    left: 0; right: 0; top: 110%;
    background: rgba(255,255,255,0.98);
    border-radius: 0.7em;
    box-shadow: 0 8px 32px rgba(0,0,0,0.13);
    z-index: 100;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.35s cubic-bezier(.4,2,.6,1), opacity 0.25s;
    min-width: 18em;
}
.wallpaper-select-custom.open .wallpaper-list {
    max-height: 400px;
    opacity: 1;
    pointer-events: auto;
    transition: max-height 0.35s cubic-bezier(.4,2,.6,1), opacity 0.25s;
}
.wallpaper-item {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 1.2em;
    cursor: pointer;
    font-size: 1em;
    border-radius: 0.5em;
    transition: background 0.18s;
}
.wallpaper-item.selected {
    background: var(--theme-color, #0099ff);
    color: #fff;
}
.wallpaper-item:hover {
    background: #f0f7ff;
}
body.night .wallpaper-current,
body.night .wallpaper-list {
    background: rgba(30,30,40,0.98);
    color: #fff;
    border: 1px solid #444;
}
body.night .wallpaper-item:hover {
    background: #222;
}
body.night .wallpaper-item.selected {
    background: var(--theme-color, #0099ff);
    color: #fff;
}

.clockfont-select-custom {
    position: relative;
    width: 18em;
    user-select: none;
    font-size: 1em;
    margin-top: 0.2em;
}
.clockfont-current {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: rgba(255,255,255,0.85);
    border-radius: 0.7em;
    padding: 0.3em 1.2em;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: border 0.2s, box-shadow 0.2s;
}
.clockfont-current:hover, .clockfont-select-custom.open .clockfont-current {
    border: 1.5px solid var(--theme-color, #0099ff);
    box-shadow: 0 4px 16px rgba(0,153,255,0.08);
}
.clockfont-arrow {
    margin-left: auto;
    font-size: 1.1em;
    transition: transform 0.25s;
}
.clockfont-select-custom.open .clockfont-arrow {
    transform: rotate(180deg);
}
.clockfont-list {
    position: absolute;
    left: 0; right: 0; top: 110%;
    background: rgba(255,255,255,0.98);
    border-radius: 0.7em;
    box-shadow: 0 8px 32px rgba(0,0,0,0.13);
    z-index: 100;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.35s cubic-bezier(.4,2,.6,1), opacity 0.25s;
    min-width: 18em;
}
.clockfont-select-custom.open .clockfont-list {
    max-height: 400px;
    opacity: 1;
    pointer-events: auto;
    transition: max-height 0.35s cubic-bezier(.4,2,.6,1), opacity 0.25s;
}
.clockfont-item {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 1.2em;
    cursor: pointer;
    font-size: 1em;
    border-radius: 0.5em;
    transition: background 0.18s;
}
.clockfont-item.selected {
    background: var(--theme-color, #0099ff);
    color: #fff;
}
.clockfont-item:hover {
    background: #f0f7ff;
}
body.night .clockfont-current,
body.night .clockfont-list {
    background: rgba(30,30,40,0.98);
    color: #fff;
    border: 1px solid #444;
}
body.night .clockfont-item:hover {
    background: #222;
}
body.night .clockfont-item.selected {
    background: var(--theme-color, #0099ff);
    color: #fff;
}
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}
#about-text {
    margin-top: 2.5em;
    margin-bottom: 0.2em;
    text-align: center;
}
.custom-confirm-mask {
    position: fixed;
    left: 0; top: 0; right: 0; bottom: 0;
    background: rgba(30,40,60,0.18);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px) saturate(1.2);
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
    animation: fadeIn 0.2s;
}
.custom-confirm-dialog {
    background: rgba(255,255,255,0.65);
    border-radius: 1.2em;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    padding: 2em 2.2em 1.5em 2.2em;
    min-width: 260px;
    max-width: 90vw;
    text-align: center;
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    animation: popIn 0.22s;
}
.custom-confirm-message {
    font-size: 1.1em;
    margin-bottom: 1.5em;
    color: #222;
}
.custom-confirm-actions {
    display: flex;
    gap: 1.5em;
    justify-content: center;
}
.custom-confirm-actions button {
    min-width: 4.5em;
    padding: 0.5em 1.2em;
    border-radius: 0.7em;
    border: none;
    font-size: 1em;
    background: var(--theme-color, #0099ff);
    color: #fff;
    cursor: pointer;
} 
.settings-close-apple {
    width: 1.6em;
    height: 1.6em;
    border-radius: 50%;
    background: radial-gradient(circle at 60% 40%, #ff5f57 70%, #e0483e 100%);
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
    margin-left: 1em;
    cursor: pointer;
    transition: box-shadow 0.18s, background 0.18s;
    position: relative;
    display: inline-block;
}
.settings-close-apple:after {
    content: '';
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.7em;
    height: 0.12em;
    background: #fff8;
    border-radius: 0.12em;
    transform: translate(-50%,-50%) rotate(45deg);
    box-shadow: 0 0 0.1em #fff8;
}
.settings-close-apple:before {
    content: '';
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.7em;
    height: 0.12em;
    background: #fff8;
    border-radius: 0.12em;
    transform: translate(-50%,-50%) rotate(-45deg);
    box-shadow: 0 0 0.1em #fff8;
}
@media (max-width: 700px) {
  .settings-panel {
    min-width: 90vw;
    max-width: 98vw;
    min-height: 60vh;
    max-height: 96vh;
    padding: 0.7em 0.5em 0.5em 0.5em;
    border-radius: 1.1em;
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
    transition: none !important;
  }
  .settings-header {
    font-size: 1.05em;
    margin-bottom: 0.7em;
  }
} 
.mode-select-custom {
    position: relative;
    width: 18em;
    user-select: none;
    font-size: 1em;
}
.mode-current {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: rgba(255,255,255,0.85);
    border-radius: 0.7em;
    padding: 0.3em 1.2em;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: border 0.2s, box-shadow 0.2s;
}
.mode-current:hover, .mode-select-custom.open .mode-current {
    border: 1.5px solid var(--theme-color, #0099ff);
    box-shadow: 0 4px 16px rgba(0,153,255,0.08);
}
.mode-flag {
    width: 1.6em;
    height: 1.6em;
    border-radius: 0.4em;
    object-fit: contain;
}
.mode-arrow {
    margin-left: auto;
    font-size: 1.1em;
    color: #222;
    transition: transform 0.2s, color 0.2s;
}
body.night .mode-arrow {
    color: #fff;
}
.mode-select-custom.open .mode-arrow {
    transform: rotate(180deg);
}
.mode-list {
    display: block;
    position: absolute;
    left: 0; right: 0; top: 110%;
    background: rgba(255,255,255,0.98);
    border-radius: 0.7em;
    box-shadow: 0 4px 24px rgba(0,153,255,0.10);
    z-index: 10;
    padding: 0.2em 0;
    border: 1.5px solid #eee;
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    overflow-y: auto;
    pointer-events: none;
    transition: max-height 0.35s cubic-bezier(.4,2,.6,1), opacity 0.25s, transform 0.25s;
}
.mode-select-custom.open .mode-list {
    max-height: 16em;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.mode-item {
    display: flex;
    align-items: center;
    gap: 0.7em;
    padding: 0.5em 1.2em;
    cursor: pointer;
    font-size: 1em;
    color: #222;
    border-radius: 0.5em;
    transition: background 0.18s, color 0.18s;
}
.mode-item.selected {
    background: var(--theme-color, #0099ff);
    color: #fff;
}
body.night .mode-item.selected {
    background: var(--theme-color, #0099ff);
    color: #fff;
}
.mode-item:hover {
    background: #f2f8ff;
}
body.night .mode-item:hover {
    background: #1a2233 !important;
}
body.night .mode-current,
body.night .mode-list {
    background: rgba(30,30,40,0.98) !important;
    color: #fff !important;
    border: 1px solid #444 !important;
}
body.night .mode-item {
    color: #fff !important;
}
body.night .mode-item.selected {
    background: var(--theme-color, #0099ff) !important;
    color: #fff !important;
}
body.night .mode-item:hover {
    background: #223355 !important;
} 