/* ===== 全局变量与重置 ===== */
:root {
    /* 主色调 - 默认可信蓝 */
    --accent-primary: #2563eb;
    --accent-secondary: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    --accent-glow: rgba(37, 99, 235, 0.22);
    
    --font-mono: 'JetBrains Mono', 'Orbitron', monospace;
    --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-pixel: 'Press Start 2P', monospace;
}

/* ===== 主题 token =====
   主题状态统一来自 <html data-theme="light|dark">（由 js/theme.js 维护），
   配色与 css/theme.css 保持一致；这里只做 clock 页面自己的 token 覆盖。 */

/* 深色主题 */
:root[data-theme="dark"] {
    --bg-primary: #0b1120;
    --bg-secondary: #111a2e;
    --bg-card: #131d33;
    --bg-overlay: rgba(11, 17, 32, 0.85);

    --text-primary: #e8edf7;
    --text-secondary: #9fb0c9;
    --text-muted: #7b8ca6;

    --border-color: #23304d;
    --border-hover: #475a7d;

    --clock-color: #e8edf7;
    --clock-glow: rgba(96, 165, 250, 0.18);
}

/* 浅色主题（默认）：白底 + 中性灰阶 + 蓝主色 */
:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-overlay: rgba(255, 255, 255, 0.86);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --border-color: #e2e8f0;
    --border-hover: #94a3b8;

    --clock-color: #0f172a;
    --clock-glow: rgba(37, 99, 235, 0.1);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.5s ease, color 0.5s ease;
    position: relative;
}

/* ===== 动态背景 ===== */
.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: orbFloat 20s ease-in-out infinite;
}

.bg-orb {
    display: none;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--accent-primary);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-secondary);
    bottom: -150px;
    right: -150px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
    opacity: 0.2;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(60px, -40px) scale(1.1); }
    50% { transform: translate(-40px, 30px) scale(0.95); }
    75% { transform: translate(50px, 20px) scale(1.05); }
}

#particleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.6;
}

:root[data-theme="light"] #particleCanvas {
    opacity: 0.15;
}

/* ===== 顶部工具栏 ===== */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: var(--bg-overlay);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.top-bar.hidden {
    transform: translateY(-100%);
    opacity: 0;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-title {
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--accent-tint);
}

.icon-btn.active {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background: var(--accent-tint);
}

.mode-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem;
    background: var(--bg-card);
    border-radius: 9999px;
    border: 1px solid var(--border-color);
}

.mode-tab {
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.mode-tab:hover {
    color: var(--text-primary);
}

.mode-tab.active {
    background: var(--accent-gradient);
    color: white;
}

/* ===== 主内容区 ===== */
.main-content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    padding-top: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-panel {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.mode-panel.active {
    display: flex;
}

/* ===== 时钟容器 ===== */
.clock-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

/* ===== 数字时钟 ===== */
.digital-clock {
    text-align: center;
}

.time-display {
    font-family: var(--font-mono);
    font-size: clamp(4rem, 15vw, 12rem);
    font-weight: 700;
    line-height: 1;
    color: var(--clock-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.1em;
    text-shadow: 0 0 60px var(--clock-glow);
    letter-spacing: -0.02em;
}

.time-unit {
    display: inline-block;
    min-width: 1.5em;
    color: var(--clock-color);
}

.time-separator {
    color: var(--accent-primary);
    opacity: 0.8;
    animation: blink 1s step-end infinite;
}

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

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.date-display {
    margin-top: 1.5rem;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.date-divider {
    color: var(--text-muted);
}

/* ===== 模拟时钟（修复版 - SVG刻度） ===== */
.analog-clock {
    display: flex;
    align-items: center;
    justify-content: center;
}

.clock-face {
    position: relative;
    width: clamp(250px, 40vw, 500px);
    height: clamp(250px, 40vw, 500px);
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--border-color);
    box-shadow: 0 0 60px var(--clock-glow), inset 0 0 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.clock-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.clock-svg .tick-major {
    stroke: var(--text-primary);
    stroke-width: 2;
    stroke-linecap: round;
}

.clock-svg .tick-minor {
    stroke: var(--text-muted);
    stroke-width: 1;
    stroke-linecap: round;
    opacity: 0.6;
}

.clock-svg .clock-num {
    fill: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
}

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

.hour-hand {
    width: 6px;
    height: 25%;
    background: var(--accent-primary);
    transform: translateX(-50%) rotate(0deg);
    box-shadow: 0 0 10px var(--accent-glow);
}

.minute-hand {
    width: 4px;
    height: 35%;
    background: var(--accent-secondary);
    transform: translateX(-50%) rotate(0deg);
    box-shadow: 0 0 8px var(--accent-tint-stronger);
}

.second-hand {
    width: 2px;
    height: 40%;
    background: var(--text-primary);
    transform: translateX(-50%) rotate(0deg);
    transition: none;
}

.clock-center {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    background: var(--accent-gradient);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px var(--accent-glow);
    z-index: 10;
}

/* ===== 翻页时钟（重写版 - 经典 split-flap 效果） ===== */
.flip-clock {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1.5rem);
}

.flip-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.flip-unit {
    position: relative;
    width: clamp(80px, 12vw, 160px);
    height: clamp(110px, 16vw, 220px);
    perspective: 400px;
    font-family: var(--font-mono);
    font-weight: 700;
}

/* 静态背景层 - 上半部分（显示新值） */
.flip-card-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 1;
}

.flip-card-top span {
    display: block;
    width: 100%;
    text-align: center;
    font-size: clamp(2.5rem, 8vw, 6rem);
    line-height: 1;
    /* 与下半层统一 padding-top：写 padding-bottom 会让上下两半的字形错位 2px */
    padding-top: 2px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transform: translateY(50%);
}

/* 静态背景层 - 下半部分（显示旧值，动画结束后更新） */
.flip-card-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1;
}

.flip-card-bottom span {
    display: block;
    width: 100%;
    text-align: center;
    font-size: clamp(2.5rem, 8vw, 6rem);
    line-height: 1;
    padding-top: 2px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transform: translateY(-50%);
}

/* 中间分隔线 */
.flip-unit::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--border-color);
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none;
}

/* 未参与动画的占位层：CSS 未定义样式，若残留会渲染成裸文本压在数字上 */
.flip-card-back-top,
.flip-card-front-bottom {
    display: none;
}

/* ===== 翻页动画层 ===== */

/* 上翻页 - 显示旧值的上半部分，向下翻 */
.flip-card-front {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 2;
}

.flip-card-front-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    transform-origin: bottom center;
    backface-visibility: hidden;
}

.flip-card-front-top span {
    display: block;
    width: 100%;
    text-align: center;
    font-size: clamp(2.5rem, 8vw, 6rem);
    line-height: 1;
    /* 与静态上半层统一 padding-top，保证字形在接缝处对齐 */
    padding-top: 2px;
    /* 必须与静态上半层用同一套渐变文字，否则翻页瞬间会从渐变跳成纯色 */
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transform: translateY(50%);
}

/* 下翻页 - 显示新值的下半部分，向下翻出 */
.flip-card-back {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 2;
}

.flip-card-back-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transform-origin: top center;
    backface-visibility: hidden;
    transform: rotateX(90deg);
}

.flip-card-back-bottom span {
    display: block;
    width: 100%;
    text-align: center;
    font-size: clamp(2.5rem, 8vw, 6rem);
    line-height: 1;
    padding-top: 2px;
    /* 同上：与静态下半层保持一致的渐变文字 */
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transform: translateY(-50%);
}

/* 动画状态 */
.flip-unit.flipping .flip-card-front-top {
    animation: flipTop 0.3s ease-in forwards;
}

.flip-unit.flipping .flip-card-back-bottom {
    animation: flipBottom 0.3s ease-out 0.3s forwards;
}

@keyframes flipTop {
    0% {
        transform: rotateX(0deg);
    }
    100% {
        transform: rotateX(-90deg);
    }
}

@keyframes flipBottom {
    0% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

.flip-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.flip-colon {
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 700;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    animation: blink 1s step-end infinite;
    margin-top: -1rem;
}

/* ===== 霓虹时钟 ===== */
.neon-clock {
    text-align: center;
}

.neon-time {
    font-family: 'Orbitron', var(--font-mono);
    font-size: clamp(3.5rem, 12vw, 9rem);
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.05em;
    letter-spacing: 0.05em;
}

.neon-digit {
    color: #fff;
    text-shadow:
        0 0 5px var(--accent-primary),
        0 0 10px var(--accent-primary),
        0 0 20px var(--accent-primary),
        0 0 40px var(--accent-primary),
        0 0 80px var(--accent-primary);
    animation: neonPulse 2s ease-in-out infinite alternate;
}

.neon-sep {
    color: #fff;
    text-shadow:
        0 0 5px var(--accent-secondary),
        0 0 10px var(--accent-secondary),
        0 0 20px var(--accent-secondary),
        0 0 40px var(--accent-secondary);
    animation: blink 1s step-end infinite;
}

@keyframes neonPulse {
    from {
        text-shadow:
            0 0 5px var(--accent-primary),
            0 0 10px var(--accent-primary),
            0 0 20px var(--accent-primary),
            0 0 40px var(--accent-primary);
    }
    to {
        text-shadow:
            0 0 10px var(--accent-primary),
            0 0 20px var(--accent-primary),
            0 0 40px var(--accent-primary),
            0 0 80px var(--accent-primary),
            0 0 120px var(--accent-primary);
    }
}

.neon-date {
    margin-top: 1.5rem;
    font-family: 'Orbitron', var(--font-mono);
    font-size: clamp(0.875rem, 1.5vw, 1.25rem);
    color: var(--text-secondary);
    letter-spacing: 0.2em;
    text-shadow: 0 0 10px var(--accent-glow);
}

/* ===== 像素时钟 ===== */
.pixel-clock {
    text-align: center;
}

#pixelCanvas {
    max-width: 90vw;
    height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.pixel-date {
    margin-top: 1rem;
    font-family: var(--font-pixel);
    font-size: clamp(0.6rem, 1.5vw, 1rem);
    color: var(--accent-primary);
    letter-spacing: 0.1em;
}

/* ===== 二进制时钟 ===== */
.binary-clock {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.binary-columns {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.5rem);
}

.binary-col {
    display: flex;
    flex-direction: column-reverse;
    gap: clamp(0.5rem, 1vw, 1rem);
}

.binary-dot {
    width: clamp(20px, 4vw, 40px);
    height: clamp(20px, 4vw, 40px);
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.binary-dot.active {
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 0 20px var(--accent-glow);
}

.binary-sep {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    color: var(--accent-primary);
}

.binary-labels {
    display: flex;
    gap: clamp(0.75rem, 2vw, 1.5rem);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-left: calc(clamp(20px, 4vw, 40px) + 0.5rem);
}

.binary-labels span {
    width: clamp(20px, 4vw, 40px);
    text-align: center;
}

.binary-time {
    font-family: var(--font-mono);
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ===== 文字时钟 ===== */
.word-clock {
    text-align: center;
    width: 100%;
    max-width: 800px;
}

.word-clock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.word-sentence {
    font-family: var(--font-sans);
    font-size: clamp(1.5rem, 5vw, 3.5rem);
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: 0.1em;
}

.word-part {
    display: inline-block;
    margin: 0 0.1em;
    transition: all 0.3s ease;
}

.word-prefix {
    color: var(--text-secondary);
    font-weight: 400;
}

.word-period {
    color: var(--text-primary);
    font-weight: 500;
}

.word-number {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 1.2em;
}

.word-unit {
    color: var(--text-primary);
    font-weight: 500;
}

.word-clock-digital {
    margin-top: 1rem;
}

.word-digital-time {
    font-family: var(--font-mono);
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.9;
}

.word-clock-date {
    font-size: clamp(0.875rem, 1.5vw, 1.125rem);
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* ===== 矩阵时钟 ===== */
.matrix-clock {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#matrixCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.4;
}

.matrix-time {
    position: relative;
    z-index: 2;
    font-family: var(--font-mono);
    font-size: clamp(4rem, 15vw, 10rem);
    font-weight: 700;
    color: #00ff41;
    text-shadow:
        0 0 10px #00ff41,
        0 0 20px #00ff41,
        0 0 40px #00ff41;
    letter-spacing: 0.1em;
}

/* ===== 共享日期显示 ===== */
.clock-date-display {
    margin-top: 1rem;
    font-size: clamp(0.875rem, 1.5vw, 1.25rem);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* ===== 专注模式提示 ===== */
.focus-hint {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.875rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.focus-hint.visible {
    opacity: 1;
}

/* 专注模式 */
body.focus-mode .top-bar,
body.focus-mode .focus-hint {
    opacity: 0;
    pointer-events: none;
}

body.focus-mode:hover .top-bar {
    opacity: 1;
    pointer-events: auto;
}

/* ===== 番茄钟 ===== */
.pomodoro-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.pomodoro-modes {
    display: flex;
    gap: 0.75rem;
    padding: 0.375rem;
    background: var(--bg-card);
    border-radius: 9999px;
    border: 1px solid var(--border-color);
}

.pomodoro-mode-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.pomodoro-mode-btn:hover {
    color: var(--text-primary);
}

.pomodoro-mode-btn.active {
    background: var(--accent-gradient);
    color: white;
}

.pomodoro-timer {
    position: relative;
    width: clamp(250px, 35vw, 400px);
    height: clamp(250px, 35vw, 400px);
}

.pomodoro-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 8;
}

.ring-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.5s ease;
}

.pomodoro-ring .ring-progress {
    stroke: var(--accent-primary);
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

.pomodoro-time {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-mono);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pomodoro-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.control-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.control-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

.control-btn.primary {
    width: 72px;
    height: 72px;
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.control-btn.primary:hover {
    box-shadow: 0 6px 30px var(--accent-glow);
    transform: scale(1.1);
}

.control-btn.large {
    width: auto;
    height: auto;
    padding: 1rem 2.5rem;
    border-radius: 9999px;
    font-size: 1rem;
    font-family: inherit;
    gap: 0.6rem;
}

.pomodoro-stats {
    display: flex;
    gap: 3rem;
}

.pomodoro-stats .stat {
    text-align: center;
}

.pomodoro-stats .stat-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pomodoro-stats .stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== 秒表 ===== */
.stopwatch-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: 600px;
    width: 90%;
}

.stopwatch-display {
    font-family: var(--font-mono);
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 700;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.1em;
}

.sw-unit {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sw-unit.sw-ms {
    font-size: 0.6em;
    color: var(--text-secondary);
    -webkit-text-fill-color: var(--text-secondary);
}

.sw-separator {
    color: var(--accent-primary);
}

.stopwatch-controls {
    display: flex;
    gap: 1rem;
}

.stopwatch-controls .control-btn {
    width: auto;
    height: auto;
    padding: 0.75rem 2rem;
    border-radius: 9999px;
    font-size: 1rem;
    font-family: inherit;
}

.lap-list {
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.lap-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.lap-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.lap-item:last-child {
    border-bottom: none;
}

.lap-number {
    color: var(--text-secondary);
}

.lap-time {
    color: var(--text-primary);
}

/* ===== 倒计时 ===== */
.countdown-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    width: 100%;
    max-width: 600px;
}

/* 设置区：原先是裸块级堆叠，标题/输入框/预设/按钮零间距且按钮左贴边 */
.countdown-setup {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
    width: 100%;
}

.countdown-title {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.countdown-inputs {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    justify-content: center;
}

.cd-input-group {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.cd-input-group input {
    width: clamp(80px, 15vw, 120px);
    height: clamp(80px, 12vw, 110px);
    text-align: center;
    font-family: var(--font-mono);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    border: 2px solid var(--border-color);
    border-radius: 16px;
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
    -moz-appearance: textfield;
}

.cd-input-group input::-webkit-outer-spin-button,
.cd-input-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cd-input-group input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.cd-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.cd-colon {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    padding-bottom: 1.5rem;
}

.countdown-presets {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.preset-btn {
    padding: 0.6rem 1.25rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-weight: 500;
}

.preset-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
    background: var(--accent-tint);
    transform: translateY(-1px);
}

.preset-btn:active {
    transform: translateY(0);
}

.countdown-display {
    position: relative;
    width: clamp(280px, 45vw, 450px);
    height: clamp(280px, 45vw, 450px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 8;
}

.ring-progress {
    fill: none;
    stroke: url(#ringGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 565.48;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.countdown-time-wrap {
    position: relative;
    z-index: 1;
    text-align: center;
}

.countdown-time {
    font-family: var(--font-mono);
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.countdown-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    letter-spacing: 0.1em;
}

.countdown-controls {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.countdown-controls .control-btn {
    display: flex;
    align-items: center;
    /* 基础 .control-btn 是 56×56 方形，这里必须放开宽高，否则「取消/暂停」会被挤成竖排 */
    width: auto;
    height: auto;
    white-space: nowrap;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: 9999px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    min-width: 120px;
    justify-content: center;
}

/* ===== 世界时钟 ===== */
.world-clock-container {
    width: 90%;
    max-width: 1000px;
    text-align: center;
}

.world-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.world-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.world-city-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    backdrop-filter: blur(10px);
}

.world-city-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.world-city-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.world-city-card:hover .world-city-remove {
    opacity: 1;
}

.world-city-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.world-city-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.world-city-country {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.world-city-time {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.world-city-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.add-city-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    border: 2px dashed var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.add-city-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background: var(--accent-tint);
}

/* ===== 设置面板 ===== */
.settings-panel,
.style-panel {
    position: fixed;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.settings-panel.open,
.style-panel.open {
    right: 0;
}

.settings-header,
.style-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-header h3,
.style-header h3 {
    font-size: 1.1rem;
}

.settings-content,
.style-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-group:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* 开关按钮 */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

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

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    transition: 0.3s;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-gradient);
    border-color: transparent;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background-color: white;
}

/* 滑块 */
.range-slider {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-gradient);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* 颜色选择器 */
.color-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--accent-primary);
}

/* ===== 样式选择面板 ===== */
.style-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1.25rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
    font-family: inherit;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.style-option:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.style-option.active {
    border-color: var(--accent-primary);
    background: var(--accent-tint);
    color: var(--text-primary);
}

.style-preview {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg-primary);
}

.style-digital {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mini-clock {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

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

.mini-hour {
    width: 3px;
    height: 14px;
    background: var(--accent-primary);
    transform: translateX(-50%) rotate(90deg);
}

.mini-minute {
    width: 2px;
    height: 18px;
    background: var(--accent-secondary);
    transform: translateX(-50%) rotate(180deg);
}

.style-flip {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    gap: 4px;
}

.mini-flip {
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.mini-flip-sep {
    color: var(--accent-primary);
}

.style-neon {
    font-family: 'Orbitron', var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    text-shadow:
        0 0 5px var(--accent-primary),
        0 0 10px var(--accent-primary),
        0 0 20px var(--accent-primary);
}

.style-pixel {
    font-family: var(--font-pixel);
    font-size: 0.875rem;
    color: var(--accent-primary);
}

.style-binary {
    font-size: 1.25rem;
    gap: 0.5rem;
    letter-spacing: 0.2em;
}

.style-binary span {
    color: var(--accent-primary);
}

.style-word {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2em;
}

.style-matrix {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: #00ff41;
    text-shadow: 0 0 10px #00ff41;
}

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.modal.open {
    display: flex;
}

.modal-content {
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
    margin-bottom: 1rem;
}

.search-input:focus {
    border-color: var(--accent-primary);
}

.city-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.city-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.city-item:hover {
    border-color: var(--border-hover);
    background: var(--accent-tint);
}

.city-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.city-item-country {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.city-item-time {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-primary);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .top-bar {
        height: 56px;
        padding: 0 1rem;
    }
    
    .app-title {
        display: none;
    }
    
    .mode-tabs {
        gap: 0.25rem;
        padding: 0.2rem;
    }
    
    .mode-tab {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .time-display {
        font-size: clamp(3rem, 18vw, 6rem);
    }
    
    .date-display {
        font-size: 0.875rem;
        gap: 0.5rem;
    }
    
    .settings-panel,
    .style-panel {
        width: 100%;
        right: -100%;
    }
    
    .pomodoro-stats {
        gap: 2rem;
    }
    
    .countdown-inputs {
        gap: 0.5rem;
    }
    
    .cd-input-group input {
        width: 70px;
        height: 60px;
        font-size: 1.75rem;
    }
    
    .world-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
    
    .world-city-time {
        font-size: 1.5rem;
    }
    
    .word-clock-grid {
        gap: 0.25rem;
        font-size: 0.875rem;
    }
    
    .binary-labels {
        display: none;
    }
}

@media (max-width: 480px) {
    .top-bar-right .icon-btn {
        width: 36px;
        height: 36px;
    }
    
    .top-bar-left .icon-btn {
        width: 36px;
        height: 36px;
    }
    
    .pomodoro-modes {
        flex-direction: column;
        width: 100%;
    }
    
    .pomodoro-mode-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .neon-time {
        font-size: clamp(2.5rem, 15vw, 5rem);
    }
}

/* ===== 滚动条样式 ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ===== 选择文本样式 ===== */
::selection {
    background: var(--accent-tint-stronger);
}


/* ===== 浅色主题适配（VibeLab 白底版） ===== */
/* 表盘：白底上用细描边 + 极轻投影，不用黑色内阴影 */
:root[data-theme="light"] .clock-face {
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08), inset 0 0 0 1px #eef2f7;
}

/* 「霓虹灯光」与「矩阵雨」只成立在深底上：浅色主题下给它们一块深色面板，
   像白墙上挂的灯牌 / 终端窗口，边界清楚，也不会把光晕糊在白底上 */
:root[data-theme="light"] .neon-clock {
    background: #0f172a;
    border-radius: 20px;
    padding: 3rem 3.5rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}

:root[data-theme="light"] .neon-date {
    color: rgba(255, 255, 255, 0.65);
    text-shadow: none;
}

:root[data-theme="light"] .matrix-clock {
    width: min(900px, 90vw);
    height: min(420px, 55vh);
    border-radius: 20px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}

#matrixCanvas {
    opacity: 0.55;
}

/* 深色下 clock 标题用提亮渐变（--accent-gradient 同时给白字按钮做底，不能动）
   注意只能用 background-image：background 简写会把 background-clip 重置成 border-box，
   渐变就会变成一整块色块而不是文字色 */
:root[data-theme="dark"] .app-title {
    background-image: linear-gradient(135deg, #60a5fa 0%, #a5b4fc 100%);
}
