/**
 * タイムトライアル（リデザイン版）
 * 共通部品は practice-focus.css。ここにはタイムトライアル固有のものだけを置く
 * 接頭辞: pf-tt-
 */

/* ---------- 設定 ---------- */
.pf-tt-best {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid var(--pf-line);
    border-radius: 14px;
    background: var(--pf-surface);
    color: var(--pf-ink);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}
.pf-tt-best .pf-svg { color: var(--pf-ai); }
.pf-tt-note {
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: var(--pf-ink-3);
}

/* ---------- 集中画面 ---------- */
.pf-tt-meter.is-danger b { background: var(--pf-shu); }
.pf-tt .pf-pill[aria-pressed="false"] { opacity: .75; }

.pf-tt-play {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

/* 上部: 残り時間を大きく */
.pf-tt-clock {
    flex: none;
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 4px 16px 0;
}
.pf-tt-time {
    margin: 0;
    font-family: var(--pf-ui);
    font-weight: 700;
    font-size: clamp(3.5rem, 19vw, 6rem);
    line-height: 1;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
    color: var(--pf-ink);
}
.pf-tt-time.is-warning { color: var(--pf-shu); }
.pf-tt-time.is-danger {
    color: var(--pf-shu);
    animation: pf-tt-blink 1s steps(2, start) infinite;
}
@keyframes pf-tt-blink { to { opacity: .55; } }
.pf-tt-tally {
    display: flex;
    gap: 18px;
    margin: 0;
    font-size: 0.875rem;
    color: var(--pf-ink-2);
    font-variant-numeric: tabular-nums;
}
.pf-tt-tally b { font-size: 1.125rem; }
.pf-tt-tally .is-ok b { color: var(--pf-rokusho); }
.pf-tt-tally .is-ng b { color: var(--pf-shu); }

/* 中央: 上の句 */
.pf-tt-q {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 10px 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--pf-line);
    border-radius: 18px;
    background: var(--pf-surface);
    text-align: center;
    outline: none;
    transition: border-color .12s, background-color .12s;
}
.pf-tt-q .pf-hint { position: static; }
.pf-tt-q.is-ok { border-color: var(--pf-rokusho); }
.pf-tt-q.is-ng { border-color: var(--pf-shu); background: var(--pf-shu-soft); }
.pf-tt-kami {
    margin: 0;
    font-family: var(--pf-uta);
    font-weight: 600;
    font-size: clamp(1.25rem, 5.6vw, 1.75rem);
    line-height: 1.6;
    letter-spacing: .06em;
    color: var(--pf-ink);
}
.pf-tt-kami span { display: inline-block; white-space: nowrap; }
.pf-tt-answer {
    margin: 0;
    min-height: 1.5em;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--pf-ink-2);
}
.pf-tt-q.is-ok .pf-tt-answer { color: var(--pf-rokusho); }
.pf-tt-q.is-ng .pf-tt-answer { color: var(--pf-shu); }

/* 下半分: かなのキー（スマホは7列×5段） */
.pf-tt-grid {
    flex: none;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
}
.pf-tt-key {
    min-height: 52px;
    padding: 0;
    border: 1.5px solid var(--pf-line);
    border-radius: 12px;
    background: var(--pf-surface);
    color: var(--pf-ink);
    font-family: var(--pf-uta);
    font-size: 1.375rem;
    font-weight: 600;
    line-height: 1;
    transition: border-color .1s, background-color .1s, transform .06s;
    touch-action: manipulation;
}
.pf-tt-key:hover { border-color: var(--pf-ai); }
.pf-tt-key:active { transform: scale(.96); background: var(--pf-ai-soft); }
.pf-tt-key.is-correct { border-color: var(--pf-rokusho); background: var(--pf-rokusho); color: #fff; }
.pf-tt-key.is-wrong { border-color: var(--pf-shu); background: var(--pf-shu); color: #fff; }

.pf-tt-buf {
    min-width: 3em;
    font-family: var(--pf-ui);
    font-weight: 700;
    color: var(--pf-ai);
    letter-spacing: .1em;
}

@media (max-height: 700px) {
    .pf-tt-time { font-size: clamp(2.75rem, 14vw, 4rem); }
    .pf-tt-key { min-height: 46px; }
}

/* PC: キーは11列×3段 */
@media (min-width: 860px) {
    .pf-tt-play { max-width: 860px; padding: 0 32px; }
    .pf-tt-clock { padding-top: 8px; }
    .pf-tt-time { font-size: 6.5rem; }
    .pf-tt-q { margin: 16px 0; padding: 20px 28px; }
    .pf-tt-kami { font-size: 2rem; }
    .pf-tt-grid {
        grid-template-columns: repeat(11, minmax(0, 1fr));
        gap: 8px;
        padding: 0;
    }
    .pf-tt-key { min-height: 60px; font-size: 1.5rem; }
    .pf-tt .pf-kbd { align-items: center; }
}

/* ---------- 結果 ---------- */
.pf-tt-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    margin: 10px auto 0;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--pf-rokusho-soft);
    color: var(--pf-rokusho);
    font-size: 0.875rem;
    font-weight: 700;
}
.pf-tt-badge[hidden] { display: none; }
.pf-result .pf-score small { margin-left: 4px; font-family: var(--pf-ui); font-size: 1.125rem; }
.pf-tt-bestline {
    margin: -8px 0 16px;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--pf-ink-3);
    font-variant-numeric: tabular-nums;
}
.pf-tt-bestline:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
    .pf-tt-time.is-danger { animation: none; }
}
