/* ===================================================
   職人技 トラック積み込みパズル — WordPress Plugin CSS
   =================================================== */

/* ラッパー全体 */
.tlp-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background-image: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    touch-action: none;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    box-sizing: border-box;
    /* WP テーマの body に overflow:hidden があると canvas が崩れるため明示 */
    -webkit-user-select: none;
    user-select: none;
}

/* ゲームタイトル（h2） */
.tlp-title {
    margin: 12px 0 0 0 !important;
    padding: 0 !important;
    font-size: 1.2rem !important;
    font-weight: 900 !important;
    color: #2c3e50 !important;
    text-align: center !important;
    letter-spacing: 0.05em !important;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8) !important;
    line-height: 1.4 !important;
    z-index: 10;
    pointer-events: none;
}

/* スコアUI */
.tlp-ui-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px 0;
    z-index: 10;
    pointer-events: none;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.tlp-score-box {
    background: rgba(255, 255, 255, 0.85);
    padding: 6px 14px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    font-weight: bold;
    color: #2c3e50;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255,255,255,0.4);
    font-size: 0.95rem;
    white-space: nowrap;
}

.tlp-score-box span {
    color: #e74c3c;
    font-size: 1.1rem;
}

/* 操作説明 */
.tlp-instructions {
    text-align: center;
    color: #7f8c8d;
    background: rgba(255,255,255,0.7);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    animation: tlp-pulse 2s infinite;
    z-index: 5;
    pointer-events: none;
    margin: 8px 0 0;
}

@keyframes tlp-pulse {
    0%   { transform: scale(1);    opacity: 0.8; }
    50%  { transform: scale(1.04); opacity: 1;   }
    100% { transform: scale(1);    opacity: 0.8; }
}

/* ゲームキャンバス領域 */
.tlp-game-container {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background: transparent;
    overflow: hidden;
}

.tlp-game-container canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    background: transparent;
    z-index: 1;
}

/* 地面ビジュアル */
.tlp-ground-line {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 40px;
    background: repeating-linear-gradient(
        45deg,
        #95a5a6,
        #95a5a6 20px,
        #7f8c8d 20px,
        #7f8c8d 40px
    );
    z-index: 0;
    opacity: 0.8;
    border-top: 4px solid #f39c12;
}

/* アイテムラベル */
.tlp-labels-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.tlp-item-label {
    position: absolute;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    text-shadow:
        1px  1px 3px rgba(0,0,0,0.8),
       -1px -1px 3px rgba(0,0,0,0.8);
    white-space: nowrap;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    line-height: 1.2;
    pointer-events: none;
}

/* ゲームオーバー画面 */
.tlp-game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.96);
    padding: 30px 28px;
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
    text-align: center;
    display: none;
    z-index: 20;
    width: 85%;
    max-width: 380px;
    backdrop-filter: blur(10px);
    border: 3px solid #fff;
    box-sizing: border-box;
}

.tlp-game-over-title {
    margin: 0 0 16px !important;
    color: #c0392b !important;
    font-size: 1.6rem !important;
    font-weight: 900 !important;
}

.tlp-result-text {
    font-size: 1.05rem;
    margin: 8px 0;
    color: #34495e;
}

.tlp-result-text span {
    font-weight: bold;
    font-size: 1.25rem;
}

/* ランク表示 */
.tlp-rank-display {
    margin: 18px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #bdc3c7;
}

.tlp-rank-display h3 {
    margin: 0 !important;
    font-size: 0.95rem !important;
    color: #7f8c8d !important;
    font-weight: normal !important;
}

.tlp-rank {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    margin-top: 6px;
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* リスタートボタン */
.tlp-restart-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff !important;
    border: none;
    padding: 13px 24px;
    font-size: 1.05rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    margin-top: 4px;
}

.tlp-restart-btn:hover,
.tlp-restart-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
    outline: none;
}

/* スマホ向け微調整 */
@media (max-width: 480px) {
    .tlp-title {
        font-size: 1rem !important;
    }
    .tlp-score-box {
        font-size: 0.82rem;
        padding: 5px 10px;
    }
    .tlp-item-label {
        font-size: 10px;
    }
}
