/* --- AI Critique Tabs Styles --- */

.critique-result {
    background: transparent;
    /* 背景色なしに変更 */
    white-space: pre-wrap;
    /* JSで <br> に変換されるため不要になるが念のため */
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    border-radius: 8px;
    overflow: hidden;
    /* タブコンテンツの境界を綺麗にする */
    padding: 0; /* padding を 0 にして高さを最小化 */
    margin: 0;
}

/* グラフの外枠（パディングを極小化して上下余白を排除） */
.radar-chart-container {
    background: var(--base-bg-color);
        padding: 5px;
    /* 余白をさらに縮小 */
    display: flex;
    justify-content: flex-start;
    /* 左寄せに変更 */
    align-items: center;
    /* ランク文字とチャートを整列 */
    gap: 0;
    /* 余白を削除 */
    border-bottom: 1px solid var(--base-bg-color);
    margin-bottom: 2px;
}

.radar-chart-container svg {
    max-width: 400px;
    /* 400pxに戻す */
    height: auto;
    margin: 0;
    padding-top: 15px;
    padding-left: 20px;
}

/* ランク表示を親コンテナ内で中央揃えにするために拡張 */
.rank-display {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rank-value {
    font-size: 150px;
    font-weight: 700;
    color: var(--base-text-color-soft);
    line-height: 1;
}

/* グラフ内のテキストスタイル */
.radar-chart-container text {
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 0.05em;
}

/* 総合評価の枠 */
.overall-result-header {
    background: var(--base-text-color-soft);
    color: var(--base-bg-color);
    padding: 20px 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* フレックスボックスの高さ制御 */
.overall-score-flex {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

/* ランクテキストを固定幅にすることでガタつきを防止 */
.overall-score-text {
    margin: 0;
    letter-spacing: 0.05em;
    font-weight: 700;
    line-height: 1;
    width: 220px; /* 固定幅を設定（SS (00/60点) が収まるサイズ） */
    text-align: left; /* 左寄せで一定位置に */
    font-variant-numeric: tabular-nums; /* 数値を等幅フォントに */
}

/* バーのコンテナの高さをテキストと同じ8pxにする */
.overall-bar-container {
    position: relative; /* マーカー配置の基準 */
    flex-grow: 1;
    max-width: 350px;
    height: 8px;
    display: flex;
    align-items: center;
    margin-top: 30px; /* 25pxから5px増やして30pxに */
}

/* マーカーコンテナ */
.overall-bar-markers {
    position: absolute;
    top: -30px; /* コンテナの上端より上に配置 */
    left: 0;
    width: 100%;
    height: 25px;
    pointer-events: none;
}

/* 各マーカーのラッパー */
.rank-marker-wrapper {
    position: absolute;
    bottom: 0; /* マーカーコンテナの下部に位置させる */
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%); /* 中央寄せ */
}

/* ランクラベル */
.rank-marker-label {
    font-size: 10px;
    font-weight: bold;
    color: var(--base-bg-color);
    margin-bottom: 0px; /* 2pxから0pxに変更 */
}

/* 個別のランクマーカー */
.rank-marker {
    width: 1px;
    height: 8px;
    background-color: var(--base-bg-color);
    opacity: 0.8;
}

/* 総合評価点バーの背景 */
.overall-bar-bg {
    background: var(--base-bg-color-transparent);
    height: 8px;
    border-radius: 4px;
    width: 100%;
    top: -5px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--base-bg-color);
}

/* 総合評価点バーの塗りつぶし */
.overall-bar-fill {
    background: var(--base-bg-color);
    height: 100%;
    width: 0;
    position: absolute;
    top: 0;
    left: 0;
    transition: width 6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* モバイル対応時の余白も調整 */
@media (max-width: 600px) {
    .rank-value {
        font-size: 80px;
    }

    .overall-result-header {
    padding: 8px 15px;
    }

    .overall-score-flex {
        gap: 5px;
    }

    .overall-score-text {
        font-size: 0.8rem;
        width: 150px; 
    }
}
    .critique-tab-header {
    display: flex;
    flex-wrap: wrap;
    /* スマホで折り返す */
    background: var(--base-bg-color);
    border-top: 1px solid var(--base-text-color);
    border-bottom: 1px solid var(--base-text-color);
    padding: 10px;
    gap: 5px;
    /* ボタン間の隙間 */
    border-radius: 0;
    }

    .critique-tab-button {
    background: var(--base-bg-color);
    border: 1px solid var(--base-text-color);
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 300;
    color: var(--base-text-color);
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
    flex-grow: 1;
    /* スペースを均等に埋める */
    min-width: 120px;
    /* 小さくなりすぎないように */
    }

#critique-result .critique-tab-button:hover:not(.active) {
    background: var(--base-text-color-transparent);
    color: var(--base-text-color);
    }

#critique-result .critique-tab-button.active {
    background: var(--base-text-color-soft);
    border-color: var(--base-bg-color);
    color: var(--base-bg-color);
}


.critique-tab-content-area {
    padding: 20px;
    background: var(--base-bg-color);
    border-bottom: 1px solid var(--base-text-color);
}

.critique-tab-content {
    display: none;
    /* デフォルトで非表示 */
}

.critique-tab-content.active {
    display: block;
    /* アクティブなタブのみ表示 */
    }

.critique-tab-content p {
    margin: 0;
    padding: 0;
    color: var(--base-text-color);
    white-space: pre-wrap;
    /* <br> で改行されるが念のため */
    }

/* タブコンテンツ内の区切り線 */
hr {
    border: 0;
    border-top: 1px solid var(--base-text-color);
    margin: 15px 0;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .critique-tab-header {
        flex-direction: column;
        /* 縦に並べる */
        padding: 5px;
        gap: 3px;
    }

    .critique-tab-button {
        padding: 10px;
        font-size: 0.8em;
        min-width: unset;
        /* 最小幅を解除 */
    }

    .critique-tab-content-area {
        padding: 15px;
    }
}

/* SVG全体サイズ */
.radar-svg {
    max-width: 400px;
    height: auto;
}

/* 軸線・目盛り */
.radar-axis {
    stroke: var(--base-text-color-transparent);
    stroke-width: 1;
    fill: none;
}

/* 外側の項目キャプション */
.radar-label {
    font-size: 13px;
    /* 少しすっきりしたサイズに */
    fill: var(--base-text-color-soft);
    font-weight: 500;
}

/* 塗りつぶされる多角形 */
.radar-polygon {
    fill: var(--base-text-color-transparent);
    stroke: var(--base-text-color);
    stroke-width: 1.5;
    /* 中心から開くアニメーション用に初期状態を設定 */
    transform-origin: 175px 125px;
    transform: scale(0);
    transition: transform 1.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s ease;
}

/* 頂点の丸 */
.radar-point {
    r: 2.5;
    fill: var(--base-text-color);
    opacity: 0;
    transition: opacity 0.5s ease 1s; /* ポリゴン描画後に表示 */
}

/* 各頂点の点数 */
.radar-value {
    text-anchor: middle;
    font-size: 15px;
    font-weight: bold;
    fill: var(--base-text-color-soft);
    opacity: 0;
    transition: opacity 0.5s ease 1.2s; /* 頂点表示後に表示 */
}

.radar-show {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* プログレスバーアニメーション */
.ecg-loader {
    width: 250px;
    height: 50px;
    margin: 20px auto;
    background-color: var(--base-bg-color); 
    display: flex;
    justify-content: center;
    align-items: center;
}

.ecg-loader svg {
    width: 100%;
    height: 100%;
}

.ecg-path {
    stroke: var(--base-text-color);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: ecg-heartbeat 2s linear infinite;
}

@keyframes ecg-heartbeat {
    0% {
        stroke-dashoffset: 600;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

