/* ===========================================
 * 投稿祭アーカイブ
 * =========================================== */

.toukousai-page {
  max-width: 1220px;
  margin: 0 auto;
  padding: 18px 14px 44px;
}

.toukousai-summary {
  margin-bottom: 14px;
}

.toukousai-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-content: center;
}

.toukousai-stat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  padding: 12px 8px 22px;
  border: 1px solid #dde5ef;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: center;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(20, 35, 55, 0.05);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.toukousai-stat::after {
  content: "▾";
  position: absolute;
  right: 8px;
  top: 6px;
  color: #98a5b4;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
}

.toukousai-stat:hover,
.toukousai-stat:focus-visible {
  transform: translateY(-1px);
  border-color: #8ab4e3;
  box-shadow: 0 4px 10px rgba(20, 35, 55, 0.1);
  outline: none;
}

.toukousai-stat:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(20, 35, 55, 0.08);
}

.toukousai-stat span {
  display: block;
  color: #16202a;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.1;
}

.toukousai-stat small {
  display: block;
  margin-top: 7px;
  color: #647486;
  font-size: 0.75rem;
  font-weight: 700;
}

.toukousai-stat-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5px;
  display: block;
  color: #8a98a7;
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.toukousai-stat.is-active-combined {
  border-color: #7ccba6;
  background: linear-gradient(160deg, #f3fbf6 40%, #fffaf0 100%);
}

.toukousai-stat.is-active-combined.is-active {
  border-color: #1e8b50;
  background: linear-gradient(160deg, #c8f0d8 40%, #ffe6a0 100%);
}

.toukousai-stat.is-current {
  border-color: #9bd6b6;
  background: #f3fbf6;
}

.toukousai-stat.is-upcoming {
  border-color: #f0ca81;
  background: #fffaf0;
}

.toukousai-stat.is-ended {
  border-color: #d4dbe5;
  background: #f7f8fa;
}

.toukousai-stat.is-active {
  border-width: 2px;
  padding: 11px 7px 21px;
  box-shadow: 0 0 0 3px rgba(11, 114, 217, 0.22), 0 4px 14px rgba(11, 114, 217, 0.18);
}

.toukousai-stat.is-active::after {
  content: "✓";
  color: #0b72d9;
  font-size: 0.82rem;
}

.toukousai-stat.is-active .toukousai-stat-hint {
  color: #0b72d9;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.toukousai-stat.is-current.is-active {
  border-color: #1e8b50;
  background: #c8f0d8;
}

.toukousai-stat.is-upcoming.is-active {
  border-color: #b07818;
  background: #ffe6a0;
}

.toukousai-stat.is-ended.is-active {
  border-color: #55657a;
  background: #d8dfe8;
}

.toukousai-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 5px rgba(20, 35, 55, 0.06);
}

.toukousai-search-row,
.toukousai-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.toukousai-toolbar label {
  display: grid;
  gap: 5px;
  min-width: 150px;
  color: #425162;
  font-size: 0.76rem;
  font-weight: 800;
}

.toukousai-search {
  flex: 1 1 300px;
}

/* メインジャンル＋サブジャンルを横並びにまとめる */
.toukousai-genre-group {
  display: flex;
  gap: 10px;
  flex: 1 1 320px;
}

.toukousai-genre-group label {
  flex: 1 1 0;
  min-width: 0;
}

.toukousai-toolbar input,
.toukousai-toolbar select {
  min-height: 38px;
  width: 100%;
  border: 1px solid #c8d4e2;
  border-radius: 6px;
  background: #fff;
  color: #17212b;
  font: inherit;
  font-size: 0.92rem;
}

.toukousai-toolbar input {
  padding: 8px 10px;
}

.toukousai-toolbar select {
  padding: 7px 30px 7px 10px;
}

.toukousai-segment,
.toukousai-view-toggle {
  display: inline-flex;
  min-height: 38px;
  border: 1px solid #c8d4e2;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.toukousai-segment button,
.toukousai-view-toggle button,
.toukousai-reset {
  min-height: 38px;
  border: 0;
  background: #fff;
  color: #2f3c4a;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.toukousai-segment button,
.toukousai-view-toggle button {
  padding: 0 12px;
  border-right: 1px solid #d9e1eb;
  white-space: nowrap;
}

.toukousai-segment button:last-child,
.toukousai-view-toggle button:last-child {
  border-right: 0;
}

.toukousai-segment button.is-active,
.toukousai-view-toggle button.is-active {
  background: #0b72d9;
  color: #fff;
}

.toukousai-reset {
  padding: 0 14px;
  border: 1px solid #c8d4e2;
  border-radius: 6px;
}

.toukousai-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  color: #5d6d7e;
  font-size: 0.84rem;
  font-weight: 700;
}

.toukousai-meta-row p {
  margin: 0;
}

.toukousai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.toukousai-card {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border: 1px solid #dae3ed;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(22, 32, 42, 0.06);
}

.toukousai-card[hidden] {
  display: none;
}

.toukousai-thumb {
  display: flex;
  aspect-ratio: 16 / 9;
  background: #e9edf2;
  color: #44515f;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.toukousai-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.toukousai-thumb img.is-contain {
  object-fit: contain;
  background: #e8f4fb;
}

.toukousai-thumb span {
  font-size: 2rem;
  font-weight: 900;
}

.toukousai-card-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.toukousai-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.toukousai-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 7px;
  border-radius: 5px;
  background: #eef3f8;
  color: #3b4b5c;
  font-size: 0.72rem;
  font-weight: 900;
}

.toukousai-badge.status-current {
  background: #ddf6e8;
  color: #11733a;
}

.toukousai-badge.status-upcoming {
  background: #fff0cf;
  color: #8a5200;
}

.toukousai-badge.status-ended,
.toukousai-badge.archived {
  background: #edf0f4;
  color: #667789;
}

.toukousai-badge.type {
  background: #e7f0ff;
  color: #005fc7;
}

.toukousai-badge.new {
  background: #e9fbf0;
  color: #0a7d3c;
  border: 1px solid #8fdcae;
}

.toukousai-badge.urgent {
  background: #ffe9e0;
  color: #c2410c;
  border: 1px solid #f2b89a;
}

.toukousai-card h3 {
  min-height: 2.6em;
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.toukousai-card h3 a {
  color: #17212b;
}

.toukousai-description {
  display: -webkit-box;
  min-height: 3.9em;
  margin: 0;
  overflow: hidden;
  color: #4b5968;
  font-size: 0.86rem;
  line-height: 1.45;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.toukousai-details {
  display: grid;
  gap: 5px;
  margin: 0;
  color: #3e4b58;
  font-size: 0.8rem;
}

.toukousai-details div {
  display: grid;
  grid-template-columns: 4.5em minmax(0, 1fr);
  gap: 7px;
}

.toukousai-details dt {
  color: #6a7886;
  font-weight: 900;
  white-space: nowrap;
}

.toukousai-details dd {
  margin: 0;
  min-width: 0;
}

.toukousai-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 2px;
}

.toukousai-actions a {
  flex: 1 1 0;
  text-align: center;
  white-space: nowrap;
}

.toukousai-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #c9d8ea;
  border-radius: 5px;
  background: #fff;
  color: #075fb5;
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
}

.toukousai-actions a:first-child {
  background: #0b72d9;
  border-color: #0b72d9;
  color: #fff;
}

.toukousai-grid.is-list {
  grid-template-columns: 1fr;
}

.toukousai-grid.is-list .toukousai-card {
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: start;
}

.toukousai-grid.is-list .toukousai-thumb {
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
}

/* 一覧表示はサムネ全体を表示（見切れ防止） */
.toukousai-grid.is-list .toukousai-thumb img {
  object-fit: contain;
  background: #e9edf2;
}

.toukousai-grid.is-list .toukousai-card h3 {
  min-height: 0;
}

.toukousai-empty {
  padding: 26px 14px;
  border: 1px dashed #becbd9;
  border-radius: 8px;
  background: #fff;
  color: #596879;
  text-align: center;
  font-weight: 800;
}

/* ── ページャー ──────────────────────────────────────── */
.toukousai-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 0 8px;
  flex-wrap: wrap;
}

.toukousai-pager:empty {
  display: none;
}

.toukousai-pager-btn,
.toukousai-pager-page {
  padding: 6px 14px;
  border: 1px solid #0b72d9;
  border-radius: 4px;
  background: #fff;
  color: #0b72d9;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.4;
  transition: background 0.12s;
}

.toukousai-pager-btn:hover:not(:disabled),
.toukousai-pager-page:hover:not(.is-current) {
  background: #e6f0fb;
}

.toukousai-pager-btn:disabled {
  border-color: #c9d5e2;
  color: #a0afbe;
  cursor: default;
  background: #fff;
}

.toukousai-pager-page.is-current {
  background: #0b72d9;
  border-color: #0b72d9;
  color: #fff;
  cursor: default;
  font-weight: 700;
}

@media (max-width: 860px) {
  .toukousai-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .toukousai-stat {
    min-height: 96px;
    padding: 14px 8px 24px;
  }

  .toukousai-stat span {
    font-size: 1.7rem;
  }

  .toukousai-stat small {
    font-size: 0.8rem;
  }

  .toukousai-stat-hint {
    font-size: 0.68rem;
    bottom: 6px;
  }

  .toukousai-stat::after {
    font-size: 0.78rem;
    right: 9px;
    top: 7px;
  }
}

@media (max-width: 640px) {
  .toukousai-page {
    padding: 12px 10px 34px;
  }

  .toukousai-toolbar {
    padding: 10px;
    scroll-margin-top: 12px;
  }

  .toukousai-meta-row {
    scroll-margin-top: 12px;
  }

  .toukousai-toolbar label,
  .toukousai-search,
  .toukousai-genre-group {
    flex: 1 1 100%;
    min-width: 0;
  }

  /* セグメントは折り返して全ボタンを表示（見切れ防止） */
  .toukousai-segment {
    width: 100%;
    flex-wrap: wrap;
    overflow: visible;
  }

  .toukousai-segment button {
    flex: 1 1 auto;
    padding: 0 10px;
    border-bottom: 1px solid #d9e1eb;
  }

  /* スマホではカードと一覧の見た目が同じなので「一覧」ボタンだけ隠す（カレンダーは残す） */
  .toukousai-view-toggle button[data-view="list"] {
    display: none;
  }
  .toukousai-view-toggle {
    width: 100%;
  }

  .toukousai-reset {
    width: 100%;
  }

  .toukousai-meta-row {
    flex-direction: column;
  }

  .toukousai-grid,
  .toukousai-grid.is-list {
    grid-template-columns: 1fr;
  }

  .toukousai-grid.is-list .toukousai-card {
    grid-template-columns: 1fr;
  }

  .toukousai-grid.is-list .toukousai-thumb {
    min-height: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

/* ===== 個別詳細ページ ===== */
.toukousai-detail-back {
  margin: 0 0 12px;
  font-size: 0.9rem;
}

.toukousai-detail {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 20px;
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 14px;
  padding: 18px;
}

.toukousai-detail-thumb img {
  width: 100%;
  border-radius: 10px;
  display: block;
  background: #e9edf2;
}

.toukousai-detail-title {
  margin: 8px 0 12px;
  font-size: 1.5rem;
  line-height: 1.35;
}

.toukousai-detail-desc {
  margin: 0 0 14px;
  color: #3b4b5c;
  line-height: 1.7;
}

.toukousai-detail-meta {
  margin: 0 0 16px;
  display: grid;
  gap: 8px;
}

.toukousai-detail-meta div {
  display: grid;
  grid-template-columns: 6em minmax(0, 1fr);
  gap: 10px;
}

.toukousai-detail-meta dt {
  color: #6a7886;
  font-weight: 900;
  white-space: nowrap;
}

.toukousai-detail-meta dd {
  margin: 0;
}

.toukousai-detail-actions a.is-primary {
  background: #0b72d9;
  color: #fff;
  border-color: #0b72d9;
}

@media (max-width: 700px) {
  .toukousai-detail {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .toukousai-detail-title {
    font-size: 1.4rem;
  }
}

.toukousai-detail-extra {
  margin-top: 24px;
  border-top: 1px dashed #c0cddb;
  padding-top: 20px;
}

.toukousai-detail-extra-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a2a3a;
  margin: 0 0 12px;
}

.toukousai-detail-extra-box {
  background: #f7f9fc;
  border-radius: 8px;
  padding: 16px;
}

.toukousai-video-uploader {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #1a2a3a;
}

.uploader-icon {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  background: #e8eef4;
}

.toukousai-video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.video-tag {
  background: #fff;
  border: 1px solid #c0cddb;
  color: #4f6477;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
}

.toukousai-video-desc {
  font-size: 0.9rem;
  color: #4f6477;
  line-height: 1.6;
  margin: 0;
  overflow-wrap: anywhere;
}

/* ===== カレンダー表示 ===== */
.toukousai-calendar {
  margin-top: 12px;
}

.toukousai-calendar-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 10px;
}

.toukousai-cal-title {
  font-size: 1.1rem;
  font-weight: 900;
  min-width: 8em;
  text-align: center;
}

.toukousai-cal-nav {
  width: 36px;
  height: 36px;
  border: 1px solid #d9e1eb;
  border-radius: 8px;
  background: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.toukousai-cal-nav:hover {
  background: #eef3f8;
}

.toukousai-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.toukousai-cal-wd {
  text-align: center;
  font-weight: 900;
  font-size: 0.78rem;
  color: #6a7886;
  padding: 4px 0;
}

.toukousai-cal-wd.is-sun { color: #c2410c; }
.toukousai-cal-wd.is-sat { color: #0b66c2; }

.toukousai-cal-cell {
  min-height: 92px;
  border: 1px solid #e4e9f0;
  border-radius: 7px;
  padding: 3px;
  background: #fff;
  overflow: hidden;
}

.toukousai-cal-cell.is-blank {
  background: #f6f8fb;
  border-style: dashed;
}

.toukousai-cal-cell.is-today {
  border-color: #0b72d9;
  box-shadow: 0 0 0 1px #0b72d9 inset;
}

.toukousai-cal-day {
  font-size: 0.78rem;
  font-weight: 700;
  color: #45525f;
  margin-bottom: 2px;
}

.toukousai-cal-cell.is-sun .toukousai-cal-day { color: #c2410c; }
.toukousai-cal-cell.is-sat .toukousai-cal-day { color: #0b66c2; }

.toukousai-cal-chip {
  display: block;
  font-size: 0.68rem;
  line-height: 1.3;
  padding: 1px 5px;
  margin-bottom: 2px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #eef3f8;
  color: #3b4b5c;
  text-decoration: none;
}

a.toukousai-cal-chip:hover {
  filter: brightness(0.95);
  text-decoration: underline;
}

.toukousai-cal-chip.status-current { background: #ddf6e8; color: #11733a; }
.toukousai-cal-chip.status-upcoming { background: #fff0cf; color: #8a5200; }
.toukousai-cal-chip.status-ended { background: #edf0f4; color: #667789; }

.toukousai-cal-more {
  font-size: 0.66rem;
  color: #6a7886;
  padding: 0 4px;
}

.toukousai-cal-all {
  display: block;
  width: 100%;
  margin-top: 2px;
  padding: 2px 4px;
  font-size: 0.66rem;
  font-weight: 700;
  color: #0b66c2;
  background: #eef4fb;
  border: 1px solid #cfe0f2;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
}

.toukousai-cal-all:hover {
  background: #e0ecf8;
}

/* 1日の全件モーダル */
.toukousai-day-modal {
  width: min(440px, 92vw);
  border: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}

.toukousai-day-modal::backdrop {
  background: rgba(0, 0, 0, .45);
}

.toukousai-day-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #e4e9f0;
  font-size: 0.95rem;
}

.toukousai-day-modal-head button {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #889;
  line-height: 1;
}

.toukousai-day-modal-list {
  padding: 12px 16px 16px;
  max-height: 70vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toukousai-day-item {
  display: block;
  padding: 9px 11px;
  border-radius: 8px;
  text-decoration: none;
  background: #eef3f8;
  color: #3b4b5c;
  font-size: 0.9rem;
  font-weight: 700;
}

a.toukousai-day-item:hover {
  text-decoration: underline;
}

.toukousai-day-item.status-current { background: #ddf6e8; color: #11733a; }
.toukousai-day-item.status-upcoming { background: #fff0cf; color: #8a5200; }
.toukousai-day-item.status-ended { background: #edf0f4; color: #667789; }

.toukousai-cal-note {
  margin: 10px 2px 0;
  font-size: 0.74rem;
  color: #8693a1;
}

@media (max-width: 640px) {
  .toukousai-cal-cell {
    min-height: 66px;
    padding: 2px;
  }
  .toukousai-cal-chip {
    font-size: 0.6rem;
    padding: 1px 3px;
  }
  .toukousai-calendar-grid {
    gap: 2px;
  }
}
