:root {
  --bg-primary: #f8fafc;
  --bg-primary-rgb: 248, 250, 252;
  --bg-secondary: #ffffff;
  --bg-secondary-rgb: 255, 255, 255;
  --bg-card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --accent: #e11d48;
  --accent-rgb: 225, 29, 72;
  --accent-hover: #be123c;
  --accent-gold: #f59e0b;
  --accent-gold-hover: #d97706;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --header-height: 56px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-primary-rgb: 15, 23, 42;
  --bg-secondary: #1e293b;
  --bg-secondary-rgb: 30, 41, 59;
  --bg-card: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #fb7185;
  --accent-rgb: 251, 113, 133;
  --accent-hover: #f43f5e;
  --accent-gold: #fbbf24;
  --accent-gold-hover: #f59e0b;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --info: #60a5fa;
  --border: #334155;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.6; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }

/* Header Navigation */
.header { position: fixed; top: 0; left: 0; right: 0; height: var(--header-height); background: var(--bg-secondary); border-bottom: 1px solid var(--border); z-index: 100; backdrop-filter: blur(10px); background: rgba(var(--bg-secondary-rgb, 255, 255, 255), 0.95); box-shadow: var(--shadow-sm); }
.header-container { width: 100%; margin: 0 auto; padding: 0 0.5rem; height: 100%; display: flex; align-items: center; justify-content: space-between; }
.header-brand { display: flex; align-items: center; gap: 0.3rem; font-weight: 800; font-size: 0.9rem; color: var(--text-primary); text-decoration: none; flex-shrink: 0; min-width: 0; }
.header-brand:hover { text-decoration: none; color: var(--accent); }
.brand-icon { font-size: 1.1rem; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-nav { flex: 1; display: flex; justify-content: center; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; min-width: 0; }
.header-nav::-webkit-scrollbar { display: none; }
.header-nav-list { display: flex; align-items: center; gap: 0; padding: 0; list-style: none; }
.header-nav-link { display: flex; align-items: center; gap: 0.2rem; padding: 0.4rem 0.5rem; border-radius: var(--radius-sm); color: var(--text-secondary); font-weight: 500; font-size: 0.75rem; text-decoration: none; transition: all 0.2s ease; white-space: nowrap; flex-shrink: 0; }
.header-nav-link:hover { background: rgba(var(--accent-rgb), 0.1); color: var(--accent); text-decoration: none; }
.header-nav-link.active { background: var(--accent); color: white; box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3); }
.header-nav-link .nav-icon { font-size: 0.85rem; }
.header-extras { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.lang-selector { position: relative; }
.lang-toggle { display: flex; align-items: center; gap: 0.25rem; padding: 0.3rem 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-primary); color: var(--text-primary); cursor: pointer; transition: all 0.2s ease; font-size: 0.75rem; }
.lang-toggle:hover { background: var(--border); }
.lang-toggle svg { width: 14px; height: 14px; }
.lang-menu { position: absolute; top: calc(100% + 0.5rem); right: 0; min-width: 160px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 0.5rem; display: none; flex-direction: column; gap: 0.25rem; z-index: 200; }
.lang-menu.active { display: flex; }
.lang-option { display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.65rem 1rem; border: none; background: transparent; color: var(--text-primary); cursor: pointer; border-radius: 4px; transition: all 0.2s ease; }
.lang-option:hover { background: var(--bg-primary); }
.lang-option.active { background: var(--accent); color: white; }
.theme-toggle { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: none; background: var(--bg-primary); border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary); transition: all 0.2s ease; }
.theme-toggle:hover { background: var(--border); color: var(--text-primary); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* Mobile Menu Toggle */
.mobile-menu-toggle { display: none; flex-direction: column; justify-content: space-between; width: 22px; height: 16px; background: none; border: none; cursor: pointer; padding: 0; }
.mobile-menu-toggle span { display: block; width: 100%; height: 2px; background: var(--text-primary); border-radius: 2px; transition: all 0.3s ease; }
.mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile Drawer */
.mobile-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 200; display: none; }
.mobile-drawer.open { display: block; }
.mobile-drawer-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.3s ease; }
.mobile-drawer.open .mobile-drawer-overlay { opacity: 1; }
.mobile-drawer-content { position: absolute; top: 0; right: 0; bottom: 0; width: 280px; max-width: 85vw; background: var(--bg-secondary); border-left: 1px solid var(--border); box-shadow: var(--shadow-xl); transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; }
.mobile-drawer.open .mobile-drawer-content { transform: translateX(0); }
.mobile-drawer-list { flex: 1; padding: calc(var(--header-height) + 1rem) 1rem 1rem; list-style: none; display: flex; flex-direction: column; gap: 0.25rem; overflow-y: auto; }
.mobile-drawer-link { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; border-radius: var(--radius-sm); color: var(--text-secondary); font-weight: 500; text-decoration: none; transition: all 0.2s ease; }
.mobile-drawer-link:hover { background: rgba(var(--accent-rgb), 0.1); color: var(--accent); text-decoration: none; }
.mobile-drawer-link.active { background: var(--accent); color: white; }
.mobile-drawer-link .nav-icon { font-size: 1.25rem; width: 24px; text-align: center; }
.mobile-drawer-footer { padding: 1rem; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.mobile-drawer-footer .lang-selector { flex: 1; min-width: 140px; }
.mobile-drawer-footer .lang-toggle { width: 100%; justify-content: center; }
.mobile-drawer-footer .theme-toggle { flex-shrink: 0; }

#mainContent { padding-top: calc(var(--header-height) + 1.5rem); padding-bottom: 3rem; min-height: 100vh; }
.container { max-width: 1000px; margin: 0 auto; padding: 0 1.5rem; }
.section { margin-bottom: 3rem; }
.section-title { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; padding-bottom: 0.75rem; border-bottom: 2px solid var(--border); font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.section-icon { font-size: 1.5rem; color: var(--accent); }
.hero-section { text-align: center; padding: 3rem 1rem; margin-bottom: 2rem; background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-md); position: relative; overflow: hidden; }
.hero-section::before { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(var(--accent-rgb), 0.1) 0%, transparent 50%); animation: heroGlow 8s ease-in-out infinite; }
@keyframes heroGlow { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(20px, 20px); } }
.hero-title { font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 900; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-gold) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 1rem; position: relative; z-index: 1; text-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.hero-subtitle { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 1.5rem; }
.hero-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.badge { display: inline-flex; align-items: center; padding: 0.35rem 0.85rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; transition: all 0.2s ease; }
.badge:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.badge-info { background: #d3f9d8; color: #1a7f37; border: 1px solid #69db7c; }
[data-theme="dark"] .badge-info { background: #0c401a; color: #69db7c; }
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: var(--shadow-sm); }
.card:hover { box-shadow: var(--shadow-lg); border-color: var(--accent); transform: translateY(-2px); }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: var(--shadow-sm); }
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-xl); }
.stat-value { font-size: 2rem; font-weight: 900; color: var(--accent); }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.5rem; }
.stat-desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.25rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1.5rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; border: none; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); text-decoration: none; box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.table-container { overflow-x: auto; margin: 1.5rem 0; border-radius: var(--radius); box-shadow: var(--shadow-md); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 1rem 1.25rem; border: 1px solid var(--border); text-align: left; }
th { background: var(--bg-primary); font-weight: 600; position: sticky; top: 0; z-index: 10; }
tr:nth-child(even) td { background: rgba(var(--bg-primary-rgb), 0.5); }
tr:hover td { background: rgba(var(--accent-rgb), 0.05); }
code { font-family: 'JetBrains Mono', monospace; font-size: 0.9em; background: var(--bg-primary); padding: 0.15em 0.4em; border-radius: 4px; }
.toast-container { position: fixed; bottom: 2rem; right: 2rem; z-index: 1100; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.5rem; box-shadow: 0 4px 12px rgba(0,0,0,0.1); animation: slideIn 0.3s ease; }
.toast.success { border-left: 4px solid #40c057; }
.toast.info { border-left: 4px solid #228be6; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.footer { background: var(--bg-secondary); border-top: 1px solid var(--border); padding: 2.5rem 1.5rem; margin-top: auto; box-shadow: 0 -4px 6px -1px rgba(0,0,0,0.05); }
.footer-content { max-width: 1000px; margin: 0 auto; display: grid; grid-template-columns: 2fr 3fr 1fr; gap: 2rem; }
.footer-info p { margin: 0.5rem 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-link { color: var(--text-secondary); font-size: 0.9rem; }
.footer-link:hover { color: var(--accent); }
.footer-disclaimer { font-size: 0.85rem; color: var(--text-secondary); padding-top: 1rem; border-top: 1px solid var(--border); grid-column: 1 / -1; }

/* Progress Bar */
.progress-bar { position: fixed; top: var(--header-height); left: 0; right: 0; height: 3px; background: transparent; z-index: 99; transform-origin: left center; transform: scaleX(0); }
.progress-bar::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--accent), var(--accent-gold)); border-radius: 0 3px 3px 0; }

/* Page transitions */
.page { display: none; animation: fadeIn 0.5s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Loading states */
.loading { position: relative; overflow: hidden; }
.loading::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); animation: loading 1.5s infinite; }
@keyframes loading { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]::after { content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--text-primary); color: var(--bg-primary); padding: 0.5rem 1rem; border-radius: var(--radius-sm); font-size: 0.8rem; white-space: nowrap; opacity: 0; visibility: hidden; transition: all 0.2s ease; z-index: 1000; }
[data-tooltip]:hover::after { opacity: 1; visibility: visible; bottom: calc(100% + 5px); }

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Daily Log Styles */
.task-item input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#dailyEditModal textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Responsive */
@media (max-width: 1200px) {
  .header-nav { display: none; }
  .mobile-menu-toggle { display: flex; }
}
@media (max-width: 768px) {
  .footer-content { grid-template-columns: 1fr; text-align: center; }
  .footer-links { justify-content: center; }
  #mainContent { padding-top: calc(var(--header-height) + 1rem); }
  .header-container { padding: 0 0.5rem; }
  .header-brand .brand-text { display: none; }
  .lang-toggle .lang-name { display: none; }
}

/* ===== Hero 圖鑑：多選篩選 dropdown (vanilla, no library) ===== */
.hero-filters { padding: 1rem 1.25rem; }
.hero-filters:hover { transform: none; }
.hero-filters-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.85rem; }
.hero-filters-head strong { font-size: 1rem; }
.hero-filters-result { font-size: 0.85rem; color: var(--text-secondary); }
.hero-filters-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem; }

.hero-filter { position: relative; }
.hero-filter > summary { list-style: none; display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.55rem 0.95rem; background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.9rem; cursor: pointer; user-select: none; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: var(--shadow-sm); }
.hero-filter > summary::-webkit-details-marker { display: none; }
.hero-filter > summary:hover { background: var(--border); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.hero-filter[open] > summary { border-color: var(--accent); color: var(--accent); }
.hero-filter-count { color: var(--accent); font-weight: 700; }
.hero-filter-caret { font-size: 0.75rem; opacity: 0.7; transition: transform 0.2s ease; }
.hero-filter[open] .hero-filter-caret { transform: rotate(180deg); }

.hero-filter-menu { position: absolute; top: calc(100% + 0.4rem); left: 0; z-index: 40; min-width: 13rem; max-height: 18rem; overflow-y: auto; padding: 0.6rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.hero-filter-actions { padding-bottom: 0.5rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.hero-filter-actions .btn { width: 100%; padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.hero-filter-option { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.35rem; border-radius: var(--radius-sm); font-size: 0.9rem; cursor: pointer; transition: background 0.15s ease; }
.hero-filter-option:hover { background: var(--bg-primary); }
.hero-filter-option input { width: 1rem; height: 1rem; accent-color: var(--accent); cursor: pointer; }
.hero-filter-empty { margin: 0.35rem 0 0; font-size: 0.85rem; color: var(--text-secondary); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.82rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
