/* ============================================
   Layout - 整體排版、TabBar、Header
   ============================================ */

#app-root {
  min-height: 100vh;
  min-height: 100dvh;
}

/* 頁面切換動畫 */
.screen {
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  animation: fade-in 0.25s ease;
}

.screen.no-tabbar {
  padding-bottom: var(--safe-bottom);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  position: sticky;
  top: var(--safe-top);
  background: var(--glass-header);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  z-index: 10;
  border-bottom: 1px solid var(--line-soft);
}

.page-header h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.page-header .actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.icon-btn:active {
  background: var(--bg-soft);
  color: var(--accent);
  transform: scale(0.94);
}
.icon-btn.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* TabBar 底部導航 */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: var(--glass-tabbar);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
  z-index: 50;
  box-shadow: 0 -1px 0 rgba(0,0,0,0.02);
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px 8px;
  height: var(--tabbar-h);
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  transition: color 0.15s, transform 0.1s;
  position: relative;
}
.tab-btn svg { stroke-width: 1.8; }
.tab-btn.active {
  color: var(--accent);
}
.tab-btn.active svg { stroke-width: 2.2; }
.tab-btn:active { transform: scale(0.92); }

.tab-btn .tab-indicator {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 0 0 var(--r-pill) var(--r-pill);
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
}
.tab-btn.active .tab-indicator {
  opacity: 1;
}

/* Floating Action Button (打卡按鈕) */
.fab {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(200, 137, 58, 0.4), 0 2px 4px rgba(0,0,0,0.1);
  z-index: 40;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab:active {
  transform: scale(0.92);
  box-shadow: 0 4px 12px rgba(200, 137, 58, 0.45);
}

/* 共用 section 間距 */
.section {
  padding: 16px 20px;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.section-title .sub {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-mute);
  letter-spacing: 0.05em;
}

/* ===== App Footer (attribution) ===== */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 16px 14px;
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  opacity: 0.7;
}
.app-footer .sig {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  color: var(--text-soft);
}
.app-footer .sep { color: var(--text-dim); }
.app-footer .ver {
  font-weight: 600;
  color: var(--accent-deep);
}
/* Setup 頁無 tabbar,給多一點底部間距 */
.setup-screen .app-footer {
  margin-top: 24px;
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
}
