/* 7628 北京时间首页 - 本地样式（无外部依赖） */
:root {
    --bg: #f0fdf4;
    --card: #ffffff;
    --line: #dcfce7;
    --line-strong: #bbf7d0;
    --green-900: #14532d;
    --green-800: #166534;
    --green-700: #15803d;
    --green-600: #16a34a;
    --green-500: #22c55e;
    --muted: #4b7a5a;
    --muted-2: #6b8f7b;
    --shadow: 0 20px 45px rgba(22, 101, 52, .10);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--bg);
    color: var(--green-900);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.7;
    font-size: 15px;
}

a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-900); }

.home-shell { width: 100%; max-width: 680px; }

.home-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.home-bar { height: 8px; background: linear-gradient(90deg, #86efac, #22c55e); }

.home-body { padding: 26px 24px 8px; }

.home-head { text-align: center; margin-bottom: 22px; }
.home-head h1 {
    margin: 0;
    font-size: clamp(26px, 6vw, 34px);
    color: var(--green-800);
    letter-spacing: .5px;
}
.home-head p { margin: 6px 0 0; color: var(--green-600); font-size: 13.5px; }

/* 日期 */
.date-box {
    background: #f0fdf4;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    padding: 12px 18px;
    text-align: center;
    margin-bottom: 20px;
}
.date-label {
    font-size: 12px;
    color: var(--green-700);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.date-value {
    margin-top: 2px;
    font-size: clamp(17px, 4.4vw, 22px);
    font-weight: 600;
    color: var(--green-800);
    font-variant-numeric: tabular-nums;
}

/* 时钟 */
.clock-stage {
    position: relative;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    background: linear-gradient(160deg, #ffffff 0%, #f7fef9 100%);
    box-shadow: inset 0 2px 10px rgba(22, 101, 52, .05);
    padding: 20px 12px 14px;
    text-align: center;
    margin-bottom: 18px;
}
.live-dot {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--green-500);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .18);
    animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }
    50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, .05); }
}
.clock-digits {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    letter-spacing: 2px;
}
.clock-digits .digit {
    font-size: clamp(46px, 15vw, 76px);
    font-weight: 800;
    line-height: 1.1;
    color: var(--green-800);
    /* 固定两位宽度，数字变化不影响整行布局，避免带动其他数位左右微动 */
    display: inline-block;
    flex: none;
    width: 2ch;
    text-align: center;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}
.clock-digits .digit.is-sec { color: var(--green-700); }
.clock-digits .colon {
    font-size: clamp(34px, 11vw, 54px);
    font-weight: 300;
    color: var(--green-500);
    margin: 0 2px;
    flex: none;
}
.clock-digits .ms-dot {
    font-size: clamp(22px, 7vw, 34px);
    font-weight: 300;
    color: #86efac;
    flex: none;
}
.clock-digits .ms {
    font-size: clamp(22px, 7vw, 32px);
    font-weight: 700;
    color: var(--green-600);
    /* 固定三位毫秒宽度，毫秒跳动时宽度恒定，不再推动前面时分秒 */
    display: inline-block;
    flex: none;
    width: 3ch;
    text-align: left;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}
.clock-caption { margin-top: 6px; font-size: 12.5px; color: #86b89b; letter-spacing: 1px; }

/* 状态与按钮 */
.home-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.sync-chip {
    background: #f0fdf4;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--green-600);
}
.sync-chip #lastSyncTime { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; }
.sync-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    background: var(--green-500);
    color: #fff;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    padding: 10px 26px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(34, 197, 94, .28);
    transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.sync-btn:hover { background: var(--green-600); box-shadow: 0 8px 20px rgba(22, 163, 74, .3); }
.sync-btn:active { transform: translateY(1px); }
.sync-btn svg { width: 18px; height: 18px; transition: transform .5s ease; }
.sync-btn:hover svg { transform: rotate(180deg); }
.sync-btn[disabled] { opacity: .7; cursor: progress; }
.sync-btn.is-loading svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 世界时间 */
.home-world { border-top: 1px solid var(--line); padding-top: 18px; }
.world-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.world-head h2 { margin: 0; font-size: 17px; color: var(--green-800); }
.world-head a { font-size: 12px; color: var(--green-500); }
.world-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.world-item {
    display: block;
    background: #f0fdf4;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 8px 12px;
    transition: background .15s ease, border-color .15s ease;
}
.world-item:hover { background: #dcfce7; border-color: var(--line-strong); }
.world-name { display: block; font-size: 12px; color: var(--green-600); }
.world-time {
    display: block;
    margin-top: 2px;
    font-size: 18px;
    font-weight: 700;
    color: var(--green-800);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}
.world-more { margin-top: 12px; text-align: right; font-size: 13.5px; }

/* 页脚 */
.home-foot {
    border-top: 1px solid var(--line);
    margin-top: 20px;
    padding: 16px 24px 22px;
    text-align: center;
    font-size: 12px;
    color: #9ab8a7;
}
.home-foot p { margin: 0 0 6px; }
.home-foot p:last-child { margin-bottom: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.foot-links a { color: var(--muted-2); }

/* Toast */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 10px);
    background: var(--green-800);
    color: #fff;
    padding: 8px 20px;
    border-radius: 999px;
    font-size: 13.5px;
    box-shadow: 0 10px 24px rgba(20, 83, 45, .25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    white-space: nowrap;
    z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
    body { padding: 10px; }
    .home-body { padding: 20px 16px 6px; }
    .home-foot { padding: 14px 16px 20px; }
    .home-head { margin-bottom: 18px; }
    .world-grid { grid-template-columns: repeat(2, 1fr); }
    .home-status { justify-content: center; }
    .sync-btn { width: 100%; justify-content: center; }
    .clock-digits { letter-spacing: 1px; }
}
