/* Playtime visualisation page (/playtime). PLAYTIME_SPEC §4. */

/* Overview row: summary cards (left half) + sync panel (right half) */
.playtime-overview {
  display: flex;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 32px;
}

/* Summary cards (reuses .stat-card) — left half, 2 cards */
.playtime-summary {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* Sync panel — right half. Info (Steam Blue) by default; amber when stale. */
.playtime-sync {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background-color: rgba(102, 192, 244, 0.08);
  border: 1px solid var(--color-steam-blue);
  border-radius: 6px;
}

.playtime-sync__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.playtime-sync__text {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text-white);
}

.playtime-sync__text i {
  margin-right: 6px;
  color: var(--color-steam-blue);
}

.playtime-sync__date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.playtime-sync .btn {
  flex-shrink: 0;
}

.playtime-sync--stale {
  background-color: rgba(232, 162, 58, 0.08);
  border-color: var(--color-warning);
}

.playtime-sync--stale .playtime-sync__text i {
  color: var(--color-warning);
}

/* Summary cards double as the rankings period selector (全期間 / 直近2週間) */
.playtime-summary__card {
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.15s, background-color 0.15s;
}

.playtime-summary__card:hover {
  background-color: var(--color-card-hover);
}

.playtime-summary__card.is-active {
  background-color: var(--color-card-hover);
  border-color: var(--color-steam-blue);
}

.playtime-summary__card:focus-visible {
  outline: 2px solid var(--color-steam-blue);
  outline-offset: 2px;
}

/* Sections */
.playtime-section {
  margin-bottom: 32px;
}

.playtime-section__title {
  margin: 0 0 16px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text-white);
}

/* Genre ranking — horizontal bars */
.genre-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.genre-bar__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.genre-bar__label {
  font-size: 0.875rem;
  color: var(--color-text-white);
}

.genre-bar__value {
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-steam-blue);
}

.genre-bar__track {
  height: 5px;
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.genre-bar__fill {
  height: 100%;
  background-color: rgba(102, 192, 244, 0.4);
  border-radius: 3px;
}

.genre-bar__contributors {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}

.genre-bar__contributor-time {
  color: var(--color-steam-blue);
}

/* Title ranking — stacked list rows (name+hours / bar / tags) */
.playtime-titles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.playtime-title__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background-color: var(--color-dark-blue);
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.15s;
}

.playtime-title__link:hover {
  background-color: var(--color-blue-gray);
}

.playtime-title__rank {
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.playtime-title__thumb {
  flex-shrink: 0;
  width: 92px;
  height: 43px;
  object-fit: cover;
  border-radius: 2px;
}

.playtime-title__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.playtime-title__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.playtime-title__name {
  font-size: 0.9375rem;
  color: var(--color-text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playtime-title__value {
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-steam-blue);
}

.playtime-title__bar {
  height: 5px;
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.playtime-title__bar-fill {
  display: block;
  height: 100%;
  background-color: rgba(102, 192, 244, 0.4);
  border-radius: 3px;
}

.playtime-title__tags {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Recently played list (by rtime_last_played) */
.playtime-recent {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.playtime-recent__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background-color: var(--color-dark-blue);
  border-radius: 4px;
  text-decoration: none;
  transition: background-color 0.15s;
}

.playtime-recent__link:hover {
  background-color: var(--color-blue-gray);
}

.playtime-recent__thumb {
  flex-shrink: 0;
  width: 92px;
  height: 43px;
  object-fit: cover;
  border-radius: 2px;
}

.playtime-recent__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.playtime-recent__name {
  font-size: 0.9375rem;
  color: var(--color-text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playtime-recent__meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Annotations */
.playtime-note {
  margin-top: 8px;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

@media (max-width: 640px) {
  .playtime-overview {
    flex-direction: column;
  }

  .playtime-title__thumb,
  .playtime-recent__thumb {
    display: none;
  }
}

/* ページヘッダー: シェアボタンを見出しのすぐ隣に左寄せ。
   共通の .page-header__left（baseline 揃え・10 テンプレート共用）は触らず、
   プレイ時間用の修飾で中央揃え＋折り返しにする。 */
.playtime-header__left {
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.playtime-header__share {
  white-space: nowrap;
}
