/* ============================================
   基本スタイル
   ============================================ */

body {
  font-family: var(--font-base);
  font-size: var(--fs-base);
  color: var(--text-main);
  background-color: var(--bg-main);
  /* セーフエリア（ノッチ・ホームバー対応） */
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  /* スタンドアロンPWAでのスクロール挙動 */
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* アプリ全体のコンテナ */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh; /* 動的ビューポート対応 */
}

/* ヘッダー */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--spacing-md);
  background-color: var(--bg-main);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.app-header__title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-main);
}

.app-header__back {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  margin-left: -8px;
  color: var(--accent);
  font-size: var(--fs-md);
}

.app-header__action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  margin-right: -8px;
  color: var(--accent);
}

/* メインコンテンツ領域 */
.app-main {
  flex: 1;
  padding: var(--spacing-md);
  /* タブナビ + セーフエリア分の余白 */
  padding-bottom: calc(var(--tab-nav-height) + var(--safe-bottom) + var(--spacing-md));
  overflow-y: auto;
}

/* 共通: セクション見出し */
.section-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: var(--spacing-sm);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* テキスト色ユーティリティ */
.text-profit { color: var(--profit); }
.text-loss { color: var(--loss); }
.text-warning { color: var(--warning); }
.text-sub { color: var(--text-sub); }
.text-mute { color: var(--text-mute); }

/* タイポグラフィユーティリティ */
.text-xs { font-size: var(--fs-xs); }
.text-sm { font-size: var(--fs-sm); }
.text-md { font-size: var(--fs-md); }
.text-base { font-size: var(--fs-base); }
.text-lg { font-size: var(--fs-lg); }
.text-xl { font-size: var(--fs-xl); }
.text-2xl { font-size: var(--fs-2xl); }
.text-3xl { font-size: var(--fs-3xl); }
.text-bold { font-weight: 600; }
.text-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* 数字のタブラ表示（金額が縦に揃う） */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* 空状態 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2xl) var(--spacing-md);
  text-align: center;
  color: var(--text-sub);
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

.empty-state__message {
  font-size: var(--fs-md);
  margin-bottom: var(--spacing-xs);
}

.empty-state__hint {
  font-size: var(--fs-sm);
  color: var(--text-mute);
}

/* ローディング表示 */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2xl) var(--spacing-md);
  color: var(--text-sub);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--spacing-md);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* フェードイン */
.fade-in {
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
