/* =============================================
   library.css — 練習ライブラリ画面スタイル
   ============================================= */

/* ─── ライブラリパネル本体（view-menu と同じ挙動） ─── */
#view-library {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 72px;
  bottom: calc(72px + max(0px, env(safe-area-inset-bottom, 0px)));
  background: #f7f7f7;
  z-index: 90;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

#view-library.active {
  transform: translateY(0);
}

/* ─── ライブラリヘッダー ─── */
.library-header {
  position: sticky;
  top: 0;
  background: #1a2e5a;
  color: #fff;
  padding: 14px 16px 12px;
  z-index: 1;
}

.library-header-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.library-header-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  margin-top: 3px;
}

/* ─── カテゴリセクション ─── */
.scenario-category {
  padding: 16px 16px 4px;
}

.scenario-category-title {
  font-size: 11px;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* ─── シナリオカード ─── */
.scenario-card {
  background: #fff;
  border: 1.5px solid #e8e8e8;
  border-radius: 12px;
  padding: 14px 14px 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  text-align: left;
  font-family: inherit;
  display: block;
}

.scenario-card:active {
  border-color: #FFC107;
  box-shadow: 0 0 0 3px rgba(255,193,7,0.2);
}

.scenario-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.scenario-card-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  background: #E3F2FD;
  color: #1565C0;
}

.scenario-card-badge.badge-ma   { background: #E8F5E9; color: #2E7D32; }
.scenario-card-badge.badge-gc   { background: #FFF8E1; color: #E65100; }
.scenario-card-badge.badge-dc   { background: #FCE4EC; color: #B71C1C; }
.scenario-card-badge.badge-rsi  { background: #EDE7F6; color: #4527A0; }
.scenario-card-badge.badge-macd { background: #E0F2F1; color: #00695C; }
.scenario-card-badge.badge-bb   { background: #F3E5F5; color: #6A1B9A; }

.scenario-card-difficulty {
  margin-left: auto;
  font-size: 12px;
  color: #FFC107;
  letter-spacing: 1px;
}

.scenario-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a2e5a;
  margin-bottom: 5px;
  line-height: 1.4;
}

.scenario-card-desc {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
}

.scenario-card-footer {
  display: flex;
  align-items: center;
  margin-top: 10px;
  gap: 6px;
}

.scenario-card-day {
  font-size: 11px;
  color: #bbb;
}

.scenario-card-arrow {
  margin-left: auto;
  color: #ccc;
  font-size: 18px;
}

/* ─── シナリオバナー（チャート上部・フリー練習中に表示） ─── */
#scenario-banner {
  display: none;
  background: #1a2e5a;
  color: #fff;
  padding: 8px 14px;
  font-size: 12px;
  line-height: 1.4;
  align-items: center;
  gap: 10px;
}

#scenario-banner.active {
  display: flex;
}

.scenario-banner-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.scenario-banner-text {
  flex: 1;
  min-width: 0;
}

.scenario-banner-title {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scenario-banner-goal {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scenario-banner-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  line-height: 1;
}

/* ─── シナリオ結果モーダル（ボトムシート） ─── */
#scenario-result-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  align-items: flex-end;
}

#scenario-result-modal.active {
  display: flex;
}

.scenario-result-sheet {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 44px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.scenario-result-header {
  text-align: center;
  margin-bottom: 18px;
}

.scenario-result-emoji {
  font-size: 42px;
  display: block;
  margin-bottom: 8px;
}

.scenario-result-label {
  font-size: 13px;
  color: #999;
}

.scenario-result-pnl {
  font-size: 30px;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.scenario-result-pnl.profit { color: #e53935; }
.scenario-result-pnl.loss   { color: #1976D2; }

.scenario-result-section {
  margin-top: 16px;
}

.scenario-result-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a2e5a;
  margin-bottom: 8px;
}

.scenario-result-explanation {
  font-size: 13px;
  color: #444;
  line-height: 1.75;
  background: #f9f9f9;
  border-radius: 10px;
  padding: 13px 14px;
}

.scenario-result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.btn-scenario-blog {
  display: block;
  width: 100%;
  padding: 14px;
  background: #1a2e5a;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-scenario-library {
  display: block;
  width: 100%;
  padding: 13px;
  background: #fff;
  color: #1a2e5a;
  border: 1.5px solid #1a2e5a;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
  font-family: inherit;
}

.btn-scenario-free {
  display: block;
  width: 100%;
  padding: 11px;
  background: #f5f5f5;
  color: #999;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}
