/*
 * ランダムかるた音声プラグイン - フロントエンドCSS
 */

/* プレイヤーコンテナの基本スタイル */
.rka-player-container {
    max-width: 80%;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* コントロールボタンのレイアウト */
.rka-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    /* ボタン間のスペース */
    margin-top: 15px;
    margin-bottom: 15px;
}

/* 個別ボタンのスタイル */
.rka-play-pause-btn,
.rka-reset-btn {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    transition: background-color 0.2s;
    min-width: 120px;
}

/* 再生/一時停止ボタンのスタイル (プライマリーアクション) */
.rka-play-pause-btn {
    background-color: #0073aa;
    /* WordPressプライマリーカラーに似た青 */
    color: white;
}

.rka-play-pause-btn:hover:not(:disabled) {
    background-color: #005177;
}

.rka-play-pause-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* リセットボタンのスタイル (セカンダリーアクション) */
.rka-reset-btn {
    background-color: #f3f3f3;
    color: #333;
    border: 1px solid #ccc;
}

.rka-reset-btn:hover:not(:disabled) {
    background-color: #e5e5e5;
}

/* ステータス表示のスタイル */
.rka-status {
    font-size: 20px;
    color: #555;
    margin: 0;
    padding-top: 10px;
    font-weight: bold;
}

/* HTML5 <audio> 要素は非表示にする (カスタムコントロールを使用するため) */
.rka-player-container audio {
    display: none;
}

/* 再生コンテンツ表示エリア */
.rka-content-display {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: white;
}

/* 内容（漢字・仮名）のテキスト */
.rka-content-text {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin: 0;
    margin-bottom: 5px;
}

/* 読み仮名（ひらがな）のテキスト */
.rka-reading-text {
    font-size: 1em;
    color: #888;
    margin: 0;
}

/*画像初期非表示*/
.rka-image-display {
    display: none;
    padding: 20px;
    width: 45%;
}

.rka-image-wrapper {
    border-radius: 0.5rem;
    overflow: hidden;
    width: 45%;
}

.rka-image-wrapper img {
    border-radius: 0.5rem;
}

.rka-image-cover {
    font-size: 20px;
}

/* -------------------------------------------
   新しいワイプアニメーションの定義: 左から右へ透明度を解除
------------------------------------------- */

/* 1. 初期状態: テキストを見えないように設定 */
.rka-content-text,
.rka-reading-text {
    /* 💡 clip-path: inset(top right bottom left) で表示領域を制御 */
    /* 初期状態: 左端から100%分だけ表示領域をカットし、何も見えない状態 */
    clip-path: inset(0 100% 0 0);

    /* 💡 アニメーションがスムーズに行われるように transition を設定 */
    /* 4.0秒かけて clip-path が変化するように設定 */
    transition: clip-path 6.0s ease-out;

    /* フォントのギザギザを防ぐため、サブピクセルレンダリングを有効にする */
    will-change: clip-path;
}

/* 2. 表示状態: is-revealed クラスが付与されたらクリップを解除 */
.rka-content-display.is-revealed .rka-content-text,
.rka-content-display.is-revealed .rka-reading-text {
    /* 💡 全体を表示 (表示領域を0%カット) */
    clip-path: inset(0 0 0 0);
}

/* 3. 親要素の overflow 設定は不要になりますが、念のため残しておく */
.rka-content-display {
    /* overflow: hidden; は引き続き安全のため残しても良い */
}

.no-transition {
    /* 全てのCSSトランジションを無効化 */
    transition: none !important;
}


/*追加CSS*/
/* プレイヤー内の特大ボタンのスタイル */
.rka-player-container button {
    /* ---------------------------------- */
    /* 1. サイズとパディングの調整 */
    /* ---------------------------------- */
    padding: 1.5rem 0rem;
    /* 上下左右に特大の余白 */
    font-size: 1.5rem;
    /* 文字サイズを大きく */
    font-weight: bold;
    /* 文字を太く */
    height: 150px;
    /* 最低高さを確保し、縦に大きくする */
    width: 45%;
    /* 最低幅を確保 */
    /* ---------------------------------- */
    /* 2. 角丸と影でクリック感を強調 */
    /* ---------------------------------- */
    border-radius: 12px;
    /* 角を大きく丸める */
    box-shadow: 0 4px 2px rgba(0, 0, 0, 0.37);
    /* 立体感を出す影 */
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    margin: 1rem;
    display: inline-block;
    text-shadow: 1px 1px 3px #555;
    color: #fff;
    border: none;
}

/* 押したときのスタイル（特大ボタンの立体感を解除） */
.rka-player-container button:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0 rgba(0, 0, 0, 0.2);
}

/* ---------------------------------- */
/* 3. 特殊なボタンの調整 */
/* ---------------------------------- */
/* 「もういちどよむ」ボタン（$rereadBtn）を大きく */
.rka-reread-button {
    padding: 0.8rem 1.5rem;
    /* 他のボタンより少し小さめだが、視認性高く */
    font-size: 1.2rem;
    min-height: 60px;
    min-width: 150px;
}

/* 画像制御ボタン「こたえをおしえて！」を調整 */
.rka-show-answer-button {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    min-height: 70px;
    min-width: 180px;
    /* 画像コントロールエリアの flex 調整 */
    margin-left: 20px;
}

/* ボタン群の配置を中央に寄せる（必要に応じて） */
.rka-controls {
    display: flex;
    justify-content: center;
    /* 中央寄せ */
    gap: 20px;
    /* ボタン間の間隔を広く */
    margin-top: 20px;
}

.rka-player-container .rka-show-answer-button {
    width: auto;
    padding: 0 1rem;
    background: #ae0000;
    font-size: 1.2rem;
}

.rka-player-container .rka-reset-button {
    width: 100%;
    height: auto;
    max-width: 95%;
    background: #777;
}

.rka-player-container .rka-play-button {
    background: #25a7e6;
}

.rka-reread-button {
    background: #50c588;
}


/*レイアウト*/
.rka-main-area {
    display: flex;
    justify-content: space-around;
    flex-direction: row-reverse;
}

.rka-content-controls-wrapper {
    width: 45%;
    max-width: 600px;
}

@media (max-width: 810px) {
    .rka-main-area {
        display: block;
    }

    .rka-content-controls-wrapper {
        width: 100%;
    }

    .rka-image-display {
        width: 100%;
    }
}