/* ============================================================
   ぱそトレ！ 5分間タイピングテスト専用「正典」スタイル (v20.7.28.Final)
   ------------------------------------------------------------
   【管理ルール】
   - 略記（shorthand）禁止。
   - 1024px絶対統治 ＆ 768px高 1画面収容ロジック。
   - 企業の採用試験を想定した、静寂と集中のデザイン。
   ============================================================ */

/* --- 1. 全体物理配置 ＆ 背景 --- */
body.test-body {
    background-color: #64758A;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    font-family: 'Noto Sans JP', sans-serif !important;
    color: #1e293b;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ヘッダー：背景色と一体化（物理高を節約） */
body.test-body header {
    background-color: #64758A;
    width: 100%;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* 1024px中央配置 ＆ ヘッダー厚みの最小化 */
body.test-body .header-inner {
    max-width: 1024px;
    margin-top: 0px;
    margin-right: auto;
    margin-bottom: 0px;
    margin-left: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    padding-right: 0px;
    padding-bottom: 10px;
    padding-left: 0px;
}

/* アイコン物理ロック */
body.test-body .nav-icon {
    width: 18px !important;
    height: 18px !important;
}

/* ナビゲーション文字色 */
body.test-body .nav-item {
    color: #2c3e50 !important;
    text-decoration-line: none !important;
}

/* メインラッパー：自動スクロールの起点となるため margin-top を 0 にし、padding で微調整 */
.test-main-wrapper {
    max-width: 1000px;
    margin-top: 0px;
    margin-right: auto;
    margin-bottom: 0px;
    margin-left: auto;
    padding-top: 20px;
}

/* --- 2. 各種カード（白ボックス）定義 --- */
.test-info-card,
.test-typing-card,
.test-result-card {
    background-color: #ffffff;
    box-sizing: border-box;
}

/* 画面コンテナ自体の背景（後ろの白い箱）を透明化 */
.test-screen-container {
    background-color: transparent !important;
    box-shadow: none !important;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* --- 3. ミニステータス（カード内右上に固定） --- */
.test-mini-status {
    position: absolute;
    top: 25px; /* ラベルの高さに合わせる */
    right: 40px; /* カードの右余白に合わせる */
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: #ffffff;
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    border-top-color: #14b8a6;
    border-right-color: #14b8a6;
    border-bottom-color: #14b8a6;
    border-left-color: #14b8a6;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-bottom-left-radius: 12px;
    padding-top: 10px;
    padding-right: 20px;
    padding-bottom: 10px;
    padding-left: 20px;
    box-shadow: 0px 4px 15px rgba(20, 184, 166, 0.1);
    z-index: 100;
}

.mini-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mini-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 800;
    color: #64748b;
}

.mini-icon {
    width: 14px;
    height: 14px;
}

.mini-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.4rem;
    font-weight: 900;
    color: #1e293b;
    line-height: 1.2;
}

.mini-val-group {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.mini-unit {
    font-size: 0.75rem;
    font-weight: 800;
    color: #94a3b8;
}

.mini-sep {
    width: 1px;
    height: 40px;
    background-color: #e2e8f0;
    margin-top: 0px;
    margin-right: 20px;
    margin-bottom: 0px;
    margin-left: 20px;
}

/* --- 4. タイピングメインカード（中央） --- */
.test-typing-card {
    position: relative; /* これにより右上の窓がこのカードの中に固定されます */
    width: 1000px;
    background-color: #ffffff;
    margin-top: 0px;
    margin-right: auto;
    margin-bottom: 180px;
    margin-left: auto;
    padding-top: 25px;
    padding-right: 40px;
    padding-bottom: 30px;
    padding-left: 40px;
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
    border-bottom-right-radius: 25px;
    border-bottom-left-radius: 25px;
    box-shadow: 0px 20px 50px rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

.test-typing-label {
    font-size: 0.9rem;
    font-weight: 800;
    color: #14b8a6;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 10px;
    margin-left: 0px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.test-text-display {
    background-color: #f8fafc;
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    border-top-color: #e2e8f0;
    border-right-color: #e2e8f0;
    border-bottom-color: #e2e8f0;
    border-left-color: #e2e8f0;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
    padding-top: 15px;
    padding-right: 25px;
    padding-bottom: 15px;
    padding-left: 25px;
    font-size: 1.55rem;
    line-height: 1.5;
    color: #1e293b;
    /* 物理高を140pxに拡張し、2行収容 ＆ スライド窓として統治 */
    height: 140px;
    word-break: break-all;
    white-space: normal;
    box-sizing: border-box;
    text-align: left;
    overflow: hidden;
    position: relative;
}

/* スライド用コンテナ：行間を 10px -> 4px へ短縮 */
.sample-inner-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform 0.2s ease-in-out;
}

.sample-line {
    min-height: 50px;
    opacity: 1;
}

/* 次の文章：フォントサイズを 1.55rem -> 1.3rem へ微減 */
.sample-line--next {
    opacity: 0.25;
    font-size: 1.3rem;
}

/* スライド実行：行間短縮に合わせて移動距離を -60px -> -55px へ調整 */
.is-sliding {
    transform: translateY(-55px);
}

/* 1. 外枠：パディングを完全に排除し、物理的な左端（0px）を確定させる */
.test-input-view-frame {
    background-color: #ffffff;
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    border-top-color: #cbd5e1;
    border-right-color: #cbd5e1;
    border-bottom-color: #cbd5e1;
    border-left-color: #cbd5e1;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 8px;
    height: 85px !important;
    padding-top: 0px !important;
    padding-right: 0px !important;
    padding-bottom: 0px !important;
    padding-left: 0px !important;
    position: relative !important;
    overflow: hidden;
    box-sizing: border-box;
}

/* 2. 内舞台：HTMLのクラス名(test-stage-layer)と完全同期。
   ここを25px右へ平行移動した「座標の起点」とする。JSはこの中だけを見て計算する */
.test-stage-layer {
    position: relative !important;
    margin-left: 25px; 
    width: calc(100% - 50px);
    height: 100%;
    display: flex;
    align-items: center;
    pointer-events: none;
}

/* 3. 入力口：ステージの左端（＝枠から25px地点）を基準に、JSが座標を支配する */
.test-hidden-field {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    left: 0px; 
    opacity: 0;
    z-index: 10;
    pointer-events: auto;
    font-family: 'Noto Sans JP', sans-serif !important;
    font-size: 1.55rem;    background-color: transparent;
    border-top-style: none !important;
    border-right-style: none !important;
    border-bottom-style: none !important;
    border-left-style: none !important;
    outline-style: none !important;
    box-shadow: none !important;
}

/* 4. 可視テキスト：舞台の0点から描画開始 */
#test-visual-text {
    position: static !important;
    z-index: 5;
    white-space: pre !important;
    font-family: 'Noto Sans JP', sans-serif !important;
    font-size: 1.55rem;
    line-height: 1;
}

/* サンプル（上段）の進捗：薄グレー */
.char-done {
    color: #cbd5e1 !important;
}

/* 下段入力エリア：確定文字 */
.char-confirmed {
    color: #1e293b;
}

/* 青いキャレット：高さをフォントサイズに同期 */
.char-current-caret {
    display: inline-block;
    width: 2px;
    height: 1.55rem;
    background-color: #2563eb;
    margin-right: -2px;
    vertical-align: middle;
    animation: test-blink 1s step-end infinite;
}

@keyframes test-blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

/* 重複定義を排除：上記の構造改革版に統合済み */

/* ダメージエフェクト（ミス時） */
.test-input-view.damage-effect {
    background-color: #fff1f2 !important;
    border-top-color: #fda4af !important;
    border-right-color: #fda4af !important;
    border-bottom-color: #fda4af !important;
    border-left-color: #fda4af !important;
    transition-property: none !important;
}

/* --- 5. 準備・結果カード専用：余白を 180px に統一 --- */
.test-info-card,
.test-result-card {
    width: 860px;
    margin-top: 10px;
    margin-right: auto;
    margin-bottom: 180px;
    margin-left: auto;
    padding-top: 20px;
    padding-right: 60px;
    padding-bottom: 20px;
    padding-left: 60px;
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
    border-bottom-right-radius: 25px;
    border-bottom-left-radius: 25px;
    box-shadow: 0px 20px 50px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.test-card-title {
    font-size: 1.8rem;
    font-weight: 900;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 15px; /* 20pxから圧縮 */
    margin-left: 0px;
}

.test-instruction {
    text-align: left;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 20px; /* 25pxから圧縮 */
    margin-left: 0px;
}

.test-lead-text {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #475569;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
}

.test-notice-box {
    background-color: #f8fafc;
    border-left-width: 6px;
    border-left-style: solid;
    border-left-color: #3498db;
    padding-top: 15px; /* 20pxから圧縮 */
    padding-right: 30px;
    padding-bottom: 15px; /* 20pxから圧縮 */
    padding-left: 30px;
    margin-top: 15px; /* 20pxから圧縮 */
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    text-align: left;
}

.notice-title {
    font-weight: 900;
    margin-bottom: 12px;
}

.test-notice-list {
    list-style-type: none;
    padding-left: 0px;
}

.test-notice-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    font-size: 1rem;
    color: #475569;
}

.test-notice-list li::before {
    content: "・";
    position: absolute;
    left: 0px;
    font-weight: 900;
}

/* --- 6. 結果画面詳細 (v20.7.28.Optimized) --- */
.res-header {
    font-size: 1.2rem; /* 少し控えめにし、ランクを際立たせる */
    font-weight: 900;
    color: #64748b;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 15px; /* 下の「判定ランク」ラベルとの距離 */
    margin-left: 0px;
}

.res-main-layout {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: flex-start; /* 指示通り「上揃え」に修正 */
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 25px;
    margin-left: 0px;
}

.res-rank-block {
    text-align: left; /* 左揃えにして安定感を出す */
}

.res-label {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 800;
    display: block;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 5px;
    margin-left: 0px;
}

.res-rank-text {
    font-size: 6.5rem;
    font-weight: 900;
    color: #2563eb;
    line-height: 1;
    margin-top: 15px; /* 判定ランク文字からの距離 */
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    /* 判定不可（複数文字）になっても位置が上下に跳ねないよう、最小高さを固定 */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 110px;
}

.res-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 300px;
    padding-top: 8px; /* さらに微圧縮 */
    padding-right: 0px;
    padding-bottom: 8px;
    padding-left: 0px;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: #f1f5f9;
}

.res-stat-label {
    font-size: 0.9rem;
    color: #475569;
    font-weight: 800;
}

.res-stat-num {
    font-size: 1.8rem; /* 数値を少し大きくし視認性向上 */
    font-weight: 700;
    color: #1e293b;
}

/* アドバイスエリア：背景を目立たせ、ラベルなしでも重要性を伝える */
.res-advice-box {
    background-color: #f0f9ff; /* 落ち着いた水色で目立たせる */
    border-left-width: 6px;
    border-left-style: solid;
    border-left-color: #3498db;
    padding-top: 20px;
    padding-right: 30px;
    padding-bottom: 20px;
    padding-left: 30px;
    border-top-right-radius: 15px;
    border-bottom-right-radius: 15px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 30px;
    margin-left: 0px;
    text-align: left;
    box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.02);
}

.advice-text {
    font-size: 1.05rem;
    font-weight: 700; /* 文字を少し太く */
    color: #334155;
    line-height: 1.7;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
}

.res-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

/* summary-btn：白背景・青枠 */
.test-result-card .summary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    height: 48px;
    background-color: #ffffff;
    border-top-width: 2px;
    border-right-width: 2px;
    border-bottom-width: 2px;
    border-left-width: 2px;
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
    border-top-color: #3498db;
    border-right-color: #3498db;
    border-bottom-color: #3498db;
    border-left-color: #3498db;
    color: #3498db;
    border-top-left-radius: 40px;
    border-top-right-radius: 40px;
    border-bottom-right-radius: 40px;
    border-bottom-left-radius: 40px;
    text-decoration-line: none;
    font-weight: 800;
    font-size: 0.95rem;
    transition-property: all;
    transition-duration: 0.2s;
}

.test-result-card .summary-btn:hover {
    background-color: #3498db;
    color: #ffffff;
    transform: translateY(-2px);
}

/* --- 7. フッター：標準規格へ復帰（余計な空白を削除） --- */
body.test-body footer {
    width: 100%;
    background-color: #ffffff;
    padding-top: 20px;
    padding-bottom: 20px;
    text-align: center;
    margin-top: 0px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 5px;
}

.footer-links a {
    color: #2c3e50;
    text-decoration-line: none;
    font-size: 0.8rem;
}

body.test-body footer p {
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
}

body.test-body footer p {
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
}

/* --- スマホ専用アクセス制限オーバーレイ（768px以下。タブレットは許可） --- */
.mobile-restriction-overlay {
    display: none;
    position: fixed;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    background-color: #f8f9fa;
    z-index: 10000;
    padding-top: 20px;
    padding-right: 20px;
    padding-bottom: 20px;
    padding-left: 20px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.restriction-card {
    background-color: #ffffff;
    padding-top: 40px;
    padding-right: 25px;
    padding-bottom: 40px;
    padding-left: 25px;
    border-top-left-radius: 25px;
    border-top-right-radius: 25px;
    border-bottom-right-radius: 25px;
    border-bottom-left-radius: 25px;
    box-shadow: 0px 10px 40px rgba(0, 0, 0, 0.1);
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-sizing: border-box;
}

/* PC版：テストカードと下部解説記事の間に十分な余白を確保する */
body.test-body article.static-page {
    margin-top: 180px !important;
}

/* スマホ・小画面のとき（768px以下）：play.css 準拠の完全統治 */
@media (max-width: 768px) {
    body.test-body {
        background-color: #f1f3f5 !important;
    }
    
    body.test-body header {
        background-color: #ffffff !important;
        border-bottom-width: 1px !important;
        border-bottom-style: solid !important;
        border-bottom-color: #e2e8f0 !important;
    }

    body.test-body #app {
        position: static !important;
        transform: none !important;
        margin-top: 0px !important;
        margin-right: auto !important;
        margin-bottom: 0px !important;
        margin-left: auto !important;
        width: 100% !important;
        max-width: 1000px !important;
        display: block !important;
        min-height: auto !important;
    }

    body.test-body main {
        display: block !important;
        height: auto !important;
        min-height: auto !important;
    }

    /* 案内ボックスをヘッダーの直下に自然なブロックとして配置する */
    body.test-body .mobile-restriction-overlay {
        display: block !important;
        position: static !important;
        height: auto !important;
        margin-top: 15px !important;
        margin-right: 15px !important;
        margin-bottom: 0px !important;
        margin-left: 15px !important;
        padding-top: 0px !important;
        padding-right: 0px !important;
        padding-bottom: 0px !important;
        padding-left: 0px !important;
        background-color: transparent !important;
    }

    body.test-body .restriction-card {
        max-width: none !important;
        width: calc(100% - 30px) !important;
        margin-top: 0px !important;
        margin-right: auto !important;
        margin-bottom: 0px !important;
        margin-left: auto !important;
        padding-top: 18px !important;
        padding-right: 20px !important;
        padding-bottom: 18px !important;
        padding-left: 20px !important;
        border-top-left-radius: 16px !important;
        border-top-right-radius: 16px !important;
        border-bottom-right-radius: 16px !important;
        border-bottom-left-radius: 16px !important;
        box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.05) !important;
        background-color: #fffbeb !important;
        border-top-width: 1px !important;
        border-right-width: 1px !important;
        border-bottom-width: 1px !important;
        border-left-width: 6px !important;
        border-top-style: solid !important;
        border-right-style: solid !important;
        border-bottom-style: solid !important;
        border-left-style: solid !important;
        border-top-color: #fde68a !important;
        border-right-color: #fde68a !important;
        border-bottom-color: #fde68a !important;
        border-left-color: #f59e0b !important;
        box-sizing: border-box !important;
        text-align: left !important;
    }

    body.test-body .restriction-card h2 { 
        font-size: 1.05rem !important; 
        font-weight: 900 !important;
        color: #d97706 !important;
        margin-top: 0px !important; 
        margin-right: 0px !important; 
        margin-bottom: 8px !important; 
        margin-left: 0px !important; 
    }

    body.test-body .restriction-card p { 
        font-size: 0.85rem !important; 
        color: #475569 !important;
        line-height: 1.6 !important;
        margin-top: 0px !important; 
        margin-right: 0px !important; 
        margin-bottom: 10px !important; 
        margin-left: 0px !important; 
    }
    
    body.test-body .restriction-card > div {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 10px !important;
        margin-top: 15px !important;
        margin-right: 0px !important;
        margin-bottom: 0px !important;
        margin-left: 0px !important;
    }

    body.test-body .restriction-card a.btn-main {
        width: 100% !important;
        max-width: 240px !important;
        padding-top: 10px !important;
        padding-right: 0px !important;
        padding-bottom: 10px !important;
        padding-left: 0px !important;
        font-size: 0.9rem !important;
        box-shadow: none !important;
        background-color: #2563EB !important;
        text-decoration-line: none !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-top-left-radius: 30px !important;
        border-top-right-radius: 30px !important;
        border-bottom-right-radius: 30px !important;
        border-bottom-left-radius: 30px !important;
        color: #ffffff !important;
        font-weight: 800 !important;
    }

    body.test-body .restriction-card a:not(.btn-main) {
        color: #64748b !important;
        font-size: 0.85rem !important;
        text-decoration-line: underline !important;
        font-weight: 700 !important;
    }
    
    /* テスト本編の画面を完全に消して高さを詰める */
    body.test-body #start-screen,
    body.test-body #game-screen,
    body.test-body #result-screen { 
        display: none !important; 
        margin-top: 0px !important;
        margin-right: 0px !important;
        margin-bottom: 0px !important;
        margin-left: 0px !important;
        padding-top: 0px !important;
        padding-right: 0px !important;
        padding-bottom: 0px !important;
        padding-left: 0px !important;
        height: 0px !important;
        overflow: hidden !important;
    }
    
    /* スマホ時の static-page および解説コンテンツの完全統治（横はみ出し根絶） */
    body.test-body article.static-page {
        padding-top: 25px !important;
        padding-right: 15px !important;
        padding-bottom: 45px !important;
        padding-left: 15px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-top: 15px !important;
        margin-right: 0px !important;
        margin-bottom: 30px !important;
        margin-left: 0px !important;
        border-top-left-radius: 0px !important;
        border-top-right-radius: 0px !important;
        border-bottom-right-radius: 0px !important;
        border-bottom-left-radius: 0px !important;
        box-shadow: none !important;
        box-sizing: border-box !important;
    }

    body.test-body .content-body {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    body.test-body .content-box,
    body.test-body .instructor-advice,
    body.test-body .info-note-box {
        padding-top: 20px !important;
        padding-right: 15px !important;
        padding-bottom: 20px !important;
        padding-left: 15px !important;
        box-sizing: border-box !important;
        max-width: 100% !important;
    }

    body.test-body .category-info-grid {
        grid-template-columns: 1fr !important;
    }
}