:root {
    --font-main: 'Inter', sans-serif;
    --dark-bg: #121212;
    --dark-text: #EAEAEA;
    --light-bg: #F5F5F5;
    --light-text: #121212;
    --accent-color: #FFFFFF;
    --dark-text-rgb: 234, 234, 234;
    --light-text-rgb: 18, 18, 18;
}

/* 基本スタイル & リセット */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    transition: background-color 0.4s ease, color 0.4s ease;
    cursor: none;
    opacity: 0; /* JSでロード後に表示するため初期状態は非表示 */
    transition: opacity 0.5s;

    /* ===== 変更: 背景パターンの設定 ===== */
    --grid-size: 30px; /* グリッドのサイズ（数値を変更して密度を調整） */
    --pattern-color: rgba(var(--dark-text-rgb), 0.1); /* デフォルトはダークモード用 */
    
    background-color: var(--dark-bg);
    background-image:
      linear-gradient(to right, var(--pattern-color) 1px, transparent 1px),
      linear-gradient(to bottom, var(--pattern-color) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
    background-attachment: fixed; /* 背景を固定 */
}
body.loaded { opacity: 1; }

body.dark-mode { 
    background-color: var(--dark-bg); 
    color: var(--dark-text); 
    --pattern-color: rgba(var(--dark-text-rgb), 0.1);
}
body.light-mode { 
    background-color: var(--light-bg); 
    color: var(--light-text); 
    --pattern-color: rgba(var(--light-text-rgb), 0.15); /* ライトモードでは少し濃く */
}

/* プリローダースタイル */
/* ▼▼▼ 変更箇所 ▼▼▼ */
#preloader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--dark-bg); z-index: 10000;
    display: flex;
    flex-direction: column; /* 画像とテキストを縦に並べる */
    justify-content: center;
    align-items: center;
    gap: 1.5rem; /* 要素間の余白 */
    transition: opacity 0.8s ease, visibility 0.8s ease;
}
#preloader.fade-out { opacity: 0; visibility: hidden; }

.loader-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    animation: spin 1.5s linear infinite; /* 回転アニメーションを適用 */
}

.loader-text { 
    color: var(--dark-text); 
    font-size: 1.2rem; 
    font-weight: 700;
    letter-spacing: 0.1em;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
/* ▲▲▲ 変更ここまで ▲▲▲ */


/* カスタムカーソル */
#custom-cursor {
    position: fixed; width: 25px; height: 25px;
    border: 2px solid var(--accent-color);
    border-radius: 50%; pointer-events: none;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, background-color 0.2s, border-color 0.4s;
    z-index: 9999;
}
body.dark-mode #custom-cursor { --accent-color: #FFFFFF; }
body.light-mode #custom-cursor { --accent-color: #000000; }
#custom-cursor.hover { width: 60px; height: 60px; background-color: rgba(255, 255, 255, 0.2); }

/* ヘッダー */
header { display: flex; justify-content: space-between; align-items: center; padding: 2rem 5%; }
.site-title { font-size: 1rem; font-weight: 700; letter-spacing: 0.1em; }
#toggle-mode-btn { background: none; border: 1px solid; border-radius: 20px; padding: 0.5rem 1rem; font-family: var(--font-main); font-weight: 700; cursor: pointer; transition: all 0.3s; color: inherit; }
body.dark-mode #toggle-mode-btn:hover { background-color: var(--dark-text); color: var(--dark-bg); }
body.light-mode #toggle-mode-btn:hover { background-color: var(--light-text); color: var(--light-bg); }

/* メインコンテンツ */
main { padding: 0 5%; overflow: hidden; }
section { padding-bottom: 6rem; }

/* === セクションタイトルの共通スタイル === */
.section-title {
    font-size: clamp(3rem, 12vw, 8rem);
    font-weight: 900;
    margin-bottom: 4rem;
    text-align: center;
    letter-spacing: -0.05em;
    overflow: hidden; /* spanがはみ出ても見えないように */
    cursor: pointer; /* ホバーできることを示す */
    -webkit-user-select: none;
    user-select: none;
}

/* 各文字（span）の基本設定（アニメーションの滑らかさ）*/
.section-title span {
    display: inline-block;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

/* ★ 初期状態（カーソルが乗っていない時）: 文字を崩す ★ */
.section-title span {
    transform: translateY(-10%) rotate(-5deg);
}
.section-title span:nth-child(2n) {
    transform: translateY(10%) rotate(5deg);
}

/* ★ ホバー状態: 文字をきれいに揃える ★ */
.section-title:hover span {
    transform: translateY(0) rotate(0);
}


/* ===== 変更: 水平スクロールのスタイルを削除し、グリッドに統一 ===== */
.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}



/* 作品カード */
.work-card {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1; /* グリッドで比率を維持 */
}
.work-card img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1), filter 0.4s;
}
.work-card:hover img {
    transform: scale(1.05);
    filter: brightness(0.6);
}

/* ▼▼▼ 追加: カードのロールタグ関連のスタイル ▼▼▼ */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 下の要素をクリックできるように */
}
.role-tags-container {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    z-index: 5;
    opacity: 0; /* PCではホバーで表示 */
    transition: opacity 0.4s ease;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.work-card:hover .role-tags-container {
    opacity: 1;
}
.role-tag {
    color: #fff;
    background: rgba(18, 18, 18, 0.6);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    backdrop-filter: blur(3px);
}
/* ▲▲▲ 追加ここまで ▲▲▲ */

/* 新しいホバーエフェクトのスタイル */
.card-hover-info {
    position: absolute; top: 0; left: 0;
    color: white; pointer-events: none;
    opacity: 0; will-change: transform;
    z-index: 10;
}
.card-hover-info .card-title { font-size: 2rem; font-weight: 900; }
.card-hover-info .card-artist { font-size: 1.2rem; font-weight: 700; }

/* ローダー */
.loader { text-align: center; grid-column: 1 / -1; font-size: 1.5rem; }
/* フッター */
footer { text-align: center; padding: 4rem 2rem 2rem; font-size: 0.8rem; opacity: 0.5; }
/* モーダル */
.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.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { position: relative; background: var(--dark-bg); color: var(--dark-text); margin: auto; padding: 2rem; border: 1px solid #888; width: 90%; max-width: 800px; border-radius: 8px; animation: fadeIn 0.5s; }
body.light-mode .modal-content { background: var(--light-bg); color: var(--light-text); }
.close-btn { position: absolute; top: 1rem; right: 1.5rem; font-size: 2rem; font-weight: bold; cursor: pointer; }
/* style.css */
.modal-body {
    display: flex;
    gap: 2rem;
    align-items: center; /* ★重要: これで要素が縦に中央揃えになる */
}

#modal-jacket {
    width: 40%;
    max-width: 300px;
    flex-shrink: 0;         /* ★重要: 画像が縮まないようにする */
    aspect-ratio: 1 / 1;    /* ★重要: 常に1:1の比率（正方形）を維持 */
    object-fit: cover;
}
.modal-info { flex: 1; }
#modal-title { font-size: 2.5rem; font-weight: 900; margin-bottom: 0.5rem; }
#modal-artist { font-size: 1.5rem; margin-bottom: 1.5rem; opacity: 0.8; }
#modal-description { font-size: 1rem; line-height: 1.6; margin-bottom: 2rem; }

@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
/* モーダル内のサービス別リンクスタイル */
.modal-links a { display: inline-block; padding: 0.75rem 1.5rem; text-decoration: none; font-weight: 700; margin-right: 1rem; margin-bottom: 1rem; border-radius: 5px; transition: transform 0.2s, opacity 0.2s; background-color: #555; color: #fff; }
.modal-links a:hover { transform: scale(1.05); opacity: 0.9; }
.modal-links .spotify-link { background-color: #1DB954; color: #FFFFFF; }
.modal-links .applemusic-link { background-color: #FC3C44; color: #FFFFFF; }


/* ===== フッター & マーキースタイル ===== */
footer {
    padding: 0; /* フッター自体のpaddingは不要に */
    text-align: center;
}
.marquee-content {
    display: flex;
    white-space: nowrap;
    will-change: transform;
    animation: marquee-scroll 7s linear infinite;
}


/* 変更: マーキーコンテナに上下のマージンを追加 */
.marquee-container {
    width: 100%;
    overflow: hidden;
    padding: 1.5rem 0;
    border-top: 1px solid;
    border-bottom: 1px solid;
    border-color: inherit;
    /* 上下のセクションとの間に余白を設ける */
    margin: 4rem 0;
}

.marquee-item {
    flex-shrink: 0;
    padding: 0 2rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.marquee-item a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s;
}

.marquee-item a:hover {
    opacity: 0.6;
}

.copyright {
    font-size: 0.8rem;
    opacity: 0.5;
    /* フッターのマーキーとの間に余白を追加 */
    margin-top: 2rem;
    padding-bottom: 2rem;
}

/* スクロールアニメーションの定義 */
@keyframes marquee-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}
/* ===== 依頼案内セクションのスタイル ===== */
#contact-prompt {
    padding: 4rem 5%;
    text-align: center;
}

#contact-prompt p {
    font-weight: 700;
    line-height: 1.8;
    max-width: 650px;
    margin: 0 auto;
}

/* 日本語テキストのスタイル */
#contact-prompt .lang-ja {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
}

/* 英語テキストのスタイル */
#contact-prompt .lang-en {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem); /* 少し小さく */
    opacity: 0.7; /* 少し薄く */
    margin-top: 0.5rem; /* 日本語との間に少し余白 */
    font-weight: 400; /* 太字ではなく通常の太さへ */
}


#contact-prompt a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 1px;
    transition: opacity 0.3s;
}

#contact-prompt a:hover {
    opacity: 0.7;
}

/* スマホ用の改行設定 */
.sp-only {
    display: none;
}
/* ▼▼▼ 追加: PC用の改行制御クラス ▼▼▼ */
.pc-only {
    display: initial;
}
/* ▲▲▲ 追加ここまで ▲▲▲ */


/* ===== Aboutセクションのスタイル ===== */
#about {
    padding: 6rem 5% 4rem;
    display: flex;
    justify-content: center;
}
.about-container {
    display: flex;
    align-items: center;
    gap: 4rem;
    max-width: 960px;
}
.about-image {
    flex: 0 0 250px;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid;
    border-color: inherit;
}
.about-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.about-text h2 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
}
.about-text p {
    line-height: 1.8;
    margin-bottom: 1.5rem;
}


/* ===== Aboutセクションのスタイル調整 & 言語切替 ===== */
#about {
    padding-top: 4rem;
    padding-bottom: 4rem; /* 上下のマーキーとの間隔を調整 */
}

.about-text .lang-toggle {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.about-text .lang-btn {
    background: transparent;
    border: 1px solid;
    color: inherit;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 700;
    transition: all 0.3s;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* アクティブなボタンのスタイル */
.about-text .lang-btn.active {
    opacity: 1;
}
body.dark-mode .about-text .lang-btn.active {
    background-color: var(--dark-text);
    color: var(--dark-bg);
}
body.light-mode .about-text .lang-btn.active {
    background-color: var(--light-text);
    color: var(--light-bg);
}

/* 英語テキストを初期状態で非表示にする */
.about-bio.lang-en {
    display: none;
}


/* モーダル内のシェア機能 */
.modal-share {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

#share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background-color: #777;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

#share-btn:hover {
    background-color: #888;
}

#share-btn:active {
    transform: scale(0.98);
}

#share-url-input {
    flex: 1;
    padding: 0.6rem;
    background-color: rgba(var(--dark-text-rgb), 0.1);
    border: 1px solid rgba(var(--dark-text-rgb), 0.2);
    color: inherit;
    border-radius: 5px;
    font-size: 0.9rem;
    outline: none;
}
/* ライトモード用の調整 */
body.light-mode #share-url-input {
    background-color: rgba(var(--light-text-rgb), 0.05);
    border: 1px solid rgba(var(--light-text-rgb), 0.2);
}

/* ===== ABOUT :PLUE タイトルのインタラクティブエフェクト ===== */

/* 既存の .about-text h2 スタイルをこちらに移動・統合 */
.about-title-interactive {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    cursor: pointer; /* ホバーできることを示すカーソルに変更 */
    -webkit-user-select: none; /* テキスト選択を防ぎ、操作感を向上 */
    -ms-user-select: none;
    user-select: none;
}

/* 各文字（span）の基本設定（アニメーションの滑らかさ）*/
.about-title-interactive span {
    display: inline-block;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

/* ★ 初期状態（カーソルが乗っていない時）: 文字を崩す ★ */
.about-title-interactive span:nth-of-type(odd) {
    transform: translateY(-12%) rotate(-8deg);
}

.about-title-interactive span:nth-of-type(even) {
    transform: translateY(15%) rotate(6deg);
}

/* よりランダムに見せるための微調整 */
.about-title-interactive span:nth-of-type(3n) {
    transform: translateY(8%) rotate(-4deg) scale(1.05);
}
.about-title-interactive span:nth-of-type(4n) {
    transform: translateY(-5%) rotate(10deg) scale(0.95);
}


/* ★ ホバー状態: 文字をきれいに揃える ★ */
.about-title-interactive:hover span {
    transform: translateY(0) rotate(0) scale(1);
}

/* ===== カード内プレビュー再生ボタンのスタイル ===== */
.card-play-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
    background-color: rgba(18, 18, 18, 0.7);
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    z-index: 15; /* card-hover-infoより手前に表示 */
    
    /* 初期状態では非表示（ホバーで表示） */
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* カードホバー時にボタンを表示 */
.work-card:hover .card-play-btn {
    opacity: 1;
    transform: scale(1);
}

.card-play-btn:hover {
    background-color: rgba(18, 18, 18, 0.9);
}

/* 再生・停止アイコンをCSSで描画 */
.card-play-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    transition: all 0.2s ease;
}

/* 再生アイコン（三角形） */
.card-play-btn::before {
    border-style: solid;
    border-width: 9px 0 9px 15px;
    border-color: transparent transparent transparent #ffffff;
    /* 中心を少し右にずらして見た目を調整 */
    transform: translate(-40%, -50%);
}

/* 再生中（playingクラスが付いた時）の停止アイコン（二本線） */
.card-play-btn.playing::before {
    border-style: double;
    border-width: 0 0 0 14px; /* 太さ14pxの二重線 */
    width: 0; /* widthではなくborderで描画 */
    height: 18px;
    transform: translate(-50%, -50%);
}

/* ===== 管理者用ボタンのスタイル ===== */
#admin-btn {
    position: fixed; /* 画面に固定 */
    top: 97%;        /* 上から50%の位置 */
    left: 0;         /* 左端に配置 */
    transform: translateY(-50%); /* 自身の高さの半分だけ上に戻して、完全に中央揃えにする */

    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 50px;
    background-color: rgba(var(--light-text-rgb), 0.1);
    border: 1px solid rgba(var(--light-text-rgb), 0.2);
    border-left: none; /* 左端の線は不要 */
    border-radius: 0 8px 8px 0; /* 右側の角だけ丸める */
    
    color: inherit; /* 文字色（アイコンの色）を親要素から継承 */
    text-decoration: none;
    font-size: 1.5rem; /* アイコンのサイズ */
    z-index: 998; /* 他の要素より手前、モーダルよりは後ろに */
    
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

/* ホバー時に少し右にスライドして背景を濃くする */
#admin-btn:hover {
    background-color: rgba(var(--light-text-rgb), 0.3);
    transform: translateY(-50%) translateX(3px);
}

/* ダークモード用の調整（今回は inherit と rgba で自動対応できているので不要ですが、念のため記載）*/
body.dark-mode #admin-btn {
    background-color: rgba(var(--dark-text-rgb), 0.1);
    border-color: rgba(var(--dark-text-rgb), 0.2);
}
body.dark-mode #admin-btn:hover {
    background-color: rgba(var(--dark-text-rgb), 0.3);
}

/* 既存のレスポンシブスタイル */
@media (max-width: 768px) {
    .modal-body { flex-direction: column; align-items: center; text-align: center; }
    #modal-jacket { width: 80%; margin-bottom: 1rem; }
    .modal-links { text-align: center; }
    .sp-only { display: block; }
    .about-container { flex-direction: column; text-align: center; gap: 2rem; }
    .about-image { width: 200px; height: 200px; }
    .about-text .lang-toggle { justify-content: center; }
}


/* ======================================= */
/* ===== ▼▼▼ スマホ対応スタイル ▼▼▼ ===== */
/* ======================================= */
@media (max-width: 768px) {
    /* --- 全体 / カーソル --- */
    body {
        cursor: auto; /* スマホではOS標準のカーソル */
    }
    #custom-cursor,
    .card-hover-info {
        display: none; /* カスタムカーソルと追従情報は非表示 */
    }
    
    /* --- レイアウトの基本余白 --- */
    section {
        padding-bottom: 4rem;
    }

    /* --- ヘッダー --- */
    header {
        padding: 1.5rem 5%;
    }

    /* --- マーキー --- */
    .marquee-container {
        padding: 1rem 0;
        margin: 3rem 0;
    }
    .marquee-item {
        padding: 0 1.5rem;
        font-size: 1rem;
    }
    
    /* --- セクションタイトル --- */
    .section-title {
        margin-bottom: 2.5rem;
    }
    
    /* --- 作品グリッドとカード --- */
    .works-grid {
        /* ▼▼▼ 変更箇所 ▼▼▼ */
        grid-template-columns: repeat(2, 1fr); /* 作品を2列で表示 */
        gap: 1rem;
        /* ▲▲▲ 変更ここまで ▲▲▲ */
    }
    
    /* スマホではホバー操作がないため、エフェクトを調整 */
    .work-card:hover img {
        transform: none;
        filter: brightness(0.7); /* タグの視認性のために少し暗くする */
    }
    
    /* タグと再生ボタンを常に表示 */
    .role-tags-container {
        opacity: 1;
    }
    .card-play-btn {
        opacity: 1;
        transform: scale(1);
        
        /* ▼▼▼ 変更箇所: カードが小さくなるのに合わせてボタンも調整 ▼▼▼ */
        width: 36px;
        height: 36px;
        top: 0.5rem;
        right: 0.5rem;
    }
    .card-play-btn::before {
        /* 再生アイコン（三角形）のサイズ調整 */
        border-width: 7px 0 7px 12px;
    }
    .card-play-btn.playing::before {
        /* 停止アイコン（二重線）のサイズ調整 */
        border-width: 0px 0px 0px 10px;
        height: 14px;
    }
    /* ▲▲▲ 変更ここまで ▲▲▲ */
    
    .work-card:hover .card-play-btn {
        background-color: rgba(18, 18, 18, 0.7);
    }

    /* --- Aboutセクション --- */
    .about-title-interactive {
        font-size: 2rem;
    }
    .about-text p {
        font-size: 0.9rem;
        line-height: 1.8;
    }

    /* --- 依頼案内と改行制御 --- */
    .pc-only {
        display: none; /* PC専用の改行を非表示に */
    }

    /* --- モーダル --- */
    .modal-content {
        padding: 1.5rem 1.2rem;
        width: 92%;
        max-height: 85vh;
        overflow-y: auto;
    }
    #modal-title { font-size: 1.7rem; }
    #modal-artist { font-size: 1.1rem; }
    #modal-description { font-size: 0.9rem; }
    
    .modal-links {
        flex-direction: column;
        align-items: stretch; /* ボタン幅をコンテナに合わせる */
        gap: 0.75rem;
    }
    .modal-links a {
        margin-right: 0;
    }
    .modal-share {
        flex-direction: column;
        align-items: stretch;
    }
    #share-btn {
        justify-content: center;
    }
    
    /* --- 管理者ボタン --- */
    #admin-btn {
        /* スマホのブラウザUI(下部バー)と干渉しにくいように調整 */
        top: auto;
        bottom: 15px;
        transform: none;
    }
}