/* ============================================================
   StudyLog.css  —  勉強ログ専用スタイル
   Style.css の変数・共通クラス（.header .drawer .field
   .btn-primary .btn-danger .success-bar .error-bar .loading
   .empty-msg .menu-btn）をそのまま流用する。
============================================================ */

/* ══════════════════════════════════════════
   ポイントバッジ（ヘッダー右端）
══════════════════════════════════════════ */
.sl-point-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  overflow: visible;
}

/* ポイント加算アニメーション */
.sl-pts-pop {
  position: absolute;
  top: -4px;
  right: 0;
  font-size: 12px;
  font-weight: 700;
  color: #b45309;
  pointer-events: none;
  white-space: nowrap;
}
.sl-pts-pop.fly {
  animation: slPtsFly .85s ease forwards;
}
@keyframes slPtsFly {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-28px); }
}

/* ══════════════════════════════════════════
   タブバー（ヘッダー直下に固定）
══════════════════════════════════════════ */
.sl-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 54px;          /* .header の height と揃える */
  z-index: 40;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.sl-tabs::-webkit-scrollbar { display: none; }

.sl-tab {
  flex: 1;
  min-width: 72px;
  padding: 10px 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: color .13s, border-color .13s;
  -webkit-tap-highlight-color: transparent;
}
.sl-tab.active {
  color: #1e40af;
  border-bottom-color: #1e40af;
}
.sl-tab:active { background: var(--bg); }

/* ══════════════════════════════════════════
   スクリーン
══════════════════════════════════════════ */
.sl-screen       { display: none; }
.sl-screen.active{ display: block; }

.sl-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.1rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ══════════════════════════════════════════
   カード
══════════════════════════════════════════ */
.sl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.sl-card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: .9rem;
}

/* ══════════════════════════════════════════
   サマリーグリッド
══════════════════════════════════════════ */
.sl-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.sl-metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: .875rem .75rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.sl-metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 5px;
  line-height: 1.3;
}
.sl-metric-value {
  font-size: 20px;
  font-weight: 700;
}

/* ══════════════════════════════════════════
   ランキング 2列完全分離
══════════════════════════════════════════ */
.sl-rank-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* 各列カード */
.sl-rank-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: .75rem .9rem;
  min-width: 0;
}

/* 列見出し */
.sl-rank-col-head {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: .55rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--border-light);
}
.sl-rank-col-icon { font-size: 13px; }

/* 各順位行 */
.sl-rank-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
}
.sl-rank-row:last-child { border-bottom: none; }

/* 順位メダル */
.sl-rank-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.sl-r1 { background: #fac775; color: #633806; }
.sl-r2 { background: #d3d1c7; color: #2c2c2a; }
.sl-r3 { background: #f0997b; color: #4a1b0c; }
.sl-rn { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

/* 名前 */
.sl-rank-name {
  flex: 1;
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 値（時間・ポイント） */
.sl-rank-val {
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}
.sl-rank-val-time { color: #1e40af; }
.sl-rank-val-pts  { color: #b45309; }

/* あなたバッジ */
.sl-you-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 20px;
  background: #dbeafe;
  color: #1e40af;
  font-weight: 700;
  border: 1px solid #bfdbfe;
  vertical-align: middle;
  margin-left: 3px;
}

/* データなし */
.sl-rank-empty {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  padding: .75rem 0;
}

/* ══════════════════════════════════════════
   ログ一覧
══════════════════════════════════════════ */
.sl-log-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.sl-log-item:last-child { border-bottom: none; }
.sl-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}
.sl-log-subject { font-size: 14px; font-weight: 600; }
.sl-log-min     { font-size: 13px; font-weight: 700; color: #1e40af; }
.sl-log-meta    { font-size: 11px; color: var(--text-tertiary); }
.sl-log-memo    { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }

/* ══════════════════════════════════════════
   タイマー
══════════════════════════════════════════ */
.sl-timer-display {
  text-align: center;
  padding: 1.5rem 0 1rem;
}
.sl-timer-num {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
}
.sl-timer-status {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.sl-timer-pts {
  font-size: 12px;
  color: #b45309;
  font-weight: 700;
  margin-top: 5px;
  min-height: 18px;
}
.sl-timer-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}
.sl-timer-btn {
  height: 44px;
  padding: 0 18px;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .12s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.sl-timer-btn:active { transform: scale(.97); }
.sl-timer-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.sl-btn-start {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.sl-btn-pause {
  background: #fffbeb;
  color: #92400e;
  border-color: #fcd34d;
}
.sl-btn-stop {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fca5a5;
}

.sl-timer-note {
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 1rem;
  line-height: 1.6;
}

/* ══════════════════════════════════════════
   ストップ後 確認画面
══════════════════════════════════════════ */
.sl-confirm-box {
  border-color: #bfdbfe;
}
.sl-confirm-time-wrap {
  text-align: center;
  padding: .75rem 0 1.1rem;
}
.sl-confirm-time {
  font-size: 34px;
  font-weight: 700;
  color: #1e40af;
}
.sl-confirm-time-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.sl-confirm-btns {
  display: flex;
  gap: 8px;
  margin-top: .75rem;
  flex-wrap: wrap;
}
.sl-confirm-btn-save {
  flex: 1;
}
.sl-btn-edit {
  height: 48px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.sl-btn-edit:active { background: var(--border); }

/* ══════════════════════════════════════════
   課題タブ
══════════════════════════════════════════ */
.sl-tasks-hint {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

.sl-task-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-light);
}
.sl-task-row:last-child { border-bottom: none; }

.sl-task-body { flex: 1; min-width: 0; }

.sl-task-title {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-all;
}
.sl-task-title.done {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.sl-task-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.sl-subject-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
  background: #dbeafe;
  color: #1e40af;
  white-space: nowrap;
}
.sl-pts-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 20px;
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fcd34d;
  font-weight: 700;
}
.sl-due {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* 達成ボタン */
.sl-task-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--text);
  color: #fff;
  border-color: var(--text);
  transition: opacity .12s;
  margin-top: 2px;
}
.sl-task-btn:active  { opacity: .8; }
.sl-task-btn:disabled {
  background: var(--bg);
  color: var(--text-tertiary);
  border-color: var(--border);
  cursor: not-allowed;
}

/* ══════════════════════════════════════════
   ヘッダー内ユーザー情報（セッション連動）
══════════════════════════════════════════ */
.sl-header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  min-width: 0;
}
.sl-header-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  /* 初期値。applySession() が上書きする */
  background: #dbeafe;
  color: #1e40af;
}
.sl-header-names {
  min-width: 0;
  line-height: 1.25;
}
.sl-header-nickname {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}
.sl-header-id {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ログアウトボタン */
.sl-logout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px 8px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-secondary);
  flex-shrink: 0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
.sl-logout-btn:hover  { background: var(--bg); color: var(--text); }
.sl-logout-btn:active { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
