/* front/css/achievements.css */

/* 全要素のボックスサイズ計算を統一し、レイアウト崩れやガタつきを防止 */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Hiragino Sans', 'Noto Sans CJK JP', sans-serif;
    color: #ffffff;
    background-color: #000;
    background-image: url('../img/Achievementsimage.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* 背景固定 */
    height: 100vh;
    overflow: hidden;
    overscroll-behavior: none; /* バウンド防止 */
}

.achievement-container {
    width: 100%;
    height: 100%;
    position: fixed; /* 画面固定 */
    top: 0;
    left: 0;
    right: 0; /* 中央揃え用 */
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 30px 40px;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
}

.back-button {
    color: #ccc;
    text-decoration: none;
    font-size: 1rem;
    padding: 8px 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: background-color 0.2s;
    display: inline-block; 
    margin-bottom: 10px; 
    cursor: pointer;
    border: none;
}
.back-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.achievement-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: flex-start; 
    gap: 20px;
    padding-bottom: 20px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    flex-direction: column; 
    align-items: flex-start; 
}

.title {
    font-size: 1.8rem;
    margin: 0; 
    font-weight: 600;
    display: flex;
    align-items: center;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.header-center {
    display: flex;
    justify-content: center;
    padding-top: 10px; 
}

.rate-control {
    display: flex;
    flex-direction: column; 
    align-items: center; 
    font-size: 1.25rem;
}
.rate-label {
    color: #ccc;
    margin-bottom: 5px; 
}
.rate-value {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px; 
    text-shadow: 0 0 15px rgba(106, 13, 173, 0.6); 
}
.rate-chart {
    width: 70px; 
    height: 70px;
}
.chart-bg {
    fill: none;
    stroke: #333; 
    stroke-width: 3.8;
}
.chart-bar {
    fill: none;
    stroke: #6a0dad; 
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

.header-right {
    display: flex;
    justify-content: flex-end; 
    align-items: flex-start; 
    gap: 15px;
    padding-top: 10px; 
}

.user-info {
    font-size: 1.1rem; 
    color: #e0e0e0;
    text-align: right; 
}
.user-info p {
    margin: 5px 0;
}
.user-info span {
    font-weight: bold;
    color: #fff;
}

.achievement-main {
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    overflow: hidden; 
    position: relative;
}

/* 一覧表示ビュー */
.achievement-list-wrapper {
    flex-grow: 1; 
    overflow-y: auto; 
    padding-right: 10px; 
    margin-top: 20px; 
    animation: fadeIn 0.3s ease;
    overscroll-behavior: none; /* バウンド防止 */
}
.achievement-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); 
    gap: 25px;
}

.achievement-list-wrapper::-webkit-scrollbar { width: 8px; }
.achievement-list-wrapper::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); border-radius: 4px; }
.achievement-list-wrapper::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 4px; }

.achievement-card {
    position: relative; 
    background: linear-gradient(135deg, rgba(40, 30, 60, 0.6), rgba(20, 10, 40, 0.6));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15); 
    border-radius: 16px;
    padding: 24px;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

.achievement-card::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.03), transparent);
    transform: rotate(45deg);
    pointer-events: none;
}

.achievement-card:hover {
    background: linear-gradient(135deg, rgba(50, 40, 80, 0.7), rgba(30, 20, 50, 0.7));
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.card-header {
    font-size: 1.4rem;
    font-weight: bold;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-status {
    font-size: 0.9rem;
    color: #bbb;
    margin: 0 0 15px 0;
}

.card-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}
.card-details a {
    color: #aaa;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s;
    cursor: pointer;
}
.card-details a:hover { color: #fff; }

.achievement-card.unlocked .card-header .icon {
    color: #ffd700;
}

.achievement-card.locked {
    background: linear-gradient(135deg, rgba(30, 20, 50, 0.6), rgba(10, 5, 30, 0.6));
}

.achievement-card.locked .card-header,
.achievement-card.locked .card-status,
.achievement-card.locked .card-details {
    opacity: 0.6;
}

.loading-text {
    font-size: 1.2rem;
    color: #ccc;
    text-align: center;
    grid-column: 1 / -1;
}

/* --- 詳細表示ビューのスタイル --- */
.achievement-detail-view {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-top: 10px;
    animation: fadeIn 0.3s ease;
    overflow-y: hidden; /* ★変更: auto -> hidden でスクロールを完全禁止 */
    overflow-x: hidden;
    overscroll-behavior: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.achievement-detail-view::-webkit-scrollbar {
    display: none;
}

.detail-nav {
    margin-bottom: 20px;
}

.detail-content-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px;
    background: linear-gradient(135deg, rgba(40, 30, 60, 0.6), rgba(20, 10, 40, 0.6));
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

.detail-icon-large {
    margin-bottom: 20px;
}
.detail-icon-large svg {
    width: 2.5em !important;
    height: 2.5em !important;
}

.detail-icon-large.unlocked {
    color: #ffd700;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.3));
}
.detail-icon-large.locked {
    opacity: 0.5;
}

.detail-title {
    font-size: 2.2rem;
    font-weight: bold;
    margin: 0 0 30px 0;
    text-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.detail-info-section {
    width: 100%;
    max-width: 700px;
    text-align: left;
}

.detail-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.detail-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #ccc;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
}

.detail-box p {
    font-size: 1.4rem;
    line-height: 1.6;
    margin: 0;
}

.reward-container {
    margin: 30px 0;
    text-align: center;
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

.reward-label {
    font-size: 0.9rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin: 0 0 12px 0;
    font-weight: 700;
    display: inline-block;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
}

.reward-tags {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.reward-tag {
    /* プレート風デザイン */
    background: rgba(13, 17, 23, 0.95);
    color: #fff;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1.2rem;
    letter-spacing: 1px;
    border: 1px solid #388bfd; /* GitHub Blue */
    box-shadow: 0 0 15px rgba(56, 139, 253, 0.2);
    text-shadow: 0 0 5px rgba(56, 139, 253, 0.5);
    /* transformを遷移対象から外し、位置移動を完全に防止 */
    transition: box-shadow 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    min-width: 90px;
    text-align: center;
    /* レイヤー固定 */
    transform: translateZ(0);
    backface-visibility: hidden;
}

.reward-tag:hover {
    /* 位置移動(transform)を強制的に無効化して動かさない */
    transform: translateZ(0) !important;
    box-shadow: 0 0 25px rgba(56, 139, 253, 0.4);
    border-color: #58a6ff;
    color: #58a6ff;
}

.detail-status-row {
    font-size: 1.2rem;
    text-align: right;
    margin-top: 10px;
}

.status-label {
    color: #bbb;
    margin-right: 10px;
}

.status-value {
    font-weight: bold;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* SP向け */
@media screen and (max-width: 768px) {
    .achievement-container {
        padding: 15px;
    }

    .achievement-header {
        grid-template-columns: 1fr;
        gap: 15px;
        text-align: center;
    }

    .header-left {
        align-items: flex-start;
        width: 100%;
    }
    
    .back-button {
        font-size: 0.9rem;
        padding: 6px 10px;
    }

    .title {
        font-size: 1.3rem; /* 文字サイズを縮小 */
        justify-content: center;
        width: 100%; 
    }

    .header-center {
        padding-top: 0;
    }

    /* グラフとレート文字の縮小 */
    .rate-control {
        font-size: 1rem;
    }
    .rate-value {
        font-size: 1.8rem;
    }
    .rate-chart {
        width: 50px;
        height: 50px;
    }

    .header-right {
        justify-content: center;
        width: 100%;
    }

    .user-info {
        text-align: center;
        display: flex;
        flex-direction: row;
        gap: 10px;
        justify-content: center;
        font-size: 0.9rem; /* 文字サイズを縮小 */
    }

    .achievement-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* 詳細画面を全画面オーバーレイ化して見切れ防止 */
    .achievement-detail-view {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 2000;
        margin-top: 0;
        background: rgba(0, 0, 0, 0.85); /* 背景を暗く */
        overflow-y: auto; /* スクロール許可 */
        padding: 15px;
    }

    .detail-content-container {
        padding: 20px;
        margin-bottom: 40px; /* スクロール用に下部余白を追加 */
    }

    .detail-title {
        font-size: 1.8rem;
    }

    .detail-box {
        padding: 15px;
    }
    
    .detail-box p {
        font-size: 1.1rem;
    }
    
    .reward-tag {
        font-size: 1.0rem;
        padding: 8px 18px;
    }
}