:root {
  --primary-color: #4361ee;
  --primary-hover: #3a56d4;
  --secondary-color: #3f37c9;
  --bg-color: #f8f9fa;
  --text-main: #2b2d42;
  --text-muted: #8d99ae;
  --surface-main: #ffffff;
  --surface-hover: #f1f3f5;
  --border-color: #e9ecef;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 32px rgba(67, 97, 238, 0.15);
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: 'Noto Sans JP', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header & Search */
.header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.header-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
  letter-spacing: -0.03em;
}

.header-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.glass-panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-md);
  width: 100%;
  margin: 0 auto;
}

/* Filter Groups */
.filter-group {
  margin-bottom: 1rem;
  text-align: left;
}

.filter-group:last-of-type {
  margin-bottom: 0.5rem;
}

.filter-group-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.4rem;
  border-left: 3px solid var(--primary-color);
  padding-left: 0.5rem;
  line-height: 1.2;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
}

.clear-btn-visible {
  background: var(--surface-main);
  border: 1px solid #ced4da;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: inherit;
}

.clear-btn-visible:hover {
  background: #f1f3f5;
  color: var(--text-main);
  border-color: #adb5bd;
}

.filter-chip {
  background: var(--surface-main);
  border: 1px solid var(--border-color);
  border-radius: 2rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-weight: 500;
}

.filter-chip:hover {
  background: var(--surface-hover);
  border-color: #d0d7de;
  transform: translateY(-1px);
}

.filter-chip.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

/* Results */
.main-content {
  max-width: 1000px;
  margin: 0 auto;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.results-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  background: var(--primary-color);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Card */
.result-card {
  background: var(--surface-main);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-color);
  opacity: 0;
  transition: var(--transition);
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: #d0d7de;
}

.result-card:hover::before {
  opacity: 1;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.year-tag {
  background: rgba(67, 97, 238, 0.1);
  color: var(--primary-color);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
}

.keywords-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.keyword-tag {
  font-size: 0.75rem;
  background: #f1f3f5;
  color: #495057;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.school-type-tag {
  background-color: #f1f3f5;
  color: #495057;
}

.school-type-tag.st-you {
  background-color: #FF1493;
  /* 蛍光ピンク */
  color: #ffffff;
  font-weight: 700;
}

.school-type-tag.st-sho {
  background-color: #00E5FF;
  /* 蛍光青（シアン） */
  color: #000000;
  font-weight: 700;
}

.school-type-tag.st-chu {
  background-color: #BFFF00;
  /* 蛍光黄緑 */
  color: #000000;
  font-weight: 700;
}

.school-type-tag.st-kou {
  background-color: #FF5500;
  /* 蛍光オレンジ */
  color: #ffffff;
  font-weight: 700;
}

.school-type-tag.st-toku {
  background-color: #FF66CC;
  /* 蛍光薄ピンク（マゼンタ系） */
  color: #000000;
  font-weight: 700;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 1rem;
  color: var(--text-main);
  flex-grow: 1;
}

.card-title .highlight {
  background-color: rgba(255, 212, 59, 0.3);
  padding: 0 2px;
  border-radius: 2px;
}

.links-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  border-top: 1px dashed var(--border-color);
  padding-top: 1rem;
}

.document-link {
  display: flex;
  flex: 1 1 auto;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  padding: 0.5rem;
  border-radius: 6px;
  background: #f8f9fa;
}

.document-link span {
  text-align: left;
  line-height: 1.3;
}

.document-link .icon-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  color: #fff;
  background-color: #8da0a6;
  /* 薄いグレー */
}

.document-link .icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 4px;
}

.document-link.link-youtube .icon-wrapper {
  color: #ea4335;
  width: auto;
  height: auto;
}

.document-link.link-other .icon-wrapper {
  color: #78909c;
}

.document-link .icon-wrapper svg {
  width: 18px;
  height: 18px;
}

.document-link.link-youtube .icon-wrapper svg {
  width: 26px;
  height: 26px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface-main);
  border-radius: var(--radius-md);
  border: 1px dashed #ced4da;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: #adb5bd;
  margin-bottom: 1.5rem;
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-card {
  animation: fadeIn 0.4s ease-out forwards;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content h1 {
    font-size: 2rem;
  }

  .glass-panel {
    padding: 1.5rem;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }
}