/* /check（AIポートフォリオチェック）LP専用。右側の図解（アップロード → 解析 → サマリー → 詳細）と
   その操作アニメーションを定義する。/profile の図解（profile.css）と同じ作り・同じ 10s ループ。
   色・角丸は style.css の v2 トークン（--v2-*）を使う。
   各要素の素のスタイル＝結果表示後の状態（動きを減らす設定ではこの状態で止まる）。
   0〜30%: アップロード・解析 / 34〜63%: サマリー / 66〜97%: 詳細 */

.ck-visual {
    gap: 10px;
    min-width: 0;
}

.ck-card {
    position: relative;
    overflow: hidden;
    padding: 12px 16px;
}

.ck-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.ck-card-head .hv-label {
    margin-bottom: 0;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--v2-ink);
}

.ck-cursor {
    position: absolute;
    z-index: 3;
    width: 14px;
    height: 18px;
    opacity: 0;
    pointer-events: none;
    transform-origin: 2px 2px;
    filter: drop-shadow(0 1px 1.5px rgba(20, 23, 42, 0.25));
}

/* 判定バッジ（結果画面の selfcheck-badge と同じ配色） */
.ck-badge {
    flex: none;
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.ck-badge-ok {
    color: var(--v2-positive);
    background: var(--v2-positive-soft);
}

.ck-badge-warn {
    color: #6e4d00;
    background: var(--v2-warn-soft);
}

.ck-badge-ng {
    color: var(--v2-negative);
    background: var(--v2-negative-soft);
}

/* ---------- 1. アップロード・解析 ---------- */
.ck-upload {
    position: relative;
    display: grid;
}

.ck-drop-target,
.ck-file {
    grid-area: 1 / 1;
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 40px;
    border-radius: var(--v2-r-md);
    box-sizing: border-box;
}

.ck-drop-target {
    justify-content: center;
    border: 1.5px dashed var(--v2-line);
    background: var(--v2-surface);
    font-size: 11px;
    color: #545860;
    opacity: 0;
}

.ck-file {
    gap: 10px;
    padding: 6px 6px 6px 10px;
    background: var(--v2-panel);
    font-size: 12px;
}

.ck-file .hv-drop-ic {
    padding: 3px 6px;
}

.ck-file-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    color: var(--v2-ink);
}

/* 右端は「チェックを開始」→「解析中＋進捗」→「解析完了」を重ねて切り替える */
.ck-file-action {
    flex: none;
    display: grid;
    align-items: center;
    justify-items: end;
}

.ck-file-action > * {
    grid-area: 1 / 1;
}

.ck-send {
    position: relative;
    padding: 4px 12px;
    border-radius: var(--v2-r-sm);
    background: #b84818;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
}

.ck-send .ck-cursor {
    left: 55%;
    top: 55%;
}

.ck-analyzing {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    color: #545860;
    white-space: nowrap;
    opacity: 0;
}

.ck-progress {
    width: 48px;
    height: 5px;
    border-radius: 3px;
    background: var(--v2-line);
    overflow: hidden;
}

.ck-progress-bar {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--v2-accent);
}

.ck-done {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--v2-positive-soft);
    color: var(--v2-positive);
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}

.ck-done::before {
    content: "✓ ";
}

.ck-drag {
    position: absolute;
    z-index: 2;
    left: 30%;
    top: 5px;
    opacity: 0;
    pointer-events: none;
}

.ck-drag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 3px;
    border: 1px solid var(--v2-line);
    border-radius: var(--v2-r-md);
    background: var(--v2-surface);
    box-shadow: 0 6px 16px rgba(20, 23, 42, 0.16);
    font-size: 11px;
    font-weight: 700;
    color: var(--v2-ink);
    white-space: nowrap;
    transform: rotate(-3deg);
}

.ck-drag-chip .hv-drop-ic {
    padding: 2px 5px;
    font-size: 8.5px;
}

.ck-drag .ck-cursor {
    right: -8px;
    bottom: -12px;
    opacity: 1;
}

/* ---------- 2. サマリー（総合スコア・件数・レーダーチャート） ---------- */
.ck-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ck-score {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ck-score-label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--v2-muted);
}

/* 点数は CSS カウンターで表示（アニメーション時は 0→75 とカウントアップ） */
@property --ck-score {
    syntax: "<integer>";
    initial-value: 9;
    inherits: false;
}

.ck-score-value {
    font-family: "Zen Kaku Gothic New", sans-serif;
    font-size: 34px;
    font-weight: 900;
    line-height: 1.15;
    color: var(--v2-accent);
    font-variant-numeric: tabular-nums;
}

.ck-score-num {
    --ck-score: 9;
    counter-reset: ck-score var(--ck-score);
}

.ck-score-num::before {
    content: counter(ck-score);
}

.ck-score-value small {
    margin-left: 2px;
    font-size: 13px;
    font-weight: 700;
    color: var(--v2-ink);
}

.ck-counts {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
}

.ck-counts li {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--v2-ink);
    font-variant-numeric: tabular-nums;
}

.ck-radar {
    flex: none;
    width: 46%;
    max-width: 190px;
    height: auto;
}

/* スマホ幅: グラフの文字が小さくなりすぎないよう、点数の下に全幅で置く */
@media (max-width: 480px) {
    .ck-summary {
        flex-direction: column;
        align-items: stretch;
    }

    .ck-radar {
        width: 100%;
        max-width: 190px;
        align-self: center;
    }
}

.ck-radar-grid {
    fill: none;
    stroke: var(--v2-line);
    stroke-width: 1;
}

.ck-radar-axis {
    stroke: var(--v2-line);
    stroke-width: 1;
}

.ck-radar-data {
    fill: rgba(224, 96, 42, 0.18);
    stroke: var(--v2-accent);
    stroke-width: 1.5;
    stroke-linejoin: round;
    transform-box: view-box;
    transform-origin: 85px 68px;
}

.ck-radar-label {
    font-size: 9.5px;
    font-weight: 700;
    fill: var(--v2-muted);
}

/* ---------- 3. 詳細（チェック項目とアドバイス） ---------- */
.ck-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ck-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 10px;
    border-radius: var(--v2-r-md);
    background: var(--v2-panel);
    font-size: 11.5px;
    color: var(--v2-ink);
}

.ck-item-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ck-item-open {
    box-shadow: inset 0 0 0 1.5px var(--v2-warn);
}

.ck-item-open .ck-cursor {
    left: 40%;
    top: 55%;
}

.ck-advice {
    margin: 8px 0 0;
    padding: 2px 0 2px 10px;
    border-left: 2px solid var(--v2-warn);
    font-size: 11px;
    line-height: 1.6;
    color: var(--v2-ink);
}

.ck-advice-page {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    color: var(--v2-muted);
}

/* ---------- 操作アニメーション ---------- */
@media (prefers-reduced-motion: no-preference) {
    .ck-card-upload { animation: ck-hl-upload 10s infinite; }
    .ck-card-summary { animation: ck-hl-summary 10s infinite; }
    .ck-card-detail { animation: ck-hl-detail 10s infinite; }

    .ck-drag { animation: ck-drag 10s infinite; }
    .ck-drop-target { animation: ck-drop-target 10s infinite; }
    .ck-file { animation: ck-file 10s infinite; }
    .ck-send { animation: ck-send 10s infinite; }
    .ck-send .ck-cursor { animation: ck-cursor-send 10s infinite; }
    .ck-analyzing { animation: ck-analyzing 10s infinite; }
    .ck-progress-bar { animation: ck-progress-bar 10s infinite; }
    .ck-done { animation: ck-done 10s infinite; }

    .ck-summary { animation: ck-summary-dim 10s infinite; }
    .ck-score-num { animation: ck-score 10s infinite; }
    .ck-radar-data { animation: ck-radar 10s infinite; }
    .ck-counts li:nth-child(1) { animation: ck-count-1 10s infinite; }
    .ck-counts li:nth-child(2) { animation: ck-count-2 10s infinite; }
    .ck-counts li:nth-child(3) { animation: ck-count-3 10s infinite; }

    .ck-item:nth-child(1) { animation: ck-item-1 10s infinite; }
    .ck-item:nth-child(2) { animation: ck-item-2 10s infinite; }
    .ck-item:nth-child(3) { animation: ck-item-3 10s infinite; }
    .ck-item-open .ck-cursor { animation: ck-cursor-item 10s infinite; }
    .ck-advice { animation: ck-advice 10s infinite; }
}

/* 操作中のカードを強調 */
@keyframes ck-hl-upload {
    0%, 30% { border-color: var(--v2-accent); }
    33%, 97% { border-color: var(--v2-line); }
    100% { border-color: var(--v2-accent); }
}

@keyframes ck-hl-summary {
    0%, 31% { border-color: var(--v2-line); }
    34%, 63% { border-color: var(--v2-accent); }
    66%, 100% { border-color: var(--v2-line); }
}

@keyframes ck-hl-detail {
    0%, 63% { border-color: var(--v2-line); }
    66%, 96% { border-color: var(--v2-accent); }
    99%, 100% { border-color: var(--v2-line); }
}

/* 1. ドラッグ&ドロップ → チェックを開始をクリック → 解析中（進捗）→ 解析完了 */
@keyframes ck-drag {
    0% { opacity: 0; transform: translate(64px, -38px); }
    3% { opacity: 1; transform: translate(64px, -38px); }
    11%, 13% { opacity: 1; transform: translate(0, 0); }
    15%, 100% { opacity: 0; transform: translate(0, 0); }
}

@keyframes ck-drop-target {
    0%, 8% { opacity: 1; border-color: var(--v2-line); background: var(--v2-surface); }
    10%, 13% { opacity: 1; border-color: var(--v2-accent); background: var(--v2-accent-soft); }
    15%, 97% { opacity: 0; border-color: var(--v2-line); background: var(--v2-surface); }
    100% { opacity: 1; border-color: var(--v2-line); background: var(--v2-surface); }
}

@keyframes ck-file {
    0%, 14% { opacity: 0; }
    16%, 96% { opacity: 1; }
    99%, 100% { opacity: 0; }
}

@keyframes ck-send {
    0%, 14% { opacity: 1; transform: scale(1); }
    20% { opacity: 1; transform: scale(1); }
    20.5% { opacity: 1; transform: scale(0.94); }
    21% { opacity: 1; transform: scale(1); }
    22%, 100% { opacity: 0; transform: scale(1); }
}

@keyframes ck-cursor-send {
    0%, 15% { opacity: 0; transform: translate(-40px, 22px); }
    16% { opacity: 1; transform: translate(-40px, 22px); }
    19.5% { opacity: 1; transform: translate(0, 0) scale(1); }
    20.5% { opacity: 1; transform: translate(0, 0) scale(0.82); }
    21.5% { opacity: 1; transform: translate(0, 0) scale(1); }
    23%, 100% { opacity: 0; transform: translate(0, 0); }
}

@keyframes ck-analyzing {
    0%, 21.5% { opacity: 0; }
    22.5%, 29% { opacity: 1; }
    30%, 100% { opacity: 0; }
}

@keyframes ck-progress-bar {
    0%, 22% { width: 0; }
    29%, 100% { width: 100%; }
}

@keyframes ck-done {
    0%, 29.5% { opacity: 0; }
    31%, 96% { opacity: 1; }
    99%, 100% { opacity: 0; }
}

/* 2. サマリー: 点数のカウントアップ・グラフの展開・件数の表示 */
@keyframes ck-summary-dim {
    0%, 31% { opacity: 0.35; }
    33%, 97% { opacity: 1; }
    100% { opacity: 0.35; }
}

@keyframes ck-score {
    0%, 34% { --ck-score: 0; }
    43%, 100% { --ck-score: 9; }
}

@keyframes ck-radar {
    0%, 34% { transform: scale(0); opacity: 0; }
    35% { opacity: 1; }
    43%, 97% { transform: scale(1); opacity: 1; animation-timing-function: ease-in; }
    100% { transform: scale(1); opacity: 0; }
}

@keyframes ck-count-1 {
    0%, 44% { opacity: 0; transform: translateY(3px); }
    46%, 100% { opacity: 1; transform: translateY(0); }
}

@keyframes ck-count-2 {
    0%, 46% { opacity: 0; transform: translateY(3px); }
    48%, 100% { opacity: 1; transform: translateY(0); }
}

@keyframes ck-count-3 {
    0%, 48% { opacity: 0; transform: translateY(3px); }
    50%, 100% { opacity: 1; transform: translateY(0); }
}

/* 3. 詳細: 項目が並ぶ → 要確認の項目をクリック → アドバイスを表示 */
@keyframes ck-item-1 {
    0%, 65% { opacity: 0.35; transform: translateY(3px); }
    67%, 97% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0.35; transform: translateY(3px); }
}

@keyframes ck-item-2 {
    0%, 67% { opacity: 0.35; transform: translateY(3px); box-shadow: inset 0 0 0 1.5px transparent; }
    69%, 75.5% { opacity: 1; transform: translateY(0); box-shadow: inset 0 0 0 1.5px transparent; }
    76.5%, 97% { opacity: 1; transform: translateY(0); box-shadow: inset 0 0 0 1.5px var(--v2-warn); }
    100% { opacity: 0.35; transform: translateY(3px); box-shadow: inset 0 0 0 1.5px transparent; }
}

@keyframes ck-item-3 {
    0%, 69% { opacity: 0.35; transform: translateY(3px); }
    71%, 97% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0.35; transform: translateY(3px); }
}

@keyframes ck-cursor-item {
    0%, 71% { opacity: 0; transform: translate(50px, 26px); }
    72% { opacity: 1; transform: translate(50px, 26px); }
    75.5% { opacity: 1; transform: translate(0, 0) scale(1); }
    76.5% { opacity: 1; transform: translate(0, 0) scale(0.82); }
    77.5% { opacity: 1; transform: translate(0, 0) scale(1); }
    80%, 100% { opacity: 0; transform: translate(0, 0); }
}

@keyframes ck-advice {
    0%, 76.5% { opacity: 0; transform: translateY(-4px); }
    79%, 97% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-4px); }
}
