/* ===== リセット・ベース ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden; /* 本体スクロール禁止 */
  background-color: #ffffff;
  color: #333333;
  font-family: system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
  /* 連打時のバウンス・スクロール防止 */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
  touch-action: pan-x pan-y;
}

/* ボタン・リンク・入力欄全般：ダブルタップズーム完全防止 */
button, a, [onclick], input, select {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* iOS フォームズーム防止（font-size 16px 未満だとSafariが自動ズームする） */
input[type="number"], input[type="text"], select {
  font-size: 16px;
}

/* ===== レイアウト ===== */
body {
  display: flex;
  flex-direction: column;
  height: 100dvh; /* dynamic viewport height（ブラウザバー対応） */
}

/* ===== ヘッダー：layout.css に移管済み ===== */

/* ===== MAトグルバー（Phase A3：2段構成） ===== */
#ma-toolbar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 16px 8px;
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
}

/* 各行（指標行 / 操作行） */
.chart-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chart-controls-row::-webkit-scrollbar { display: none; }

.ma-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px; /* ピル型 */
  border: 1.5px solid;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

/* MA5/MA25ピルのON色はcomponents.cssの.btn-pill.active/.active-blueで管理 */
#btn-ma5  { background-color: var(--color-ma5);  border-color: var(--color-ma5); }
#btn-ma25 { background-color: var(--color-ma25); border-color: var(--color-ma25); }

.ma-btn:active { opacity: 0.7; }

/* ツールバー区切り */
.toolbar-sep {
  width: 1px;
  height: 18px;
  background-color: #d0d0d0;
  margin: 0 4px;
}

/* 描画ツールボタン */
.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid #aaaaaa;
  font-size: 11px;
  font-weight: 600;
  color: #555555;
  background-color: #ffffff;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tool-btn:active { opacity: 0.7; }

/* ===== 描画モードバー ===== */
#draw-mode-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 16px;
  background-color: #fff8e1;
  border-bottom: 1px solid #f5a623;
  font-size: 12px;
  font-weight: 600;
  color: #b07000;
}

/* ===== チャートコンテナ ===== */
#chart-container {
  flex: 1;
  width: 100%;
  min-height: 0;
  position: relative; /* Canvas オーバーレイのための基準 */
  /* チャート内タッチとページスクロールの競合を防ぐ */
  touch-action: none;
  -webkit-overflow-scrolling: none;
  overflow: hidden;
}

/* ===== コントロールエリア ===== */
#controls-area {
  flex-shrink: 0;
  background-color: #ffffff;
  border-top: 1px solid #e0e0e0;
}

/* ===== 再生コントロールバー ===== */
#playback-bar {
  flex-shrink: 0;
  background-color: #f0f4f8;
  border-bottom: 2px solid #c8d8e8;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 1行目：◀ ラベル ▶ */
#playback-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
}

#playback-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px;
  overflow: hidden;
}

.playback-year {
  font-size: 11px;
  font-weight: 500;
  color: #888888;
  line-height: 1.2;
}

.playback-date {
  font-size: 13px;
  font-weight: 700;
  color: #333333;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.3;
}

/* 再生ボタン共通（52px タッチターゲット） */
.playback-btn {
  height: 52px;
  padding: 0 18px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.1s;
  background-color: #d0d8e0;
  color: #333333;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 88px;
}

.playback-btn.primary {
  background-color: var(--color-brand);
  color: #1F2937;
  min-width: 110px;
  font-size: 16px;
}

.playback-btn.result-btn {
  background-color: #4a90d9;
  color: #ffffff;
  text-decoration: none;
  min-width: 110px;
}

.playback-btn:disabled {
  background-color: #cccccc;
  color: #aaaaaa;
  cursor: not-allowed;
}

.playback-btn:active:not(:disabled) {
  opacity: 0.75;
  transform: scale(0.96);
}

/* 2行目：自動再生 / 速度 / やり直す */
#playback-row2 {
  display: flex;
  align-items: center;
  gap: 6px;
}

.playback-sub-btn {
  height: 40px;
  padding: 0 14px;
  border: 1.5px solid #aaaaaa;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  background-color: #ffffff;
  color: #444444;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.playback-sub-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.playback-sub-btn:active:not(:disabled) { opacity: 0.7; }

#speed-btns {
  display: flex;
  gap: 5px;
  flex: 1;
  justify-content: center;
}

.speed-btn {
  height: 40px;
  min-width: 44px;
  padding: 0 8px;
  border: 1.5px solid #aaaaaa;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  background-color: #ffffff;
  color: #666666;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s, color 0.12s;
}

.speed-btn.active {
  background-color: #333333;
  border-color: #333333;
  color: #ffffff;
}

.speed-btn:active { opacity: 0.7; }

/* ===== 資産表示バー ===== */
#asset-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  font-size: 12px;
  gap: 4px;
}

.asset-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.asset-label {
  font-size: 10px;
  color: #888888;
}

.asset-value {
  font-size: 13px;
  font-weight: 600;
  color: #333333;
  font-variant-numeric: tabular-nums;
}

.asset-divider {
  color: #cccccc;
  font-size: 12px;
}

.trade-pnl-value {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.trade-pnl-value.up   { color: var(--color-bull); }
.trade-pnl-value.down { color: var(--color-bear); }

/* ===== 保有株表示 ===== */
#holding-info {
  padding: 6px 16px;
  font-size: 12px;
  color: #555555;
  background-color: #f0f7ff;
  border-bottom: 1px solid #d0e8ff;
  line-height: 1.6;
}

#holding-info .up   { color: #00b894; font-weight: 700; }
#holding-info .down { color: #ff4757; font-weight: 700; }

/* ===== 売買パネル ===== */
#trade-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
}

#quantity-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.qty-label {
  font-size: 13px;
  color: #555555;
}

#trade-quantity {
  width: 72px;
  height: 44px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  border: 1.5px solid #cccccc;
  border-radius: 8px;
  background: #fff;
  color: #333333;
  -moz-appearance: textfield;
}
#trade-quantity::-webkit-inner-spin-button,
#trade-quantity::-webkit-outer-spin-button { -webkit-appearance: none; }

.qty-unit {
  font-size: 13px;
  color: #555555;
}

#trade-buttons {
  display: flex;
  gap: 10px;
  flex: 1;
}

.trade-btn {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.1s;
}

.trade-btn:active {
  opacity: 0.8;
  transform: scale(0.97);
}

.buy-btn  { background-color: var(--color-bull); }
.sell-btn { background-color: var(--color-bear); }

.trade-btn:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
}

/* ===== リセットリンク ===== */
#reset-row {
  text-align: center;
  padding: 4px 16px 10px;
}

#reset-link {
  font-size: 11px;
  color: #aaaaaa;
  text-decoration: underline;
}

/* ===== 取引履歴リンク（index.html 下部） ===== */
#history-link-row {
  text-align: center;
  padding: 6px 16px 10px;
  border-top: 1px solid #e0e0e0;
}

#history-link-row a {
  font-size: 13px;
  font-weight: 600;
  color: #4a90d9;
  text-decoration: none;
}

/* ===== ブログ連携カード（lesson-card として再設計 → components.css で管理） ===== */
#blog-card {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-brand-light);
  border-top: 2px solid var(--color-brand);
  border-bottom: 1px solid var(--color-border);
}

/* ===== マイルストーンバナー（.cta-card で統一） ===== */
#milestone-banner {
  padding: 10px 12px;
}

/* ===== 免責事項モーダル ===== */
#disclaimer-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

#disclaimer-modal {
  background-color: #ffffff;
  border-radius: 20px;
  padding: 28px 22px 22px;
  max-width: 360px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

#disclaimer-logo {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #00b894;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

#disclaimer-title {
  font-size: 18px;
  font-weight: 800;
  color: #1a1a2e;
  text-align: center;
  margin-bottom: 4px;
}

#disclaimer-tagline {
  font-size: 12px;
  color: #888888;
  text-align: center;
  margin-bottom: 18px;
}

#disclaimer-features {
  list-style: none;
  background: #f8fffe;
  border: 1px solid #d0f5ec;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

#disclaimer-features li {
  font-size: 13px;
  color: #333333;
  padding: 4px 0;
  line-height: 1.6;
}

#disclaimer-notice {
  font-size: 11px;
  color: #888888;
  line-height: 1.7;
  background: #f9f9f9;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 18px;
}

#disclaimer-notice strong {
  color: #555555;
  display: block;
  margin-bottom: 4px;
}

#disclaimer-agree {
  display: block;
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #00b894, #00d4aa);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 12px;
  letter-spacing: 0.03em;
}

#disclaimer-link-note {
  font-size: 11px;
  color: #aaaaaa;
  text-align: center;
  margin: 0;
}

#disclaimer-link-note a {
  color: #00b894;
  text-decoration: none;
  user-select: auto;
  -webkit-user-select: auto;
}

/* ===== アフィリエイトカード（history.html） ===== */
#affili-section {
  padding: 16px;
  border-top: 1px solid #e0e0e0;
}

#affili-card {
  background: linear-gradient(135deg, #f0fff8, #e8f5ff);
  border: 1px solid #b3e5d8;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}

#affili-text {
  font-size: 13px;
  font-weight: 600;
  color: #333333;
  margin-bottom: 12px;
  line-height: 1.6;
}

#affili-btn {
  display: inline-block;
  padding: 12px 24px;
  background-color: #00b894;
  color: #ffffff;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
}

#affili-note {
  margin-top: 8px;
  font-size: 10px;
  color: #999999;
}

/* ========================================
   history.html 専用スタイル
======================================== */

/* history.html は body.history-page でスコープ */
body.history-page {
  overflow-y: auto;  /* スクロール可能に */
  height: auto;
  min-height: 100dvh;
  display: block;    /* flex を解除 */
}

/* ===== 履歴ヘッダー ===== */
#history-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  z-index: 100;
}

#back-link {
  font-size: 13px;
  color: #4a90d9;
  text-decoration: none;
  font-weight: 600;
}

#history-title {
  font-size: 16px;
  font-weight: 700;
  color: #333333;
  margin: 0;
}

/* ===== サマリーエリア ===== */
#summary-area {
  padding: 16px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.summary-grid:last-child { margin-bottom: 0; }

.summary-card {
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.summary-card.wide {
  grid-column: 1 / -1; /* 2列分 */
}

.summary-label {
  font-size: 11px;
  color: #888888;
  margin-bottom: 4px;
}

.summary-value {
  font-size: 22px;
  font-weight: 700;
  color: #333333;
  font-variant-numeric: tabular-nums;
}

.summary-value.up   { color: #00b894; }
.summary-value.down { color: #ff4757; }

/* ===== グラフセクション ===== */
#pnl-chart-section {
  padding: 16px 16px 8px;
  border-bottom: 1px solid #e0e0e0;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: #555555;
  margin-bottom: 10px;
}

#pnl-chart {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

/* ===== 取引一覧 ===== */
#trade-list-section {
  padding: 16px;
}

#trade-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  gap: 8px;
}

.trade-date-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trade-stock-name {
  font-size: 11px;
  color: #888888;
}

.trade-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.trade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
}

.badge-buy  { background-color: #4a90d9; }
.badge-sell { background-color: #ff4757; }

.trade-date {
  font-size: 12px;
  color: #888888;
}

.trade-row-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  gap: 2px;
}

.trade-price {
  font-size: 13px;
  font-weight: 600;
  color: #333333;
  font-variant-numeric: tabular-nums;
}

.trade-qty {
  font-size: 11px;
  color: #888888;
}

.trade-row-right {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.trade-row-right .up   { color: #00b894; }
.trade-row-right .down { color: #ff4757; }
.pnl-na { color: #cccccc; font-size: 13px; }

/* ===== 取引なし表示 ===== */
#empty-message {
  text-align: center;
  padding: 40px 16px;
  color: #888888;
  line-height: 2;
}

.go-chart-btn {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 24px;
  background-color: #4a90d9;
  color: #ffffff;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
}

/* ===== 銘柄選択ボトムシート ===== */

#stock-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s;
}

#stock-sheet-overlay.open {
  display: block;
  opacity: 1;
}

#stock-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  border-radius: 18px 18px 0 0;
  z-index: 210;
  max-height: 70vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

#stock-sheet.open {
  transform: translateY(0);
}

#stock-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  background-color: #ffffff;
  z-index: 1;
}

#stock-sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: #333333;
}

#stock-sheet-close {
  width: 32px;
  height: 32px;
  border: none;
  background-color: #f0f0f0;
  border-radius: 50%;
  font-size: 16px;
  color: #555555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#stock-list {
  padding: 8px 0 24px;
}

.stock-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.1s;
}

.stock-item:last-child {
  border-bottom: none;
}

.stock-item:active {
  background-color: #f8f9fa;
}

.stock-item.active {
  background-color: #f0faf7;
}

.stock-item-name {
  font-size: 15px;
  font-weight: 600;
  color: #333333;
}

.stock-item.active .stock-item-name {
  color: #00b894;
}

.stock-item-desc {
  font-size: 12px;
  color: #888888;
  margin-top: 3px;
}

/* ===== 履歴ページ 銘柄フィルター ===== */

#stock-filter-row {
  padding: 12px 16px;
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
}

#stock-selector {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  background-color: #f8f9fa;
  color: #333333;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ===== Xシェアボタン（履歴画面） ===== */
#share-section {
  padding: 0 16px 16px;
  text-align: center;
}

#btn-share-x {
  display: inline-block;
  width: 100%;
  padding: 14px;
  background-color: #000000;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#btn-share-x:disabled {
  background-color: #cccccc;
  cursor: default;
}

#btn-share-x:not(:disabled):active {
  background-color: #333333;
}

#share-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #888888;
}

/* ===== 売り後シェアトースト（チャート画面） ===== */
#sell-share-toast {
  text-align: center;
  padding: 6px 16px 2px;
}

#sell-share-link {
  display: inline-block;
  padding: 8px 20px;
  background-color: #000000;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

#sell-share-link:active {
  background-color: #333333;
}

/* ===== ボトムシート：フィルターチップ ===== */

#stock-sheet #stock-filter-row {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background-color: #ffffff;
  border-bottom: 1px solid #eeeeee;
  position: sticky;
  top: 57px;   /* stock-sheet-header の高さ分下げる */
  z-index: 2;
}

#stock-sheet #stock-filter-row::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1.5px solid #cccccc;
  border-radius: 20px;
  background-color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  color: #555555;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.filter-chip.active {
  background-color: #00b894;
  border-color: #00b894;
  color: #ffffff;
}

.filter-chip:active {
  opacity: 0.75;
}

/* ===== ボトムシート：セクタータブ ===== */

#sector-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 109px;  /* header + filter-row の高さ分下げる */
  z-index: 2;
}

#sector-tabs::-webkit-scrollbar {
  display: none;
}

.sector-tab {
  flex-shrink: 0;
  padding: 10px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: #888888;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, border-bottom-color 0.15s;
}

.sector-tab.active {
  color: #00b894;
  border-bottom-color: #00b894;
}

.sector-tab:active {
  opacity: 0.7;
}

/* ===== ボトムシート：銘柄アイテム（拡張） ===== */

.stock-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.stock-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.screen-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-gc  { background-color: #e8f8f1; color: #00b894; }
.badge-vol { background-color: #fff3e0; color: #e65100; }
.badge-up  { background-color: #fce4ec; color: #c62828; }
.badge-div { background-color: #e8eaf6; color: #3949ab; }

/* ===== ボトムシート：セクション見出し ===== */

.sector-heading {
  padding: 10px 20px 4px;
  font-size: 11px;
  font-weight: 700;
  color: #aaaaaa;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background-color: #f8f9fa;
  border-bottom: 1px solid #eeeeee;
}

/* ===== ボトムシート：空状態 ===== */

.stock-empty {
  padding: 40px 20px;
  text-align: center;
  font-size: 14px;
  color: #aaaaaa;
}

/* ===== 銘柄シート：アフィリ導線CTA ===== */

#stock-sheet-affili {
  position: sticky;
  bottom: 0;
  background: var(--color-brand-light);
  border-top: 1.5px solid var(--color-brand);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#stock-sheet-affili-text {
  font-size: 12px;
  font-weight: var(--fw-medium);
  color: #92660A;
  flex: 1;
  min-width: 0;
}

#stock-sheet-affili-btn {
  display: inline-block;
  background: var(--color-brand);
  color: var(--color-text);
  font-size: 12px;
  font-weight: var(--fw-bold);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
}

#stock-sheet-affili-btn:active {
  opacity: 0.8;
}

/* ===== A-4: 売買エフェクト ===== */

/* トースト */
#trade-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  z-index: 9000;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  display: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.trade-toast-buy    { background: #00b894; color: #ffffff; }
.trade-toast-profit { background: #00b894; color: #ffffff; }
.trade-toast-loss   { background: #ff4757; color: #ffffff; }

/* ボタンパルス */
@keyframes pulseGreen {
  0%   { box-shadow: 0 0 0 0 rgba(0,184,148,0.7); }
  70%  { box-shadow: 0 0 0 14px rgba(0,184,148,0); }
  100% { box-shadow: 0 0 0 0  rgba(0,184,148,0); }
}

@keyframes pulseRed {
  0%   { box-shadow: 0 0 0 0 rgba(255,71,87,0.7); }
  70%  { box-shadow: 0 0 0 14px rgba(255,71,87,0); }
  100% { box-shadow: 0 0 0 0  rgba(255,71,87,0); }
}

.btn-pulse-green { animation: pulseGreen 0.7s ease-out; }
.btn-pulse-red   { animation: pulseRed   0.7s ease-out; }

/* 赤フラッシュオーバーレイ */
#flash-overlay {
  position: fixed;
  inset: 0;
  background: #ff4757;
  z-index: 8999;
  pointer-events: none;
  display: none;
  transition: opacity 0.4s;
}

/* ===== B-3: バッジモーダル ===== */

#badge-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
}

#badge-modal-inner {
  background: #ffffff;
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  max-width: 280px;
  width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

.badge-modal-emoji {
  font-size: 56px;
  margin-bottom: 8px;
}

.badge-modal-title {
  font-size: 13px;
  color: #888888;
  margin-bottom: 4px;
}

.badge-modal-label {
  font-size: 22px;
  font-weight: 800;
  color: #333333;
  margin-bottom: 8px;
}

.badge-modal-desc {
  font-size: 13px;
  color: #555555;
  margin-bottom: 20px;
}

.badge-modal-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.badge-share-btn {
  display: inline-block;
  background: #000000;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 20px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.badge-close-btn {
  background: #f0f0f0;
  color: #555555;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ===== B-3: バッジ一覧（履歴画面用） ===== */

.badge-list-header {
  padding: 12px 16px 8px;
  font-size: 14px;
  color: #555555;
  border-bottom: 1px solid #eeeeee;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 16px;
}

.badge-card {
  text-align: center;
  padding: 16px 8px;
  border-radius: 12px;
  background: #f8f9fa;
}

.badge-card.earned {
  background: linear-gradient(135deg, #e8f8f1, #d4f5e9);
  border: 1.5px solid #00b894;
}

.badge-card.locked {
  opacity: 0.5;
}

.badge-card-emoji {
  font-size: 28px;
  margin-bottom: 6px;
}

.badge-card-label {
  font-size: 11px;
  font-weight: 700;
  color: #333333;
  margin-bottom: 4px;
}

.badge-card-desc {
  font-size: 10px;
  color: #888888;
  line-height: 1.4;
}
