/* ============================================================
   リセット & テーマ変数
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg-color:      #0f172a;
  --card-bg:       #1e293b;
  --border-color:  #334155;
  --text-primary:  #f1f5f9;
  --text-secondary:#cbd5e1;
  --text-muted:    #64748b;
  --accent-color:  #6366f1;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP',
               system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   ヘッダー
   ============================================================ */
.app-header {
  text-align: center;
  padding: 3rem 1rem 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.app-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.app-subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

/* ============================================================
   メイン
   ============================================================ */
.app-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem;
}

.app-loading,
.app-error {
  text-align: center;
  padding: 4rem 0;
  color: var(--text-muted);
}

.app-error { color: #f87171; }

/* ============================================================
   検索ボックス
   ============================================================ */
.search-root {
  display: flex;
  justify-content: center;
  padding: 1rem 0 0.25rem;
}

.search-input {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 1.25rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* ============================================================
   カテゴリフィルター
   ============================================================ */
.cf-root {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 1rem 0;
}

.cf-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 1rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cf-btn:hover {
  border-color: var(--accent-color);
  color: var(--text-primary);
}

.cf-btn--active {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
  font-weight: 600;
}

/* ============================================================
   タイムライン
   ============================================================ */
.tl-root {
  position: relative;
  padding: 2rem 0 4rem;
}

/* 中央の縦ライン */
.tl-axis {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--border-color);
  transform: translateX(-50%);
}

/* 年グループ */
.tl-year-group {
  position: relative;
}

/* 年マーカー */
.tl-year-marker {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 2rem 0 1.5rem;
  z-index: 2;
}

.tl-year-marker span {
  background: var(--accent-color);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.3rem 1.25rem;
  border-radius: 99px;
  letter-spacing: 0.05em;
}

/* アイテム（左右交互） */
.tl-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  width: 50%;
  box-sizing: border-box;
}

.tl-item--left {
  left: 0;
  justify-content: flex-end;
  padding-right: 3rem;
  padding-left: 1rem;
}

.tl-item--right {
  left: 50%;
  justify-content: flex-start;
  padding-left: 3rem;
  padding-right: 1rem;
}

/* ドット */
.tl-dot {
  position: absolute;
  top: 1.25rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--bg-color);
  z-index: 1;
}

.tl-item--left  .tl-dot { right: -7px; }
.tl-item--right .tl-dot { left:  -7px; }

/* カード */
.tl-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  max-width: 340px;
  width: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tl-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.tl-card__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.tl-card__emoji {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.tl-card__meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tl-card__date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tl-card__category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 99px;
  width: fit-content;
}

.tl-card__title {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tl-card__description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tl-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 4rem 0;
}

/* ============================================================
   ステータスパネル（大画面のみ表示）
   ============================================================ */
.sp-root {
  display: none;
  position: fixed;
  top: 50%;
  right: 1.5rem;
  transform: translateY(-50%);
  width: 210px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem 1rem;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

@media (min-width: 1400px) {
  .sp-root { display: block; }
}

.sp-root.sp-visible {
  opacity: 1;
  pointer-events: auto;
}

.sp-year-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.sp-year {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent-color);
  letter-spacing: -0.03em;
}

.sp-age {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-color);
  padding: 0.15rem 0.6rem;
  border-radius: 99px;
  border: 1px solid var(--border-color);
}

.sp-section {
  margin-bottom: 0.75rem;
}

.sp-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.2rem;
}

.sp-status-value {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

.sp-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 0.75rem 0;
}

.sp-events-list {
  list-style: none;
  margin: 0.3rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sp-event-item {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

.sp-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.4em;
}

.sp-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================================
   モバイル（680px 以下）
   ============================================================ */
@media (max-width: 680px) {
  .tl-axis { left: 1.5rem; }

  .tl-item {
    width: 100%;
    left: 0 !important;
    padding-left: 3rem !important;
    padding-right: 1rem !important;
    justify-content: flex-start !important;
  }

  .tl-dot {
    left: -7px !important;
    right: auto !important;
  }
}
