/* ========== 作品検索画面専用スタイル ========== */

/* 作品グリッドレイアウト（3列、縦長長方形サムネイル） */
#works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  max-width: 480px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* 作品カードスタイル（縦長長方形対応） */
.work-card {
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.work-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.work-card:active {
  transform: translateY(0);
}

/* 作品画像コンテナ（縦長長方形） */
.work-image-container {
  width: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 4px 4px 0 0;
  /* 3:4の比率を親要素で確保 */
  padding-top: 133.33%; /* 3:4 = 100/3 * 4 = 133.33% */
}

/* 作品画像（縦長長方形、3:4比率、上下欠け修正） */
.work-image {
  position: absolute; /* 親要素の padding-top に合わせて絶対配置 */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* coverからcontainに変更 */
  /* 画像全体が表示されるが、余白ができる場合がある */
  background-color: #f0f0f0;
  display: block;
  border: none;
}

/* 作品画像エラー時のプレースホルダー */
.work-image.placeholder {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 430.963 78'%3E%3Cpath fill='%23FF6B81' d='M206.836,15v14h-55V15H206.836z M144.836,57v14h73V57H144.836z M394.463,45.083l-38.627-19.539V0h-14 v78h14V41.247l32.202,16.317L394.463,45.083z M330.836,8h-56v14h33.654l-41.334,41.334l9.898,9.9l24.453-24.453L329.2,69.053 l8.268-11.297l-26.219-18.992L330.836,22V8z M231.233,51.574l-13.994,0.341L215.643,0h13.995L231.233,51.574z M266.448,0h-13.93 l-8.09,78h13.93L266.448,0z M143.836,29V15h-22.222l-2.179-15h-13.429l1.896,15H86.836v14h23.102l1.745,12H81.836v13h31.738 l3.593,24h13.429l-3.309-24h16.549V41h-18.44l-1.746-12H143.836z M47.176,78H60.98l4.243-45h15l1.292-14h-15l1.66-19h-14l-1.66,19 h-40l-1.292,14h27.271L0,68.244l8.709,9.596l41.919-38.377l-1.856,20.121l-4.92-5.422l-10.381,9.189L47.176,78z M400.926,48.4 l4.793-31.816l3.939-16.287l21.305,6.088L425.7,22.294l-12.652,29.571L400.926,48.4z M402.487,53.771 c-6.451,0-11.68,5.229-11.68,11.68s5.229,11.68,11.68,11.68s11.68-5.229,11.68-11.68S408.938,53.771,402.487,53.771z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 60% auto;
  background-color: #f9f9f9;
  opacity: 0.3;
}

/* ========== 並び替えボタン・アコーディオンスタイル ========== */

/* 並び替えボタン（女優ページと同じスタイル） */
.sort-button {
  display: flex;
  align-items: center;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  position: relative;
  background: none;
  border: none;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sort-button svg {
  margin-right: 5px;
  width: 1.3em;
  height: 1.3em;
  stroke: #555555;
}

.sort-button p {
  color: #555555;
  margin: 0;
  font-size: 1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.sort-button.active {
  color: #ff6b81;
}

.sort-button.active svg {
  stroke: #ff6b81;
}

.sort-button.active p {
  color: #ff6b81;
}

/* 検索ボタンの状態（メイン画面と同様） */
.search-button {
  display: flex;
  align-items: center;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  position: relative;
  background: none;
  border: none;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.search-button svg {
  margin-right: 5px;
  width: 1.3em;
  height: 1.3em;
  stroke: #555555;
}

.search-button p {
  color: #555555;
  margin: 0;
  font-size: 1em;
}

/* 検索アクティブ状態（ピンク表示） */
.search-button.active {
  color: #ff6b81;
}

.search-button.active svg {
  stroke: #ff6b81;
}

.search-button.active p {
  color: #ff6b81;
}

/* 🆕 絞り込みボタンのアクティブ状態 */
.filter-right.filtered svg line,
.filter-right.filtered svg circle {
  stroke: #ff6b81 !important;
}

.filter-right.filtered p {
  color: #ff6b81 !important;
}

/* アコーディオン式並べ替えオプション */
.sort-accordion {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease, padding 0.3s ease;
  background-color: #f8f9fa;
  border-bottom: 1px solid #eee;
}

.sort-accordion.open {
  max-height: 80px;
  padding: 15px 10px;
}

.sort-options-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 0;
}

.sort-option-btn {
  flex: 1;
  padding: 8px 6px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background-color: white;
  font-size: 0.85em;
  color: #555;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
  min-width: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sort-option-btn:hover {
  background-color: #f0f0f0;
  border-color: #ff6b81;
}

.sort-option-btn.active {
  background-color: #ff6b81;
  color: white;
  border-color: #ff6b81;
  font-weight: bold;
}

/* ========== 検索ウィンドウスタイル（メイン画面と同じ） ========== */

/* 検索ウィンドウ */
.search-window {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  z-index: 2000;
  overflow-y: auto;
  font-size: 16px;
}

.search-window-container {
  padding: 10px;
  background-color: #fff;
  width: 100%;
}

.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 5px 20px;
  position: sticky;
  top: 0;
  background-color: white;
  z-index: 1000;
  border-bottom: 1px solid #eee;
}

.search-header h2 {
  text-align: center;
  flex-grow: 1;
  font-size: 1.2em;
  font-weight: bold;
}

.close-search-button {
  font-size: 2.3em;
  color: #888;
  background: none;
  border: none;
  cursor: pointer;
  width: 30px;
  text-align: left;
  margin-left: 15px;
}

.search-content {
  padding: 20px 15px;
}

/* 検索入力フィールド */
.search-input-container {
  position: relative;
  flex-grow: 1;
  display: flex;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 50px;
  padding: 0 15px;
  background-color: #f5f5f5;
  height: 40px;
  margin-bottom: 30px;
}

.search-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 6px 0;
  font-size: 16px;
  outline: none;
}

.search-input::placeholder {
  color: #999;
}

.clear-search-button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  font-size: 1.2em;
  color: #999;
  cursor: pointer;
  display: none;
}

/* 検索履歴 */
.search-history-container {
  padding: 10px 15px;
}

.search-history-title {
  font-size: 0.9em;
  color: #777;
  margin-bottom: 15px;
  font-weight: bold;
}

.search-history-item {
  display: inline-block;
  margin-right: 10px;
  margin-bottom: 10px;
  padding: 8px 16px;
  background-color: #f0f0f0;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #555;
}

.search-history-item:hover {
  background-color: #e8e8e8;
  border-color: #d0d0d0;
}

.search-history-item:active {
  transform: scale(0.95);
}

/* 検索ボタン */
.search-buttons-container {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 30px;
}

.search-buttons-container .action-button {
  flex: 1;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.95em;
  border: none;
  transition: all 0.2s ease;
}

.search-buttons-container .action-button:first-child {
  background-color: white;
  color: #666;
  border: 1px solid #ddd;
}

.search-buttons-container .action-button:first-child:hover {
  background-color: #f9f9f9;
  border-color: #ccc;
}

.search-buttons-container .primary-button {
  background-color: #ff6b81;
  color: white;
  border: 1px solid #ff6b81;
}

.search-buttons-container .primary-button:hover:not(.disabled) {
  background-color: #ff5a73;
  border-color: #ff5a73;
}

.search-buttons-container .disabled {
  background-color: #aaa !important;
  color: white !important;
  border-color: #aaa !important;
  cursor: not-allowed !important;
  opacity: 0.6;
}

.search-buttons-container .disabled:hover {
  background-color: #aaa !important;
  border-color: #aaa !important;
  transform: none !important;
}

/* ========== 🆕 絞り込みウィンドウスタイル ========== */

/* 絞り込みウィンドウ（全画面白背景） */
.filter-window {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  z-index: 2100; /* 検索ウィンドウより上 */
  overflow-y: auto;
  font-size: 16px;
}

.filter-window-container {
  padding: 10px;
  background-color: #fff;
  width: 100%;
}

/* 絞り込みヘッダー */
.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 5px 20px;
  position: sticky;
  top: 0;
  background-color: white;
  z-index: 1000;
  border-bottom: 1px solid #eee;
}

.filter-header h2 {
  text-align: center;
  flex-grow: 1;
  font-size: 1.2em;
  font-weight: bold;
  color: #333;
}

.close-filter-button {
  font-size: 2.3em;
  color: #888;
  background: none;
  border: none;
  cursor: pointer;
  width: 30px;
  text-align: left;
  margin-left: 15px;
}

/* 絞り込みコンテンツ */
.filter-content {
  padding: 20px 15px 100px; /* 下部ボタン分の余白 */
}

/* 絞り込みセクション */
.filter-section {
  margin-bottom: 35px;
  padding-bottom: 25px;
}

.filter-section:not(:last-child) {
  border-bottom: 1px solid #f0f0f0;
}

.filter-section-title {
  font-size: 1.1em;
  font-weight: bold;
  color: #333;
  margin-bottom: 15px;
  padding-left: 5px;
}

/* 🆕 チェックボックススタイル */
.filter-checkbox-container {
  padding: 10px 0;
}

.filter-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 1em;
  color: #555;
  gap: 10px;
}

.filter-checkbox {
  display: none;
}

.filter-checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid #ddd;
  border-radius: 4px;
  background-color: white;
  position: relative;
  transition: all 0.2s ease;
}

.filter-checkbox:checked + .filter-checkbox-custom {
  background-color: #ff6b81;
  border-color: #ff6b81;
}

.filter-checkbox:checked + .filter-checkbox-custom::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

/* 🆕 数値範囲入力スタイル */
.filter-range-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.filter-range-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.filter-range-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1em;
  background-color: #f9f9f9;
  transition: background-color 0.2s ease;
  min-width: 0;
}

.filter-range-input:focus {
  outline: none;
  background-color: white;
}

.filter-range-input::placeholder {
  color: #999;
}

.filter-range-separator {
  color: #666;
  font-weight: bold;
  font-size: 1.1em;
  flex-shrink: 0;
}

.filter-unit {
  color: #666;
  font-size: 0.9em;
  flex-shrink: 0;
  min-width: 30px;
}

/* 🆕 プリセットボタンスタイル */
.filter-range-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-preset-btn {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background-color: white;
  font-size: 0.85em;
  color: #555;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.filter-preset-btn:hover {
  background-color: #f0f0f0;
  border-color: #ff6b81;
}

.filter-preset-btn:active {
  background-color: #ff6b81;
  color: white;
  border-color: #ff6b81;
}

/* 🆕 日付入力スタイル */
.filter-date-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.filter-date-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.filter-date-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1em;
  background-color: #f9f9f9;
  transition: background-color 0.2s ease;
  min-width: 0;
}

.filter-date-input:focus {
  outline: none;
  background-color: white;
}

/* 🆕 絞り込みボタンコンテナ */
.filter-buttons-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: white;
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 10px;
  z-index: 1001;
}

.filter-reset-button {
  flex: 1;
  padding: 12px 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: white;
  color: #666;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-reset-button:hover {
  background-color: #f9f9f9;
  border-color: #ccc;
}

.filter-apply-button {
  flex: 2;
  padding: 12px 20px;
  border: 1px solid #ff6b81;
  border-radius: 8px;
  background-color: #ff6b81;
  color: white;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-apply-button:hover {
  background-color: #ff5a73;
  border-color: #ff5a73;
}

.filter-apply-button:active {
  transform: scale(0.98);
}

/* ========== エラー・空データ表示 ========== */

.error-message {
  text-align: center;
  padding: 40px;
  color: #999;
}

.retry-button {
  background-color: #ff6b81;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
}

.no-works {
  text-align: center;
  color: #999;
  padding: 40px;
  grid-column: 1 / -1;
  font-size: 1.1em;
  line-height: 1.6;
}

/* ローディング状態 */
.works-loading {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-size: 1.1em;
  grid-column: 1 / -1;
}

.works-loading::after {
  content: "...";
  animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
  0%,
  20% {
    content: "...";
  }
  40% {
    content: "";
  }
  60% {
    content: ".";
  }
  80% {
    content: "..";
  }
}

/* ========== レスポンシブデザイン ========== */

/* タブレット表示の調整 */
@media (min-width: 481px) and (max-width: 767px) {
  #works-grid {
    max-width: 90%;
    gap: 10px;
    padding: 12px;
  }

  .work-title {
    font-size: 0.87em;
    height: 62px;
  }

  .filter-range-presets {
    justify-content: center;
  }
}

/* PC表示用の調整 */
@media (min-width: 768px) {
  #works-grid {
    gap: 12px;
    padding: 15px;
  }

  .work-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  }

  .work-title {
    font-size: 0.9em;
    height: 65px;
    padding: 10px 8px;
  }

  /* 🔧 修正: PC版検索ウィンドウを半透明背景＋左寄せ */
  .search-window {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 半透明背景 */
    z-index: 2000;
    justify-content: flex-start; /* 左寄せ */
    align-items: flex-start;
  }

  .search-window-container {
    background-color: white;
    max-width: 480px;
    width: 480px; /* 固定幅 */
    height: 100%;
    overflow-y: auto;
    margin: 0; /* 中央寄せを削除 */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  }

  /* 🔧 修正: PC版絞り込みウィンドウを半透明背景＋左寄せ */
  .filter-window {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* 半透明背景 */
    z-index: 2100;
    justify-content: flex-start; /* 左寄せ */
    align-items: flex-start;
  }

  .filter-window-container {
    background-color: white;
    max-width: 480px;
    width: 480px; /* 固定幅 */
    height: 100%;
    overflow-y: auto;
    margin: 0; /* 中央寄せを削除 */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    padding: 20px 20px 100px;
  }

  .filter-buttons-container {
    position: fixed;
    bottom: 0;
    left: 0; /* 左端から開始 */
    transform: none; /* 中央寄せを削除 */
    max-width: 480px;
    width: 480px; /* 固定幅 */
    background-color: white;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    border-radius: 0; /* 角丸を削除 */
  }
}

/* 🔧 修正: モバイル表示の改善（使いやすさ重視） */
@media (max-width: 480px) {
  #works-grid {
    gap: 6px;
    padding: 8px;
  }

  .work-card {
    border-radius: 4px;
  }

  .work-title {
    font-size: 0.8em;
    height: 58px;
    padding: 6px 4px;
  }

  .sort-options-row {
    gap: 4px;
  }

  .sort-option-btn {
    padding: 6px 4px;
    font-size: 0.8em;
  }

  /* 🔧 修正: モバイル絞り込み調整（使いやすさ重視） */

  /* 絞り込みコンテンツの余白調整 */
  .filter-content {
    padding: 15px 10px 120px; /* 左右の余白を減らし、下部余白を増加 */
  }

  /* セクション間の間隔を調整 */
  .filter-section {
    margin-bottom: 25px; /* 35px → 25px */
    padding-bottom: 20px; /* 25px → 20px */
  }

  .filter-section-title {
    font-size: 1.05em; /* 1.1em → 1.05em */
    margin-bottom: 12px; /* 15px → 12px */
  }

  /* 🆕 数値範囲入力：横並び維持（改善版） */
  .filter-range-inputs {
    display: flex;
    flex-direction: row; /* column → row に戻す */
    align-items: center;
    gap: 6px; /* 8px → 6px */
    justify-content: space-between;
  }

  .filter-range-input {
    flex: 1;
    min-width: 0;
    padding: 10px 8px; /* 10px 12px → 10px 8px */
    font-size: 0.95em; /* 1em → 0.95em */
  }

  .filter-range-separator {
    color: #666;
    font-weight: bold;
    font-size: 1em; /* 1.1em → 1em */
    flex-shrink: 0;
  }

  .filter-unit {
    color: #666;
    font-size: 0.85em; /* 0.9em → 0.85em */
    flex-shrink: 0;
    min-width: 25px; /* 30px → 25px */
    text-align: left; /* center → left */
  }

  /* 🆕 プリセットボタン：2行レイアウト（改善版） */
  .filter-range-presets {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2列グリッド */
    gap: 6px;
    margin-top: 10px;
  }

  .filter-preset-btn {
    width: 100%;
    text-align: center;
    padding: 8px 6px; /* 6px 12px → 8px 6px */
    font-size: 0.8em; /* 0.85em → 0.8em */
    border-radius: 18px; /* 20px → 18px */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 3つのボタンの場合：1行目2個、2行目1個（中央配置） */
  .filter-section:nth-child(2) .filter-range-presets {
    /* 収録時間：3つのプリセット */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .filter-section:nth-child(2) .filter-preset-btn:nth-child(3) {
    grid-column: 1 / 3; /* 3番目のボタンを全幅に */
  }

  .filter-section:nth-child(4) .filter-range-presets {
    /* レビュー数：3つのプリセット */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .filter-section:nth-child(4) .filter-preset-btn:nth-child(3) {
    grid-column: 1 / 3; /* 3番目のボタンを全幅に */
  }

  /* 評価点：2つのプリセット（そのまま2列） */
  .filter-section:nth-child(3) .filter-range-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  /* 🆕 日付入力：横並び維持（改善版） */
  .filter-date-inputs {
    display: flex;
    flex-direction: row; /* column → row に戻す */
    align-items: center;
    gap: 6px; /* 8px → 6px */
    justify-content: space-between;
  }

  .filter-date-input {
    flex: 1;
    min-width: 0;
    padding: 10px 8px;
    font-size: 0.95em;
  }

  /* 🆕 発売日プリセットボタン：2行レイアウト */
  .filter-date-container .filter-range-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 10px;
  }

  .filter-date-container .filter-preset-btn:nth-child(3) {
    grid-column: 1 / 3; /* 3番目のボタン（直近3ヶ月）を全幅に */
  }

  /* 🆕 チェックボックスのタップ領域拡大 */
  .filter-checkbox-label {
    padding: 8px 0; /* タップしやすくする */
    font-size: 0.95em; /* 1em → 0.95em */
  }

  .filter-checkbox-custom {
    width: 18px; /* 20px → 18px */
    height: 18px; /* 20px → 18px */
  }

  .filter-checkbox:checked + .filter-checkbox-custom::after {
    font-size: 12px; /* 14px → 12px */
  }

  /* 🆕 下部ボタンの改善 */
  .filter-buttons-container {
    padding: 12px 15px; /* 15px 20px → 12px 15px */
    gap: 8px; /* 10px → 8px */
  }

  .filter-reset-button,
  .filter-apply-button {
    padding: 10px 16px; /* 12px 20px → 10px 16px */
    font-size: 0.95em; /* 1em → 0.95em */
    border-radius: 6px; /* 8px → 6px */
  }
}

/* 🆕 さらに小さな画面（iPhone SE等）への対応 */
@media (max-width: 375px) {
  .filter-content {
    padding: 12px 8px 120px;
  }

  .filter-range-input,
  .filter-date-input {
    padding: 8px 6px;
    font-size: 0.9em;
  }

  .filter-preset-btn {
    padding: 6px 4px;
    font-size: 0.75em;
  }

  .filter-unit {
    min-width: 20px;
    font-size: 0.8em;
  }

  .filter-range-separator {
    font-size: 0.9em;
  }

  .filter-section-title {
    font-size: 1em;
  }
}

/* 🆕 横向き表示時の調整 */
@media (max-width: 768px) and (orientation: landscape) {
  .filter-content {
    padding: 10px 15px 100px;
  }

  .filter-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
  }

  .filter-range-presets,
  .filter-date-container .filter-range-presets {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
  }

  .filter-preset-btn {
    flex: 1;
    min-width: calc(33.333% - 4px);
  }

  .filter-section:nth-child(2) .filter-preset-btn:nth-child(3),
  .filter-section:nth-child(4) .filter-preset-btn:nth-child(3),
  .filter-date-container .filter-preset-btn:nth-child(3) {
    grid-column: unset; /* グリッド設定を解除 */
  }
}

/* ========== アニメーション効果 ========== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.work-card {
  animation: fadeInUp 0.3s ease-out;
}

/* グリッドアイテムの遅延アニメーション */
.work-card:nth-child(1) {
  animation-delay: 0.05s;
}
.work-card:nth-child(2) {
  animation-delay: 0.1s;
}
.work-card:nth-child(3) {
  animation-delay: 0.15s;
}
.work-card:nth-child(4) {
  animation-delay: 0.2s;
}
.work-card:nth-child(5) {
  animation-delay: 0.25s;
}
.work-card:nth-child(6) {
  animation-delay: 0.3s;
}

/* 検索ウィンドウのアニメーション */
.search-window {
  animation: fadeIn 0.3s ease-out;
}

.search-window-container {
  animation: slideInUp 0.3s ease-out;
}

/* 🆕 絞り込みウィンドウのアニメーション */
.filter-window {
  animation: fadeIn 0.3s ease-out;
}

.filter-window-container {
  animation: slideInUp 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 🆕 絞り込み表示エリアのスタイル */
.active-filters-container {
  max-width: 480px; /* PC表示での幅制限 */
  margin-left: auto;
  margin-right: auto;
  background-color: #f8f9fa;
  position: relative; /* 相対配置でボタンの基準点に */
  border-bottom: 1px solid #e9ecef;
  padding: 12px 15px;
}

.active-filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.active-filters-title {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
}

.clear-all-filters-btn {
  background: none;
  border: 1px solid #ff6b81;
  color: #ff6b81;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-all-filters-btn:hover {
  background-color: #ff6b81;
  color: white;
}

.active-filters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tag {
  display: inline-flex;
  align-items: center;
  background-color: #ff6b81;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(255, 107, 129, 0.2);
}

.filter-tag-content {
  margin-right: 6px;
}

.remove-filter {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  margin-left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.remove-filter:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.remove-filter:active {
  background-color: rgba(255, 255, 255, 0.3);
}

/* ========== 🔧 最終修正：ハートマーク位置調整 ========== */

.work-title .favorite-heart.active {
  display: block;
}

/* レスポンシブ対応：モバイル */
@media (max-width: 480px) {
  .work-title.has-heart {
    text-indent: 26px; /* 🔧 修正：18px → 26px（2文字分追加） */
  }

  .work-title .favorite-heart {
    left: 4px; /* 🔧 修正：1px → 4px */
    top: 1px;
    width: 14px;
    height: 14px;
    line-height: 1.4;
  }
}

/* レスポンシブ対応：タブレット */
@media (min-width: 481px) and (max-width: 767px) {
  .work-title.has-heart {
    text-indent: 25px; /* 🔧 修正：21px → 25px */
  }

  .work-title .favorite-heart {
    left: 4px; /* 🔧 修正：2px → 4px */
    top: 1px;
    width: 16px;
    height: 16px;
  }
}

/* PC表示での調整 */
@media (min-width: 768px) {
  .work-title.has-heart {
    text-indent: 26px; /* 🔧 修正：22px → 26px（PCでさらに右に） */
  }

  .work-title .favorite-heart {
    left: 5px; /* 🔧 修正：3px → 5px（PCでもう少し右に） */
    top: 1px;
    width: 16px;
    height: 16px;
    line-height: 1.3;
  }

  .work-card:hover .favorite-heart {
    transform: scale(1.05);
    transition: transform 0.2s ease;
  }
}

/* 🆕 追加：新しいハート位置制御 */

/* タイトル全体のラッパー */
.work-title-wrapper {
  position: relative; /* ハートの絶対配置の基準点 */
  flex: 1; /* 高さを親要素に合わせる */
  padding: 8px 6px;
  height: 60px; /* 3行表示を想定した固定の高さ */
  display: flex; /* テキストを垂直方向に中央揃えする場合などに備える */
  align-items: flex-start; /* テキストを上寄せ */
}

/* ハートアイコンのスタイル（位置調整） */
.work-title-wrapper .favorite-heart {
  position: absolute;
  left: 4px;
  width: 12px;
  height: 12px;
  fill: #ff6b81;
  z-index: 1;
  pointer-events: none;
}

/* テキスト部分のスタイル */
.work-title-text {
  margin: 0;
  padding: 0;
  width: 100%;
  font-size: 0.85em;
  line-height: 1.4;
  color: #333;
  word-break: break-word;

  /* 複数行の省略スタイル */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* 🔧 修正：1行目のみインデント（padding-left削除、text-indentに変更） */
.work-title-wrapper.has-heart .work-title-text {
  text-indent: 12px; /* 1行目のみ16px分インデント */
}

/* レスポンシブ調整 */
@media (max-width: 480px) {
  .work-title-wrapper .favorite-heart {
    left: 3px;
    width: 11px;
    height: 11px;
  }

  .work-title-wrapper.has-heart .work-title-text {
    text-indent: 10px; /* 🔧 修正：1行目のみ14px分インデント */
  }
}
