/* ===================================================================
   タイピングゲーム専用CSS
   元のtyping-play-cp.php (3822-4600行) から完全移植
   =================================================================== */

/* ゲームオーバーレイ */
#game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 140, 0, 0.7) 0%, rgba(255, 99, 71, 0.7) 100%);
    opacity: .9;
    z-index: 9999;
}

/* ゲーム画面本体 */
#game-screen {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(135deg, #FFF8DC 0%, #FFE4B5 100%);
    padding: 0 10px 10px;
    z-index: 10000;
    border-radius: 20px;
    border: 4px solid #FF8C00;
    box-shadow: 0 10px 30px rgba(255, 140, 0, 0.5);
}

#game-screen,
#game-screen * {
    font-family: Meiryo, Arial, sans-serif;
    box-sizing: border-box;
}

#game-screen ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

/* 閉じるボタンエリア */
#close-area {
    text-align: right;
    padding: 10px 10px 0 10px;
}

#close-button1 {
    width: 80px;
    height: 35px;
    font-size: 14px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #FF8C00, #FFA500);
    padding: 5px 10px;
    border: 2px solid #FF6B35;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(255, 140, 0, 0.3);
    transition: all 0.3s ease;
}

#close-button1:hover {
    background: linear-gradient(135deg, #FF6B35, #FF8C00);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.4);
}

/* YouTube埋め込みエリア */
#video-area {
    display: table;
    width: 320px;
    height: 245px;
    margin: 0 auto;
}

/* ゲームボディ */
#game-body {
    display: table;
    width: 780px;
    height: 450px;
    color: #636363;
    margin: 0 auto;
}

/* ビュー1: スタート画面 */
#game-view1 {
    position: relative;
    display: table-cell;
    text-align: center;
    vertical-align: middle;
}

#game-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
}

#game-explain {
    font-size: 15px;
    padding: 0 24px;
    margin: 12px 0 74px;
    color: #666;
}

#start-button {
    width: 180px;
    height: 55px;
    line-height: 55px;
    text-align: center;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(135deg, #FF6B35 0%, #FFA500 100%);
    border: 3px solid #FF8C00;
    border-radius: 30px;
    margin: 0 auto;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(255, 140, 0, 0.4);
    transition: all 0.3s ease;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

#start-button:hover {
    background: linear-gradient(135deg, #FFA500 0%, #FFD700 100%);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(255, 140, 0, 0.5);
}

#start-button:active {
    transform: translateY(0) scale(1);
    box-shadow: 0 3px 10px rgba(255, 140, 0, 0.3);
}

/* オプション機能エリア */
#game-func {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 28px;
    line-height: 26px;
    background-color: #f3f3f3;
    padding: 0 12px;
    border-radius: 3px;
    border: 1px solid #d9d9d9;
    white-space: nowrap;
}

#game-func > span {
    display: inline-block;
    font-size: 11px;
}

#game-func .switch-btn {
    display: inline-block;
    position: relative;
    width: 36px;
    height: 16px;
    vertical-align: middle;
    margin-right: 6px;
    overflow: hidden;
}

#game-func .switch-btn:last-child {
    margin-right: 0;
}

#game-func .switch-btn .btn {
    position: absolute;
    display: none;
    top: 0;
    left: 0;
    width: 36px;
    height: 16px;
    line-height: 15px;
    letter-spacing: 0.5px;
    font-size: 11px;
    color: #fff;
    text-align: center;
    border: 0;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
}

#game-func .switch-btn .on-btn {
    background-color: #FF8C00;
}

#game-func .switch-btn .off-btn {
    background-color: #D3D3D3;
}

.show {
    display: block !important;
}

/* ビュー2: ゲーム画面 */
#game-view2 {
    display: none;
}

/* テキスト表示コンテナ */
#text-container {
    position: relative;
    max-width: 610px;
    height: 160px;
    border: 1px solid #d8d8d8;
    margin: 0 auto 10px;
    overflow: hidden;
    background-color: #fff;
}

/* ミスタイプ時の赤フラッシュ */
#miss-type-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
}

#miss-type-screen.missed {
    animation: miss .2s;
}

@keyframes miss {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* スペースキー待機メッセージ */
#start-msg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    font-size: 14px;
    text-align: center;
    line-height: 170%;
    padding-top: 46px;
}

#start-msg p {
    padding: 0;
    margin: 0 0 4px;
}

#start-msg em {
    font-size: 24px;
    font-style: normal;
    color: #ff9c00;
}

/* カウントダウン */
#countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    color: #ff9c00;
    font-size: 80px;
    transform: translateX(-50%) translateY(-50%);
}

/* 例文表示（漢字混じり） */
#example {
    position: absolute;
    left: 15px;
    top: 36px;
    width: 580px;
    height: 36px;
    font-size: 30px;
    line-height: 36px;
    overflow: hidden;
    font-variant-ligatures: no-common-ligatures;
}

#example > div {
    position: absolute;
    top: 0;
    left: 0;
    height: 30px;
    white-space: nowrap;
}

/* ひらがな表示 */
#kana {
    position: absolute;
    left: 15px;
    top: 73px;
    width: 580px;
    height: 24px;
    font-size: 20px;
    line-height: 24px;
    overflow: hidden;
    font-variant-ligatures: no-common-ligatures;
}

#kana > div {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    white-space: nowrap;
}

/* ローマ字表示 */
#sentence {
    position: absolute;
    left: 15px;
    top: 102px;
    width: 580px;
    height: 30px;
    font-size: 26px;
    line-height: 26px;
    overflow: hidden;
    text-transform: uppercase;
    font-variant-ligatures: no-common-ligatures;
}

#sentence > div {
    position: absolute;
    top: 0;
    left: 0;
    height: 30px;
    white-space: nowrap;
}

#sentence .typed {
    color: #ffd0a6;
}

#sentence .miss {
    color: #ff0000;
}

/* 進捗バー */
/* document-typing.cssで定義されているため、このスタイルは無効化
#progress-bar {
    position: absolute;
    bottom: 1px;
    left: 5px;
    width: calc(100% - 10px);
    height: 4px;
    background-color: #bcbcbc;
    transform-origin: left top;
}
*/

/* リアルタイムKPM表示 */
#current-kpm {
    display: none;
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 14px;
    font-weight: bold;
}

/* スピードバー */
#speed-bar {
    display: none;
    position: absolute;
    top: 2px;
    left: 5px;
    width: calc(100% - 10px);
    height: 3px;
    background: linear-gradient(90deg, #FFD700, #FF8C00, #FF6347);
    transform-origin: left top;
}

#speed-bar .cover {
    position: absolute;
    top: 0;
    right: 0;
    height: 3px;
    background: #FFF8DC;
    transform-origin: right top;
}

/* 仮想キーボード */
#virtual-keyboard {
    position: relative;
    width: 610px;
    margin: 0 auto;
    height: 140px;
}

#virtual-keyboard div {
    position: absolute;
    width: 36px;
    height: 24px;
    border: 1px solid #d8d8d8;
    border-radius: 3px;
    font-weight: bold;
    font-size: 14px;
    line-height: 26px;
    text-align: center;
    overflow: hidden;
    background-color: #fff;
}

#virtual-keyboard div.active {
    background-color: #ffeb3b;
    border-color: #fbc02d;
    box-shadow: 0 0 8px rgba(251, 192, 45, 0.6);
}

/* 装飾キー */
#virtual-keyboard div.deco_key1,
#virtual-keyboard div.deco_key4,
#virtual-keyboard div.deco_key5,
#virtual-keyboard div.deco_key7,
#virtual-keyboard div.deco_key10,
#virtual-keyboard div.deco_key11,
#virtual-keyboard div.deco_key12,
#virtual-keyboard div.deco_key13,
#virtual-keyboard div.deco_key14,
#virtual-keyboard div.deco_key15,
#virtual-keyboard div.deco_key16,
#virtual-keyboard div.deco_key17,
#virtual-keyboard div.deco_key18 {
    background-color: #e0e0e0;
    border-color: #bdbdbd;
}

/* キー配置 - 数字行 */
#virtual-keyboard div.deco_key1 { top: 0; left: 0; }
#virtual-keyboard div.key_1 { top: 0; left: 41px; }
#virtual-keyboard div.key_2 { top: 0; left: 82px; }
#virtual-keyboard div.key_3 { top: 0; left: 123px; }
#virtual-keyboard div.key_4 { top: 0; left: 164px; }
#virtual-keyboard div.key_5 { top: 0; left: 205px; }
#virtual-keyboard div.key_6 { top: 0; left: 246px; }
#virtual-keyboard div.key_7 { top: 0; left: 287px; }
#virtual-keyboard div.key_8 { top: 0; left: 328px; }
#virtual-keyboard div.key_9 { top: 0; left: 369px; }
#virtual-keyboard div.key_0 { top: 0; left: 410px; }
#virtual-keyboard div.key_hyphen { top: 0; left: 451px; }
#virtual-keyboard div.key_tilde { top: 0; left: 492px; }
#virtual-keyboard div.key_yen { top: 0; left: 533px; }

/* キー配置 - QWERTY行 */
#virtual-keyboard div.deco_key4 { top: 29px; left: 0; width: 56px; }
#virtual-keyboard div.deco_key5 { top: 29px; left: 574px; width: 36px; }
#virtual-keyboard div.key_q { top: 29px; left: 61px; }
#virtual-keyboard div.key_w { top: 29px; left: 102px; }
#virtual-keyboard div.key_e { top: 29px; left: 143px; }
#virtual-keyboard div.key_r { top: 29px; left: 184px; }
#virtual-keyboard div.key_t { top: 29px; left: 225px; }
#virtual-keyboard div.key_y { top: 29px; left: 266px; }
#virtual-keyboard div.key_u { top: 29px; left: 307px; }
#virtual-keyboard div.key_i { top: 29px; left: 348px; }
#virtual-keyboard div.key_o { top: 29px; left: 389px; }
#virtual-keyboard div.key_p { top: 29px; left: 430px; }
#virtual-keyboard div.key_atmark { top: 29px; left: 471px; }
#virtual-keyboard div.key_brackets { top: 29px; left: 512px; }
#virtual-keyboard div.key_Enter { top: 29px; left: 553px; width: 57px; height: 53px; line-height: 53px; }

/* キー配置 - ホームポジション行 */
#virtual-keyboard div.deco_key7 { top: 58px; left: 0; width: 66px; }
#virtual-keyboard div.key_a { top: 58px; left: 71px; }
#virtual-keyboard div.key_s { top: 58px; left: 112px; }
#virtual-keyboard div.key_d { top: 58px; left: 153px; }
#virtual-keyboard div.key_f { top: 58px; left: 194px; }
#virtual-keyboard div.key_g { top: 58px; left: 235px; }
#virtual-keyboard div.key_h { top: 58px; left: 276px; }
#virtual-keyboard div.key_j { top: 58px; left: 317px; }
#virtual-keyboard div.key_k { top: 58px; left: 358px; }
#virtual-keyboard div.key_l { top: 58px; left: 399px; }
#virtual-keyboard div.key_semicolon { top: 58px; left: 440px; }
#virtual-keyboard div.key_colon { top: 58px; left: 481px; }
#virtual-keyboard div.key_closebrackets { top: 58px; left: 522px; }

/* キー配置 - 下段行 */
#virtual-keyboard div.key_lShift { top: 87px; left: 0; width: 92px; line-height: 24px; font-size: 10px; }
#virtual-keyboard div.key_z { top: 87px; left: 97px; }
#virtual-keyboard div.key_x { top: 87px; left: 138px; }
#virtual-keyboard div.key_c { top: 87px; left: 179px; }
#virtual-keyboard div.key_v { top: 87px; left: 220px; }
#virtual-keyboard div.key_b { top: 87px; left: 261px; }
#virtual-keyboard div.key_n { top: 87px; left: 302px; }
#virtual-keyboard div.key_m { top: 87px; left: 343px; }
#virtual-keyboard div.key_comma { top: 87px; left: 384px; }
#virtual-keyboard div.key_period { top: 87px; left: 425px; }
#virtual-keyboard div.key_slash { top: 87px; left: 466px; }
#virtual-keyboard div.key_underline { top: 87px; left: 507px; }
#virtual-keyboard div.key_rShift { top: 87px; left: 548px; width: 62px; line-height: 24px; font-size: 10px; }

/* キー配置 - スペース行 */
#virtual-keyboard div.deco_key10 { top: 116px; left: 0; width: 46px; }
#virtual-keyboard div.deco_key11 { top: 116px; left: 51px; width: 36px; }
#virtual-keyboard div.deco_key12 { top: 116px; left: 92px; width: 36px; }
#virtual-keyboard div.deco_key13 { top: 116px; left: 133px; width: 36px; }
#virtual-keyboard div.key_space { top: 116px; left: 174px; width: 262px; font-size: 11px; }
#virtual-keyboard div.deco_key14 { top: 116px; left: 441px; width: 36px; }
#virtual-keyboard div.deco_key15 { top: 116px; left: 482px; width: 36px; }
#virtual-keyboard div.deco_key16 { top: 116px; left: 523px; width: 36px; }
#virtual-keyboard div.deco_key17 { top: 116px; left: 564px; width: 20px; }
#virtual-keyboard div.deco_key18 { top: 116px; left: 589px; width: 21px; }

/* 指ガイド */
#hands {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    gap: 15px;
}

.middle-f {
    background-color: #f0f0f0;
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
    width: 30px;
    height: 80px;
    display: table-cell;
    writing-mode: vertical-lr;
    vertical-align: bottom;
}

.index-f {
    background-color: #f0f0f0;
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
    width: 30px;
    height: 70px;
    margin-top: 10px;
}

.ring-f {
    background-color: #f0f0f0;
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
    width: 30px;
    height: 70px;
    margin-top: 10px;
}

.pinky-f {
    background-color: #f0f0f0;
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
    width: 30px;
    height: 60px;
    margin-top: 20px;
}

.thumb-f {
    background-color: #f0f0f0;
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
    width: 30px;
    height: 60px;
    margin-top: 20px;
}

.middle-f.active {
    background: linear-gradient(180deg, #FF6B35 0%, #FFA500 100%);
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.5);
}

.ring-f.active {
    background: linear-gradient(180deg, #FF6B35 0%, #FFA500 100%);
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.5);
}

.index-f.active {
    background: linear-gradient(180deg, #FF6B35 0%, #FFA500 100%);
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.5);
}

.pinky-f.active {
    background: linear-gradient(180deg, #FF6B35 0%, #FFA500 100%);
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.5);
}

.thumb-f.active {
    background: linear-gradient(180deg, #FF6B35 0%, #FFA500 100%);
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.5);
}

/* ビュー3: 結果画面 */
#game-result {
    display: none;
    width: 728px;
    margin: 0 auto;
}

#current-result {
    position: relative;
    float: left;
    width: 590px;
    height: 337px;
    border: 1px solid #d0d0d0;
    margin: 0 0 12px;
}

#game-result .result-title {
    height: 37px;
    font-size: 15px;
    font-weight: bold;
    line-height: 37px;
    overflow: hidden;
    margin: 0;
    padding: 0 0 0 10px;
}

#current-result .result-title {
    color: #fff;
    background: linear-gradient(135deg, #FF6B35 0%, #FFA500 100%);
    border-bottom: 3px solid #FF8C00;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

#example-list {
    position: absolute;
    top: 49px;
    left: 12px;
    width: 376px;
    height: 274px;
    padding: 10px;
    overflow: auto;
    border: 1px solid #d0d0d0;
}

#example-list ul {
    width: 354px;
    list-style: none;
    padding: 0;
    margin: 0;
}

#example-list ul li {
    font-size: 16px;
    margin-bottom: 12px;
    overflow-wrap: break-word;
}

#example-list .sentence {
    text-transform: uppercase;
}

#example-list .miss {
    color: #f00;
}

#game-result .result-data {
    position: absolute;
    width: 188px;
    height: 298px;
    top: 37px;
    right: 0;
    padding: 12px 11px 0 11px;
    background: linear-gradient(135deg, #FFF8DC 0%, #FFE4B5 100%);
    border-left: 3px solid #FFA500;
}

#game-result .result-data ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#game-result .result-data ul li {
    position: relative;
    border-bottom: 1px solid #d0d0d0;
}

#game-result .result-data ul li .title {
    position: absolute;
    font-size: 11px;
    height: 32px;
    line-height: 32px;
    top: 0;
    left: 0;
}

#game-result .result-data ul li .data {
    color: #FF6B35;
    font-size: 14px;
    height: 32px;
    line-height: 32px;
    width: 166px;
    text-align: right;
    font-weight: bold;
    padding-right: 6px;
}

#game-result .result-data ul li:last-child .data {
    text-transform: uppercase;
}

#prev-result {
    position: relative;
    width: 138px;
    height: 337px;
    float: right;
    border-top: 1px solid #d0d0d0;
    border-right: 1px solid #d0d0d0;
    border-bottom: 1px solid #d0d0d0;
}

#prev-result .result-title {
    border-bottom: 1px solid #d0d0d0;
}

#prev-result .result-data {
    width: 137px;
}

#prev-result .result-data ul li .data {
    width: 115px;
}

#result-comment {
    position: relative;
    width: 728px;
    height: 53px;
    text-align: center;
    border: 1px solid #d0d0d0;
    margin: 12px 0 0;
    clear: both;
}

#result-comment .container {
    position: absolute;
    width: 726px;
    font-size: 14px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    padding: 0 18px;
}

#btn-area {
    position: relative;
    margin: 18px 0 0;
    height: 39px;
}

#game-result .btn {
    position: absolute;
    display: block;
    width: 129px;
    height: 39px;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#replay-button {
    right: 149px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
}

#replay-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.4);
}

#close-button2 {
    right: 10px;
    background: linear-gradient(135deg, #FF6B35 0%, #FFA500 100%);
    box-shadow: 0 4px 10px rgba(255, 140, 0, 0.3);
}

#close-button2:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 140, 0, 0.4);
}

#close-button2 {
    background: linear-gradient(135deg, #bdbdbd 0%, #9e9e9e 100%);
    border-color: #9e9e9e;
}

#close-button2:hover {
    box-shadow: 0 6px 15px rgba(158, 158, 158, 0.4);
}
