/* ========================================
  ページ全体
======================================== */

.condition-page {
  background: #fffdf8;
  color: #333;
}

/* ========================================
  ヒーロー
======================================== */

.condition-hero {
  padding: 56px 20px 36px;
  background: linear-gradient(180deg, #eef7fb 0%, #fffdf8 100%);
  text-align: center;
}

.condition-hero__inner {
  max-width: 960px;
  margin: 0 auto;
}

.condition-hero__title {
  margin: 0 0 18px;
  color: #2f6f89;
  font-size: 32px;
  line-height: 1.5;
  letter-spacing: 0.06em;
}

.condition-hero__lead {
  margin: 0;
  font-size: 16px;
  line-height: 2;
}

/* ========================================
  条件検索エリア
======================================== */

.condition-search {
  padding: 32px 20px;
}

.condition-search__inner {
  max-width: 1080px;
  margin: 0 auto;
}

.condition-form {
  display: grid;
  gap: 24px;
}

.condition-form__box {
  padding: 24px;
  background: #fff;
  border: 1px solid #dcecf2;
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(47, 111, 137, 0.08);
}

.condition-form__title {
  margin: 0 0 8px;
  color: #2f6f89;
  font-size: 22px;
}

.condition-form__text {
  margin: 0 0 18px;
  color: #666;
  font-size: 14px;
  line-height: 1.8;
}

/* ========================================
  OR・AND切り替え
======================================== */

.condition-operator {
  padding: 0;
  margin: 0 0 24px;
  border: 0;
}

.condition-operator__choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.condition-operator__choice {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.condition-operator__choice input {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.condition-operator__note {
  min-height: 1.5em;
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.condition-operator__note:empty {
  display: none;
}

.condition-operator__note.is-error {
  color: #c62828;
  font-weight: 700;
}

/* ========================================
  タグ選択
======================================== */

.condition-form__terms {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.condition-checkbox {
  cursor: pointer;
}

.condition-checkbox input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.condition-checkbox span {
  display: inline-block;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #b8d8e4;
  border-radius: 999px;
  color: #2f6f89;
  font-size: 14px;
  line-height: 1.4;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.condition-checkbox span:hover {
  background: #eef7fb;
}

.condition-checkbox input:checked + span {
  background: #2f6f89;
  border-color: #2f6f89;
  color: #fff;
}

.condition-checkbox input:checked + span:hover {
  background: #2f6f89;
}

.condition-checkbox input:focus-visible + span {
  outline: 2px solid #168ee0;
  outline-offset: 3px;
}

/* ========================================
  件数・検索ボタン
======================================== */

.condition-form__sticky-actions {
  position: relative;
}

.condition-form__live-count {
  margin: 8px auto 0;
  color: #2f6f89;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.8;
  text-align: center;
}

.condition-form__live-count.is-empty {
  color: #b35c5c;
}

.condition-form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}

.condition-form__submit {
  appearance: none;
  padding: 13px 36px;
  background: #2f6f89;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(47, 111, 137, 0.22);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.condition-form__submit:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.condition-form__submit:focus-visible {
  outline: 2px solid #168ee0;
  outline-offset: 3px;
}

.condition-form__reset {
  color: #2f6f89;
  font-size: 14px;
  text-decoration: underline;
}

/* ========================================
  検索結果
======================================== */

.condition-results {
  padding: 24px 20px 72px;
}

.condition-results.is-before-search {
  padding: 0;
}

.condition-results__inner {
  max-width: 1080px;
  margin: 0 auto;
}

.condition-results__head {
  margin-bottom: 24px;
  text-align: center;
}

.condition-results__title {
  margin: 0 0 10px;
  color: #2f6f89;
  font-size: 26px;
}

.condition-results__count {
  margin: 0;
  color: #555;
  font-size: 15px;
  line-height: 1.8;
}

/* ========================================
  ドラマカード
======================================== */

.condition-drama-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}

.condition-drama-card {
  overflow: hidden;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(47, 111, 137, 0.08);
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.condition-drama-card:hover {
  box-shadow: 0 12px 24px rgba(47, 111, 137, 0.14);
  transform: translateY(-3px);
}

.condition-drama-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.condition-drama-card__image {
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: #eef7fb;
}

.condition-drama-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.condition-drama-card__noimage {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #8aa9b5;
  font-size: 14px;
}

.condition-drama-card__body {
  padding: 14px 14px 16px;
}

.condition-drama-card__title {
  margin: 0 0 6px;
  color: #333;
  font-size: 16px;
  line-height: 1.6;
}

.condition-drama-card__year {
  margin: 0 0 8px;
  color: #777;
  font-size: 13px;
}

.condition-drama-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.condition-drama-card__tags span {
  display: inline-block;
  padding: 4px 8px;
  background: #eef7fb;
  border-radius: 999px;
  color: #2f6f89;
  font-size: 12px;
  line-height: 1.4;
}

/* ========================================
  0件表示
======================================== */

.condition-results__empty {
  padding: 32px 20px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(47, 111, 137, 0.08);
  text-align: center;
}

.condition-results__empty p {
  margin: 0 0 8px;
  line-height: 1.8;
}

.condition-results__empty p:last-child {
  margin-bottom: 0;
}

/* ========================================
  ページネーション
======================================== */

.condition-pagination {
  margin-top: 40px;
}

.condition-pagination .page-numbers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.condition-pagination .page-numbers li {
  margin: 0;
}

.condition-pagination .page-numbers a,
.condition-pagination .page-numbers span {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid #b8d8e4;
  border-radius: 999px;
  color: #2f6f89;
  font-size: 14px;
  text-decoration: none;
}

.condition-pagination .page-numbers .current {
  background: #2f6f89;
  border-color: #2f6f89;
  color: #fff;
}

/* ========================================
  画面上では隠し、読み上げには残す
======================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
  タブレット
======================================== */

@media screen and (max-width: 1024px) {
  .condition-drama-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ========================================
  スマートフォン
======================================== */

@media screen and (max-width: 767px) {
  .condition-hero {
    padding: 44px 18px 28px;
  }

  .condition-hero__title {
    font-size: 26px;
  }

  .condition-hero__lead {
    font-size: 14px;
    line-height: 1.9;
  }

  .condition-search {
    padding: 24px 18px;
  }

  .condition-form {
    gap: 20px;
  }

  .condition-form__box {
    padding: 20px 16px;
    border-radius: 16px;
  }

  .condition-form__title {
    font-size: 20px;
  }

  .condition-form__text {
    margin-bottom: 16px;
  }

  /*
   * OR・ANDを横一列にする
   */
  .condition-operator {
    margin-bottom: 20px;
  }

  .condition-operator__choices {
    flex-wrap: nowrap;
    gap: 12px;
  }

  .condition-operator__choice {
    gap: 4px;
    white-space: nowrap;
    font-size: 14px;
  }

  .condition-operator__choice input {
    width: 15px;
    height: 15px;
  }

  /*
   * タグ
   */
  .condition-form__terms {
    gap: 5px;
  }

  .condition-checkbox span {
    padding: 8px 13px;
  }

  /*
   * SP：検索操作エリアを画面下部に固定
   * JSがフッターとの重なりを避けるため、
   * --condition-sticky-bottom の値を変更する
   */
  .condition-form__sticky-actions {
    position: fixed;
    right: 0;
    bottom: var(--condition-sticky-bottom, 0px);
    left: 0;
    z-index: 1000;

    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));

    background: rgba(255, 252, 247, 0.97);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(100%);

    transition:
      opacity 0.25s ease,
      visibility 0.25s ease,
      transform 0.25s ease;
  }

  .condition-form__sticky-actions.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .condition-form__sticky-actions .condition-form__live-count {
    margin: 0 0 7px;
    font-size: 14px;
    line-height: 1.4;
  }

  .condition-form__sticky-actions .condition-form__actions {
    flex-wrap: nowrap;
    gap: 14px;
    margin: 0;
  }

  .condition-form__sticky-actions .condition-form__submit {
    min-width: 190px;
    padding: 13px 24px;
  }

  .condition-form__sticky-actions .condition-form__reset {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /*
   * 検索前は空の結果セクションに余白を作らない
   */
  .condition-results.is-before-search {
    padding: 0;
  }

  /*
   * 検索後
   */
  .condition-results.is-searched {
    padding: 24px 20px 180px;
  }

  .condition-drama-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .condition-drama-card__body {
    padding: 12px;
  }

  .condition-drama-card__title {
    font-size: 14px;
  }
}

/* ========================================
  小さいスマートフォン
======================================== */

@media screen and (max-width: 374px) {
  .condition-search {
    padding-right: 14px;
    padding-left: 14px;
  }

  .condition-form__box {
    padding-right: 14px;
    padding-left: 14px;
  }

  .condition-operator__choices {
    gap: 8px;
  }

  .condition-operator__choice {
    font-size: 13px;
  }

  .condition-operator__choice input {
    width: 14px;
    height: 14px;
  }

  .condition-drama-list {
    gap: 12px;
  }

  .condition-checkbox span {
    padding: 7px 11px;
    font-size: 13px;
  }

  .condition-form__sticky-actions {
    padding-right: 10px;
    padding-left: 10px;
  }

  .condition-form__sticky-actions .condition-form__actions {
    gap: 10px;
  }

  .condition-form__sticky-actions .condition-form__submit {
    min-width: 0;
    padding-right: 20px;
    padding-left: 20px;
    font-size: 15px;
  }

  .condition-form__sticky-actions .condition-form__reset {
    font-size: 13px;
  }
}
