/* ========== CSS Variables & Reset ========== */
:root {
    --bg-primary: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 40%, #f0f9ff 100%);
    --bg-card: rgba(255, 255, 255, 0.55);
    --bg-card-hover: rgba(255, 255, 255, 0.75);
    --text-main: #0f172a;
    --text-sub: #475569;
    --text-muted: #94a3b8;
    --accent: #0ea5e9;
    --accent-glow: rgba(14, 165, 233, 0.4);
    --accent2: #6366f1;
    --accent3: #06b6d4;
    --border-color: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --toolbar-bg: rgba(255, 255, 255, 0.6);
    --tab-active-bg: rgba(14, 165, 233, 0.15);
    --calendar-today-bg: rgba(14, 165, 233, 0.2);
    --calendar-today-border: #0ea5e9;
    --scrollbar-thumb: rgba(14, 165, 233, 0.4);
    --fs-bg: rgba(15, 23, 42, 0.92);
}

[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    --bg-card: rgba(30, 41, 59, 0.6);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --text-main: #f1f5f9;
    --text-sub: #94a3b8;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.3);
    --accent2: #818cf8;
    --accent3: #22d3ee;
    --border-color: rgba(255, 255, 255, 0.12);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --toolbar-bg: rgba(15, 23, 42, 0.7);
    --tab-active-bg: rgba(56, 189, 248, 0.15);
    --calendar-today-bg: rgba(56, 189, 248, 0.2);
    --calendar-today-border: #38bdf8;
    --scrollbar-thumb: rgba(56, 189, 248, 0.4);
    --fs-bg: rgba(15, 23, 42, 0.95);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    transition: background 1.5s ease;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* ========== Single-row Toolbar ========== */
.toolbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--toolbar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.5s ease, border-color 0.5s ease;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    text-decoration: none;
    flex-shrink: 0;
}
.btn-icon:hover {
    background: var(--bg-card-hover);
    box-shadow: 0 0 12px var(--accent-glow);
    transform: translateY(-1px);
}

.toolbar-sep {
    width: 1px; height: 24px;
    background: var(--border-color);
    flex-shrink: 0;
}

/* Tab items inline */
.tab-item {
    position: relative;
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-sub);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    user-select: none;
    background: transparent;
    border: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.tab-item:hover {
    color: var(--text-main);
    background: var(--tab-active-bg);
}
.tab-item.active {
    color: var(--accent);
    font-weight: 600;
    background: var(--tab-active-bg);
}
.tab-icon {
    width: 20px; height: 20px;
    vertical-align: middle;
    margin-right: 3px;
}
.toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* ========== Main Content ========== */
.main-content {
    padding-top: 56px;
    padding-bottom: 40px;
    min-height: 100vh;
}

.tab-panel { display: none; animation: fadeIn 0.4s ease; }
.tab-panel.active { display: block; }

.date-subview { display: none; }
.date-subview.active { display: block; animation: fadeIn 0.4s ease; }

.cal-subview { display: none; }
.cal-subview.active { display: block; animation: fadeIn 0.4s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== Glass Card ========== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: all 0.5s ease;
}
.glass-card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow), 0 0 20px var(--accent-glow);
}

/* ========== TAB 1: Clock ========== */
.clock-section {
    text-align: center;
    padding: 30px 20px;
}

.digital-clock {
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 4px;
    background: linear-gradient(135deg, var(--accent), var(--accent2), var(--accent3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px var(--accent-glow));
    line-height: 1.1;
    transition: font-size 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.digital-clock.size-sm { font-size: 60px; letter-spacing: 2px; }
.digital-clock.size-md { font-size: 120px; letter-spacing: 3px; }
.digital-clock.size-lg { font-size: 180px; letter-spacing: 4px; }
.digital-clock.size-xl { font-size: 240px; letter-spacing: 5px; }

.date-display {
    font-size: 20px; color: var(--text-sub); margin-bottom: 6px; font-weight: 500;
}
.week-display {
    font-size: 15px; color: var(--text-muted); margin-bottom: 16px;
}
.timestamp-card {
    display: inline-block;
    padding: 8px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px; color: var(--text-sub);
}
.timestamp-card span { color: var(--accent); font-weight: 600; }

.clock-info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 20px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}
.clock-info-item {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 12px 10px;
    text-align: center;
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}
.clock-info-item:hover {
    background: var(--bg-card-hover);
    box-shadow: 0 4px 16px var(--accent-glow);
}
.ci-label {
    font-size: 11px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500;
}
.ci-value {
    font-size: 14px; color: var(--text-main); font-weight: 600;
    line-height: 1.4;
}
.ci-value .accent { color: var(--accent); }
.ci-value .holiday-red { color: #f43f5e; }
.ci-value .term-green { color: #059669; }

/* World Clock */
.world-clock-section {
    max-width: 900px;
    margin: 28px auto 0;
    text-align: center;
}
.wc-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 14px;
}
.wc-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}
.wc-add-btn {
    padding: 4px 14px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-card);
    color: var(--text-sub);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}
.wc-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}
.wc-cards {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.wc-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 24px;
    min-width: 130px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.wc-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 60%);
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.wc-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px var(--accent-glow), var(--shadow);
    border-color: var(--accent);
}
.wc-card:hover::before {
    opacity: 0.15;
}
.wc-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 8px;
}
.wc-card-time {
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}
.wc-card-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.wc-offset {
    display: inline-block;
    padding: 1px 7px;
    margin-left: 6px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* World Clock Selector */
.wc-selector {
    display: inline-block;
    margin-top: 12px;
    padding: 14px 18px !important;
    cursor: default;
}
#wc-selector-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

@media (max-width: 768px) {
    .wc-card {
        min-width: 100px;
        padding: 12px 16px;
    }
    .wc-card-time {
        font-size: 20px;
    }
    .wc-card-name {
        font-size: 11px;
    }
}
@media (max-width: 480px) {
    .wc-cards {
        gap: 8px;
    }
    .wc-card {
        min-width: 80px;
        padding: 10px 12px;
    }
    .wc-card-time {
        font-size: 17px;
        letter-spacing: 0;
    }
}

/* Fullscreen: world clock */
.cf-content .world-clock-section {
    max-width: 960px;
    margin: 20px auto 0;
}
.cf-content .wc-card {
    min-width: clamp(100px, 10vw, 160px);
    padding: clamp(10px, 1.5vw, 20px) clamp(14px, 2vw, 30px);
}
.cf-content .wc-card-time {
    font-size: clamp(20px, 2.8vw, 36px);
}
.cf-content .wc-card-name {
    font-size: clamp(11px, 1.3vw, 15px);
}
.cf-content .wc-card-date {
    font-size: clamp(10px, 1.1vw, 14px);
}
.cf-content .wc-title {
    font-size: clamp(12px, 1.4vw, 16px);
}

@media (max-width: 480px) {
    .clock-info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

/* Fullscreen: clock content */
.cf-content .digital-clock {
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent2), var(--accent3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 40px var(--accent-glow));
    font-size: clamp(48px, 10vw, 160px);
    text-align: center;
    line-height: 1.1;
}
.cf-content .date-display {
    font-size: clamp(20px, 3vw, 42px);
    text-align: center;
}
.cf-content .week-display {
    font-size: clamp(16px, 2vw, 28px);
    text-align: center;
}
.cf-content .timestamp-card {
    text-align: center;
    font-size: clamp(12px, 1.5vw, 20px);
}
.cf-content .clock-info-grid {
    max-width: 720px;
    margin: 24px auto 0;
    gap: clamp(8px, 1.5vw, 16px);
}
.cf-content .clock-info-item {
    padding: clamp(10px, 2vw, 20px) clamp(8px, 1.5vw, 16px);
}
.cf-content .ci-label {
    font-size: clamp(11px, 1.3vw, 16px);
}
.cf-content .ci-value {
    font-size: clamp(13px, 1.6vw, 20px);
}
.cf-content .clock-hint {
    font-size: clamp(10px, 1vw, 13px);
    text-align: center;
    margin-top: 24px;
}

@keyframes pulse-glow {
    0%, 100% { filter: drop-shadow(0 0 20px var(--accent-glow)); }
    50% { filter: drop-shadow(0 0 35px var(--accent-glow)); }
}
.digital-clock.pulse { animation: pulse-glow 1s ease-in-out infinite; }

/* ========== TAB 2: Date Info ========== */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(8px);
}
.date-nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    flex-shrink: 0;
}
.date-nav-btn:hover {
    background: var(--bg-card-hover);
    box-shadow: 0 0 10px var(--accent-glow);
    transform: translateY(-1px);
}
.date-nav-btn:active { transform: scale(0.95); }
.date-nav-today {
    font-size: 16px; font-weight: 700;
    color: var(--accent); min-width: 180px;
    text-align: center;
    user-select: none;
}
.date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.info-label {
    font-size: 12px; color: var(--text-muted); margin-bottom: 4px;
    text-transform: uppercase; letter-spacing: 1px;
}
.info-value {
    font-size: 26px; font-weight: 700; color: var(--text-main); line-height: 1.3;
}
.info-value .accent {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.info-sub { font-size: 13px; color: var(--text-sub); margin-top: 4px; }
.solar-term-badge {
    display: inline-block;
    padding: 4px 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent3));
    color: white; border-radius: 20px;
    font-size: 13px; font-weight: 600; margin-top: 8px;
}
/* 黄历宜忌列表 */
.hl-yi-list, .hl-ji-list {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.hl-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 13px; font-weight: 500;
}
.hl-tag.yi { background: rgba(5,150,105,0.1); color: #059669; border: 1px solid rgba(5,150,105,0.2); }
.hl-tag.ji { background: rgba(244,63,94,0.08); color: #f43f5e; border: 1px solid rgba(244,63,94,0.15); }
/* 历史上的今天卡片 */
.history-list {
    display: flex; flex-direction: column; gap: 8px; margin-top: 4px;
}
.history-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 6px 0; border-bottom: 1px dashed var(--border-color);
}
.history-item:last-child { border-bottom: none; }
.history-year {
    font-size: 12px; font-weight: 700; color: var(--accent);
    background: rgba(14,165,233,0.08); padding: 2px 8px; border-radius: 12px;
    white-space: nowrap; flex-shrink: 0; margin-top: 1px;
}
.history-text {
    font-size: 13px; color: var(--text-sub); line-height: 1.5;
    flex: 1; min-width: 0;
}
.history-link {
    text-decoration: none;
    transition: color 0.2s ease;
}
.history-link:hover {
    color: var(--accent);
    text-decoration: underline;
}
.history-empty {
    font-size: 13px; color: var(--text-muted);
    text-align: center; padding: 8px 0;
}
.hl-global-header, .hl-china-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 2px;
}
.hl-global-badge, .hl-china-badge {
    font-size: 11px; font-weight: 600; padding: 2px 8px;
    border-radius: 10px; display: inline-flex; align-items: center; gap: 4px;
}
.hl-global-badge { background: rgba(99,102,241,0.1); color: #6366f1; border: 1px solid rgba(99,102,241,0.2); }
.hl-china-badge { background: rgba(239,68,68,0.08); color: #ef4444; border: 1px solid rgba(239,68,68,0.15); }
.view-hint {
    margin-top: 12px; font-size: 12px; color: var(--text-muted); text-align: center;
}

/* Week view */
.week-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.week-day {
    text-align: center;
    padding: 10px 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: all 0.3s ease;
}
.week-day.today {
    background: var(--calendar-today-bg);
    border-color: var(--calendar-today-border);
    box-shadow: 0 0 10px var(--accent-glow);
}
.week-day .wd-name {
    font-size: 11px; color: var(--text-muted); margin-bottom: 4px;
}
.week-day .wd-date {
    font-size: 18px; font-weight: 700; color: var(--text-main);
}
.week-day.today .wd-date { color: var(--accent); }
.week-day .wd-lunar {
    font-size: 10px; color: var(--text-muted); margin-top: 2px;
}

/* Month view */
.month-mini-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.month-mini-header {
    text-align: center;
    font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 4px 0;
}
.month-mini-day {
    text-align: center;
    padding: 5px 2px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-main);
    cursor: default;
}
.month-mini-day.other { color: var(--text-muted); opacity: 0.3; }
.month-mini-day.today {
    background: var(--calendar-today-bg);
    border: 1px solid var(--calendar-today-border);
    box-shadow: 0 0 8px var(--accent-glow);
    font-weight: 700;
}

/* Quarter view */
.quarter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.quarter-month {
    text-align: center;
}
.quarter-month .qm-title {
    font-size: 14px; font-weight: 600; color: var(--text-sub); margin-bottom: 8px;
}
.quarter-month .qm-title.current { color: var(--accent); }
.qm-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.qm-header {
    font-size: 9px; color: var(--text-muted); padding: 2px 0; text-align: center;
}
.qm-day {
    font-size: 10px; padding: 2px 0; text-align: center; border-radius: 4px;
    color: var(--text-main);
}
.qm-day.other { opacity: 0.25; }
.qm-day.today {
    background: var(--calendar-today-bg);
    font-weight: 700; color: var(--accent);
}

/* ========== TAB 3: Calendar ========== */
.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.calendar-nav button {
    display: flex; align-items: center; justify-content: center;
    width: 72px; height: 72px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    font-size: 36px;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}
.calendar-nav button:hover {
    background: var(--bg-card-hover);
    box-shadow: 0 0 12px var(--accent-glow);
}
.calendar-title {
    font-size: 36px; font-weight: 700; color: var(--text-main);
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}
.calendar-header {
    text-align: center;
    font-size: 24px; font-weight: 600; color: var(--text-muted); padding: 6px 0;
}
.calendar-day {
    position: relative;
    aspect-ratio: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-radius: 12px;
    font-size: 28px; font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}
.calendar-day:hover {
    background: var(--bg-card-hover);
    transform: scale(1.08);
    box-shadow: 0 0 12px var(--accent-glow);
}
.calendar-day.other-month {
    color: var(--text-muted); opacity: 0.35;
}
.calendar-day.today {
    background: var(--calendar-today-bg);
    border-color: var(--calendar-today-border);
    box-shadow: 0 0 12px var(--accent-glow);
    font-weight: 700;
}
.calendar-day .lunar-text {
    font-size: 18px; color: var(--text-muted); margin-top: 1px; transform: scale(0.85);
}
.calendar-day.today .lunar-text { color: var(--accent); }
.lunar-text.first-month { color: #f43f5e; }
.calendar-day.today .lunar-text.first-month { color: #f43f5e; }

/* Yearly view */
.yearly-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}
.yearly-month {
    text-align: center;
}
.yearly-month .ym-title {
    font-size: 26px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px;
    cursor: pointer;
    transition: color 0.3s ease;
}
.yearly-month .ym-title:hover { color: var(--accent); }
.yearly-month .ym-title.current { color: var(--accent); }
.ym-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}
.ym-header {
    font-size: 16px; color: var(--text-muted); padding: 1px 0; text-align: center;
}
.ym-day {
    font-size: 18px; padding: 2px 0; text-align: center; border-radius: 3px;
    color: var(--text-main);
    cursor: pointer;
    line-height: 1.3;
}
.ym-day:hover { background: var(--tab-active-bg); }
.ym-day.other { opacity: 0.2; }
.ym-day.today {
    background: var(--calendar-today-bg);
    font-weight: 700; color: var(--accent);
}
.ym-lunar {
    font-size: 9px; color: var(--text-muted); display: block; line-height: 1; transform: scale(0.85);
}
.ym-day.today .ym-lunar { color: var(--accent); }
.ym-lunar.month-name { color: var(--accent2); font-weight: 600; }
.ym-lunar.first-month { color: #f43f5e; font-weight: 700; }
.ym-day.today .ym-lunar.first-month { color: #f43f5e; }

/* Calendar holiday & term badges */
.cal-holiday-badge {
    font-size: 14px; color: #fff; background: #f43f5e; border-radius: 3px;
    padding: 0 2px; margin-top: 1px; line-height: 1.2; white-space: nowrap;
    transform: scale(0.8);
}
.cal-work-badge {
    font-size: 14px; color: #fff; background: #64748b; border-radius: 3px;
    padding: 0 2px; margin-top: 1px; line-height: 1.2; white-space: nowrap;
    transform: scale(0.8);
}
.cal-term-badge {
    font-size: 14px; color: #059669; background: rgba(5,150,105,0.12); border-radius: 3px;
    padding: 0 2px; margin-top: 1px; line-height: 1.2; white-space: nowrap;
    transform: scale(0.8); font-weight: 600;
}
.calendar-day.holiday { background: rgba(244,63,94,0.08); }
.calendar-day.workday { background: rgba(100,116,139,0.08); }

/* Content Fullscreen Overlay */
.cf-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 200;
    background: var(--fs-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}
.cf-overlay.show {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.cf-close-btn {
    position: fixed;
    top: 10px; right: 16px;
    z-index: 210;
    padding: 6px 16px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.cf-close-btn:hover { background: rgba(255,255,255,0.2); }
.cf-content {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    padding: 52px 16px 24px;
    display: flex;
    flex-direction: column;
}
/* Fullscreen mode: scale calendar to fill */
.cf-content .calendar-grid {
    flex: 1;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    align-content: start;
}
.cf-content .calendar-day {
    font-size: clamp(26px, 4vw, 44px);
    border-radius: 10px;
}
.cf-content .calendar-day .lunar-text {
    font-size: clamp(16px, 2.2vw, 26px);
}
.cf-content .calendar-header {
    font-size: clamp(20px, 2.4vw, 30px);
}
.cf-content .calendar-title {
    font-size: clamp(32px, 5vw, 56px);
}
.cf-content .calendar-nav {
    margin-bottom: 12px;
}
.cf-content .calendar-nav button {
    font-size: clamp(32px, 5vw, 56px);
}
.cf-content .yearly-grid {
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 12px;
}
.cf-content .ym-title {
    font-size: clamp(24px, 3vw, 36px);
}
.cf-content .ym-day {
    font-size: clamp(18px, 2.4vw, 28px);
    padding: 3px 0;
}
.cf-content .ym-lunar {
    font-size: clamp(8px, 1.1vw, 13px);
}
.cf-content .ym-header {
    font-size: clamp(16px, 1.8vw, 22px);
}
.cf-content .cal-holiday-badge,
.cf-content .cal-work-badge,
.cf-content .cal-term-badge {
    font-size: clamp(12px, 1.4vw, 18px);
}
/* Fullscreen mode: date views */
.cf-content .date-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.cf-content .week-row {
    font-size: clamp(14px, 2vw, 24px);
}
.cf-content .month-mini-grid {
    grid-template-columns: repeat(7, 1fr);
}
.cf-content .month-mini-grid .mm-day {
    font-size: clamp(11px, 1.3vw, 16px);
}
.cf-content .quarter-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}
.cf-content .view-hint {
    font-size: clamp(10px, 1vw, 13px);
    margin-bottom: 8px;
}
.cf-content .info-label {
    font-size: clamp(11px, 1.2vw, 14px);
}
.cf-content .info-value {
    font-size: clamp(20px, 3vw, 40px);
}
.cf-content .info-sub {
    font-size: clamp(11px, 1.2vw, 14px);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .digital-clock.size-sm { font-size: 36px; }
    .digital-clock.size-md { font-size: 52px; }
    .digital-clock.size-lg { font-size: 68px; letter-spacing: 2px; }
    .digital-clock.size-xl { font-size: 88px; letter-spacing: 3px; }
    .tab-item { padding: 6px 12px; font-size: 12px; }
    .toolbar { gap: 4px; padding: 6px 10px; }
    .date-grid { grid-template-columns: 1fr; }
    .info-value { font-size: 22px; }
    .glass-card { padding: 16px; }
    .calendar-day { font-size: 24px; }
    .week-row { gap: 2px; }
    .week-day { padding: 6px 2px; }
    .week-day .wd-date { font-size: 15px; }
    .quarter-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .yearly-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

@media (max-width: 480px) {
    .quarter-grid { grid-template-columns: 1fr 1fr; }
    .yearly-grid { grid-template-columns: repeat(2, 1fr); }
    .tab-item { padding: 5px 10px; font-size: 11px; }
    .toolbar { padding: 5px 8px; gap: 2px; }
}

/* Info Modal */
.info-modal-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}
.info-modal-overlay.show { display: flex; align-items: center; justify-content: center; }
.info-modal {
    position: relative;
    width: 90vw; max-width: 600px;
    height: 80vh; max-height: 700px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.info-modal-close {
    position: absolute;
    top: 10px; right: 14px;
    z-index: 10;
    width: 32px; height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    color: var(--text-main);
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
}
.info-modal-close:hover { background: var(--bg-card-hover); }
.info-modal iframe {
    width: 100%; height: 100%;
    border: none;
}

/* Feedback Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 420px;
    max-width: 92vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.feedback-modal-card {
    width: 420px;
    max-width: 92vw;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 18px;
    font-weight: 700;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-main);
    cursor: pointer;
    opacity: 0.6;
    padding: 0 4px;
    transition: opacity 0.2s ease;
}
.modal-close:hover { opacity: 1; }
.modal-body {
    padding: 20px;
}
.fb-field {
    margin-bottom: 16px;
}
.fb-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
    margin-bottom: 8px;
}
.fb-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-card);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.fb-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}
.fb-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.fb-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}
.fb-select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}
[data-theme="dark"] .fb-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23cbd5e1' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}
.fb-rating-group {
    display: flex;
    gap: 6px;
}
.fb-rating-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 4px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sub);
    opacity: 0.7;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    line-height: 1.3;
}
.fb-rating-btn:hover {
    border-color: var(--accent);
    opacity: 1;
    background: var(--tab-active-bg);
}
.fb-rating-btn.fb-selected {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-color: var(--accent);
    color: #fff;
    opacity: 1;
    box-shadow: 0 4px 12px var(--accent-glow);
    transform: translateY(-1px);
}
.fb-btn-row {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.fb-submit-btn {
    flex: 1;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
}
.fb-submit-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 16px var(--accent-glow);
}
.fb-submit-btn:active {
    transform: scale(0.97);
}
.fb-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.fb-cancel-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s ease;
}
.fb-cancel-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--tab-active-bg);
}
.fb-error {
    display: none;
    color: #f43f5e;
    font-size: 12px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(244, 63, 94, 0.1);
    border-radius: 8px;
    border-left: 3px solid #f43f5e;
}
.fb-success {
    text-align: center;
    padding: 10px 0;
}
.fb-success-icon {
    font-size: 56px;
    margin-bottom: 12px;
    animation: fbPop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes fbPop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.fb-success-text {
    font-size: 14px;
    color: var(--text-sub);
    opacity: 0.8;
    margin-bottom: 24px;
}
.fb-success .fb-btn-row {
    max-width: 280px;
    margin: 0 auto;
}

/* Toast notification */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 500;
    padding: 12px 28px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 15px; font-weight: 600;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.toast.show { opacity: 1; visibility: visible; }
.toast.speak-toast {
    font-size: 22px;
    padding: 16px 36px;
    min-width: 200px;
    text-align: center;
}

/* ========== Tab 4: Countdown & Timer ========== */
.ct-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Form Card */
.ct-form-card {
    cursor: default;
}
.ct-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    user-select: none;
}
.ct-form-arrow {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}
.ct-form-body {
    margin-top: 16px;
    display: block;
}
.ct-form-row {
    margin-bottom: 12px;
}
.ct-form-split {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
}
.ct-form-row input[type="text"],
.ct-form-row input[type="datetime-local"],
.ct-form-row select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    outline: none;
}
.ct-form-row input:focus,
.ct-form-row select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}
.ct-form-row select {
    cursor: pointer;
}
.ct-tz-label {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.ct-tz-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-sub);
    user-select: none;
}
.ct-tz-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
}
.ct-tz-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ct-tz-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-sub);
    cursor: pointer;
    background: var(--bg-card);
    transition: all 0.2s ease;
    user-select: none;
}
.ct-tz-chip:hover {
    border-color: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
}
.ct-tz-chip:has(input:checked) {
    border-color: var(--accent);
    background: var(--tab-active-bg);
    color: var(--accent);
    font-weight: 600;
}
.ct-tz-chip input[type="checkbox"] {
    display: none;
}
.ct-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}
.ct-btn {
    padding: 9px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    font-family: inherit;
}
.ct-btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border: none;
}
.ct-btn-primary:hover {
    box-shadow: 0 0 16px var(--accent-glow);
    transform: translateY(-1px);
}
.ct-btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-sub);
}
.ct-btn-ghost:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

/* Timer List */
.ct-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}
.ct-timer-card {
    position: relative;
    overflow: hidden;
}
.ct-timer-card.is-ended {
    opacity: 0.55;
}
.ct-timer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.ct-timer-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ct-timer-title-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}
.ct-timer-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.ct-badge-down {
    background: rgba(99, 102, 241, 0.12);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.2);
}
.ct-badge-up {
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.2);
}
.ct-timer-del {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.ct-timer-del:hover {
    background: rgba(244, 63, 94, 0.12);
    color: #f43f5e;
    border-color: rgba(244, 63, 94, 0.3);
}
.ct-timer-target {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.ct-timer-main {
    text-align: center;
    padding: 12px 0 16px;
}
.ct-big-diff {
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 42px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--accent), var(--accent2), var(--accent3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 12px var(--accent-glow));
    line-height: 1.2;
}
.ct-big-diff.is-ended {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    -webkit-background-clip: text;
    background-clip: text;
    filter: none;
}
.ct-big-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}
.ct-tz-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
}
.ct-tz-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    padding: 5px 0;
    color: var(--text-sub);
}
.ct-tz-name {
    width: 80px;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 12px;
}
.ct-tz-target {
    color: var(--accent);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-weight: 600;
    flex-shrink: 0;
}
.ct-tz-now {
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
    flex: 1;
}

.ct-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.ct-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}
.ct-empty p {
    font-size: 14px;
}

/* Fullscreen: countdown */
.cf-content .ct-section {
    max-width: 960px;
    padding: 10px 0;
}
.cf-content .ct-big-diff {
    font-size: clamp(36px, 5vw, 64px);
}
.cf-content .ct-tz-row {
    font-size: clamp(11px, 1.2vw, 14px);
}
.cf-content .ct-tz-name {
    width: clamp(70px, 7vw, 90px);
}
.cf-content .ct-btn {
    font-size: clamp(12px, 1.3vw, 15px);
    padding: clamp(8px, 1vw, 10px) clamp(16px, 2vw, 22px);
}

@media (max-width: 768px) {
    .ct-big-diff {
        font-size: 32px;
    }
    .ct-tz-row {
        flex-wrap: wrap;
        gap: 4px;
    }
    .ct-tz-name {
        width: 65px;
        font-size: 11px;
    }
    .ct-form-split {
        grid-template-columns: 100px 1fr;
    }
}
@media (max-width: 480px) {
    .ct-big-diff {
        font-size: 26px;
        letter-spacing: 1px;
    }
    .ct-tz-name {
        width: 50px;
        font-size: 11px;
    }
    .ct-tz-target, .ct-tz-now {
        font-size: 10px;
    }
    .ct-form-split {
        grid-template-columns: 1fr;
    }
}
