:root {
  --bar-cyan: #00e5ff;
  --bar-fire-red: #ff0033;
  --btn-green: var(--bar-cyan);

  /* --- タブ1・2共通 伸縮カードの高さ規格 ---
     ヘッダー帯: 62px + env(safe-area-inset-top)
     カード上下余白: 16px × 2 = 32px
     フッターピル帯 + マージン: 約 80px + env(safe-area-inset-bottom) */
  --focus-card-height: calc(
    100dvh 
    - 62px - env(safe-area-inset-top, 0px) 
    - 80px - env(safe-area-inset-bottom, 0px) 
    - 32px
  );

  /* --- z-index 階層定義 --- */
  --z-bg: -1;
  --z-base: 1;
  --z-sticky-header: 100;
  --z-bottom-nav: 200;
  --z-fab: 210;
  --z-card-dropdown: 300;
  --z-card-drag: 400;
  --z-card-tooltip: 500;
  --z-drawer: 600;
  --z-modal: 700;
  --z-submodal: 800;
  --z-cropper: 900;
  --z-urgent: 1000;
  --z-toast: 1100;
  /* --- 共通デザインシステム（サーフェス・立体・シャドウ規格） --- */
  --ui-bg-surface: #1b212f;
  --ui-border-surface: 1px solid rgba(255, 255, 255, 0.12);
  --ui-shadow-panel: 0 4px 0 #111522;
  --ui-shadow-track: inset 0 2px 4px rgba(0, 0, 0, 0.4);
  --ui-btn-press-depth: 4px;
}

/* ==========================================================================
   共通デザインコンポーネント定義 (Design System)
   ========================================================================== */

/* 1. パネル・カードのサーフェス */
.ui-surface {
  background: var(--ui-bg-surface);
  border: var(--ui-border-surface);
  border-radius: 20px;
  box-shadow: var(--ui-shadow-panel);
  box-sizing: border-box;
}

/* 2. 背景レール・溝表現 */
.ui-track,
#scheduleListOverview .card-slim-bar-track {
background: rgba(0, 0, 0, 0.35);
box-shadow: var(--ui-shadow-track);
overflow: hidden;
box-sizing: border-box;
}

/* 3. ゲージ・メーター共通の立体光沢ハイライト */
.ui-glass-highlight::after,
.daily-goal-fill::after,
.card-slim-bar-fill::after,
#scheduleListOverview .card-slim-bar-fill::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(
to bottom,
rgba(255, 255, 255, 0.45) 0%,
rgba(255, 255, 255, 0.25) 15%,
rgba(255, 255, 255, 0.05) 30%,
transparent 100%
);
border-radius: inherit;
pointer-events: none;
}

/* 4. アクションボタンの共通立体アフォーダンス（4px押し込み規格） */
.ui-btn-press {
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ui-btn-press:active {
  transform: translateY(var(--ui-btn-press-depth));
}

body {
  font-family:
    "Noto Sans JP",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  margin: 0;
  padding: 0 0 140px 0;
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  background-color: #0b0d13;
  color: #f8fafc;
  overflow-x: hidden;
  touch-action: pan-y;
  box-sizing: border-box;
  min-height: 100vh;
  position: relative;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* 固定背景レイヤー（ホーム・実行中など通常画面用） */
#bg-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #0b0d13;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: var(--z-bg);
  pointer-events: none;
}

/* 上部ヘッダー（壁紙透過対応） */
.header-sticky-wrapper {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: var(--z-sticky-header);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
  padding-top: env(safe-area-inset-top, 0px);
}

.header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 6px 16px;
  box-sizing: border-box;
}
/* ヘッダー中央：アプリ名表示エリア */
.header-app-brand {
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
user-select: none;
}
.header-app-name {
font-size: 1.15rem;
font-weight: 900;
color: #ffffff;
letter-spacing: 0.05em;
text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 0;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  line-height: 1;
  overflow: hidden;
  padding: 0;
  box-sizing: border-box;
  flex-shrink: 0;
  transition:
    background-color 0.2s,
    transform 0.2s;
}
.icon-btn:active {
  transform: scale(0.92);
  background-color: rgba(255, 255, 255, 0.15);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
  stroke: #f8fafc;
  display: block;
}
.icon-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: none;
}

/* 1日達成数プログレスバー（緑色・ドットメモリ・右端5pt余白） */
.daily-goal-bar-container {
  margin: 0 16px 8px 16px;
  background: transparent;
  border: none;
  border-radius: 14px;
  padding: 6px 4px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.daily-goal-text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  z-index: 5;
  pointer-events: none;
}

.daily-goal-track-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
}

.daily-goal-track {
  width: 100%;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}

.daily-goal-fill {
  height: 100%;
  background: linear-gradient(90deg, #059669, #10b981);
  border-radius: 14px;
  transition: width 0.3s ease;
  position: relative;
  z-index: 1;
  overflow: hidden;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.25);
}



/* メモリドットを非表示 */
.daily-goal-dot {
  display: none !important;
}

.daily-goal-icon-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  flex-shrink: 0;
  user-select: none;
}

.daily-goal-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.daily-goal-streak-text {
  font-size: 0.7rem;
  font-weight: 800;
  color: #f59e0b;
  line-height: 1;
  margin-top: 2px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* サイドメニュー */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: var(--z-drawer);
}

.sidebar-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: #161b26;
  z-index: var(--z-drawer);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  transition: left 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  box-sizing: border-box;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px
    calc(24px + env(safe-area-inset-bottom, 0px)) 16px;
}

.sidebar-drawer.active {
  left: 0;
}
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.sidebar-header h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #f8fafc;
}

/* サイドメニュー（一本線区切り・フォント1.1倍） */
.sidebar-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.sidebar-menu-item {
  padding: 16px 4px;
  border-radius: 0;
  background: transparent;
  color: #f8fafc;
  font-size: 1.05rem; /* 1.1倍 */
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: opacity 0.15s;
  box-sizing: border-box;
  width: 100%;
}
.sidebar-menu-item:last-child {
  border-bottom: none;
}
.sidebar-menu-item:active {
  opacity: 0.6;
}

/* マイタスク青枠追加ボタン */
.btn-add-mycard-blue {
  width: 100%;
  background: rgba(37, 99, 235, 0.15);
  border: 1.5px solid #2563eb;
  color: #60a5fa;
  border-radius: 10px;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    background 0.15s,
    transform 0.1s;
}
.btn-add-mycard-blue:active {
  transform: scale(0.98);
  background: rgba(37, 99, 235, 0.25);
}

/* マイタスク画面（右からスライドイン） */
#standaloneDictModal .modal-content {
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}
#standaloneDictModal.active .modal-content {
  transform: translateX(0);
}

/* マイタスク長押し選択・削除UI */
.dict-item-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  overflow: hidden;
  border-radius: 10px;
}
.dict-item-checkbox {
  position: absolute;
  left: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s;
}
.dict-item-checkbox.checked {
  background: var(--bar-cyan);
  border-color: var(--bar-cyan);
}
.dict-item-checkbox.checked::after {
  content: "✓";
  color: #0b0d13;
  font-size: 14px;
  font-weight: 900;
}
.dict-item {
  width: 100%;
  transition: transform 0.25s ease;
  margin-bottom: 0 !important;
  user-select: none;
  -webkit-user-select: none;
}
.is-select-mode .dict-item-checkbox {
  display: flex;
}
.is-select-mode .dict-item {
  transform: translateX(42px);
}

.dict-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9rem;
  transition:
    transform 0.1s,
    opacity 0.15s;
}
.btn:active {
transform: translateY(4px);
}
.btn-primary {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 4px 0 #1d4ed8;
}

.btn-primary:active {
box-shadow: 0 0 0 #1d4ed8;
}

.btn-success {
  background: var(--bar-cyan);
  color: #0b0d13;
  font-weight: bold;
  box-shadow: 0 4px 0 #0099b8;
}

.btn-success:active {
box-shadow: 0 0 0 #0099b8;
}

.btn-danger {
  background: var(--bar-fire-red);
  color: #fff;
}

.btn-danger:active {
box-shadow: 0 0 0 #b91c1c;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   PWA インストール誘導バナー（浮遊吹き出し）
   ========================================================================== */
.pwa-install-prompt {
  display: none;
  position: fixed;
  bottom: calc(max(16px, env(safe-area-inset-bottom, 16px)) + 64px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: 90%;
  max-width: 390px;
  background: rgba(22, 27, 38, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(0, 229, 255, 0.3);
  border-radius: 16px;
  padding: 12px 14px 10px 14px;
  box-sizing: border-box;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75), 0 0 16px rgba(0, 229, 255, 0.15);
  z-index: var(--z-card-dropdown);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
}

.pwa-install-prompt.show {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.pwa-prompt-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
}
.pwa-prompt-close:active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.pwa-prompt-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 18px;
}

.pwa-prompt-desc {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.45;
  margin: 0;
}

.pwa-prompt-desc strong {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 4px;
}

.pwa-prompt-inline-icon {
  display: inline-flex;
  vertical-align: -3px;
  margin: 0 2px;
}
.pwa-prompt-inline-icon svg {
  width: 15px;
  height: 15px;
  stroke: var(--bar-cyan);
}

.pwa-prompt-install-btn {
  margin-top: 4px;
  width: 100%;
  background: linear-gradient(135deg, #00e5ff 0%, #0284c7 100%);
  color: #0b0d13;
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 #0369a1;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.pwa-prompt-install-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #0369a1;
}

/* 下向き矢印ポインター */
.pwa-prompt-pointer {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid rgba(22, 27, 38, 0.96);
}

/* フローティングピル型フッターナビゲーション */
.bottom-nav-container {
  position: fixed;
  bottom: max(16px, env(safe-area-inset-bottom, 16px));
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  z-index: var(--z-bottom-nav);
  pointer-events: none;
}

.bottom-nav-pill {
  pointer-events: auto;
  background: rgba(18, 22, 32, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 40px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  width: 92%;
  max-width: 410px;
  box-sizing: border-box;
  justify-content: space-between;
}
.nav-pill-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 6px;
  border-radius: 18px;
  color: #94a3b8;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  user-select: none;
  flex: 1;
  text-align: center;
}
.nav-pill-item.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}
.nav-pill-item.active .nav-icon svg {
  stroke: var(--bar-cyan);
}
.nav-pill-item:active {
  transform: scale(0.92);
}
.nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}
.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: -0.03em;
}

.nav-profile-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid var(--bar-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.nav-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.nav-profile-avatar svg {
  width: 14px;
  height: 14px;
  stroke: #f8fafc;
}

.nav-chat-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 8px;
  height: 8px;
  background: #ff0033;
  border: 1.5px solid #161b26;
  border-radius: 50%;
  display: none;
}

.nav-chat-badge.show {
  display: block;
}

/* 実行中用バッジ */
.nav-in-progress-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--bar-cyan);
  color: #0b0d13;
  font-size: 0.65rem;
  font-weight: 900;
  border-radius: 10px;
  border: 1.5px solid #161b26;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}
.nav-in-progress-badge.show {
  display: flex;
}

/* タブアイコンのポンッと弾むアニメーション */
@keyframes tabIconBounce {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.35) translateY(-4px);
  }
  65% {
    transform: scale(0.92) translateY(1px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}
.tab-bounce-active {
  animation: tabIconBounce 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* FAB */
.fab-group {
  position: fixed;
  right: 24px;
  bottom: 88px;
  display: flex;
  gap: 16px;
  z-index: var(--z-fab);
  pointer-events: none;
}
.fab {
  border-radius: 50%;
  border: 1.5px solid rgba(79, 42, 180, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  touch-action: none;
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: auto;
  user-select: none;
}
.fab:active {
  transform: scale(0.88);
}

.fab-add {
  width: 70px;
  height: 66px;
  font-size: 34px;
  background: #2563eb;
  color: #f8fafc;
  font-weight: 700;
  box-shadow:
    0 5px 0 #51239c;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease;
  opacity: 1;
}

.fab-add:active {
  transform: translateY(5px);
  box-shadow:
    0 0 0 #51239c;
}

/* ホーム画面追加時（スタンドアロン起動時）の専用位置設定 */
@media (display-mode: standalone) {
  .bottom-nav-container {
    bottom: 24px;
  }
  .fab-group {
    bottom: 122px; /* 88px + 34px */
  }
}