/* ===== Magic Toolbox - 主样式表 ===== */
/* ===== 页面切换动画 ===== */
.page-wrapper {
  display: none;
  padding-bottom: 16px;
  min-height: 100vh;
}
.page-wrapper.active {
  display: block;
  animation: pageSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.page-wrapper.active.slide-out {
  animation: pageSlideOut 0.25s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes pageSlideIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pageSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-24px); }
}

/* 导航点击涟漪效果 */
.nav-item {
  position: relative;
  overflow: hidden;
}
.nav-item::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), var(--primary) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.nav-item:active::after {
  opacity: 0.15;
}
.nav-item:active {
  transform: scale(0.92);
  transition: transform 0.1s;
}

/* ===== CSS Variables ===== */
:root {
  --bg: #0f0f1a;
  --bg-card: rgba(30,30,56,0.85);
  --bg-nav: rgba(15,15,35,0.98);
  --bg-sidebar: #1a1a2e;
  --bg-sidebar-hover: rgba(255,255,255,0.05);
  --bg-sidebar-active: rgba(108,92,231,0.2);
  --text: #e2e8f0;
  --text-secondary: rgba(255,255,255,0.55);
  --text-muted: rgba(255,255,255,0.3);
  --border: rgba(255,255,255,0.07);
  --primary: #6c5ce7;
  --primary-light: #a29bfe;
  --primary-bg: rgba(108,92,231,0.12);
  --accent: #6c5ce7;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #e17055;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.15);
  --sidebar-width: 260px;
}
[data-theme="light"] {
  --bg: #f5f6fa;
  --bg-card: rgba(255,255,255,0.92);
  --bg-nav: rgba(255,255,255,0.98);
  --bg-sidebar: #2d2d44;
  --bg-sidebar-hover: rgba(255,255,255,0.08);
  --bg-sidebar-active: rgba(108,92,231,0.25);
  --text: #2d2d44;
  --text-secondary: rgba(0,0,0,0.5);
  --text-muted: rgba(0,0,0,0.35);
  --border: rgba(0,0,0,0.08);
  --primary: #6c5ce7;
  --primary-light: #a29bfe;
  --primary-bg: rgba(108,92,231,0.08);
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #e17055;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  padding-bottom: 72px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(129,140,248,0.3); border-radius: 4px; }

/* ===== Bottom Navigation ===== */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: 64px;
  background: var(--bg-nav);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  z-index: 9999; padding: 0 8px; padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ===== Desktop Layout (≥900px) ===== */
@media (min-width: 900px) {
  body { padding-bottom: 0; background: var(--bg); }

  /* ===== 顶部导航栏 ===== */
  .desktop-topnav {
    display: flex; align-items: center; justify-content: space-between;
    position: fixed; top: 0; left: 0; right: 0; height: 64px;
    padding: 0 24px;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    z-index: 10000;
  }
  .desktop-topnav .topnav-left {
    display: flex; align-items: center; gap: 24px;
  }
  .desktop-topnav .topnav-logo {
    font-size: 18px; font-weight: 800;
    color: #fff;
    white-space: nowrap;
  }
  [data-theme="light"] .desktop-topnav .topnav-logo {
    color: var(--text);
  }
  .desktop-topnav .topnav-links {
    display: flex; align-items: center; gap: 4px;
  }
  .desktop-topnav .topnav-links a {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.6);
    text-decoration: none; cursor: pointer;
    font-size: 14px; font-weight: 500;
    transition: all 0.2s;
  }
  [data-theme="light"] .desktop-topnav .topnav-links a {
    color: rgba(0,0,0,0.55);
  }
  .desktop-topnav .topnav-links a:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.08);
  }
  [data-theme="light"] .desktop-topnav .topnav-links a:hover {
    color: rgba(0,0,0,0.8);
    background: rgba(0,0,0,0.05);
  }
  .desktop-topnav .topnav-links a.active {
    color: #fff;
    background: rgba(108,92,231,0.25);
  }
  [data-theme="light"] .desktop-topnav .topnav-links a.active {
    color: var(--primary);
    background: rgba(108,92,231,0.1);
  }
  .desktop-topnav .topnav-links a .nav-icon { font-size: 16px; }
  .desktop-topnav .topnav-right {
    display: flex; align-items: center; gap: 12px;
  }
  .desktop-topnav .theme-switch { --toggle-size: 16px; display: flex; align-items: center; }
  .desktop-topnav .update-time { font-size: 12px; color: var(--text-muted); }

  /* ===== 主体布局 ===== */
  .desktop-body {
    margin-top: 64px;
    min-height: calc(100vh - 64px);
    display: flex;
    justify-content: center;
  }
  .desktop-main {
    width: 100%; max-width: 1400px;
    padding: 24px 28px;
  }
  .desktop-content { width: 100%; }

  #bottom-nav { display: none; }
  .top-bar { display: none; }
  .desktop-sidebar { display: none !important; }

  /* ===== AI 状态栏 ===== */
  .ai-status-bar {
    margin: 0 0 20px 0;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: default;
  }

  /* ===== 卡片 ===== */
  .card {
    padding: 20px 24px;
    margin: 0 0 20px 0;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
  }
  .card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
    border-color: var(--border);
  }
  .card-title { font-size: 15px; margin-bottom: 16px; }

  /* ===== 天气 ===== */
  .weather-metrics { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .weather-temp { font-size: 48px; }
  .weather-icon { font-size: 48px; }
  .metric { padding: 12px; }
  .metric b { font-size: 18px; }

  /* ===== 价格 ===== */
  .price-row { padding: 12px 0; }
  .price-name { font-size: 14px; }
  .price-value { font-size: 16px; }

  /* ===== 输入框/按钮 ===== */
  .input-field { padding: 10px 16px; font-size: 14px; }
  .btn { padding: 10px 24px; font-size: 14px; }

  /* ===== Tab ===== */
  .tab-bar { justify-content: flex-start; gap: 6px; padding: 0; flex-wrap: wrap; overflow-x: visible; }
  .tab-item { padding: 7px 16px; font-size: 13px; border-radius: 8px; }

  /* ===== 模式选择 ===== */
  .mode-selector { justify-content: flex-start; }
  .mode-selector .mode-btn { flex: 0 1 auto; padding: 8px 16px; font-size: 13px; }

  /* ===== 家庭页卡片适配 ===== */
  .home-col-card.home-card { border-radius: var(--radius-sm); }
}

/* ===== Mobile (≤899px) ===== */
@media (max-width: 899px) {
  .desktop-topnav { display: none; }
  .desktop-sidebar { display: none; }
  .desktop-main { display: block; }
  /* 手机端隐藏桌面信息栏 */
  .desktop-info { display: none; }
  .desktop-body { display: block; }
  .desktop-content { display: block; }
  .page-sidebar { display: none; }
  #mobileThemeSwitch { display: inline-flex !important; }
  .tab-bar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* 手机端视频提取区域优化 */
  #videoTool .card { padding: 24px 18px !important; margin: 0 12px 16px !important; border-radius: 20px !important; }
  #videoTool .card-title { font-size: 17px !important; margin-bottom: 18px !important; }
  #videoTool .card-title .badge { font-size: 11px !important; padding: 3px 10px !important; }
  .video-input-group { flex-direction: row !important; gap: 10px; min-height: auto; align-items: center; }
  .video-input-group .input-field { font-size: 16px !important; padding: 14px 16px !important; border-radius: 16px !important; min-height: 48px; width: 100% !important; box-sizing: border-box; }
  #clearVideoUrlBtn { display: none; }
  .search-border-wrapper { position: relative; flex: 1 !important; min-width: 0; width: auto !important; }
  .launch-btn-container { flex-shrink: 0; align-self: center !important; width: 80px !important; height: 80px !important; margin: 0; }
  .launch-btn-container #button { width: 80px !important; height: 80px !important; border-radius: 20px !important; }
  .launch-btn-container #to-launch { font-size: 16px !important; }
  .launch-btn-container #shuttle-wrapper #b { width: 46px !important; }
  .launch-btn-container #clickHandler:hover ~ #button { width: 140px !important; height: 140px !important; border-radius: 2rem !important; transform: translate3d(0px, -16px, 0px) rotateX(51deg) rotateZ(43deg) !important; }
  .launch-btn-container #clickHandler:hover ~ #shuttle-wrapper { opacity: 1 !important; }

  .mode-selector { display: flex; flex-wrap: nowrap !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; gap: 12px; margin-top: 18px; padding-bottom: 4px; scrollbar-width: none; }
  .mode-selector::-webkit-scrollbar { display: none; }
  .mode-selector .mode-btn { flex: 0 0 auto !important; padding: 14px 24px !important; font-size: 15px !important; border-radius: 22px !important; min-height: 48px; font-weight: 600; white-space: nowrap; }

  #progressWrap { margin-top: 18px !important; padding: 0; }
  #progressWrap > div:first-child { font-size: 14px !important; }
  #progressBar { height: 10px !important; border-radius: 5px !important; }
  .video-logs { font-size: 14px !important; max-height: 250px !important; padding: 14px 16px !important; margin-top: 14px !important; border-radius: 16px !important; line-height: 1.7; }
  .video-result { margin-top: 18px !important; }
  .video-result video { max-width: 100% !important; max-height: 320px !important; border-radius: 18px !important; }
  .video-result > div:not(video):not(.result-actions) { font-size: 15px !important; line-height: 1.8 !important; padding: 18px !important; border-radius: 16px !important; }
  .video-result .result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
  .video-result .result-actions .btn { flex: 1; min-width: 0; padding: 14px 12px !important; font-size: 15px !important; border-radius: 14px !important; text-align: center; justify-content: center; min-height: 50px; }
  .video-history { margin-top: 18px !important; }
  .video-history-item { padding: 16px 0 !important; font-size: 15px !important; min-height: 52px; }
  .video-history-item > div:first-child > div:first-child { font-size: 15px !important; }
  .history-service-tag { padding: 5px 12px !important; font-size: 13px !important; border-radius: 14px !important; }
  #historyToggleBtn { padding: 16px 20px !important; font-size: 15px !important; border-radius: 16px !important; min-height: 54px; width: 100%; justify-content: center; }
  #historyToggleBtn:active { transform: scale(0.97); opacity: 0.8; }
  .video-history > div:last-child .btn { padding: 12px 24px !important; font-size: 14px !important; min-height: 44px; }
  #settingsModal > div { max-width: 100% !important; margin: 0 16px !important; padding: 24px !important; border-radius: 18px !important; }
  #settingsModal textarea { font-size: 15px !important; min-height: 100px !important; }
}

/* ===== 侧边栏卡片（已移除） ===== */
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--text-secondary); cursor: pointer;
  padding: 6px 12px; border-radius: 12px; transition: all 0.25s ease;
  border: none; background: transparent; min-width: 60px;
}
.nav-item .nav-icon { font-size: 22px; line-height: 1; }
.nav-item .nav-label { font-weight: 500; }
.nav-item.active { color: var(--primary); background: var(--primary-bg); }
[data-theme="light"] .nav-item { color: rgba(0,0,0,0.5); }
[data-theme="light"] .nav-item.active { color: #6366f1; }

/* ===== Top Bar ===== */
.top-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 8px; position: sticky; top: 0; z-index: 100;
  background: rgba(11,11,20,0.85); backdrop-filter: blur(16px);
}
[data-theme="light"] .top-bar { background: rgba(240,242,245,0.85); }
.top-bar .logo { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; }
.top-bar .logo span { background: linear-gradient(135deg, #818cf8, #a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.top-actions button {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: rgba(255,255,255,0.04);
  color: var(--text-secondary); cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all 0.2s; font-size: 16px;
}
.top-actions button:hover { background: rgba(255,255,255,0.1); }

/* ===== AI Status Bar ===== */
.ai-status-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px; margin: 4px 16px 12px;
  background: linear-gradient(135deg, rgba(129,140,248,0.12), rgba(167,139,250,0.08));
  border: 1px solid rgba(129,140,248,0.2);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  min-height: 40px;
  transition: all 0.3s;
  cursor: pointer;
}
.ai-status-bar:hover { border-color: rgba(129,140,248,0.4); }
.ai-status-icon { font-size: 18px; flex-shrink: 0; }
.ai-status-text {
  flex: 1; font-size: 13px; color: var(--text-secondary);
  line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-status-ask, .ai-status-settings {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border); background: rgba(255,255,255,0.06);
  color: var(--text-secondary); cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all 0.2s; font-size: 14px;
}
.ai-status-ask:hover, .ai-status-settings:hover { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }
.ai-status-loading .ai-status-icon { animation: aiPulse 1.5s ease-in-out infinite; }
@keyframes aiPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* ===== Card ===== */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin: 0 16px 16px;
  backdrop-filter: blur(12px); transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.card:hover {
  border-color: rgba(129,140,248,0.2);
  box-shadow: 0 8px 32px rgba(129,140,248,0.06);
  transform: translateY(-1px);
}
[data-theme="light"] .card:hover {
  border-color: rgba(99,102,241,0.2);
  box-shadow: 0 8px 32px rgba(99,102,241,0.08);
}
.card-title {
  font-size: 16px; font-weight: 700; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,0.8);
}
[data-theme="light"] .card-title { color: rgba(0,0,0,0.8); }
.card-title .badge {
  font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 20px;
  background: var(--primary-bg); color: var(--primary); margin-left: auto;
}

/* ===== Loading & Skeleton ===== */
.loading { text-align: center; padding: 30px 0; color: var(--text-muted); font-size: 13px; }
.loading::after { content: '...'; animation: dots 1.5s steps(4,end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, rgba(129,140,248,0.05) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-line {
  height: 14px; margin-bottom: 10px; border-radius: 6px;
}
.skeleton-line:last-child { width: 60%; }
.skeleton-block {
  height: 80px; border-radius: 12px; margin-bottom: 12px;
}

/* 平滑滚动 */
html { scroll-behavior: smooth; }

/* ===== Tabs ===== */
.tab-bar {
  display: flex; gap: 8px; padding: 0 16px; margin-bottom: 16px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-item {
  padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 500;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer; white-space: nowrap;
  transition: all 0.2s; flex-shrink: 0;
}
.tab-item.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Input ===== */
.input-field {
  width: 100%; padding: 12px 16px; border-radius: 12px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; outline: none; transition: all 0.2s;
}
.input-field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(129,140,248,0.15); }
[data-theme="light"] .input-field { background: rgba(0,0,0,0.03); }

/* ===== Button ===== */
.btn {
  padding: 10px 24px; border-radius: 12px; border: none; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--primary); color: #fff;
  position: relative; overflow: hidden;
}
.btn:hover { opacity: 0.92; transform: translateY(-2px); box-shadow: 0 4px 16px rgba(129,140,248,0.25); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-outline {
  background: transparent; border: 1px solid var(--border); color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-bg); box-shadow: none;
}
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }

/* ===== Search Border Effect Wrapper ===== */
.search-border-wrapper {
  isolation: isolate;
  position: relative;
  flex: 1;
  min-width: 0;
}
.search-border-wrapper .input-field {
  position: relative;
  z-index: 1;
  background: #161628;
  border: 2px solid transparent;
  border-radius: 14px;
}
[data-theme="light"] .search-border-wrapper .input-field {
  background: #ffffff;
}

/* ===== Search Border Effect (from PhanDangKhoa96) ===== */
.search-border-wrapper .pink-overlay {
  position: absolute;
  left: -0.75rem;
  top: 50%;
  border-radius: 9999px;
  width: 5rem;
  height: 5rem;
  transition: all 500ms cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  filter: blur(24px) drop-shadow(0 0 60px #b43598);
  background: #b43598;
  z-index: 0;
  pointer-events: none;
  translate: 0 -50%;
}

.search-border-wrapper .blue-overlay {
  position: absolute;
  right: -1.25rem;
  top: 66.666667%;
  border-radius: 9999px;
  transition: all 500ms cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  filter: blur(24px) drop-shadow(0 0 60px #120d57);
  height: 100px;
  width: 100px;
  z-index: 0;
  pointer-events: none;
  background: #120d57;
  translate: 0 -50%;
}

.search-gradient-box {
  --border-angle: 0turn;
  --main-bg: conic-gradient(
    from var(--border-angle),
    rgba(0, 0, 0, 0.1),
    rgba(0, 0, 0, 0.1) 100%
  );
  --gradient-border: conic-gradient(
    from var(--border-angle),
    transparent 25%,
    rgba(255,255,255,0.8) 28%,
    transparent 30%,
    transparent 60%,
    transparent 73%,
    rgba(255,255,255,0.8) 78%,
    transparent 80%
  );
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  border-color: transparent;
  border-style: solid;
  height: calc(100% + 6px);
  width: calc(100% + 6px);
  border-width: 2px;
  filter: blur(2px);
  z-index: 0;
  pointer-events: none;
  border-radius: 14px;
  background: var(--main-bg) padding-box, var(--gradient-border) border-box, var(--main-bg) border-box;
  background-position: center center;
  animation: search-border-spin 5s linear infinite forwards;
}

.search-border-wrapper:hover .pink-overlay {
  width: 8rem;
  height: 8rem;
  filter: blur(20px) drop-shadow(0 0 80px #b43598);
}

.search-border-wrapper:hover .blue-overlay {
  width: 8rem;
  height: 8rem;
  filter: blur(20px) drop-shadow(0 0 80px #120d57);
}

[data-theme="light"] .search-border-wrapper .pink-overlay {
  background: #f472b6;
  filter: blur(24px) drop-shadow(0 0 60px #f472b6);
}
[data-theme="light"] .search-border-wrapper .blue-overlay {
  background: #818cf8;
  filter: blur(24px) drop-shadow(0 0 60px #818cf8);
}
[data-theme="light"] .search-border-wrapper:hover .pink-overlay {
  filter: blur(20px) drop-shadow(0 0 80px #f472b6);
}
[data-theme="light"] .search-border-wrapper:hover .blue-overlay {
  filter: blur(20px) drop-shadow(0 0 80px #818cf8);
}
[data-theme="light"] .search-gradient-box {
  --gradient-border: conic-gradient(
    from var(--border-angle),
    transparent 25%,
    rgba(99,102,241,0.5) 28%,
    transparent 30%,
    transparent 60%,
    transparent 73%,
    rgba(99,102,241,0.5) 78%,
    transparent 80%
  );
}

@keyframes search-border-spin {
  to { --border-angle: 1turn; }
}

@property --border-angle {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0turn;
}

/* ===== kennyotsu Launch Button (adapted from Uiverse) ===== */
.video-input-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.launch-btn-container {
  flex-shrink: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 80px;
  height: 80px;
  color: rgb(131, 131, 131);
  transition: 400ms ease-in-out;
}

.launch-btn-container #clickHandler {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 999;
  cursor: pointer;
}

.launch-btn-container #launchCheckbox {
  display: none;
  position: absolute;
  bottom: 0;
  width: 56px;
}

.launch-btn-container #button {
  width: 80px;
  height: 80px;
  border: none;
  border-radius: 18px;
  transition: 0.4s ease-in-out;
  box-shadow: 5px 5px 8px 0 rgba(28, 27, 88, 0.315);
  background: linear-gradient(125deg, #ffffff 50%, #f5f5ff);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: inherit;
  transition-delay: 100ms;
  position: relative;
  overflow: visible;
  cursor: pointer;
}

.launch-btn-container #to-launch {
  color: rgb(1, 85, 255);
  font-size: 17px;
  font-weight: bold;
  transition: ease-out 200ms;
  white-space: nowrap;
  position: relative;
  z-index: 2;
}

.launch-btn-container #platform {
  position: absolute;
  width: 70%;
  height: 0;
  border-radius: 12px;
  background-color: rgb(234, 234, 234);
  transition: 0.3s ease-in-out;
  transition-delay: 150ms;
  border: solid 0px rgba(42, 42, 42, 0);
  outline: dashed rgba(255, 173, 57, 0);
  outline-width: 0px;
  outline-offset: 0px;
}

.launch-btn-container #shuttle-wrapper {
  position: absolute;
  bottom: calc(100% - 2px);
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: 200ms ease-in;
  z-index: 200;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.launch-btn-container #shuttle-wrapper #b {
  width: 40px;
  height: auto;
  z-index: 200;
  display: block;
}

.launch-btn-container #shadow {
  position: absolute;
  width: 50px;
  height: 30px;
  transform: rotateX(45deg) rotateZ(45deg);
  bottom: -8px;
  z-index: -1;
  background: radial-gradient(rgba(0, 0, 0, 0.382) 0%, rgba(0, 0, 0, 0) 70%);
}

.launch-btn-container .caution {
  position: absolute;
  width: 100%;
  text-align: center;
  pointer-events: none;
}

.launch-btn-container #caution-left {
  transition: 200ms ease;
  opacity: 0;
  transform: translate3d(48px, 0px, 0px) rotateZ(-90deg);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 2px;
  white-space: nowrap;
}

.launch-btn-container #caution-right {
  transition: 200ms ease;
  opacity: 0;
  transform: translate3d(0px, 38px, 0px);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 2px;
  white-space: nowrap;
}

.launch-btn-container:hover {
  transform: translateY(4px);
}

.launch-btn-container #clickHandler:hover ~ #button {
  width: 150px;
  height: 150px;
  border-radius: 2.2rem;
  transform: translate3d(0px, -16px, 0px) rotateX(51deg) rotateZ(43deg);
  box-shadow: 2px 2px 0 2px #b2b2b2, -1px 0 28px 0 rgba(255, 250, 225, 0.512),
    28px 28px 28px 0 rgba(28, 27, 88, 0.315);
  transition-delay: 0ms;
}

.launch-btn-container #clickHandler:hover ~ #button #to-launch {
  opacity: 0;
}

.launch-btn-container #clickHandler:hover ~ #button #platform {
  height: 60%;
  background: rgb(244, 244, 244);
  border: solid 3px rgb(42, 42, 42);
  outline: dashed rgb(255, 172, 57);
  outline-width: 3px;
  outline-offset: -3px;
  animation: shake_010 80ms infinite;
}

.launch-btn-container #clickHandler:hover ~ #button .caution #caution-left {
  opacity: 1;
  transition: 400ms ease-in;
  animation: glow_010 1.2s infinite;
}

.launch-btn-container #clickHandler:hover ~ #button .caution #caution-right {
  opacity: 1;
  transition: 400ms ease-in;
  animation: glow_010 1.2s infinite;
}

.launch-btn-container #clickHandler:hover ~ #shuttle-wrapper {
  opacity: 1;
  transform: translateX(-50%);
  transition: 300ms ease-in-out;
}

.launch-btn-container #launchCheckbox:checked ~ #shuttle-wrapper {
  opacity: 1;
  transform: translateX(-50%);
}

.launch-btn-container #launchCheckbox:checked ~ #shuttle-wrapper #b {
  animation-name: launch_31;
  animation-timing-function: ease-in-out;
  animation-duration: 6s;
}

.launch-btn-container #launchCheckbox:checked ~ #shuttle-wrapper #shadow {
  animation: shadow-launch 6s ease-in-out;
}

.launch-btn-container #launchCheckbox:checked ~ #button #to-launch {
  animation-name: fadeout_010;
  animation-duration: 6s;
}

[data-theme="dark"] .launch-btn-container #button {
  background: linear-gradient(125deg, #2a2a4a 50%, #1e1e3a);
  box-shadow: 5px 5px 8px 0 rgba(0,0,0,0.4);
}
.launch-btn-container #button {
  background: linear-gradient(125deg, #ffffff 50%, #f5f5ff);
}
[data-theme="dark"] .launch-btn-container #to-launch {
  color: #818cf8;
}
[data-theme="dark"] .launch-btn-container #clickHandler:hover ~ #button {
  background: linear-gradient(125deg, #2a2a4a 50%, #1e1e3a) !important;
  box-shadow: 2px 2px 0 2px #3a3a5a, -1px 0 28px 0 rgba(129,140,248,0.2),
    28px 28px 28px 0 rgba(0,0,0,0.4);
}
[data-theme="dark"] .launch-btn-container #clickHandler:hover ~ #button #platform {
  background: #2a2a4a;
  border-color: #818cf8;
  outline-color: rgba(129,140,248,0.3);
}
[data-theme="dark"] .launch-btn-container #clickHandler:hover ~ #button .caution {
  color: #818cf8;
}

@keyframes launch_31 {
  5% { opacity: 1; }
  15%, 90% {
    transform: translateY(-200px);
    transition-timing-function: ease-in;
    opacity: 0;
  }
  100% { opacity: 1; }
}

@keyframes shadow-launch {
  0% { opacity: 1; }
  10%, 90% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes fadeout_010 {
  100% { opacity: 1; }
  0%, 20%, 90% { opacity: 0; }
}

@keyframes shake_010 {
  0%, 50% { transform: translate3d(1px, 0px, 0px); }
  100% { transform: translate3d(0px, 1px, 0px); }
}

@keyframes glow_010 {
  0% {
    color: rgb(94, 94, 94);
    filter: drop-shadow(0 0 0.75rem rgb(255, 214, 90));
  }
  70% { color: rgba(255, 255, 255, 0); }
  100% {
    color: rgb(94, 94, 94);
    filter: drop-shadow(0 0 0.75rem rgb(255, 214, 90));
  }
}

/* ===== Mode Selector ===== */
.mode-selector { display: flex; gap: 8px; margin-top: 10px; }
.mode-selector .mode-btn { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all 0.2s; white-space: nowrap; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); }

/* ===== Grid ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ===== Weather ===== */
.weather-main { display: flex; align-items: center; gap: 16px; padding: 10px 0; }
.weather-temp { font-size: 48px; font-weight: 200; line-height: 1; }
.weather-icon { font-size: 48px; }
.weather-desc { font-size: 14px; color: var(--text-secondary); }
.weather-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }

.metric { text-align: center; padding: 12px; background: rgba(255,255,255,0.03); border-radius: 12px; }
.metric small { font-size: 11px; color: var(--text-muted); }
.metric b { display: block; font-size: 18px; margin: 4px 0; }
.metric em { font-size: 11px; color: var(--text-secondary); font-style: normal; }

/* ===== Weather Forecast - MSN Style Cards ===== */
.weather-forecast-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 4px 12px 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.weather-forecast-scroll::-webkit-scrollbar {
  height: 4px;
}
.weather-forecast-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.weather-day-card {
  flex-shrink: 0;
  scroll-snap-align: start;
  text-align: center;
  padding: 14px 14px 12px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  min-width: 88px;
  backdrop-filter: blur(8px);
  transition: transform 0.2s, box-shadow 0.2s;
}
.weather-day-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.weather-day-card.today {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 1px var(--primary);
}
.weather-day-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.weather-day-week {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.weather-day-icon {
  font-size: 28px;
  margin: 6px 0 4px;
  line-height: 1.2;
}
.weather-day-cond {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  white-space: nowrap;
}
.weather-day-temps {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.weather-day-high {
  color: #f87171;
}
.weather-day-sep {
  color: var(--text-muted);
  margin: 0 2px;
  font-weight: 400;
}
.weather-day-low {
  color: #60a5fa;
}
.weather-day-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.weather-day-icon-small {
  font-size: 18px;
  margin: 2px 0;
  line-height: 1.2;
}
.weather-day-cond-small {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===== Gold/Fuel Price ===== */
.price-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.price-row:last-child { border-bottom: none; }
.price-name { font-size: 14px; }
.price-value { font-size: 16px; font-weight: 700; color: var(--primary); }
.price-unit { font-size: 12px; color: var(--text-muted); margin-left: 4px; }
.price-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--primary-bg); color: var(--primary); }

/* ===== Math ===== */
.math-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.math-btn {
  padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary); cursor: pointer;
  font-size: 13px; transition: all 0.2s;
}
.math-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.math-print-area {
  margin-top: 16px; padding: 16px; border-radius: 12px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
}
.math-print-area .print-header {
  text-align: center; font-size: 14px; font-weight: 700; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.math-line { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 2px; }
.math-item { font-size: 14px; padding: 3px 2px; display: flex; align-items: center; gap: 2px; color: var(--text); }
.m-ans { display: inline-block; border-bottom: 1.5px solid var(--text-secondary); width: 30px; height: 14px; margin-left: 2px; }
.m-gap { display: inline-block; border-bottom: 1.5px solid var(--text-secondary); width: 22px; height: 14px; margin: 0 2px; }
.m-circle { display: inline-block; border: 1.5px solid var(--text-secondary); width: 16px; height: 16px; border-radius: 50%; margin: 0 2px; }

/* ===== Video ===== */
.video-input-group { display: flex; gap: 8px; }
.video-input-group .input-field { flex: 1; min-width: 0; }
.video-result { margin-top: 16px; }
.video-result video { width: 100%; max-width: 400px; max-height: 300px; border-radius: 12px; display: block; margin: 0 auto; }
.video-history { margin-top: 12px; }
.video-history-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
  cursor: pointer; color: var(--text-secondary);
}
.video-history-item:hover { color: var(--primary); }
[data-theme="light"] .video-history-item { color: rgba(0,0,0,0.5); }
[data-theme="light"] .video-history-item:hover { color: #6366f1; }

/* ===== AI ===== */
.ai-textarea { width: 100%; min-height: 120px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,0.05); color: var(--text); font-size: 14px; resize: vertical; outline: none; }
.ai-result { margin-top: 12px; padding: 16px; border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); white-space: pre-wrap; font-size: 14px; line-height: 1.6; display: none; }

/* ===== OCR ===== */
.ocr-upload {
  border: 2px dashed var(--border); border-radius: 16px; padding: 40px 20px;
  text-align: center; cursor: pointer; transition: all 0.3s;
  background: rgba(255,255,255,0.02);
}
.ocr-upload:hover { border-color: var(--primary); background: rgba(129,140,248,0.05); }
.ocr-icon { font-size: 48px; margin-bottom: 12px; }
.ocr-text { font-size: 15px; color: var(--text-secondary); margin-bottom: 6px; }
.ocr-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.ocr-preview { margin-top: 16px; }
.ocr-preview img { max-width: 100%; max-height: 400px; border-radius: 12px; border: 1px solid var(--border); }
.ocr-result { margin-top: 16px; }

/* ===== Print ===== */
@media print {
  @page { size: A4; margin: 15mm 12mm; }
  #bottom-nav, .top-bar, .top-actions, .btn, .tab-bar, .math-controls, .video-input-group, .video-history, .ai-textarea, #aiBtn, #aiClear, .input-field { display: none !important; }
  body { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .page-wrapper { display: none !important; min-height: auto !important; }
  .page-wrapper.active { display: block !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; background: #fff !important; backdrop-filter: none !important; }
  .card-title { color: #000 !important; }
  .math-print-area { background: #fff !important; border: none !important; padding: 0 !important; }
  .math-print-area .print-header { color: #000 !important; border-color: #333 !important; }
  .math-item { color: #000 !important; font-size: 15px !important; }
  .m-ans { border-color: #333 !important; }
  .m-gap { border-color: #333 !important; }
  .m-circle { border-color: #333 !important; }
  .loading { color: #666 !important; }
  .badge { color: #666 !important; background: #f0f0f0 !important; }
  .weather-temp { color: #000 !important; }
  .weather-desc { color: #666 !important; }
  .metric { background: #f5f5f5 !important; }
  .metric small, .metric em { color: #666 !important; }
  .metric b { color: #000 !important; }
  .price-row { border-color: #ddd !important; }
  .price-name { color: #000 !important; }
  .price-value { color: #000 !important; }
  .price-unit { color: #666 !important; }
  .price-tag { color: #666 !important; background: #f0f0f0 !important; }
  .video-result video { max-width: 100% !important; max-height: 250px !important; }
  .ai-result { border-color: #ddd !important; color: #000 !important; background: #fff !important; }
  .ocr-upload, .ocr-preview, .ocr-result { display: none !important; }
}

/* ===== Toast ===== */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  padding: 10px 24px; border-radius: 12px; font-size: 14px; font-weight: 500;
  z-index: 99999; animation: toastIn 0.3s ease; pointer-events: none;
  backdrop-filter: blur(12px);
}
.toast.info { background: rgba(129,140,248,0.9); color: #fff; }
.toast.success { background: rgba(52,211,153,0.9); color: #fff; }
.toast.error { background: rgba(248,113,113,0.9); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== Responsive (≤480px) ===== */
@media (max-width: 480px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
  .weather-temp { font-size: 36px; }
}

/* ===== Theme Switch (from Galahhad) ===== */
.theme-switch {
  --toggle-size: 30px;
  --container-width: 5.625em;
  --container-height: 2.5em;
  --container-radius: 6.25em;
  --container-light-bg: #3D7EAE;
  --container-night-bg: #1D1F2C;
  --circle-container-diameter: 3.375em;
  --sun-moon-diameter: 2.125em;
  --sun-bg: #ECCA2F;
  --moon-bg: #C4C9D1;
  --spot-color: #959DB1;
  --circle-container-offset: calc((var(--circle-container-diameter) - var(--container-height)) / 2 * -1);
  --stars-color: #fff;
  --clouds-color: #F3FDFF;
  --back-clouds-color: #AACADF;
  --transition: .5s cubic-bezier(0, -0.02, 0.4, 1.25);
  --circle-transition: .3s cubic-bezier(0, -0.02, 0.35, 1.17);
}

.theme-switch, .theme-switch *, .theme-switch *::before, .theme-switch *::after {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-size: var(--toggle-size);
}

.theme-switch__container {
  width: var(--container-width);
  height: var(--container-height);
  background-color: var(--container-light-bg);
  border-radius: var(--container-radius);
  overflow: hidden;
  cursor: pointer;
  -webkit-box-shadow: 0em -0.062em 0.062em rgba(0, 0, 0, 0.25), 0em 0.062em 0.125em rgba(255, 255, 255, 0.94);
  box-shadow: 0em -0.062em 0.062em rgba(0, 0, 0, 0.25), 0em 0.062em 0.125em rgba(255, 255, 255, 0.94);
  -webkit-transition: var(--transition);
  -o-transition: var(--transition);
  transition: var(--transition);
  position: relative;
}

.theme-switch__container::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  -webkit-box-shadow: 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset, 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset;
  box-shadow: 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset, 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset;
  border-radius: var(--container-radius)
}

.theme-switch__checkbox {
  display: none;
}

.theme-switch__circle-container {
  width: var(--circle-container-diameter);
  height: var(--circle-container-diameter);
  background-color: rgba(255, 255, 255, 0.1);
  position: absolute;
  left: var(--circle-container-offset);
  top: var(--circle-container-offset);
  border-radius: var(--container-radius);
  -webkit-box-shadow: inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), 0 0 0 0.625em rgba(255, 255, 255, 0.1), 0 0 0 1.25em rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), 0 0 0 0.625em rgba(255, 255, 255, 0.1), 0 0 0 1.25em rgba(255, 255, 255, 0.1);
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-transition: var(--circle-transition);
  -o-transition: var(--circle-transition);
  transition: var(--circle-transition);
  pointer-events: none;
}

.theme-switch__sun-moon-container {
  pointer-events: auto;
  position: relative;
  z-index: 2;
  width: var(--sun-moon-diameter);
  height: var(--sun-moon-diameter);
  margin: auto;
  border-radius: var(--container-radius);
  background-color: var(--sun-bg);
  -webkit-box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #a1872a inset;
  box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #a1872a inset;
  -webkit-filter: drop-shadow(0.062em 0.125em 0.125em rgba(0, 0, 0, 0.25)) drop-shadow(0em 0.062em 0.125em rgba(0, 0, 0, 0.25));
  filter: drop-shadow(0.062em 0.125em 0.125em rgba(0, 0, 0, 0.25)) drop-shadow(0em 0.062em 0.125em rgba(0, 0, 0, 0.25));
  overflow: hidden;
  -webkit-transition: var(--transition);
  -o-transition: var(--transition);
  transition: var(--transition);
}

.theme-switch__moon {
  -webkit-transform: translateX(100%);
  -ms-transform: translateX(100%);
  transform: translateX(100%);
  width: 100%;
  height: 100%;
  background-color: var(--moon-bg);
  border-radius: inherit;
  -webkit-box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #969696 inset;
  box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #969696 inset;
  -webkit-transition: var(--transition);
  -o-transition: var(--transition);
  transition: var(--transition);
  position: relative;
}

.theme-switch__spot {
  position: absolute;
  top: 0.75em;
  left: 0.312em;
  width: 0.75em;
  height: 0.75em;
  border-radius: var(--container-radius);
  background-color: var(--spot-color);
  -webkit-box-shadow: 0em 0.0312em 0.062em rgba(0, 0, 0, 0.25) inset;
  box-shadow: 0em 0.0312em 0.062em rgba(0, 0, 0, 0.25) inset;
}

.theme-switch__spot:nth-of-type(2) {
  width: 0.375em;
  height: 0.375em;
  top: 0.937em;
  left: 1.375em;
}

.theme-switch__spot:nth-last-of-type(3) {
  width: 0.25em;
  height: 0.25em;
  top: 0.312em;
  left: 0.812em;
}

.theme-switch__clouds {
  width: 1.25em;
  height: 1.25em;
  background-color: var(--clouds-color);
  border-radius: var(--container-radius);
  position: absolute;
  bottom: -0.625em;
  left: 0.312em;
  -webkit-box-shadow: 0.937em 0.312em var(--clouds-color), -0.312em -0.312em var(--back-clouds-color), 1.437em 0.375em var(--clouds-color), 0.5em -0.125em var(--back-clouds-color), 2.187em 0 var(--clouds-color), 1.25em -0.062em var(--back-clouds-color), 2.937em 0.312em var(--clouds-color), 2em -0.312em var(--back-clouds-color), 3.625em -0.062em var(--clouds-color), 2.625em 0em var(--back-clouds-color), 4.5em -0.312em var(--clouds-color), 3.375em -0.437em var(--back-clouds-color), 4.625em -1.75em 0 0.437em var(--clouds-color), 4em -0.625em var(--back-clouds-color), 4.125em -2.125em 0 0.437em var(--back-clouds-color);
  box-shadow: 0.937em 0.312em var(--clouds-color), -0.312em -0.312em var(--back-clouds-color), 1.437em 0.375em var(--clouds-color), 0.5em -0.125em var(--back-clouds-color), 2.187em 0 var(--clouds-color), 1.25em -0.062em var(--back-clouds-color), 2.937em 0.312em var(--clouds-color), 2em -0.312em var(--back-clouds-color), 3.625em -0.062em var(--clouds-color), 2.625em 0em var(--back-clouds-color), 4.5em -0.312em var(--clouds-color), 3.375em -0.437em var(--back-clouds-color), 4.625em -1.75em 0 0.437em var(--clouds-color), 4em -0.625em var(--back-clouds-color), 4.125em -2.125em 0 0.437em var(--back-clouds-color);
  -webkit-transition: 0.5s cubic-bezier(0, -0.02, 0.4, 1.25);
  -o-transition: 0.5s cubic-bezier(0, -0.02, 0.4, 1.25);
  transition: 0.5s cubic-bezier(0, -0.02, 0.4, 1.25);
}

.theme-switch__stars-container {
  position: absolute;
  color: var(--stars-color);
  top: -100%;
  left: 0.312em;
  width: 2.75em;
  height: auto;
  -webkit-transition: var(--transition);
  -o-transition: var(--transition);
  transition: var(--transition);
}

.theme-switch__checkbox:checked + .theme-switch__container {
  background-color: var(--container-night-bg);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container {
  left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter));
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container:hover {
  left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter) - 0.187em)
}

.theme-switch__circle-container:hover {
  left: calc(var(--circle-container-offset) + 0.187em);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__moon {
  -webkit-transform: translate(0);
  -ms-transform: translate(0);
  transform: translate(0);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__clouds {
  bottom: -4.062em;
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__stars-container {
  top: 50%;
  -webkit-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  transform: translateY(-50%);
}

.theme-switch--mobile {
  --toggle-size: 14px;
}

/* ===== 家庭页-用电统计双账号布局 ===== */
.elec-dual-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 100%;
}

.elec-column {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}

.elec-col-header {
  padding: 12px 16px;
  background: rgba(99, 102, 241, 0.08);
  border-bottom: 1px solid var(--border);
}

.elec-col-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.elec-col-number {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.elec-col-body {
  padding: 12px;
}

.elec-summary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.elec-summary-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.elec-summary-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.elec-summary-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.elec-summary-value small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

.elec-summary-value.primary { color: var(--primary); }
.elec-summary-value.danger { color: var(--danger); }
.elec-summary-value.success { color: var(--success); }

.elec-calendar { margin-bottom: 10px; }

.elec-cal-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.elec-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.elec-cal-weekday {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  padding: 3px 0;
  font-weight: 600;
}

.elec-cal-cell {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px;
  text-align: center;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.elec-cal-empty { background: transparent; border-color: transparent; }
.elec-cal-today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.elec-cal-future { opacity: 0.3; }

.elec-cal-day {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
}

.elec-cal-kwh {
  font-size: 9px;
  color: var(--primary);
  line-height: 1.2;
  font-weight: 500;
}

.elec-cal-cost {
  font-size: 8px;
  color: var(--danger);
  line-height: 1.2;
}

.elec-monthly-table { margin-bottom: 10px; }

.elec-monthly-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.elec-monthly-table th {
  padding: 5px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
}

.elec-monthly-table td {
  padding: 4px 6px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  color: var(--text);
}

.elec-monthly-table tr:hover td { background: var(--bg-hover); }

.elec-year-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.elec-year-summary > div {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
}

.elec-year-summary > div span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.elec-year-summary > div strong {
  font-size: 15px;
  color: var(--text);
}

@media (max-width: 900px) {
  .elec-dual-columns { grid-template-columns: 1fr; }
}

/* ===== 家庭页-固定布局（三行） ===== */
.home-layout {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 行 */
.home-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

/* 第一行：三列等宽 */
.home-row-top .home-col {
  flex: 1;
  min-width: 0;
}

/* 全宽列（日历、电费） */
.home-col-full {
  width: 100%;
}

/* 卡片样式 */
.home-col-card.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(12px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* 卡片通用样式 */
.home-card-title {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
[data-theme="light"] .home-card-title { color: rgba(0,0,0,0.8); }
.home-card-body {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
}
.home-card-btn {
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}

/* 天气卡片 — 小方块，带渐变背景 */
.home-card-weather {
  cursor: pointer;
  background: linear-gradient(135deg, rgba(74,144,226,0.08), rgba(255,255,255,0.03));
  border: 1px solid rgba(74,144,226,0.2);
}

/* 响应式：手机端第一行改为纵向排列 */
@media (max-width: 899px) {
  .home-row-top {
    flex-direction: column;
  }
  .home-row-top .home-col {
    width: 100%;
  }
}

/* ===== 家庭页-事件标签块布局 ===== */
.events-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.events-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid;
  font-size: 11px;
  white-space: nowrap;
}
.events-tag-time {
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ===== 家庭页-日历（桌面大号 + 手机适配） ===== */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-nav-btn {
  padding: 4px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  line-height: 1.2;
}
.cal-nav-title {
  font-size: 18px;
  font-weight: 700;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 3px;
}
.cal-weekday {
  text-align: center;
  font-size: 13px;
  padding: 4px 0;
  color: var(--text-muted);
  font-weight: 600;
}
.cal-weekday.cal-weekend {
  color: #ef4444;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-cell {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 50px;
  padding: 2px;
}
.cal-cell:hover {
  background: rgba(255,255,255,0.08) !important;
}

.cal-day-num {
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
}
.cal-day-num.cal-day-today {
  font-weight: 700;
}

.cal-weather-icon {
  font-size: 16px;
  line-height: 1.1;
  margin-top: 1px;
}
.cal-weather-temp {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.1;
  white-space: nowrap;
}

.cal-lunar {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.1;
  margin-top: 1px;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 95%;
}
.cal-holiday-name {
  color: #fbbf24;
  opacity: 1;
}

.cal-legend {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  justify-content: center;
  flex-wrap: wrap;
}

/* 手机端：缩小字体和间距 */
@media (max-width: 899px) {
  .cal-nav-title { font-size: 15px; }
  .cal-nav-btn { padding: 3px 10px; font-size: 14px; }
  .cal-weekday { font-size: 11px; padding: 3px 0; }
  .cal-grid { gap: 1px; }
  .cal-cell { min-height: 40px; border-radius: 5px; padding: 1px; }
  .cal-day-num { font-size: 16px; }
  .cal-weather-icon { font-size: 12px; }
  .cal-weather-temp { font-size: 9px; }
  .cal-lunar { font-size: 10px; }
  .cal-legend { font-size: 10px; gap: 6px; margin-top: 6px; }
}

/* rocket.svg 装饰 — 天气卡片右下角 */
.home-rocket-deco {
  position: absolute;
  right: 10px;
  bottom: 6px;
  width: 28px;
  height: auto;
  opacity: 0.12;
  pointer-events: none;
  transform: rotate(30deg);
  transition: opacity 0.3s, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.home-card-weather:hover .home-rocket-deco {
  opacity: 0.3;
  transform: rotate(30deg) translateY(-3px) scale(1.1);
}
