* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 40px;
}

header {
  text-align: center;
  margin-bottom: 30px;
  padding: 50px 20px;
  border-bottom: 3px solid #667eea;
  border-radius: 12px;
  position: relative;
  background-image: url('top.png');
  background-size: cover;
  background-position: center bottom;
}

h1 {
  font-size: 2.3em;
  font-weight: 800;
  margin-bottom: 26px;
  color: #9b8fc8;
  /* 二重オフセット(0.03em/0.06em)の多方向 text-shadow で太い黒縁取りを表現する。
     px固定だとモバイルでフォントが縮んだ際に縁取りだけ相対的に太くなりすぎるため em で統一する */
  text-shadow:
    -0.03em -0.03em 0 #000, 0.03em -0.03em 0 #000, -0.03em 0.03em 0 #000, 0.03em 0.03em 0 #000,
    -0.03em 0 0 #000, 0.03em 0 0 #000, 0 -0.03em 0 #000, 0 0.03em 0 #000,
    -0.06em -0.06em 0 #000, 0.06em -0.06em 0 #000, -0.06em 0.06em 0 #000, 0.06em 0.06em 0 #000,
    -0.06em 0 0 #000, 0.06em 0 0 #000, 0 -0.06em 0 #000, 0 0.06em 0 #000,
    0 0.1em 0.3em rgba(0, 0, 0, 0.6);
}
.subtitle {
  color: #fff;
  font-size: 1.1em;
  text-shadow:
    -0.03em -0.03em 0 #000, 0.03em -0.03em 0 #000, -0.03em 0.03em 0 #000, 0.03em 0.03em 0 #000,
    -0.03em 0 0 #000, 0.03em 0 0 #000, 0 -0.03em 0 #000, 0 0.03em 0 #000,
    -0.06em -0.06em 0 #000, 0.06em -0.06em 0 #000, -0.06em 0.06em 0 #000, 0.06em 0.06em 0 #000,
    -0.06em 0 0 #000, 0.06em 0 0 #000, 0 -0.06em 0 #000, 0 0.06em 0 #000,
    0 0.1em 0.3em rgba(0, 0, 0, 0.6);
}

@media (max-width: 768px) { h1 { font-size: 1.3em; } }

/* VPNモード切替 */
.vpn-switch {
  max-width: 1200px;
  margin: 0 auto 25px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.vpn-switch .label { font-weight: 600; color: #495057; }
.vpn-btn {
  padding: 10px 24px;
  border: 2px solid #667eea;
  border-radius: 30px;
  background: white;
  color: #667eea;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.vpn-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.notice-section { max-width: 1200px; margin: 0 auto 25px; }

.main-content {
  background: #f8f9fa;
  padding: 30px;
  border-radius: 12px;
  max-width: 1200px;
  margin: 0 auto 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-section {
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 2px solid #e0e0e0;
}
.filter-section:last-of-type { border-bottom: none; }
.filter-section h2 { margin-bottom: 15px; color: #495057; font-size: 1.5em; }
.filter-section h3.sub { font-size: 1em; color: #6c757d; margin: 14px 0 8px; }
.filter-section h3.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-bulk-select { font-size: 0.85em; font-weight: normal; white-space: nowrap; }
.section-bulk-select a { color: #667eea; text-decoration: none; }
.section-bulk-select a:hover { text-decoration: underline; }

.select-controls { margin-bottom: 15px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.country-region-groups { display: flex; flex-direction: column; gap: 4px; }
.region-heading { font-size: 0.85em; color: #9099a3; margin: 8px 0 2px; font-weight: 600; }
.country-filters { display: flex; flex-wrap: wrap; gap: 12px; }
.category-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 15px;
  padding: 8px 16px;
  background: white;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.checkbox-label:hover { background: #e9ecef; }
.checkbox-label input[type="checkbox"] { margin-right: 8px; width: 18px; height: 18px; cursor: pointer; }
.btn-select { background: #667eea; color: white; font-weight: 600; }
.btn-deselect { background: #6c757d; color: white; font-weight: 600; }

.year-row { display: flex; gap: 15px; align-items: center; padding: 15px; background: #f0f0f2; border-radius: 6px; max-width: 600px; }
.year-row select { width: 100%; padding: 8px 12px; border: 2px solid #ddd; border-radius: 4px; font-size: 14px; background: white; cursor: pointer; }
.year-row label { display: block; margin-bottom: 5px; font-weight: 600; color: #333; }

.groups-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  padding: 8px 16px;
  border-radius: 20px;
  background: #e9ecef;
  color: #495057;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}
.chip:hover { background: #dde1e6; }
.chip.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }

.sort-row select { padding: 8px 12px; border: 2px solid #ddd; border-radius: 4px; font-size: 14px; background: white; cursor: pointer; }

.results-section h2 { margin-bottom: 20px; color: #495057; font-size: 1.5em; }
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 25px; }

.result-card {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}
.result-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); border-color: #667eea; }
.result-image { width: 100%; height: 280px; object-fit: cover; background: #f0f0f0; display: flex; align-items: center; justify-content: center; color: #999; }
.result-image img { width: 100%; height: 100%; object-fit: cover; }
.result-info { padding: 20px; }
.result-title { font-size: 1.1em; font-weight: 600; margin-bottom: 8px; color: #212529; line-height: 1.4; }
.result-title .en { display: block; font-size: 0.78em; color: #868e96; font-weight: 400; margin-top: 2px; }
.result-meta { font-size: 0.9em; color: #6c757d; margin-bottom: 8px; font-weight: 500; }
.result-rating { font-size: 0.9em; color: #ff9800; margin-bottom: 8px; font-weight: 600; }
.result-countries { display: flex; flex-wrap: wrap; gap: 6px; }
.country-badge { display: inline-block; padding: 4px 10px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border-radius: 12px; font-size: 0.8em; font-weight: 500; }

.load-more { display: block; margin: 30px auto 0; padding: 12px 32px; border: none; border-radius: 8px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; font-size: 16px; font-weight: 600; cursor: pointer; }
.load-more:hover { transform: translateY(-2px); }

.empty-state { text-align: center; padding: 60px 20px; color: #6c757d; }

/* モーダル */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0, 0, 0, 0.7); animation: fadeIn 0.3s ease; }
.modal.open { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content { background: white; margin: 5% auto; padding: 30px; border-radius: 15px; width: 90%; max-width: 700px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3); animation: slideDown 0.3s ease; position: relative; }
@keyframes slideDown { from { transform: translateY(-50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-close { color: #aaa; float: right; font-size: 35px; font-weight: bold; line-height: 30px; cursor: pointer; transition: color 0.2s ease; }
.modal-close:hover { color: #667eea; }
.modal-image-container { width: 100%; max-height: 400px; overflow: hidden; border-radius: 10px; margin-bottom: 20px; background: #f0f0f0; display: flex; align-items: center; justify-content: center; }
.modal-image-container img { width: 100%; max-height: 400px; object-fit: contain; }
.modal-content h2 { color: #333; margin-bottom: 6px; font-size: 1.7em; line-height: 1.4; }
.modal-content .modal-en { color: #868e96; margin-bottom: 15px; }
.modal-content h3 { color: #667eea; margin-top: 20px; margin-bottom: 10px; font-size: 1.3em; }
.modal-meta { display: flex; gap: 20px; margin-bottom: 15px; font-size: 1em; color: #6c757d; }
.modal-countries { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
#modalSynopsis {
  font-size: 1.05em;
  line-height: 1.8;
  color: #444;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.modal-imdb, .modal-share-btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 2px solid #667eea; border-radius: 999px;
  padding: 8px 18px; font-size: 14px; font-weight: 600;
  color: #667eea; background: #fff; text-decoration: none;
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.modal-imdb:hover, .modal-share-btn:hover { background: #667eea; color: #fff; }

.modal-codoc { margin-top: 14px; padding-top: 10px; border-top: 1px dashed #e5e5e5; text-align: center; }

.search-container { position: relative; margin-bottom: 10px; max-width: 600px; }
.search-box { width: 100%; padding: 12px 45px 12px 15px; font-size: 16px; border: 2px solid #ddd; border-radius: 8px; transition: all 0.3s ease; font-family: inherit; }
.search-box:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); }
.clear-search-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: none; background: #ddd; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #666; }
.search-hint { font-size: 14px; color: #666; font-style: italic; }

@media (max-width: 768px) {
  .container { padding: 20px; }
  header { padding: 30px 10px; }
  .results-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }
  .modal-content { width: 95%; margin: 10% auto; padding: 20px; }
}
