  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700;900&display=swap');

  :root {
    --pink:    #ff85a1;
    --purple:  #c084fc;
    --blue:    #60a5fa;
    --green:   #34d399;
    --yellow:  #fbbf24;
    --orange:  #fb923c;
    --teal:    #2dd4bf;
    --rose:    #fb7185;
    --bg:      #fdf4ff;
    --card-bg: #ffffff;
    --text:    #3b1764;
    --sub:     #7c3aed;
  }

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

  body {
    font-family: 'Noto Sans JP', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
  }

  /* ===== HEADER ===== */
  header {
    background: linear-gradient(135deg, #f9a8d4 0%, #c084fc 40%, #818cf8 100%);
    padding: 48px 24px 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
  }
  header::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255,255,255,0.3) 0%, transparent 60%),
                radial-gradient(circle at 80% 20%, rgba(255,255,255,0.2) 0%, transparent 40%);
  }
  .header-inner { position: relative; z-index: 1; }
  .header-badge {
    display: inline-block;
    background: rgba(255,255,255,0.9);
    color: var(--sub);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 4px 16px;
    border-radius: 999px;
    margin-bottom: 16px;
  }
  header h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 12px rgba(100,0,200,0.25);
    line-height: 1.2;
  }
  header p {
    color: rgba(255,255,255,0.9);
    margin-top: 10px;
    font-size: 1rem;
  }
  .stars {
    font-size: 1.4rem;
    letter-spacing: 4px;
    margin-top: 8px;
  }

  /* floating deco */
  .deco {
    position: absolute;
    border-radius: 50%;
    opacity: 0.25;
    animation: float 6s ease-in-out infinite;
  }
  .deco:nth-child(1){ width:80px;height:80px;background:#fff;top:-20px;left:5%;animation-delay:0s; }
  .deco:nth-child(2){ width:50px;height:50px;background:#fde68a;top:20px;left:18%;animation-delay:1s; }
  .deco:nth-child(3){ width:100px;height:100px;background:#fbcfe8;top:-30px;right:10%;animation-delay:2s; }
  .deco:nth-child(4){ width:40px;height:40px;background:#a5f3fc;bottom:10px;right:25%;animation-delay:0.5s; }
  @keyframes float {
    0%,100%{ transform:translateY(0) rotate(0); }
    50%{ transform:translateY(-14px) rotate(8deg); }
  }

  /* ===== STATS BAR ===== */
  .stats-bar { display: none; }
  .stat { text-align: center; }
  .stat-num {
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  .stat-label { font-size: 0.75rem; color: #9ca3af; margin-top: 2px; }

  /* ===== CONTROLS ===== */
  .controls {
    max-width: 1200px;
    margin: 32px auto 0;
    padding: 0 24px;
  }
  .search-wrap {
    position: relative;
    margin-bottom: 20px;
  }
  .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
  }
  #search {
    width: 100%;
    padding: 14px 14px 14px 46px;
    border: 2px solid #e9d5ff;
    border-radius: 999px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    background: white;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  #search:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 4px rgba(192,132,252,0.15);
  }



  /* ===== QUICK TAG CHIPS ===== */
  .tag-section-label {
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 700;
    margin: 12px 0 6px;
  }
  .tag-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
  }
  .tag-btn {
    padding: 5px 13px;
    border: 1.5px solid #e9d5ff;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    background: white;
    color: #7c3aed;
    transition: all 0.2s;
    white-space: nowrap;
  }
  .tag-btn:hover { background: #f3e8ff; border-color: #c084fc; }
  .tag-btn.active {
    background: linear-gradient(135deg, #c084fc, #818cf8);
    color: white;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(192,132,252,0.3);
  }

  /* ===== WORK TAG CHIPS (card / modal) ===== */
  .work-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 0;
  }
  .work-tag {
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    background: #ede9fe;
    color: #6d28d9;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    font-family: inherit;
  }
  .work-tag:hover { background: #ddd6fe; }

  .result-count {
    display: none;
  }
  .result-count span { color: var(--purple); font-weight: 700; }

  /* ===== GRID ===== */
  .grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 60px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
  }

  /* ===== CARD ===== */
  .card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(100,0,200,0.07);
    transition: transform 0.25s, box-shadow 0.25s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    border: 2px solid transparent;
  }
  .card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(100,0,200,0.15);
    border-color: var(--purple);
  }
  .card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #f3e8ff;
  }
  .card-img-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
  }
  .card:hover .card-img-wrap img { transform: scale(1.06); }
  .card-img-placeholder {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #d8b4fe;
  }
  .card-school-tag {
    position: absolute;
    top: 10px; left: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    color: white;
    backdrop-filter: blur(4px);
  }
  .card-id {
    position: absolute;
    bottom: 10px; right: 10px;
    background: rgba(0,0,0,0.45);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
  }
  .card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
  .card-title {
    font-size: 0.97rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .card-desc {
    font-size: 0.78rem;
    color: #6b7280;
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .card-body .work-tags { margin-top: 16px; }
  .card-footer {
    padding: 10px 16px;
    border-top: 1px solid #f3e8ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .pgm-badge {
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 999px;
    background: #ede9fe;
    color: var(--sub);
    font-weight: 700;
  }
  .detail-link {
    font-size: 0.72rem;
    color: var(--purple);
    font-weight: 700;
  }

  /* ===== MODAL ===== */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(59,23,100,0.55);
    backdrop-filter: blur(6px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: white;
    border-radius: 0;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transition: transform 0.5s ease, opacity 0.5s ease;
  }
  .modal-close {
    position: absolute;
    top: 16px; right: 16px;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: #f3e8ff;
    color: var(--sub);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    z-index: 10;
    transition: background 0.2s;
  }
  .modal-close:hover { background: #e9d5ff; }
  .modal-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 0;
    display: block;
  }
  .modal-img-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    border-radius: 0;
    color: #d8b4fe;
  }
  #modal-img-area { margin-bottom: 0; line-height: 0; }
  .modal-body { padding: 10px 28px 28px; }
  .modal-school {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    color: white;
    margin-bottom: 0;
    margin-top: 0;
  }
  .modal-id {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-left: 8px;
  }
  .modal-title {
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 14px;
    line-height: 1.35;
  }
  .modal-desc {
    font-size: 1rem;
    color: #4b5563;
    line-height: 1.85;
    margin-bottom: 24px;
  }
  .modal-pgm-section { margin-top: 32px; }
  .modal-pgm-label,
  .modal-prompt-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sub);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ede9fe;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* report links */
  .modal-report-section {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fdf4ff, #ede9fe);
    border-radius: 12px;
    border: 1.5px solid #e9d5ff;
  }
  .modal-report-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--sub);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .modal-report-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-report-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: white;
    border: 1.5px solid #c084fc;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--sub);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
  }
  .modal-report-link:hover {
    background: var(--purple);
    color: white;
    border-color: var(--purple);
  }

  /* school colors */
  .school-0 { background: #ec4899; }
  .school-1 { background: #8b5cf6; }
  .school-2 { background: #3b82f6; }
  .school-3 { background: #10b981; }
  .school-4 { background: #f59e0b; }
  .school-5 { background: #ef4444; }
  .school-6 { background: #6366f1; }
  .school-7 { background: #14b8a6; }



  /* No results */
  .no-results {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
  }
  .no-results .emoji { font-size: 3rem; margin-bottom: 12px; }

  /* footer */
  footer {
    text-align: center;
    padding: 24px;
    font-size: 0.8rem;
    color: #9ca3af;
    border-top: 2px solid #ede9fe;
  }

  /* Prompt speech bubble */
  .modal-prompt-wrap {
    margin-top: 20px;
    position: relative;
  }
  .modal-aiblock-img {
    display: block;
    width: 100%;
    border-radius: 8px;
  }
  .modal-prompt-bubble {
    position: relative;
    background: #f3e8ff;
    border: 1.5px solid #d8b4fe;
    border-radius: 16px;
    padding: 14px 16px;
  }
  .modal-prompt-bubble::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 73%;
    transform: translateX(-50%);
    border: 11px solid transparent;
    border-bottom-color: #d8b4fe;
  }
  .modal-prompt-bubble::after {
    content: '';
    position: absolute;
    top: -16px;
    left: 73%;
    transform: translateX(-50%);
    border: 9px solid transparent;
    border-bottom-color: #f3e8ff;
  }
  .modal-prompt-text {
    font-size: 0.85rem;
    color: #5b21b6;
    line-height: 1.75;
    white-space: pre-wrap;
  }
