/* ===== CSS 变量：深色 ===== */
:root {
  /* 深色 */
  --bg: #0d1117;
  --bg-glass: rgba(22, 27, 34, 0.72);
  --text-1: #e6edf3;
  --text-2: #9ca3af;
  --text-3: #6b7280;
  --border: rgba(255,255,255,0.07);
  --shadow: 0 4px 32px rgba(0,0,0,0.4);
  --shadow-h: 0 8px 48px rgba(0,0,0,0.55);
  --footer-sep: rgba(255,255,255,0.08);
  /* 主题色 */
  --accent: #c4a882;
  --accent-2: #d4c4a8;
  --accent-glow: rgba(196,168,130,0.18);
  /* 杂项 */
  --r: 16px;
  --drawer-h: 80vh;
}

/* ===== 浅色模式 ===== */
:root[data-theme="light"] {
  --bg: #f4f1ec;
  --bg-glass: rgba(255,255,255,0.85);
  --text-1: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: rgba(0,0,0,0.09);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-h: 0 8px 40px rgba(0,0,0,0.14);
  --footer-sep: rgba(0,0,0,0.08);
  --accent-glow: rgba(196,168,130,0.1);
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  min-height: 100dvh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ===== 粒子背景 ===== */
#particleCanvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
  opacity: 0.45;
}

/* ===== 工具栏 ===== */
.toolbar {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 6px 8px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.toolbar-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.25s ease, transform 0.2s ease;
  padding: 0;
}
.toolbar-btn:hover { color: var(--accent); transform: scale(1.1); }
.toolbar-btn svg { width: 18px; height: 18px; }
.toolbar-btn .icon-sun { display: none; }
:root[data-theme="light"] .toolbar-btn .icon-moon { display: none; }
:root[data-theme="light"] .toolbar-btn .icon-sun { display: block; }

/* ===== 全屏时钟舞台 ===== */
.clock-stage {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 0;
}

/* 时钟（无背景圆环） */
.clock-wrap {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px;
}

.time-display {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: clamp(3.2rem, 10vw, 6.5rem);
  font-weight: 200;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  line-height: 1;
  user-select: none;
  text-shadow: 0 0 40px var(--accent-glow);
  transition: text-shadow 0.4s ease, color 0.4s ease;
}

.colon {
  display: inline-block;
  margin: 0 0.04em;
  opacity: 0.5;
}

/* 日期行 */
.date-block {
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  color: var(--text-2);
  letter-spacing: 0.06em;
  line-height: 2;
  word-break: keep-all;
  text-align: center;
  margin-bottom: 32px;
  white-space: nowrap;
}
.date-sep {
  margin: 0 8px;
  opacity: 0.3;
}

/* 名句卡片 */
.quote-card {
  position: relative;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 26px 32px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.35s cubic-bezier(0.16,1,0.3,1), box-shadow 0.3s ease, background 0.4s ease;
  overflow: hidden;
}
.quote-card::before {
  content: '"';
  position: absolute; top: 4px; left: 14px;
  font-family: 'STSong', 'SimSun', 'Songti SC', serif;
  font-size: 4rem; color: var(--accent); opacity: 0.07;
  line-height: 1; pointer-events: none;
  transition: color 0.4s ease;
}
.quote-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-h); }
.quote-card:active { transform: scale(0.985); }

.quote-text {
  font-size: clamp(1.1rem, 2.8vw, 1.45rem);
  font-weight: 500;
  line-height: 1.9;
  color: var(--text-1);
  transition: opacity 0.3s ease, color 0.4s ease;
}
.quote-source {
  font-size: 0.82rem;
  color: var(--text-3);
  margin-top: 12px;
  letter-spacing: 0.04em;
  transition: opacity 0.3s ease;
}

/* 底部抽屉触发提示 */
.drawer-hint {
  position: absolute;
  bottom: 60px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-3);
  transition: color 0.25s ease;
  animation: hintFloat 2.5s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}
.drawer-hint:hover { color: var(--accent); }
.hint-arrow-svg {
  width: 22px; height: 22px;
  display: block;
  opacity: 0.8;
  transition: color 0.4s ease;
}
.hint-text {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

@keyframes hintFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}

/* ===== 抽屉遮罩 ===== */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity 0.38s cubic-bezier(0.16,1,0.3,1);
}
.drawer-overlay.active { opacity: 1; pointer-events: auto; }

/* ===== 底部应用抽屉 ===== */
.app-drawer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 400;
  background: var(--bg-glass);
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -8px 48px rgba(0,0,0,0.3);
  transform: translateY(100%);
  transition: transform 0.42s cubic-bezier(0.16,1,0.3,1), background 0.4s ease;
  max-height: var(--drawer-h);
  overflow: hidden;
  display: flex; flex-direction: column;
}

.app-drawer.open {
  transform: translateY(0);
  max-height: var(--drawer-h);
  overflow-y: auto;
}
.app-drawer.open::-webkit-scrollbar { width: 0; }

/* 拖拽把手区 */
.drawer-handle {
  padding: 12px 20px 4px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  cursor: grab;
  flex-shrink: 0;
}
.handle-bar {
  width: 40px; height: 4px;
  border-radius: 2px;
  background: var(--border);
}

/* 抽屉 Header — 标题居中 */
.drawer-header {
  display: flex; align-items: center; justify-content: center;
  padding: 0 20px 16px;
  flex-shrink: 0;
}
.drawer-title {
  font-size: 0.82rem;
  color: var(--text-3);
  letter-spacing: 0.18em;
  text-align: center;
}

/* 全部应用网格 */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
  padding: 0 20px 32px;
}

/* 应用卡片 */
.app-card {
  text-align: center;
  text-decoration: none;
  color: var(--text-1);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
  border-radius: 0;
  padding: 14px 10px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}
.app-card:hover { transform: translateY(-4px); }
.app-card:active { transform: scale(0.96); }

.app-icon {
  width: 60px; height: 60px;
  border-radius: 15px;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, rgba(196,168,130,0.12), rgba(196,168,130,0.04));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  color: var(--accent);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.25s ease;
}
.app-card:hover .app-icon { transform: scale(1.06); }
.app-icon img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  padding: 6px;
}
.app-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.4;
  word-break: keep-all;
}
.app-desc {
  font-size: 0.62rem;
  color: var(--text-3);
  margin-top: 3px;
}

/* ===== Footer ===== */
.footer {
  flex-shrink: 0;
  position: relative; z-index: 1;
  background: transparent;
}
.footer-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 24px 20px 36px;
  flex-wrap: wrap;
  text-align: center;
  border-top: 1px solid var(--footer-sep);
  transition: border-color 0.4s ease;
}
.qrcode-section {
  display: flex; align-items: center; gap: 10px;
  text-align: left; position: relative; cursor: pointer;
}
.qrcode-img {
  width: 52px; height: 52px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.3s ease;
}
.qrcode-img:hover { transform: scale(1.05); }
.qrcode-tooltip {
  position: absolute;
  bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: var(--bg-glass);
  color: var(--text-2);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.qrcode-tooltip::after {
  content: ''; position: absolute;
  top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--bg-glass);
}
.qrcode-section:hover .qrcode-tooltip { opacity: 1; }
.qrcode-info { display: flex; flex-direction: column; gap: 2px; }
.qrcode-name { font-size: 0.78rem; color: var(--text-2); font-weight: 500; }
.qrcode-hint { font-size: 0.62rem; color: var(--text-3); }
.icp-info { font-size: 0.7rem; color: var(--text-3); line-height: 1.9; }
.icp-info a { color: var(--text-3); text-decoration: none; transition: color 0.2s ease; }
.icp-info a:hover { color: var(--accent); }
.footer-divider-v { width: 1px; height: 36px; background: var(--footer-sep); flex-shrink: 0; }

/* ===== 二维码灯箱 ===== */
.qr-lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16,1,0.3,1);
  backdrop-filter: blur(8px);
}
.qr-lightbox.active { opacity: 1; pointer-events: auto; }
.qr-lightbox-img {
  max-width: 80vw; max-height: 80vh;
  border-radius: var(--r);
  box-shadow: var(--shadow-h);
  border: 1px solid var(--border);
}
.qr-lightbox-close {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
  font-family: inherit; line-height: 1;
}
.qr-lightbox-close:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .quote-card { margin: 0 12px; padding: 20px 18px; }
  .drawer-hint { bottom: 50px; }
  .footer-content { gap: 16px; padding: 18px 16px 28px; }
  .footer-divider-v { display: none; }
  .qrcode-section { flex-direction: column; text-align: center; gap: 6px; }
  .qrcode-info { display: none; }
  .apps-grid { padding: 0 14px 28px; gap: 10px; }
  .app-card { padding: 12px 8px 10px; }
  .app-icon { width: 52px; height: 52px; border-radius: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
