/* ==========================================================================
   長榮世界時鐘 - 全域樣式與變數定義
   ========================================================================== */
:root {
    --bg-color: #0b0c10;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    
    /* 霓虹配色預設值 */
    --cyan: #00f2fe;
    --blue: #4facfe;
    --primary-glow: rgba(0, 242, 254, 0.15);
    --cyan-glow: rgba(0, 242, 254, 0.02);
    --blue-glow: rgba(79, 172, 254, 0.08);
    
    --green: #00ff87;
    --yellow: #f9d423;
    --red: #ff4e50;
    --text-main: #f0f3f8;
    --text-muted: #8a99ad;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-clock: 'Orbitron', monospace;

    /* 指針時鐘尺寸與刻度變數 */
    --dial-size: 150px;
    --dial-radius: 75px;
    --dial-mark-offset: -63px;
    --hour-hand-height: 35px;
    --minute-hand-height: 52px;
    --second-hand-height: 60px;
    
    /* 指針與中心點粗細變數 (預設) */
    --hour-hand-width: 4px;
    --minute-hand-width: 3px;
    --second-hand-width: 1.5px;
    --center-nut-size: 10px;

    /* 國家與國旗大小設定（預設值，在大螢幕下生效） */
    --digital-flag-size: 42px;
    --digital-font-size: 1.6rem;
    --digital-offset-size: 0.85rem;
    --analog-flag-size: 34px;
    --analog-font-size: 1.4rem;
    --analog-offset-size: 0.85rem;

    /* 更多可自訂的大小設定（新） */
    --digital-time-size: clamp(3.0rem, 5.5vh, 4.5rem);
    --digital-date-size: clamp(1.15rem, 2vh, 1.5rem);
    --analog-dial-size: clamp(180px, 26vh, 300px);
    --analog-date-size: clamp(1.15rem, 2vh, 1.5rem);
}

/* 國旗隱藏 */
body.hide-flags .flag {
    display: none !important;
}

/* 滑鼠靜止隱藏 (包含 html 元素，並使用 1x1 透明 SVG 自訂游標強制 Firefox Linux 重新繪製游標) */
html.hide-cursor, html.hide-cursor *,
body.hide-cursor, body.hide-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'), none !important;
}

/* 游標隱藏時，將所有子代元素的指針事件關閉，從而取消所有的 :hover 狀態 */
body.hide-cursor * {
    pointer-events: none !important;
}

/* 透過全螢幕透明偽元素強迫瀏覽器重新評估與隱藏游標 */
body.hide-cursor::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    pointer-events: auto !important;
    background: transparent;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'), none !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    position: relative;
    padding: 2rem 1rem;
}

/* 背景科技發光感 */
.background-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

/* 動態背景核心發光球體樣式 */
.background-glow::before,
.background-glow::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.7;        /* 適度透明度，避免過亮重疊產生閃爍 */
    will-change: transform; /* 強制 GPU 合成層，防止軟體渲染重繪閃爍 */
    transition: background 1.5s ease-in-out, opacity 1.5s ease-in-out; /* 切換模式時平滑過渡；不對 filter 做 transition 避免重算 */
}

/* 預設與 1. 極光幻影 (Aurora Glow) - 橫向擺動長條光帶 */
body:not([class*="bg-effect-"]) .background-glow::before,
body.bg-effect-aurora .background-glow::before {
    top: -10%;
    left: -10%;
    width: 95vw;
    height: 45vh;
    border-radius: 40% 60% 50% 50% / 40% 50% 60% 50%;
    background: radial-gradient(ellipse at center, var(--bg-glow-1) 0%, rgba(0, 242, 254, 0.08) 50%, transparent 80%);
    animation: auroraWave1 12s infinite alternate ease-in-out;
}
body:not([class*="bg-effect-"]) .background-glow::after,
body.bg-effect-aurora .background-glow::after {
    bottom: 15%;
    right: -10%;
    width: 90vw;
    height: 40vh;
    border-radius: 50% 50% 40% 60% / 50% 40% 50% 60%;
    background: radial-gradient(ellipse at center, var(--bg-glow-2) 0%, rgba(79, 172, 254, 0.08) 50%, transparent 80%);
    animation: auroraWave2 14s infinite alternate ease-in-out;
}

/* 2. 深海流光 (Deep Sea) - 底部沉浸、極慢速垂直潮汐 */
body.bg-effect-deepsea .background-glow::before {
    top: auto;
    bottom: -25vh;
    left: -10vw;
    width: 120vw;
    height: 55vh;
    border-radius: 50% 50% 0 0;
    background: radial-gradient(ellipse at center, var(--bg-glow-1) 0%, rgba(0, 119, 182, 0.08) 60%, transparent 80%);
    animation: deepSeaTide1 22s infinite alternate ease-in-out;
}
body.bg-effect-deepsea .background-glow::after {
    top: auto;
    bottom: -35vh;
    right: -10vw;
    width: 130vw;
    height: 60vh;
    border-radius: 50% 50% 0 0;
    background: radial-gradient(ellipse at center, var(--bg-glow-2) 0%, rgba(3, 4, 94, 0.06) 60%, transparent 80%);
    animation: deepSeaTide2 26s infinite alternate ease-in-out;
}

/* 3. 星雲飛渡 (Cosmic Nebula) - 多中心自轉自轉漩渦 */
body.bg-effect-nebula .background-glow::before {
    top: -20vh;
    left: -20vw;
    width: 90vw;
    height: 90vw;
    border-radius: 50%;
    background: 
        radial-gradient(circle at 35% 35%, var(--bg-glow-1) 0%, rgba(0, 242, 254, 0.08) 40%, transparent 70%),
        radial-gradient(circle at 65% 65%, var(--bg-glow-2) 0%, rgba(79, 172, 254, 0.06) 40%, transparent 70%);
    animation: nebulaSpin1 10s infinite linear;
}
body.bg-effect-nebula .background-glow::after {
    bottom: -25vh;
    right: -25vw;
    width: 100vw;
    height: 100vw;
    border-radius: 50%;
    background: 
        radial-gradient(circle at 40% 60%, var(--bg-glow-2) 0%, rgba(79, 172, 254, 0.08) 40%, transparent 70%),
        radial-gradient(circle at 60% 40%, var(--bg-glow-1) 0%, rgba(0, 242, 254, 0.06) 40%, transparent 70%);
    animation: nebulaSpin2 12s infinite linear;
}

/* 4. 關閉動態效果 (Solid Black) - 維持全黑背景 */
body.bg-effect-off .background-glow::before,
body.bg-effect-off .background-glow::after {
    opacity: 0 !important;
    display: none !important;
}
body.bg-effect-off {
    background: #000000 !important;
}

/* 極光：橫向擺動與微幅非對稱拉伸 (X軸平移為主) */
@keyframes auroraWave1 {
    0% {
        transform: translate(0, 0) scale(1) rotate(-2deg);
    }
    50% {
        transform: translate(12vw, 2vh) scale(1.08) rotate(1deg);
    }
    100% {
        transform: translate(-8vw, -2vh) scale(0.95) rotate(-4deg);
    }
}

@keyframes auroraWave2 {
    0% {
        transform: translate(0, 0) scale(1) rotate(3deg);
    }
    50% {
        transform: translate(-10vw, -3vh) scale(1.05) rotate(0deg);
    }
    100% {
        transform: translate(12vw, 2vh) scale(0.92) rotate(5deg);
    }
}

/* 深海：極慢速垂直潮汐起伏與呼吸 (僅在 Y 軸和 scaleY 做慢速呼吸，幾乎無左右位移) */
@keyframes deepSeaTide1 {
    0% {
        transform: translateY(0) scaleY(1);
    }
    50% {
        transform: translateY(-6vh) scaleY(1.12);
    }
    100% {
        transform: translateY(2vh) scaleY(0.92);
    }
}

@keyframes deepSeaTide2 {
    0% {
        transform: translateY(0) scaleY(1.05);
    }
    50% {
        transform: translateY(-8vh) scaleY(0.9);
    }
    100% {
        transform: translateY(3vh) scaleY(1.15);
    }
}

/* 星雲：360度持續自轉，配合中速的大小脈動 */
@keyframes nebulaSpin1 {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.15);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes nebulaSpin2 {
    0% {
        transform: rotate(360deg) scale(1.08);
    }
    50% {
        transform: rotate(180deg) scale(0.92);
    }
    100% {
        transform: rotate(0deg) scale(1.08);
    }
}

.container {
    width: 94%;
    max-width: 1450px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ==========================================================================
   Header 樣式
   ========================================================================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-icon {
    font-size: 2rem;
    animation: pulse 2s infinite ease-in-out;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ffffff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    flex-direction: column;
}

header h1 span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-top: 0.2rem;
}

/* 切換開關容器 (Toggle Switch Container) */
.switch-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.switch-container:hover {
    border-color: rgba(0, 242, 254, 0.25);
    background: rgba(255, 255, 255, 0.04);
}

.switch-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
    transition: color 0.3s, text-shadow 0.3s;
}

/* 使用 :has 監聽 input 勾選狀態，動態亮起指示文字 */
.switch-container:has(#clock-mode-toggle:checked) .switch-label:last-of-type {
    color: var(--cyan);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.6);
}

.switch-container:not(:has(#clock-mode-toggle:checked)) .switch-label:first-of-type {
    color: var(--cyan);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.6);
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--card-border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-main);
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

input:checked + .slider {
    background-color: rgba(0, 242, 254, 0.2);
    border-color: var(--cyan);
}

input:checked + .slider:before {
    transform: translateX(30px);
    background-color: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
}

/* ==========================================================================
   主要佈局與 2x3 時鐘 Grid 排版
   ========================================================================== */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

.clock-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.clock-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    min-height: 220px;
}

.clock-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 242, 254, 0.25);
    box-shadow: 0 12px 40px 0 rgba(0, 242, 254, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.8rem;
}

.city-info {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 70%;
}

.select-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.flag {
    width: 28px;
    aspect-ratio: 3 / 2; /* 強制固定寬高比例為 3:2，保證國旗大小完全一致 */
    object-fit: cover;   /* 強制覆蓋，避免比例不同導致的高度不一致 */
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    display: inline-block;
}

.flag, .city-name {
    pointer-events: none;
}

.city-name {
    position: relative;
    z-index: 1;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.city-name span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* 底部滑入細線提示 */
.city-name::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 1.5px;
    background: var(--cyan);
    box-shadow: 0 0 5px var(--cyan);
    transition: width 0.3s ease, left 0.3s ease;
}

.city-info:hover .city-name::after {
    width: 100%;
    left: 0;
}

.city-info:hover .city-name {
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

/* 完全透明且絕對定位覆蓋的下拉選單 */
.city-select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    box-sizing: border-box;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    border: none;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.city-select option {
    background: #14161d;
    color: var(--text-main);
}

.timezone-offset {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cyan);
    background: var(--primary-glow);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--cyan) 20%, transparent);
    transition: color 0.3s, background 0.3s, border-color 0.3s;
}

.clock-body {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
}

/* ==========================================================================
   數位時鐘樣式
   ========================================================================== */
.digital-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    animation: fadeIn 0.4s ease-in-out;
}

.digital-display .time {
    font-family: var(--font-clock);
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-main);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.08em; /* 統一所有數字與冒號之間的間距，保證視覺均勻 */
    font-variant-numeric: tabular-nums; /* 強制所有數字等寬渲染，根除跳動與重心偏移 */
}

.digital-display .time-digit {
    display: inline-block;
    width: 0.72em; /* 使用固定寬度，徹底消除每秒更新時間時的字元寬度抖動 */
    text-align: center;
    flex-shrink: 0;
}

.digital-display .time-colon {
    display: inline-block;
    width: 0.35em; /* 使用固定寬度 */
    text-align: center;
    flex-shrink: 0;
    margin: 0;
}

.digital-display .date,
.analog-date .date {
    font-size: 1.15rem;
    color: var(--text-muted);
    font-weight: 400;
    text-align: center;
}

.digital-display .date-en,
.analog-date .date-en {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.85;
    text-align: center;
    margin-top: 0.15rem;
}

/* ==========================================================================
   指針時鐘樣式
   ========================================================================== */
.analog-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    animation: fadeIn 0.4s ease-in-out;
}

.analog-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    width: 100%;
}

.analog-display {
    width: var(--dial-size);
    height: var(--dial-size);
    display: flex;
    justify-content: center;
    align-items: center;
}

.clock-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.01) 60%, rgba(255, 255, 255, 0.03) 100%);
    border: 3px solid rgba(255, 255, 255, 0.1);
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 255, 255, 0.05);
}

.hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    border-radius: 4px;
    z-index: 2;
}

.hour-hand {
    width: var(--hour-hand-width);
    height: var(--hour-hand-height);
    background: var(--text-main);
    margin-left: calc(var(--hour-hand-width) / -2);
}

.minute-hand {
    width: var(--minute-hand-width);
    height: var(--minute-hand-height);
    background: var(--blue);
    margin-left: calc(var(--minute-hand-width) / -2);
    box-shadow: 0 0 8px rgba(79, 172, 254, 0.5);
}

.second-hand {
    width: var(--second-hand-width);
    height: var(--second-hand-height);
    background: var(--cyan);
    margin-left: calc(var(--second-hand-width) / -2);
    z-index: 3;
    box-shadow: 0 0 10px var(--cyan);
}

.center-nut {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--center-nut-size);
    height: var(--center-nut-size);
    background: var(--cyan);
    border: 2px solid var(--text-main);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    box-shadow: 0 0 8px var(--cyan);
}

/* 鐘面刻度 */
.dial-marks {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.mark {
    position: absolute;
    width: 2px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    left: 50%;
    top: 50%; /* 從中心點出發 */
    margin-left: -1px;
    margin-top: -3px; /* 高度的一半，使其精確居中 */
    transform: rotate(var(--angle)) translateY(var(--dial-mark-offset));
    transform-origin: center center; /* 繞中心旋轉 */
}

.mark.hour-mark {
    height: 10px;
    width: 2px;
    margin-top: -5px; /* 小時標記高度一半 */
    background: var(--text-muted);
}

/* ==========================================================================
   倒數計時器樣式
   ========================================================================== */
.countdown-section {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    
    /* 平滑收合與淡出動畫 */
    transition: opacity 0.4s ease, transform 0.4s ease, max-height 0.4s ease, padding 0.4s ease, margin-top 0.4s ease, border-color 0.4s ease;
    max-height: 600px;
    overflow: hidden;
}

.countdown-section.hide-countdown {
    opacity: 0;
    transform: translateY(20px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: -2rem; /* 抵消 container 的 gap */
    border-color: transparent;
    pointer-events: none;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.section-title h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.section-title h2 span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 2px;
    display: block;
    margin-top: 0.2rem;
}

.countdown-container {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    align-items: center;
}

/* 輸入框排版 */
.countdown-inputs {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    width: 100%;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 120px;
}

.input-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    font-family: var(--font-clock);
    font-size: 1.8rem;
    font-weight: 700;
    padding: 0.8rem;
    border-radius: 12px;
    text-align: center;
    outline: none;
    transition: all 0.3s;
}

.input-group input:hover, .input-group input:focus {
    border-color: var(--cyan);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
}

.input-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 1px;
}

/* 倒數時間顯示 */
.countdown-display-wrapper {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    background: none;
    padding: 1rem 0;
    border: none;
}

.countdown-time-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
}

.time-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.time-block span:first-of-type {
    font-family: var(--font-clock);
    font-size: 5.5rem;
    font-weight: 700;
    color: var(--text-main);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
    min-width: 130px;
    text-align: center;
}

.time-block .unit {
    font-size: 1.3rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 0.4rem;
}

.colon {
    font-family: var(--font-clock);
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 1.8rem;
    animation: blink 1s infinite;
}

/* 進度條樣式 */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--cyan));
    box-shadow: 0 0 10px var(--cyan);
    border-radius: 3px;
    transition: width 0.2s linear;
}

/* ==========================================================================
   計時器排版與控制按鈕組樣式
   ========================================================================== */
.countdown-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    min-height: 55px; /* 給予最小高度以防時間顯示隱藏時版面抖動，同時保持高度緊湊 */
    transition: min-height 0.3s ease;
}

.countdown-controls-group {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    position: absolute;
    right: 2rem;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 5;
}

/* 控制 SVG 圖示大小 */
.control-svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* 正圓形控制按鈕樣式 */
.countdown-controls-group .btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 當沒有任何計時，控制組置中 */
.countdown-row.no-time .countdown-controls-group {
    position: static;
    margin: 0 auto;
}

/* 靜止隱藏按鈕組 */
.countdown-controls-group.hide-controls {
    opacity: 0;
    transform: scale(0.9) translateY(5px);
    pointer-events: none;
}

@media (max-width: 768px) {
    .countdown-row {
        flex-direction: column;
        gap: 1rem;
        min-height: auto;
    }
    .countdown-controls-group {
        position: static;
        margin: 0.5rem auto 0;
    }
    .countdown-row.no-time .countdown-controls-group {
        margin-top: 0;
    }
}

.btn {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.8rem 1.8rem;
    border-radius: 12px;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue) 0%, var(--cyan) 100%);
    color: #0b0c10;
}
.btn-primary:not(:disabled):hover {
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
    transform: translateY(-2px);
}

.btn-warning {
    background: rgba(249, 212, 35, 0.1);
    color: var(--yellow);
    border: 1px solid rgba(249, 212, 35, 0.3);
}
.btn-warning:not(:disabled):hover {
    background: rgba(249, 212, 35, 0.2);
    border-color: var(--yellow);
    box-shadow: 0 0 15px rgba(249, 212, 35, 0.3);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(255, 78, 80, 0.1);
    color: var(--red);
    border: 1px solid rgba(255, 78, 80, 0.3);
}
.btn-danger:not(:disabled):hover {
    background: rgba(255, 78, 80, 0.2);
    border-color: var(--red);
    box-shadow: 0 0 15px rgba(255, 78, 80, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-secondary:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--cyan);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-2px);
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

/* ==========================================================================
   警示 Overlay 樣式
   ========================================================================== */
.alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 12, 16, 0.85);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.alert-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.alert-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 78, 80, 0.3);
    box-shadow: 0 0 50px rgba(255, 78, 80, 0.2);
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.alert-overlay.show .alert-content {
    transform: scale(1);
}

.alert-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: ringBell 0.5s infinite alternate;
}

.alert-content h2 {
    font-size: 2rem;
    color: var(--red);
    margin-bottom: 0.8rem;
    font-weight: 700;
}

.alert-content p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.alert-content .btn {
    width: 100%;
    justify-content: center;
}

/* ==========================================================================
   動畫效果
   ========================================================================== */
.hidden {
    display: none !important;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.05); opacity: 1; filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.6)); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes blink {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

@keyframes ringBell {
    0% { transform: rotate(-10deg); }
    100% { transform: rotate(10deg); }
}

/* 當倒數結束時，整個畫面的閃爍警告效果 */
.alert-flashing {
    animation: flashScreen 0.5s infinite alternate;
}

@keyframes flashScreen {
    from { box-shadow: inset 0 0 0px transparent; }
    to { box-shadow: inset 0 0 100px rgba(255, 78, 80, 0.4); }
}

/* ==========================================================================
   自適應 (Responsive) 排版
   ========================================================================== */
@media (max-width: 900px) {
    .clock-grid {
        grid-template-columns: 1fr; /* 切換為單欄 */
    }
}

@media (max-width: 600px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        text-align: center;
    }
    
    .countdown-inputs {
        gap: 0.8rem;
    }
    
    .time-block span:first-of-type {
        font-size: 3.5rem;
        min-width: 80px;
    }
    
    .time-block .unit {
        font-size: 0.95rem;
    }
    
    .colon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   寬螢幕與 16:9 比例免捲動版面調整 (桌面端)
   ========================================================================== */
@media (min-width: 1024px) {
    body {
        height: 100vh;
        min-height: auto;
        overflow: hidden;
        padding: 1.5vh 1vw; /* 左右寬度 100% 利用，最少留白 */
        display: flex;
        align-items: center; /* 垂直置中整體內容 */
    }
    
    .container {
        height: 100%;
        max-height: 97vh;
        width: 100%;
        max-width: 100%; /* 100% 寬度利用 */
        gap: 1.5vh;
        justify-content: space-between;
    }
    
    /* 統一為 3 欄 2 列佈局 */
    .clock-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 1.8vh 1vw;
        flex: 1;
        min-height: 0;
    }
    
    /* 數位與指針模式卡片統一為：上下置中排列，且呈懸浮無邊框狀態 */
    .clock-card {
        min-height: 0;
        height: 100%;
        padding: 1.5vh 1.5vw;
        display: flex;
        flex-direction: column; /* 統一為上下排列 */
        align-items: center;
        justify-content: center !important; /* 垂直置中整體國家與時間 */
        text-align: center;
        gap: 2.2vh !important; /* 精準控制國家與時間之間的垂直間距，防空洞 */
        transition: all 0.3s ease;
        background: none;
        border-color: transparent;
        box-shadow: none;
    }
    
    .clock-card:hover {
        border-color: transparent;
        box-shadow: none;
        transform: translateY(-4px);
    }
    
    /* 上半部：國家與時區資訊（置中） */
    .clock-card .card-header {
        border-bottom: none;
        padding-bottom: 0;
        display: flex;
        flex-direction: column;
        align-items: center; /* 水平置中 */
        text-align: center;
        width: 100%;
        gap: 0.3vh;
    }
    
    /* 國旗大小依模式動態設定 */
    body:not(.mode-analog) .flag {
        width: var(--digital-flag-size);
    }
    body.mode-analog .flag {
        width: var(--analog-flag-size);
    }
    .flag {
        transition: width 0.2s ease;
    }
    
    .city-info {
        width: 100%;
        justify-content: center;
        gap: 0.5vw;
    }
    
    /* 國家名稱大小大小依模式動態設定 */
    body:not(.mode-analog) .city-info h2 {
        font-size: var(--digital-font-size);
    }
    body.mode-analog .city-info h2 {
        font-size: var(--analog-font-size);
    }
    .city-info h2 {
        line-height: 1.2;
        align-items: center;
    }
    
    /* 英文城市名相對於國家名稱等比例調整 */
    .city-info h2 span {
        font-size: 0.6em;
        margin-top: 0.1vh;
        display: block;
    }
    
    .timezone-offset {
        padding: 0.2vh 0.6vw;
        margin-top: 0.2vh;
        border-radius: 6px;
    }
    
    body:not(.mode-analog) .timezone-offset {
        font-size: var(--digital-offset-size, clamp(0.75rem, 1.2vh, 0.95rem)) !important;
    }
    
    body.mode-analog .timezone-offset {
        font-size: var(--analog-offset-size, clamp(0.75rem, 1.2vh, 0.95rem)) !important;
    }
    
    /* 下半部：時間顯示區（居中） */
    .clock-card .clock-body {
        width: 100%;
        height: auto;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-grow: 0 !important; /* 取消撐開剩餘空間，防止國家與時間分隔太遠 */
    }
    
    /* 數位時鐘大字顯示（置中並極致放大） */
    .digital-display {
        align-items: center; /* 置中對齊 */
        gap: 0.2vh;
    }
    
    .digital-display .time {
        font-size: var(--digital-time-size, clamp(3.0rem, 5.5vh, 4.5rem)); /* 大幅放大數位時間大小 */
        line-height: 1;
        letter-spacing: 0;
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.25);
    }
    
    .digital-display .date {
        font-size: var(--digital-date-size, clamp(1.15rem, 2vh, 1.5rem)); /* 大幅放大數位日期大小 */
    }
    
    .digital-display .date-en {
        font-size: calc(var(--digital-date-size, clamp(1.15rem, 2vh, 1.5rem)) * 0.82); /* 依比例縮小英文日期大小 */
        margin-top: 0.2vh;
    }
    
    .analog-date .date {
        font-size: var(--analog-date-size, clamp(1.15rem, 2vh, 1.5rem)); /* 大幅放大指針日期大小 */
    }
    
    .analog-date .date-en {
        font-size: calc(var(--analog-date-size, clamp(1.15rem, 2vh, 1.5rem)) * 0.82); /* 依比例縮小英文日期大小 */
        margin-top: 0.2vh;
    }
    
    /* --------------------------------------------------
       指針模式重構 (body.mode-analog)：無邊框懸浮與錶盤防溢出
       -------------------------------------------------- */
    body.mode-analog .analog-wrapper {
        gap: 1.2vh; /* 微調垂直間距以防在小高度螢幕下太擠 */
    }
    
    /* 模擬錶盤無級縮放，最佳大小從 155px 放大至最大 300px，刻度比例縮放 */
    body.mode-analog .analog-display {
        --dial-size: var(--analog-dial-size, clamp(180px, 26vh, 300px));
        --dial-radius: calc(var(--dial-size) / 2);
        --dial-mark-offset: calc(var(--dial-size) * -0.42); /* -0.42 確保刻度 100% 在圓圈內緣 */
        --hour-hand-height: calc(var(--dial-size) * 0.22);
        --minute-hand-height: calc(var(--dial-size) * 0.33);
        --second-hand-height: calc(var(--dial-size) * 0.38);
        
        /* 指針與中心點粗細等比例縮放 */
        --hour-hand-width: calc(var(--dial-size) * 0.025);
        --minute-hand-width: calc(var(--dial-size) * 0.018);
        --second-hand-width: calc(var(--dial-size) * 0.009);
        --center-nut-size: calc(var(--dial-size) * 0.06);
        
        width: var(--dial-size);
        height: var(--dial-size);
    }
    
    /* 大錶盤刻度粗細與長度等比例縮放 */
    body.mode-analog .mark {
        width: calc(var(--dial-size) * 0.012);
        height: calc(var(--dial-size) * 0.035);
        margin-left: calc(var(--dial-size) * -0.006);
        margin-top: calc(var(--dial-size) * -0.0175);
    }
    
    body.mode-analog .mark.hour-mark {
        width: calc(var(--dial-size) * 0.015);
        height: calc(var(--dial-size) * 0.055);
        margin-top: calc(var(--dial-size) * -0.0275);
    }
    
    /* 錶盤外框與陰影等比例縮放 */
    body.mode-analog .clock-face {
        border-width: calc(var(--dial-size) * 0.018);
        box-shadow: inset 0 0 calc(var(--dial-size) * 0.12) rgba(0, 0, 0, 0.8), 0 0 calc(var(--dial-size) * 0.09) rgba(255, 255, 255, 0.05);
    }
    
    /* --------------------------------------------------
       底部倒數計時器橫向佈局
       -------------------------------------------------- */
    .countdown-section {
        padding: 0.5vh 1.5vw; /* 大幅縮減 padding，防擠壓 */
        height: auto;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .countdown-section .section-title {
        display: none;
    }
    
    .countdown-container {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1vh;
        width: 100%;
        min-height: 0;
    }
    
    .countdown-display-wrapper {
        display: flex;
        flex-grow: 1;
        max-width: 700px;
        padding: 0;
        gap: 0.4vh;
        background: none;
        border: none;
    }
    
    .countdown-time-display {
        gap: 0.6vw;
    }
    
    .time-block span:first-of-type {
        font-size: clamp(3rem, 6.5vh, 5.5rem); /* 大螢幕置中時間大小 (加大) */
        min-width: clamp(90px, 8vw, 130px);
    }
    
    .time-block .unit {
        font-size: clamp(0.9rem, 2vh, 1.3rem); /* 放大單位 (加大) */
        margin-top: 0.3vh;
    }
    
    .colon {
        font-size: clamp(2.2rem, 4.8vh, 4rem); /* 放大冒號 (加大) */
        margin-bottom: 0.8rem;
    }
    
    .progress-bar-container {
        height: 5px; /* 進度條稍微加粗 */
    }
    
    /* --------------------------------------------------
       倒數控制按鈕組大螢幕縮放
       -------------------------------------------------- */
    .countdown-controls-group {
        right: clamp(1rem, 2vw, 3rem);
    }
    .countdown-controls-group .btn {
        width: clamp(38px, 4.5vh, 48px);
        height: clamp(38px, 4.5vh, 48px);
    }
    .control-svg {
        width: clamp(15px, 1.8vh, 20px);
        height: clamp(15px, 1.8vh, 20px);
    }
}

/* ==========================================================================
   主題配色設定彈窗樣式
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 8, 10, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.modal-content {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    padding: 1.2rem 1.6rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px var(--primary-glow);
    animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

@keyframes modalFadeIn {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.5rem;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ffffff 0%, var(--cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
}

.close-btn:hover {
    color: var(--red);
    transform: rotate(90deg);
}

.modal-body {
    overflow-y: auto;
    padding-right: 0.5rem;
    flex-grow: 1;
}

/* 彈窗自訂滾動條 */
.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--cyan);
}

.modal-body h4 {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    letter-spacing: 1px;
    font-weight: 600;
}

/* 預設主題選項排版 */
.theme-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

.theme-option {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.theme-option.active {
    border-color: var(--cyan);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 10px rgba(0, 242, 254, 0.1), 0 0 15px var(--primary-glow);
}

.color-preview {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.theme-option span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

/* 自訂色彩選擇器排版 */
.custom-color-picker {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.5rem;
}

.picker-row {
    display: flex;
    gap: 1rem;
}

.picker-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.picker-item label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.picker-item input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 100%;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.picker-item input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.picker-item input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: border-color 0.2s;
}

.picker-item input[type="color"]:hover::-webkit-color-swatch {
    border-color: var(--cyan);
}

/* ==========================================================================
   設定彈窗內模式控制樣式
   ========================================================================== */
.settings-section {
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-switch-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.settings-switch-row .switch-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.3s, text-shadow 0.3s;
    white-space: nowrap; /* 確保時鐘模式標籤（如數位時鐘、指針時鐘）文字絕對不折行 */
}

/* 監聽 active 切換顯示 */
.settings-switch-row:has(#clock-mode-toggle:checked) .switch-label:last-of-type {
    color: var(--cyan);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.6);
}

.settings-switch-row:not(:has(#clock-mode-toggle:checked)) .switch-label:first-of-type {
    color: var(--cyan);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.6);
}

/* 國家與國旗大小設定 Slider 樣式 */
.size-setting-group h5 {
    font-size: 0.85rem;
    color: var(--cyan);
    margin-bottom: 0.6rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.slider-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.8rem;
}

.slider-row label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.slider-row label span {
    color: var(--text-main);
    font-weight: 600;
}

.slider-row input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
    transition: background 0.3s;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
    cursor: pointer;
    transition: transform 0.1s;
}

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ==========================================================================
   大螢幕專屬優化與重疊避讓 (加在最後確保最高優先權，不受全域樣式覆蓋影響)
   ========================================================================== */
@media (min-width: 1024px) {
    /* 1. 大螢幕時，重置 select-wrapper 的 flex 與寬度，使國旗靠近國家名稱居中對齊 */
    .select-wrapper {
        flex: none !important;
        width: auto !important;
    }

    /* 2. 設定對話框大螢幕橫向超寬面板與間距優化 */
    .modal-content {
        width: 1050px !important; /* 微調寬度以適應二分欄滑桿 */
        max-width: 95% !important;
        max-height: 92vh !important;
        padding: 1.2rem 1.6rem !important; /* 縮減 padding */
    }
    
    .modal-body {
        display: grid !important;
        grid-template-columns: 1.05fr 0.95fr !important; /* 左右二分欄 */
        gap: 0 2.5rem !important;
        align-items: start !important;
        overflow-y: auto !important;
        padding-right: 0.5rem !important;
        max-height: calc(92vh - 80px) !important;
    }
    
    /* 縮減大螢幕下的區塊間距 */
    .modal-body .settings-section {
        margin-bottom: 0.8rem !important;
        padding-bottom: 0.6rem !important;
    }
    
    /* 預設主題改為 5 欄橫向排列，節省垂直空間 */
    .modal-body .theme-options {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 0.4rem !important;
        margin-bottom: 0.8rem !important;
    }
    
    /* 自訂配色區間距精簡 */
    .modal-body .custom-color-picker { 
        grid-column: 1 !important; 
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        padding-top: 0.6rem !important;
    }
    
    /* 大小調整區塊擺放於右欄，美化為副面板 */
    .modal-body .settings-section:nth-of-type(3) {
        grid-column: 2 !important;
        grid-row: 1 / span 3 !important; /* 跨越 3 行高度以對齊左側內容 */
        border-bottom: none !important;
        padding-bottom: 0 !important;
        background: rgba(255, 255, 255, 0.015) !important;
        border: 1px solid rgba(255, 255, 255, 0.05) !important;
        border-radius: 16px !important;
        padding: 1rem 1.2rem !important;
        box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.01) !important;
    }
    
    /* 將大小調整內部的滑桿改為雙欄排列，以減少高度 */
    .modal-body .size-setting-group {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.4rem 1.2rem !important;
    }
    
    .modal-body .size-setting-group h5 {
        grid-column: span 2 !important;
        margin-bottom: 0.2rem !important;
    }
    
    .modal-body .slider-row {
        margin-bottom: 0.3rem !important;
    }
    
    /* 左欄的其他區塊分配 */
    .modal-body .settings-section:nth-of-type(1) { grid-column: 1 !important; }
    .modal-body .settings-section:nth-of-type(2) { grid-column: 1 !important; }
    .modal-body .settings-section:nth-of-type(4) { grid-column: 1 !important; }

    /* 3. 當計時區塊顯示時，自動壓縮時鐘間距以避開重疊 */
    body:has(.countdown-section:not(.hide-countdown)) .container {
        gap: 0.8vh !important; /* 減少 container 間距 */
    }
    
    body:has(.countdown-section:not(.hide-countdown)) .clock-grid {
        gap: 1.0vh 1vw !important; /* 減少網格間距，騰出垂直空間 */
    }
    
    body:has(.countdown-section:not(.hide-countdown)) .clock-card {
        padding: 0.8vh 1.2vw !important; /* 縮小卡片內距 */
        gap: 0.5vh !important;
    }
    
    body:has(.countdown-section:not(.hide-countdown)) .clock-card .card-header {
        gap: 0.2vh !important;
    }
    
    body:has(.countdown-section:not(.hide-countdown)) .digital-display {
        gap: 0.1vh !important;
    }
    
    body:has(.countdown-section:not(.hide-countdown)) .analog-wrapper {
        gap: 0.6vh !important; /* 縮小指針模式下間距 */
}

/* ==========================================================================
   安全密碼驗證遮罩層 (Glassmorphism & Neon Glow)
   ========================================================================== */
.password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 12, 18, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s;
}

.password-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.password-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5),
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.password-card h3 {
    margin-bottom: 0.8rem;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 242, 254, 0.2);
}

.password-card p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.password-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    width: 100% !important;
    max-width: 320px !important;
    margin: 0 auto !important;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.password-input-group input[type="password"] {
    width: 100% !important;
    max-width: 100% !important;
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 12px !important;
    padding: 1rem 1.2rem !important;
    color: #fff !important;
    font-size: 1.1rem !important;
    font-family: inherit !important;
    text-align: center !important;
    letter-spacing: 4px !important;
    outline: none !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease !important;
}

.password-input-group input[type="password"]::placeholder {
    letter-spacing: normal !important;
    color: rgba(255, 255, 255, 0.3) !important;
    font-size: 0.95rem !important;
}

.password-input-group input[type="password"]:focus {
    border-color: rgba(0, 242, 254, 0.6) !important;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.25),
                inset 0 0 10px rgba(0, 242, 254, 0.05) !important;
    background: rgba(0, 0, 0, 0.5) !important;
}

.password-input-group button {
    width: 100% !important;
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 1rem !important;
    color: #0b0c10 !important;
    font-weight: 700 !important;
    font-size: 1.05rem !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2) !important;
    box-sizing: border-box !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.password-input-group button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4) !important;
    filter: brightness(1.1) !important;
}

.password-input-group button:active {
    transform: translateY(0) !important;
}

.password-card .error-message {
    color: #ff4e50;
    font-size: 0.9rem;
    margin-top: 1.2rem;
    min-height: 1.2rem;
    text-shadow: 0 0 10px rgba(255, 78, 80, 0.2);
    animation: fadeIn 0.3s ease;
}

/* 霓虹微發光呼吸卡片邊框 */
.animate-pulse-border {
    animation: pulseBorder 4s infinite alternate ease-in-out;
}

@keyframes pulseBorder {
    0% {
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    }
    100% {
        border-color: rgba(0, 242, 254, 0.25);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 242, 254, 0.1);
    }
}

/* 預先授權狀態下，直接隱藏遮罩層，防止任何毫秒級的閃爍 */
.pre-authorized .password-overlay {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* 預載入防閃爍專用樣式 (指針模式切換) */
body.mode-analog .digital-display {
    display: none !important;
}
body.mode-analog .analog-wrapper {
    display: flex !important;
}
