@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&family=Noto+Sans+JP:wght@400;700&display=swap');
@import url('./partials/header.css');
@import url('./partials/page-title.css');
@import url('./partials/footer.css');

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

body {
    font-family: Montserrat, 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
    background: #fff;
    color: #222;
    margin: 0;
    padding: 0;
}

h1, h2, h3 {
    color: #c40000;
    font-family: Montserrat, 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 700;
    letter-spacing: 0.03em;
}

a {
    color: #c40000;
    transition: 0.3s;
}

a:hover {
    opacity: 0.7;
}

.section h1 {
    color: #c40000;
    font-size: 2rem;
    text-align: center;
    margin: auto;
}

header {
    position: relative;
    z-index: 2;
    height: 80px;
}

#chart-canvas {
    display: block;
    margin: 0 auto;
    max-width: 500px;
    max-height: 500px;
    width: 100%;
    height: auto;
}

/* 能力チャート詳細レイアウト */
.chart-detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.chart-display {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
}

.chart-display #chart-canvas {
    max-width: 550px;
    max-height: 550px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* チャート強調時のアニメーション */
.chart-display.chart-highlighted #chart-canvas {
    transform: scale(1.02);
    filter: drop-shadow(0 4px 12px rgba(196, 0, 0, 0.2));
}

.chart-details {
    display: flex;
    flex-direction: column;
}

.ability-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ability-item {
    background: linear-gradient(145deg, #f0f2f5 0%, #e8ecf0 100%);
    border-radius: 12px;
    padding: 0.75rem;
    border: none;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 
        8px 8px 16px rgba(174, 174, 192, 0.4),
        -8px -8px 16px rgba(255, 255, 255, 0.8),
        inset 0 0 0 rgba(174, 174, 192, 0),
        inset 0 0 0 rgba(255, 255, 255, 0);
    position: relative;
    overflow: hidden;
}

.ability-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(196, 0, 0, 0.05) 50%, transparent 100%);
    transition: left 0.6s ease;
    pointer-events: none;
}

.ability-item:hover {
    background: linear-gradient(145deg, #e8ecf0 0%, #f0f2f5 100%);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 
        4px 4px 8px rgba(174, 174, 192, 0.3),
        -4px -4px 8px rgba(255, 255, 255, 0.7),
        inset 4px 4px 8px rgba(174, 174, 192, 0.2),
        inset -4px -4px 8px rgba(255, 255, 255, 0.6);
}

.ability-item:hover::before {
    left: 100%;
}

.ability-item:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s ease;
}

.ability-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.ability-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    position: relative;
}

.ability-item:hover .ability-name {
    color: #c40000;
    text-shadow: 0 0 8px rgba(196, 0, 0, 0.2);
}

.ability-score {
    font-weight: 700;
    color: #c40000;
    font-size: 0.85rem;
    background: linear-gradient(145deg, #f8f9fb 0%, #edf0f4 100%);
    padding: 0.15rem 0.5rem;
    border-radius: 16px;
    box-shadow: 
        2px 2px 4px rgba(174, 174, 192, 0.3),
        -2px -2px 4px rgba(255, 255, 255, 0.8),
        inset 1px 1px 2px rgba(255, 255, 255, 0.6),
        inset -1px -1px 2px rgba(174, 174, 192, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.ability-score::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(196, 0, 0, 0.1) 50%, transparent 100%);
    transition: left 0.5s ease;
}

.ability-item:hover .ability-score {
    color: #a00000;
    transform: scale(1.05);
    box-shadow: 
        1px 1px 2px rgba(174, 174, 192, 0.2),
        -1px -1px 2px rgba(255, 255, 255, 0.7),
        inset 2px 2px 4px rgba(174, 174, 192, 0.3),
        inset -2px -2px 4px rgba(255, 255, 255, 0.8);
}

.ability-item:hover .ability-score::before {
    left: 100%;
}

.ability-bar {
    width: 100%;
    height: 6px;
    background: linear-gradient(145deg, #e8ecf0 0%, #f0f2f5 100%);
    border-radius: 6px;
    margin-bottom: 0;
    overflow: hidden;
    box-shadow: 
        inset 2px 2px 4px rgba(174, 174, 192, 0.3),
        inset -2px -2px 4px rgba(255, 255, 255, 0.8);
    position: relative;
}

.ability-progress {
    height: 100%;
    background: linear-gradient(90deg, #c40000 0%, #ff4757 30%, #ff6b7a 70%, #c40000 100%);
    background-size: 200% 100%;
    border-radius: 6px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 1px 3px rgba(196, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    position: relative;
    animation: shimmer 3s ease-in-out infinite;
    width: 0%; /* 初期状態は0%から開始 */
}

.ability-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    animation: progress-shine 2s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes progress-shine {
    0% {
        left: -100%;
    }

    50%, 100% {
        left: 100%;
    }
}

.profile-photo {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 5px solid #c40000;
    object-fit: cover;
    box-shadow: 0 5px 20px rgba(196,0,0,0.4);
    transition: 0.3s;
}

.profile-photo:hover {
    transform: scale(1.1);
}

.position-label {
    color: #c40000;
    font-weight: bold;
}

.section {
    max-width: 800px;
    margin: 50px auto;
    padding: 40px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(196,0,0,0.18), 0 2px 24px rgba(0,0,0,0.10);
    border-radius: 16px;
    opacity: 0;
    transform: translateY(20px);
    transition: 1s, box-shadow 0.4s cubic-bezier(.25,.8,.25,1);
    will-change: auto;
}

.section.is-3d-hover {
    z-index: auto;
}

.section:hover {
    box-shadow: 0 24px 56px rgba(196,0,0,0.22), 0 8px 32px rgba(0,0,0,0.16);
    z-index: 3;
}

.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.hero-title, .position-label {
    text-shadow: 0 2px 8px rgba(255, 255, 255, 5), 0 0 1px #fff;
}

.section h2 {
    font-family: Montserrat, 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
    font-size: 2.1rem;
    font-weight: 700;
    color: #c40000;
    letter-spacing: 0.04em;
    filter: drop-shadow(0 8px 16px rgba(196,0,0,0.18));
    transition: filter 0.3s;
}

.section:hover h2 {
    filter: drop-shadow(0 16px 32px rgba(196,0,0,0.28));
}

.profile-flexbox {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    border-radius: 16px;
    border: 1px solid #e0e0e0;
}

.profile-flexbox .profile-photo {
    flex-shrink: 0;
    margin-bottom: 0;
    width: 160px;
    height: 160px;
}

.profile-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    flex: 1;
    padding-left: 1rem;
}

.profile-info .kana-text {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
    letter-spacing: 0.05em;
    margin: 0;
}

.profile-info .name-text {
    font-size: 2.2rem;
    color: #c40000;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    font-family: Montserrat, 'Noto Sans JP', sans-serif;
}

.bio .bio-text {
    font-size: 1rem;
    padding-top: 1rem;
}

.career .career-text {
    font-size: 1rem;
    padding-top: 1rem;
}

/* 基本プロフィール2カラム用ラッパー */
.profile-section-flex {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

/* 左カラム（基本プロフィールテーブル） */
.profile-left-column {
    display: flex;
    flex-direction: column;
}

.profile-left-column .profile-table {
    margin: 0;
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 右カラム（チーム情報カード） */
.profile-right-column {
    display: flex;
    flex-direction: column;
}

.team-info-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: fit-content;
}

.team-info-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
    text-align: center;
    font-family: Montserrat, 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #c40000 0%, #a00000 100%);
    padding: 1rem 1.5rem;
    box-shadow: 
        0 4px 12px rgba(196, 0, 0, 0.25),
        0 2px 4px rgba(196, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    border-bottom: 1px solid #fff;
}

.team-info-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.team-info-table th, .team-info-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1rem;
    text-align: left;
}

.team-info-table th {
    width: 35%;
    background: linear-gradient(135deg, #c40000 0%, #a00000 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
}

.team-info-table td {
    background: #fff;
    color: #333;
    font-weight: 500;
}

.team-info-table tr:last-child th,
.team-info-table tr:last-child td {
    border-bottom: none;
}

/* モバイル用テーブル（デスクトップでは非表示） */
.mobile-table {
    display: none;
}

.profile-table th, .profile-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 1rem;
    text-align: left;
}

.profile-table th {
    width: 35%;
    background: linear-gradient(135deg, #c40000 0%, #a00000 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
}

.profile-table td {
    background: #fff;
    color: #333;
    font-weight: 500;
}

.profile-table tr:last-child th,
.profile-table tr:last-child td {
    border-bottom: none;
}

/* 右カラム（チーム名・背番号・ポジション）の幅を広げ、nowrap指定を削除 */
.profile-section-flex .profile-side-info {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    min-width: 220px;
    max-width: 340px;
    margin-left: 0;
    margin-right: auto;
    gap: 18px;
}

.profile-side-info-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.profile-side-info-label {
    font-size: 1.05rem;
    color: #c40000;
    font-weight: 700;
    min-width: 56px;
}

.profile-side-info-value {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
    word-break: break-all;
}

/* 右カラムのチーム名・ポジションのセル幅を広げ、改行しにくくする */
.profile-side-info th, .profile-side-info td {
    max-width: 200px;
    min-width: 100px;
    width: 100%;

    /* nowrapは削除 */
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    header {
        height: 60px;
    }

    .profile-section-flex {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        margin-top: 1rem;
    }

    .profile-left-column,
    .profile-right-column {
        display: flex;
    }

    .mobile-table {
        display: none;
    }

    /* チャート詳細のモバイル表示 */
    .chart-detail-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .chart-display {
        padding: 1rem 0;
    }

    .chart-display #chart-canvas {
        max-width: 400px !important;
        max-height: 400px !important;
    }

    .ability-list {
        gap: 0.8rem;
    }
}

@media (max-width: 600px) {
    .section {
        padding: 1.5rem 3rem; /* 上下1.5rem、左右3remでさらに広い余白に */
        margin: 30px 2rem; /* 左右に2remの外側余白を追加 */
    }

    /* bio基本情報セクションのカード化を解除 */
    .section#bio {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }

    .section h2 {
        font-size: 1.8rem;
        letter-spacing: 0.02em;
        line-height: 1.2;
    }

    .profile-photo {
        width: 120px;
        height: 120px;
        order: 1; /* 画像を最初に表示 */
    }

    .profile-flexbox {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
        padding: 1.5rem 1rem;
    }

    .profile-info {
        align-items: center;
        padding-left: 0;
        display: flex;
        flex-direction: column;
        order: 2; /* テキスト情報を画像の後に表示 */
    }

    .profile-info .kana-text {
        font-size: 0.9rem;
        order: 1; /* 振り仮名を最初に */
        margin-bottom: 0.25rem;
    }

    .profile-info .name-text {
        font-size: 1.8rem;
        order: 2; /* 名前を振り仮名の後に */
    }

    .mobile-table th, .mobile-table td {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .chart-canvas {
        max-width: 280px;
        max-height: 280px;
    }

    .chart-display #chart-canvas {
        max-width: 380px !important;
        max-height: 380px !important;
    }

    .ability-list {
        gap: 0.7rem;
    }

    .ability-item {
        padding: 0.6rem;

        /* タッチデバイス用の追加スタイル */
        touch-action: manipulation;
        user-select: none;
        -webkit-tap-highlight-color: rgba(196, 0, 0, 0.1);
        cursor: pointer;
    }

    /* タッチ用の大きなタップエリア */
    .ability-item:active {
        background: linear-gradient(145deg, #e0e4e8 0%, #e8ecf0 100%);
        transform: translateY(0) scale(0.98);
        transition: all 0.1s ease;
    }

    .ability-name {
        font-size: 0.85rem;
    }

    .ability-score {
        font-size: 0.8rem;
    }

    /* 長いタイトル用の追加調整 */
    #message h2 {
        font-size: 1.5rem;
        white-space: nowrap;
        text-align: center;
        word-spacing: -0.1em;
        letter-spacing: -0.02em;
    }
}

/* アニメーション定義 */
@keyframes fade-in-menu {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fade-out-menu {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.95);
    }
}

@media (max-width: 430px) {
    .section {
        padding: 1rem 2.5rem; /* 上下1rem、左右2.5remでより広い余白を確保 */
        margin: 20px 1.5rem; /* 左右に1.5remの外側余白を追加 */
    }

    /* bio基本情報セクションのカード化を解除 */
    .section#bio {
        background: transparent;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }

    .section h2 {
        font-size: 1.6rem;
        letter-spacing: 0.01em;
        line-height: 1.1;
        text-align: center;
        word-break: keep-all;
        overflow-wrap: break-word;
    }

    .profile-flexbox {
        flex-direction: column !important;
        align-items: center !important;
        gap: 1rem !important;
        text-align: center !important;
        padding: 1rem;
    }

    .profile-photo {
        width: 100px;
        height: 100px;
        order: 1 !important;
        margin-bottom: 0;
    }

    .profile-info {
        align-items: center !important;
        text-align: center !important;
        display: flex;
        flex-direction: column;
        gap: 0.25rem !important;
        padding-left: 0;
    }

    .profile-info .name-text {
        font-size: 1.5rem;
        order: 3 !important;
    }

    .profile-info .kana-text {
        font-size: 0.8rem;
        order: 2 !important;
    }

    .mobile-table th, .mobile-table td {
        padding: 0.7rem 0.8rem;
        font-size: 0.85rem;
    }

    #chart-canvas {
        max-width: 380px !important;
        max-height: 380px !important;
    }

    /* 非常に小さな画面での長いタイトル調整 */
    #message h2 {
        font-size: 1.3rem;
        white-space: nowrap;
        text-align: center;
        word-spacing: -0.15em;
        letter-spacing: -0.03em;
    }
}