/* =====================================================
 * ゆけ！ぴよ丸 プラグイン用CSS
 * ショートコード [yuke_piyomaru] と合わせて使用
 *
 * ゲーム本体のスタイルのみ。
 * LP固有の装飾（body背景、浮遊画像、アコーディオン装飾等）は
 * ページ側のカスタムCSSで対応すること。
 * ===================================================== */

/* スクリーンリーダー専用テキスト */
.yp-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* タイトル */
.yp-title{
    text-align: center;
    font-size: 1.15rem;
    font-weight: 500;
    margin: 0.5em 0;
    padding: 0;
    line-height: 1.6;
    border: none;
    background: none;
    color: inherit;
}
.yp-title .yp-title__sub{
    font-size: 0.7rem;
    font-weight: normal;
}

/* ゲームキャンバス */
#yp-game-container canvas {
    display: block;
    background: #a18b7b;
}
#yp-game-container {
    position: relative;
    width: 100%;
    max-width: 370px;
    height: 460px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #e2d8d0;
}
.yp-name-input {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(180px, 70%);
    font-size: 16px;
    padding: 10px 12px;
    border: 2px solid #FFD700;
    border-radius: 4px;
    text-align: center;
    background: #1a1a1a;
    color: #fff;
    z-index: 100;
}
.yp-name-input:focus {
    outline: 2px solid #FFD700;
    outline-offset: 2px;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* 名前入力アクション（おくる/やめる） -- canvas外DOMで誤タップを防ぐ */
.yp-name-actions {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    z-index: 100;
    width: min(180px, 70%);
}
.yp-action-btn {
    appearance: none;
    border: none;
    width: 100%;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
}
.yp-action-btn--submit {
    background: #FFD700;
    color: #000;
}
.yp-action-btn--submit:hover:not(:disabled) {
    background: #ffe33d;
}
.yp-action-btn--submit:disabled {
    background: #666;
    color: #999;
    cursor: default;
}
.yp-action-btn--cancel {
    background: transparent;
    color: #ccc;
    border: 1px solid #666;
    font-weight: 400;
    font-size: 13px;
    min-height: 36px;
}
.yp-action-btn--cancel:hover {
    color: #fff;
    border-color: #999;
}

/* 上部ボタンボックス */
.yp-toolbar{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

/* アンカーリンクボタン */
.yp-toolbar a.yp-toolbar__link {
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    position: relative;
    display: inline-block;
    user-select: none;
    transition: all 0.3s;
    text-align: center;
    vertical-align: middle;
    text-decoration: none;
    letter-spacing: 0.1em;
    border-radius: 0.5rem;
    padding: 6px 10px;
    color: #5aab10;
    border: 3px solid #5aab10;
    background: #f5ffef;
    overflow: hidden;
}
.yp-toolbar a.yp-toolbar__link:before {
    position: absolute;
    content: "";
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    top: 0;
    bottom: 0;
    left: -100%;
    margin: auto 0;
    z-index: 1;
    opacity: 0.4;
    transition: 0.2s;
}
.yp-toolbar a.yp-toolbar__link:hover:before {
    left: 0;
}

/* BGMボタン */
.yp-bgm-toggle{
    display: flex;
    align-items: center;
    flex-direction: column;
    width: 42px;
    cursor: pointer;
}
.yp-bgm-toggle .yp-bgm-toggle__icon{
    width: 26px;
}
.yp-bgm-toggle .yp-bgm-toggle__label{
    font-size: 10px;
}

/* ランキングボタン（ゲーム外） */
.yp-ranking-btn {
    display: block;
    width: 100%;
    max-width: 370px;
    margin: 8px auto 0;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 700;
    color: #FFD700;
    background: transparent;
    border: 2px solid #FFD700;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    min-height: 44px;
}
.yp-ranking-btn:hover {
    background: rgba(255, 215, 0, 0.1);
}
.yp-ranking-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ランキングモーダル */
.yp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.yp-modal {
    background: #1a1a1a;
    border: 2px solid #FFD700;
    border-radius: 12px;
    width: 100%;
    max-width: 360px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.yp-modal__title {
    color: #FFD700;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    padding: 16px 16px 12px;
    margin: 0;
    border-bottom: 1px solid #333;
}
.yp-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    color: #e0e0e0;
    font-size: 14px;
}
.yp-modal__message {
    text-align: center;
    padding: 24px 0;
}
.yp-modal__list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: rank;
}
.yp-modal__list li {
    counter-increment: rank;
    display: flex;
    align-items: baseline;
    padding: 5px 4px;
    border-bottom: 1px solid #2a2a2a;
}
.yp-modal__list li::before {
    content: counter(rank) ".";
    width: 28px;
    flex-shrink: 0;
    color: #aaa;
    font-size: 13px;
}
.yp-modal__name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.yp-modal__score {
    flex-shrink: 0;
    margin-left: 12px;
    font-variant-numeric: tabular-nums;
}
.yp-modal__footer {
    padding: 12px 16px;
    text-align: center;
    border-top: 1px solid #333;
}
.yp-modal__close {
    background: transparent;
    border: none;
    color: #FFD700;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 24px;
    min-height: 44px;
}
.yp-modal__close:hover {
    text-decoration: underline;
}

/* 確認モーダル（破壊的操作の前に1段挟む） */
.yp-confirm-modal__footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}
.yp-confirm-modal__footer .yp-action-btn--submit {
    order: 0;  /* 「もどる」を上に置いて誤タップを防ぐ */
}
.yp-confirm-modal__footer .yp-modal__close {
    order: 1;
    color: #999;
    font-weight: 400;
    font-size: 13px;
    min-height: 36px;
}

/* レスポンシブ */
@media screen and (max-width: 500px){
    .yp-toolbar{
        width: 100%;
    }
}
