@import url('https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@400;700&family=Zen+Maru+Gothic:wght@400;700&display=swap');

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

/* モーダル表示中はスクロール無効 */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
}

body {
    font-family: 'Zen Maru Gothic', sans-serif;
    background: #f5f0e8;
    min-height: 100vh;
    color: #3a3530;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(180, 140, 100, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(100, 140, 180, 0.15) 0%, transparent 50%),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 30px,
            rgba(0,0,0,0.02) 30px,
            rgba(0,0,0,0.02) 60px
        );
}

.game-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    padding: 12px;
    text-align: center;
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), transparent);
}

h1 {
    font-family: 'Shippori Mincho', serif;
    font-size: 1.8rem;
    color: #8b5a3c;
    letter-spacing: 0.3em;
    text-shadow: 0 2px 10px rgba(139, 90, 60, 0.2);
}

.title-symbol {
    display: inline-block;
    color: #c48040;
    margin: 0 0.1em;
    width: 1.5em;
    text-align: center;
    transition: transform 0.8s ease-in-out;
}

.title-symbol.rotating {
    animation: symbol-rotate 1.2s ease-in-out;
}

.play-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    gap: 5px;
}

/* エリアラベル - 非表示 */
.area-label {
    display: none;
}

/* 手札エリア */
.cpu-area, .player-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    position: relative;
    z-index: 10;
}

.player-area {
    margin-top: -60px;
}

.cpu-area {
    margin-bottom: -60px;
}

/* 扇形の手札 */
.cpu-hand {
    display: flex;
    justify-content: center;
    position: relative;
    height: 145px;
    width: 100%;
}

.player-hand {
    display: flex;
    justify-content: center;
    position: relative;
    height: 280px;
    width: 100%;
}

.cpu-hand .card,
.player-hand .card {
    position: absolute;
    transition: all 0.3s ease-out;
}

/* CPUのカード */
.cpu-hand .card {
    width: 90px;
    height: 130px;
}

/* プレイヤーのカードは大きく */
.player-hand .card {
    width: 180px;
    height: 265px;
}

.player-hand .card .card-image {
    width: 155px;
    height: 185px;
}

.player-hand .card .card-name {
    font-size: 1.1rem;
}

.player-hand .card .card-attrs {
    font-size: 0.8rem;
}

.cpu-hand .card:hover,
.player-hand .card:hover {
    z-index: 100 !important;
}

/* フィールド */
.field-area {
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    min-height: 140px;
    position: relative;
}

.cpu-field {
    background: linear-gradient(180deg,
        rgba(180, 100, 100, 0.1) 0%,
        rgba(180, 100, 100, 0.05) 50%,
        transparent 100%);
}

.player-field {
    background: linear-gradient(0deg,
        rgba(100, 140, 180, 0.1) 0%,
        rgba(100, 140, 180, 0.05) 50%,
        transparent 100%);
}

.last-pair {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pair-arrow {
    font-size: 1rem;
    color: #8b5a3c;
    opacity: 0.7;
}

.last-pair .pair-arrow {
    font-size: 0.8rem;
}

/* コメントウィンドウ */
.pair-comment-window {
    display: none;
    width: 200px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(139, 90, 60, 0.3);
    border-radius: 4px;
    box-shadow:
        0 4px 20px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.5);
    overflow: hidden;
}

.pair-comment-window.show {
    display: block;
}

.comment-window-header {
    background: rgba(139, 90, 60, 0.1);
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(139, 90, 60, 0.15);
}

.comment-window-title {
    font-size: 0.7rem;
    color: #8b5a3c;
    letter-spacing: 0.1em;
}

.comment-window-close {
    color: #8a8580;
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.2s;
}

.comment-window-close:hover {
    color: #8b5a3c;
}

.comment-window-body {
    padding: 12px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #5a5550;
}

/* 承認/却下ボタン */
.comment-window-buttons {
    display: flex;
    gap: 8px;
    padding: 8px 12px 12px;
    justify-content: center;
}

.approve-btn, .reject-btn {
    padding: 6px 16px;
    font-size: 0.8rem;
    border-radius: 3px;
    font-family: 'Zen Maru Gothic', sans-serif;
    border: 1px solid transparent;
    transition: all 0.2s ease-out;
}

.approve-btn {
    background: rgba(100, 160, 100, 0.3);
    border-color: rgba(100, 160, 100, 0.5);
    color: #a0d0a0;
}

.approve-btn:hover {
    background: rgba(100, 160, 100, 0.5);
    transform: scale(1.02);
}

.reject-btn {
    background: rgba(160, 100, 100, 0.3);
    border-color: rgba(160, 100, 100, 0.5);
    color: #d0a0a0;
}

.reject-btn:hover {
    background: rgba(160, 100, 100, 0.5);
    transform: scale(1.02);
}

/* カード */
.card {
    width: 150px;
    height: 220px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease-out;
    border: 2px solid rgba(139, 90, 60, 0.25);
    background: linear-gradient(145deg, #ffffff, #f0ebe5);
    padding: 10px;
    text-align: center;
    box-shadow:
        0 2px 8px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.card:hover {
    transform: translateY(-8px) scale(1.05);
    border-color: #8b5a3c;
    box-shadow:
        0 8px 25px rgba(139, 90, 60, 0.2),
        inset 0 1px 0 rgba(255,255,255,0.8);
    z-index: 100;
}

.card.selected {
    transform: translateY(-15px) scale(1.08);
    border-color: #c48040;
    box-shadow:
        0 12px 30px rgba(196, 128, 64, 0.3),
        0 0 20px rgba(196, 128, 64, 0.2);
}

/* カード裏面（チェック柄） */
.card.back {
    background:
        repeating-conic-gradient(
            from 0deg at 50% 50%,
            #d8c8b8 0deg 90deg,
            #e8ddd0 90deg 180deg
        );
    background-size: 12px 12px;
    border-color: rgba(139, 90, 60, 0.3);
    position: relative;
    overflow: hidden;
}

.card.back::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(139, 90, 60, 0.2);
    border-radius: 3px;
    background: linear-gradient(145deg,
        rgba(255, 250, 245, 0.9),
        rgba(240, 235, 225, 0.9));
}

.card.back .card-name {
    position: relative;
    z-index: 1;
    color: #a09080;
    font-size: 1.5rem;
}

.card.back:hover {
    border-color: #8b5a3c;
}

.card.disabled {
    opacity: 0.85;
    cursor: default;
}

.card.disabled:hover {
    transform: none;
    border-color: rgba(139, 90, 60, 0.25);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-image {
    width: 125px;
    height: 150px;
    background: #f5f0e8;
    border-radius: 4px;
    margin-bottom: 8px;
    object-fit: cover;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.card-name {
    font-size: 1rem;
    font-weight: 700;
    color: #8b5a3c;
    letter-spacing: 0.05em;
}

.card-attrs {
    font-size: 0.7rem;
    color: #6a7a6a;
    margin-top: 4px;
    line-height: 1.5;
    word-break: break-all;
    min-height: 3.15em;
    max-height: 3.15em;
    overflow: hidden;
}

/* カード拡大モーダル */
.card-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(60, 50, 40, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    cursor: pointer;
}

.card-modal.hidden {
    display: none;
}

.card-modal-content {
    pointer-events: none;
}

.card.enlarged {
    width: 250px;
    height: 380px;
    cursor: default;
    transform: none;
}

.card.enlarged:hover {
    transform: none;
}

.card.enlarged .card-image {
    width: 220px;
    height: 280px;
}

.card.enlarged .card-name {
    font-size: 1.1rem;
    margin-top: 8px;
}

.card.enlarged .card-attrs {
    font-size: 0.7rem;
    margin-top: 5px;
}

/* 中サイズカード */
.card.medium-size {
    width: 160px;
    height: 240px;
    cursor: default;
    transform: none;
}

.card.medium-size:hover {
    transform: none;
}

.card.medium-size .card-image {
    width: 140px;
    height: 175px;
}

.card.medium-size .card-name {
    font-size: 0.9rem;
    margin-top: 6px;
}

.card.medium-size .card-attrs {
    font-size: 0.55rem;
    margin-top: 4px;
}

/* ペア確認モーダル */
.pair-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(60, 50, 40, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.pair-modal.hidden {
    display: none;
}

.pair-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.pair-modal-cards {
    display: flex;
    align-items: center;
    gap: 20px;
}

.pair-modal-cards .pair-arrow {
    font-size: 2rem;
    display: inline-block;
    min-width: 2.5em;
    text-align: center;
    transition: transform 0.8s ease-in-out, opacity 0.3s ease;
    background: radial-gradient(circle, rgba(196, 128, 64, 0.6) 0%, rgba(139, 90, 60, 0.3) 60%, transparent 80%);
    color: #ffe8c0;
    text-shadow: 0 0 10px rgba(255, 200, 100, 0.8), 0 0 20px rgba(196, 128, 64, 0.5);
    padding: 15px;
    border-radius: 50%;
}

.pair-modal-cards .pair-arrow.rotating {
    animation: symbol-rotate 1.2s ease-in-out;
}

@keyframes symbol-rotate {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); opacity: 0.5; }
    100% { transform: rotate(360deg); }
}

.pair-modal-comment {
    font-size: 1.2rem;
    color: #f0e8d8;
    text-align: center;
    max-width: 500px;
    line-height: 1.6;
}

.card-name-highlight {
    font-size: 1.4rem;
    font-weight: bold;
    color: #ffe8c0;
    text-shadow: 0 0 10px rgba(255, 200, 100, 0.5);
}

.comment-small {
    font-size: 0.9rem;
    color: #c0b8a8;
}

.pair-modal-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.pair-modal-buttons.hidden {
    display: none;
}

/* 語ろう！メッセージ */
.talk-message {
    font-family: 'Shippori Mincho', serif;
    font-size: 1.5rem;
    color: #f0e0c0;
    letter-spacing: 0.2em;
    animation: talk-pulse 2s ease-in-out infinite;
    margin-bottom: 5px;
}

@keyframes talk-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pair-modal-ok {
    padding: 12px 50px;
    background: linear-gradient(145deg, rgba(80, 140, 80, 0.5), rgba(80, 140, 80, 0.3));
    border-color: rgba(80, 140, 80, 0.7);
    color: #c0f0c0;
}

.pair-modal-ok:hover {
    background: linear-gradient(145deg, rgba(80, 140, 80, 0.7), rgba(80, 140, 80, 0.45));
}

.pair-modal-cancel {
    padding: 10px 30px;
    background: linear-gradient(145deg, rgba(140, 80, 80, 0.4), rgba(140, 80, 80, 0.25));
    border-color: rgba(140, 80, 80, 0.6);
    color: #f0b0b0;
    font-size: 0.9rem;
}

.pair-modal-cancel:hover {
    background: linear-gradient(145deg, rgba(140, 80, 80, 0.6), rgba(140, 80, 80, 0.4));
}

.pair-modal-buttons .approve-btn,
.pair-modal-buttons .reject-btn {
    padding: 12px 40px;
    font-size: 1rem;
}

.pair-modal-buttons .approve-btn {
    background: rgba(80, 140, 80, 0.5);
    border-color: rgba(80, 140, 80, 0.7);
    color: #c0f0c0;
}

.pair-modal-buttons .approve-btn:hover {
    background: rgba(80, 140, 80, 0.7);
}

.pair-modal-buttons .reject-btn {
    background: rgba(140, 80, 80, 0.4);
    border-color: rgba(140, 80, 80, 0.6);
    color: #f0b0b0;
}

.pair-modal-buttons .reject-btn:hover {
    background: rgba(140, 80, 80, 0.6);
}

/* 山札風の重なり（小さめ） */
.last-pair {
    display: flex;
    gap: 5px;
    align-items: center;
    position: relative;
}

.last-pair .card-stack {
    position: relative;
}

.last-pair .card-stack .card {
    position: relative;
    width: 70px;
    height: 100px;
    padding: 5px;
}

.last-pair .card-stack .card .card-image {
    width: 55px;
    height: 65px;
}

.last-pair .card-stack .card .card-name {
    font-size: 0.5rem;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.last-pair .card-stack .card .card-attrs {
    display: none;
}

.last-pair .card-stack .card:not(:first-child) {
    position: absolute;
    top: 0;
    left: 0;
}

.card-stack-0 { transform: rotate(-2deg) translate(-3px, -2px); z-index: 1; }
.card-stack-1 { transform: rotate(1deg) translate(2px, 1px); z-index: 2; }
.card-stack-2 { transform: rotate(-1deg) translate(-1px, 2px); z-index: 3; }
.card-stack-3 { transform: rotate(2deg) translate(1px, -1px); z-index: 4; }
.card-stack-4 { transform: rotate(0deg); z-index: 5; }

/* ドローフェーズ時のCPUカードの光 */
.card.back.drawable {
    animation: card-glow 0.8s ease-in-out infinite;
    border-width: 3px;
    cursor: pointer;
}

@keyframes card-glow {
    0%, 100% {
        border-color: #ffcc00;
        box-shadow: 0 0 20px rgba(255, 200, 0, 0.7), 0 0 40px rgba(255, 180, 0, 0.4);
    }
    50% {
        border-color: #ffdd44;
        box-shadow: 0 0 30px rgba(255, 220, 50, 0.9), 0 0 60px rgba(255, 200, 0, 0.6);
    }
}

/* カードを場に出すアニメーション */
.card.play-to-field {
    animation: play-card 0.6s ease-out forwards;
}

@keyframes play-card {
    0% {
        transform: scale(1.2) translateY(50px);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) translateY(-10px);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* CPUがカードを出すアニメーション */
.card.cpu-play-to-field {
    animation: cpu-play-card 0.6s ease-out forwards;
}

@keyframes cpu-play-card {
    0% {
        transform: scale(1.2) translateY(-50px);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) translateY(10px);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* カードをもらうアニメーション（プレイヤーがCPUから引く） */
.card.draw-from-cpu {
    animation: draw-card-down 0.6s ease-out;
}

@keyframes draw-card-down {
    0% {
        transform: translateY(-120px) scale(0.7);
        opacity: 0;
    }
    40% {
        transform: translateY(0) scale(1.08);
        opacity: 1;
    }
    60% {
        transform: translateY(25px) scale(1);
    }
    80% {
        transform: translateY(-5px) scale(1);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* カードをもらうアニメーション（CPUがプレイヤーから引く） */
.card.draw-from-player {
    animation: draw-card-up 0.5s ease-out;
}

@keyframes draw-card-up {
    0% {
        transform: translateY(100px) scale(0.8) rotate(10deg);
        opacity: 0.5;
    }
    60% {
        transform: translateY(-20px) scale(1.05) rotate(-5deg);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* ペアモーダルのカード登場アニメーション */
.pair-modal-cards .card.enlarged {
    animation: pair-card-appear 0.4s ease-out;
}

@keyframes pair-card-appear {
    0% {
        transform: scale(0.5) rotate(-5deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.05) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* アクションボタン */
.action-buttons {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    gap: 10px;
    z-index: 50;
}

.action-buttons.hidden {
    display: none;
}

.pass-btn, .surrender-btn {
    padding: 10px 15px;
    font-size: 0.75rem;
    border-radius: 4px;
    writing-mode: horizontal-tb;
}

.pass-btn {
    background: rgba(100, 120, 140, 0.3);
    border-color: rgba(100, 120, 140, 0.5);
    color: #708090;
}

.pass-btn:hover {
    background: rgba(100, 120, 140, 0.5);
}

.pass-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.surrender-btn {
    background: rgba(140, 100, 100, 0.3);
    border-color: rgba(140, 100, 100, 0.5);
    color: #a08080;
}

.surrender-btn:hover {
    background: rgba(140, 100, 100, 0.5);
}

/* 開始・結果画面 */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(245, 240, 232, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background-image:
        radial-gradient(circle at 30% 70%, rgba(180, 140, 100, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(100, 140, 180, 0.2) 0%, transparent 50%);
}

.result-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(245, 240, 232, 0.98);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
    overflow-y: auto;
    padding: 50px 20px 30px;
    background-image:
        radial-gradient(circle at 30% 70%, rgba(180, 140, 100, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 30%, rgba(100, 140, 180, 0.2) 0%, transparent 50%);
}

.start-screen.hidden, .result-screen.hidden {
    display: none;
}

/* 画面遷移アニメーション */
.start-screen.fade-out {
    animation: screen-fade-out 0.5s ease-out forwards;
}

.result-screen.fade-in {
    animation: screen-fade-in 0.5s ease-out;
}

@keyframes screen-fade-out {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.05);
    }
}

@keyframes screen-fade-in {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* タイトル装飾 */
.title-decoration {
    font-size: 1.2rem;
    color: #c4a070;
    letter-spacing: 0.8em;
    margin-bottom: 10px;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.start-screen h2, .result-screen h2 {
    font-family: 'Shippori Mincho', serif;
    font-size: 3rem;
    color: #8b5a3c;
    margin-bottom: 10px;
    letter-spacing: 0.3em;
    text-shadow: 0 4px 20px rgba(139, 90, 60, 0.2);
}

.start-screen p, .result-screen p {
    color: #6a6a7a;
    margin-bottom: 5px;
    letter-spacing: 0.15em;
}

.subtitle {
    font-size: 1rem;
    color: #8a7a6a;
    margin-bottom: 25px !important;
}

/* はじめるボタン - 華やか */
.start-btn {
    position: relative;
    padding: 16px 50px;
    font-size: 1.2rem;
    font-weight: bold;
    background: linear-gradient(145deg, #c48040, #a06830);
    border: none;
    border-radius: 30px;
    color: #fff;
    letter-spacing: 0.2em;
    box-shadow:
        0 6px 20px rgba(196, 128, 64, 0.4),
        0 0 0 3px rgba(196, 128, 64, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    overflow: hidden;
    margin-bottom: 5px;
}

.start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.start-btn:hover {
    background: linear-gradient(145deg, #d89050, #b07840);
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 10px 30px rgba(196, 128, 64, 0.5),
        0 0 0 4px rgba(196, 128, 64, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* もう一度プレイするボタン */
.play-again-btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    background: linear-gradient(145deg, #c48040, #a06830);
    border: none;
    border-radius: 25px;
    color: #fff;
    box-shadow: 0 4px 15px rgba(196, 128, 64, 0.35);
}

.play-again-btn:hover {
    background: linear-gradient(145deg, #d89050, #b07840);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 128, 64, 0.45);
}

/* 終了メッセージ */
.end-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Shippori Mincho', serif;
    font-size: 4rem;
    color: #8b5a3c;
    -webkit-text-stroke: 2px #f0e0c0;
    paint-order: stroke fill;
    text-shadow: 0 4px 20px rgba(139, 90, 60, 0.4);
    z-index: 150;
    animation: end-message-appear 1s ease-out;
}

@keyframes end-message-appear {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* サウンドオプション - トグルスイッチ */
.sound-options {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.sound-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #6a6560;
    font-size: 0.95rem;
}

.sound-option input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: linear-gradient(145deg, #e0d8d0, #d0c8c0);
    border-radius: 13px;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: linear-gradient(145deg, #fff, #f0ebe5);
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.sound-option input:checked + .toggle-switch {
    background: linear-gradient(145deg, #c48040, #a06830);
}

.sound-option input:checked + .toggle-switch::after {
    left: 27px;
    background: linear-gradient(145deg, #fff8f0, #ffe8d0);
}

.toggle-label {
    user-select: none;
    font-weight: 500;
}

/* フッター */
.game-footer {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.75rem;
    color: #8a8580;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-decoration {
    color: #c4a070;
    font-size: 0.9rem;
    letter-spacing: 0.5em;
    opacity: 0.7;
}

.footer-credits {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-footer a {
    color: #8b5a3c;
    text-decoration: none;
    transition: color 0.2s;
}

.game-footer a:hover {
    color: #c48040;
    text-decoration: underline;
}

/* ヘルプボタン */
.help-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.3rem;
    font-weight: bold;
    border-radius: 50%;
    background: linear-gradient(145deg, #fff8f0, #f0e8e0);
    border: 2px solid rgba(139, 90, 60, 0.3);
    color: #8b5a3c;
    box-shadow: 0 3px 10px rgba(139, 90, 60, 0.15);
}

.help-btn:hover {
    background: linear-gradient(145deg, #c48040, #a06830);
    border-color: #c48040;
    color: #fff;
    transform: translateY(-2px) scale(1.05);
}

/* ヘルプモーダル */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(60, 50, 40, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.help-modal.hidden {
    display: none;
}

.help-modal-content {
    background: linear-gradient(145deg, #f8f3eb, #f0ebe3);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow:
        0 10px 40px rgba(0,0,0,0.3),
        0 0 0 3px rgba(196, 128, 64, 0.1);
    overflow: hidden;
}

.help-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(139, 90, 60, 0.2);
}

.help-modal-header h2 {
    font-family: 'Shippori Mincho', serif;
    font-size: 1.3rem;
    color: #8b5a3c;
    margin: 0;
}

.help-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #8a8580;
    cursor: pointer;
    padding: 0 5px;
    width: auto;
    height: auto;
}

.help-close-btn:hover {
    color: #8b5a3c;
    background: none;
    transform: none;
    box-shadow: none;
}

.help-body {
    padding: 25px;
    text-align: center;
}

.help-body p {
    color: #5a4a3a;
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 10px;
}

.help-divider {
    color: #c4a070;
    font-size: 0.9rem;
    letter-spacing: 0.3em;
    margin: 20px 0;
    opacity: 0.7;
}

.help-note {
    font-size: 0.8rem !important;
    color: #8a7a6a !important;
    line-height: 1.6 !important;
}

/* ランキングボタン */
.ranking-btn {
    margin-top: 10px;
    padding: 8px 20px;
    font-size: 0.85rem;
    background: transparent;
    border: 2px solid rgba(139, 90, 60, 0.3);
}

/* ランキングモーダル */
.ranking-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(60, 50, 40, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.ranking-modal.hidden {
    display: none;
}

.ranking-modal-content {
    background: linear-gradient(145deg, #f8f3eb, #f0ebe3);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 10px 40px rgba(0,0,0,0.3),
        0 0 0 3px rgba(196, 128, 64, 0.1);
}

.ranking-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(139, 90, 60, 0.2);
}

.ranking-modal-header h2 {
    font-family: 'Shippori Mincho', serif;
    font-size: 1.3rem;
    color: #8b5a3c;
    margin: 0;
}

.ranking-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #8a8580;
    cursor: pointer;
    padding: 0 5px;
}

.ranking-close-btn:hover {
    color: #8b5a3c;
}

.ranking-tabs {
    display: flex;
    padding: 10px 15px;
    gap: 10px;
    border-bottom: 1px solid rgba(139, 90, 60, 0.1);
}

.ranking-tab {
    flex: 1;
    padding: 10px 12px;
    font-size: 0.8rem;
    background: transparent;
    border: 2px solid rgba(139, 90, 60, 0.2);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.ranking-tab:hover {
    background: rgba(139, 90, 60, 0.08);
}

.ranking-tab.active {
    background: linear-gradient(145deg, rgba(196, 128, 64, 0.2), rgba(139, 90, 60, 0.15));
    border-color: rgba(139, 90, 60, 0.4);
    font-weight: 500;
}

.ranking-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.ranking-loading, .ranking-empty {
    text-align: center;
    padding: 30px;
    color: #8a8580;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(139, 90, 60, 0.1);
    border-radius: 8px;
    margin-bottom: 4px;
    transition: background 0.2s;
}

.ranking-item:hover {
    background: rgba(139, 90, 60, 0.05);
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item.top-3 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.08) 0%, transparent 100%);
}

.ranking-rank {
    font-family: 'Shippori Mincho', serif;
    font-size: 1.1rem;
    font-weight: bold;
    color: #8b5a3c;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.ranking-rank.rank-1 {
    background: linear-gradient(145deg, #ffd700, #e6c200);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.4);
}

.ranking-rank.rank-2 {
    background: linear-gradient(145deg, #c0c0c0, #a8a8a8);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    box-shadow: 0 3px 10px rgba(192, 192, 192, 0.4);
}

.ranking-rank.rank-3 {
    background: linear-gradient(145deg, #cd7f32, #b8722d);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    box-shadow: 0 3px 10px rgba(205, 127, 50, 0.4);
}

.ranking-name {
    flex: 1;
    font-size: 0.95rem;
    color: #3a3530;
    padding: 0 10px;
}

.ranking-count {
    font-size: 0.8rem;
    color: #6a6560;
}

/* ペアログ */
.pairlog-section {
    margin-top: auto;
    padding-top: 20px;
    text-align: center;
    width: 100%;
    max-width: 500px;
    border-top: 1px solid rgba(139, 90, 60, 0.2);
}

.pairlog-title {
    font-family: 'Shippori Mincho', serif;
    font-size: 0.95rem;
    color: #8b5a3c;
    margin-bottom: 10px;
}

.pairlog-list {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    max-height: 150px;
    overflow-y: auto;
    padding: 5px;
}

.pairlog-section-title {
    font-size: 0.75rem;
    color: #6a6560;
    margin-bottom: 5px;
    font-weight: bold;
}

.pairlog-item {
    font-size: 0.8rem;
    color: #5a5550;
    padding: 2px 0;
}

.select-group {
    margin-bottom: 25px;
    text-align: center;
}

.select-group p {
    margin-bottom: 15px;
    color: #7a7a8a;
    font-size: 0.9rem;
}

.select-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.select-buttons.vertical {
    flex-direction: column;
}

button {
    padding: 12px 30px;
    font-size: 1rem;
    font-family: 'Zen Maru Gothic', sans-serif;
    background: linear-gradient(145deg, rgba(139, 90, 60, 0.15), rgba(139, 90, 60, 0.08));
    border: 2px solid rgba(139, 90, 60, 0.25);
    border-radius: 12px;
    color: #8b5a3c;
    cursor: pointer;
    transition: all 0.25s ease-out;
    letter-spacing: 0.1em;
}

button:hover {
    background: linear-gradient(145deg, rgba(139, 90, 60, 0.25), rgba(139, 90, 60, 0.12));
    border-color: rgba(139, 90, 60, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 90, 60, 0.15);
}

/* 結果画面 */
#result-lastcard {
    margin: 20px 0;
}

#result-lastcard .card {
    cursor: default;
}

/* 決まり手 */
.kimarite-section {
    margin: 10px 0;
    text-align: center;
}

.kimarite-title {
    font-family: 'Shippori Mincho', serif;
    font-size: 1.1rem;
    color: #8b5a3c;
    margin-bottom: 8px;
    letter-spacing: 0.15em;
}

.kimarite-label {
    font-family: 'Shippori Mincho', serif;
    font-size: 1.2rem;
    color: #3a3530;
    margin-bottom: 12px;
    letter-spacing: 0.1em;
}

.highlight-name {
    font-weight: bold;
    color: #8b5a3c;
}

.highlight-small {
    font-size: 0.85rem;
    color: #6a6560;
}

.kimarite-counter {
    font-size: 0.8rem;
    color: #8b7a6c;
    font-weight: normal;
}

.kimarite-who {
    font-size: 0.85rem;
    color: #6a6560;
    margin-bottom: 10px;
}

.kimarite-nav-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.kimarite-nav {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(240, 235, 225, 0.9));
    color: #8b5a3c;
    border: 1px solid rgba(139, 90, 60, 0.3);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.25s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(139, 90, 60, 0.15);
    padding: 0;
}

.kimarite-nav:hover:not(:disabled) {
    background: linear-gradient(145deg, rgba(196, 128, 64, 0.2), rgba(196, 128, 64, 0.1));
    border-color: rgba(139, 90, 60, 0.5);
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(139, 90, 60, 0.25);
}

.kimarite-nav:disabled {
    background: rgba(200, 200, 200, 0.3);
    border-color: rgba(180, 180, 180, 0.3);
    color: #bbb;
    cursor: not-allowed;
    box-shadow: none;
}

.kimarite-cards {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    overflow: visible;
    padding: 10px;
}

.kimarite-cards .card {
    width: 140px;
    height: 200px;
    flex-shrink: 0;
}

.kimarite-cards .card .card-image {
    width: 115px;
    height: 115px;
}

.kimarite-cards .card .card-name {
    font-size: 0.9rem;
}

.kimarite-cards .card .card-attrs {
    font-size: 0.6rem;
    max-height: 3em;
    overflow: hidden;
}

/* めくりアニメーション */
.kimarite-cards.slide-from-next {
    animation: slide-in-right 0.35s ease-out;
}

.kimarite-cards.slide-from-prev {
    animation: slide-in-left 0.35s ease-out;
}

@keyframes slide-in-right {
    0% {
        opacity: 0;
        transform: translateX(60px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slide-in-left {
    0% {
        opacity: 0;
        transform: translateX(-60px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* 結果画面の×アニメーション */
.result-arrow {
    font-size: 1.5rem;
    color: #8b5a3c;
    display: inline-block;
    min-width: 2em;
    text-align: center;
    transition: transform 0.8s ease-in-out, opacity 0.3s ease;
}

.result-arrow.rotating {
    animation: symbol-rotate 1.2s ease-in-out;
}

.kimarite-cards .card {
    cursor: default;
}

.kimarite-comment {
    font-size: 0.9rem;
    color: #a0a0a0;
    font-style: italic;
}

/* 画像コピーセクション */
.copy-image-section {
    margin: 10px 0 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.copy-image-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    background: linear-gradient(145deg, #c48040, #a06830);
    border: none;
    border-radius: 25px;
    color: #fff;
    cursor: pointer;
    transition: all 0.25s ease-out;
    box-shadow: 0 4px 15px rgba(196, 128, 64, 0.35);
}

.copy-image-btn:hover {
    background: linear-gradient(145deg, #d89050, #b07840);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 128, 64, 0.45);
}

.copy-image-btn:active {
    transform: translateY(0);
}

.copy-image-btn svg {
    flex-shrink: 0;
}

.copy-status {
    font-size: 0.8rem;
    color: #6a8f00;
    min-height: 1.2em;
}

.copy-status.error {
    color: #c07070;
}

/* シェアセクション */
.share-section {
    margin: 25px 0 20px;
    text-align: center;
}

.share-label {
    font-size: 0.9rem;
    color: #8b5a3c;
    margin-bottom: 15px;
    letter-spacing: 0.15em;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 0.8rem;
    border-radius: 20px;
    transition: all 0.25s ease-out;
    background: linear-gradient(145deg, #fff8f0, #f0e8e0);
    border: 2px solid rgba(139, 90, 60, 0.2);
    color: #6a5a4a;
}

.share-btn svg {
    flex-shrink: 0;
}

.share-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(139, 90, 60, 0.2);
}

.share-btn.x-btn {
    border-color: rgba(0, 0, 0, 0.2);
    color: #333;
}

.share-btn.x-btn:hover {
    background: linear-gradient(145deg, #333, #555);
    border-color: #333;
    color: #fff;
}

.share-btn.bluesky {
    border-color: rgba(0, 133, 255, 0.3);
    color: #0077dd;
}

.share-btn.bluesky:hover {
    background: linear-gradient(145deg, #0085ff, #0066cc);
    border-color: #0085ff;
    color: #fff;
}

.share-btn.misskey {
    border-color: rgba(134, 179, 0, 0.3);
    color: #6a8f00;
}

.share-btn.misskey:hover {
    background: linear-gradient(145deg, #86b300, #6a8f00);
    border-color: #86b300;
    color: #fff;
}

.play-again-btn {
    margin-top: 10px;
}

/* 広告エリア */
.ad-container {
    width: 100%;
    max-width: 728px;
    margin: 10px auto;
    text-align: center;
    min-height: 90px;
    background: rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 横向き推奨メッセージ（使用しない） */
.rotate-message {
    display: none;
}

/* ============================================
   スマホ縦向き対応
   ============================================ */
@media (max-width: 480px) and (orientation: portrait) {
    header {
        padding: 5px;
    }

    h1 {
        font-size: 1.1rem;
        letter-spacing: 0.1em;
    }

    .play-area {
        padding: 3px;
        gap: 0;
    }

    /* CPU手札エリア */
    .cpu-area {
        margin-bottom: -15px;
        padding: 3px 0;
    }

    .cpu-hand {
        height: 70px;
    }

    .cpu-hand .card {
        width: 50px;
        height: 70px;
    }

    /* プレイヤー手札エリア */
    .player-area {
        margin-top: -15px;
        padding: 3px 0;
    }

    .player-hand {
        height: 230px;
    }

    .player-hand .card {
        width: 115px;
        height: 190px;
        overflow: hidden;
    }

    .player-hand .card .card-image {
        width: 95px;
        height: 95px;
        object-fit: cover;
        margin-bottom: 0;
    }

    .player-hand .card .card-name {
        font-size: 0.85rem;
        margin-top: 4px;
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .player-hand .card .card-attrs {
        font-size: 0.6rem;
        line-height: 1.4;
        overflow: hidden;
        max-height: 3.5em;
    }

    /* フィールドエリア */
    .field-area {
        min-height: 50px;
        padding: 3px;
        gap: 5px;
        flex-direction: row;
    }

    .cpu-field {
        flex-direction: row;
    }

    .last-pair {
        transform: scale(0.4);
        transform-origin: center;
    }

    .pair-comment-window {
        display: none;
    }

    /* アクションボタン */
    .action-buttons {
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        gap: 8px;
    }

    .pass-btn, .surrender-btn {
        padding: 6px 10px;
        font-size: 0.65rem;
    }

    /* モーダル */
    .pair-modal-content {
        padding: 10px;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .pair-modal-cards {
        gap: 3px;
        flex-wrap: nowrap;
        max-width: 100%;
    }

    .pair-modal-cards .card.enlarged {
        width: 145px;
        height: 240px;
        padding: 8px;
        flex-shrink: 0;
    }

    .pair-modal-cards .card.enlarged .card-image {
        width: 120px;
        height: 120px;
    }

    .pair-modal-cards .card.enlarged .card-name {
        font-size: 1rem;
        margin-top: 12px;
        margin-bottom: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .pair-modal-cards .card.enlarged .card-attrs {
        font-size: 0.65rem;
        max-height: 4em;
        overflow: hidden;
        word-break: break-all;
        line-height: 1.5;
    }

    .pair-modal-cards .pair-arrow {
        font-size: 1rem;
        padding: 0 2px;
        min-width: auto;
    }

    .pair-modal-comment {
        font-size: 0.7rem;
        margin: 5px 0;
        padding: 0 5px;
        max-width: 90vw;
        word-break: break-all;
    }

    .pair-modal-buttons {
        gap: 5px;
        flex-wrap: wrap;
    }

    .pair-modal-ok, .pair-modal-cancel,
    .approve-btn, .reject-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .talk-message {
        font-size: 0.85rem;
    }

    /* 開始・結果画面 */
    .start-screen, .result-screen {
        padding: 10px;
    }

    .start-screen h2, .result-screen h2 {
        font-size: 1.6rem;
    }

    .start-screen p {
        font-size: 0.85rem;
        margin: 8px 0;
    }

    .start-screen button, .result-screen button {
        padding: 10px 20px;
        font-size: 0.85rem;
        margin: 5px;
    }

    .sound-options {
        gap: 15px;
        margin-bottom: 15px;
    }

    .result-kimarite {
        padding: 8px;
    }

    .kimarite-title {
        font-size: 0.9rem;
    }

    .kimarite-label {
        font-size: 0.8rem;
    }

    .kimarite-who {
        font-size: 0.75rem;
    }

    /* 決まり手セクション - スマホ */
    .kimarite-section {
        width: 100%;
        padding: 0 10px;
        box-sizing: border-box;
    }

    .kimarite-nav-container {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
    }

    .kimarite-nav {
        width: 32px;
        height: 32px;
        min-width: 32px;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .kimarite-cards {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 8px;
    }

    .kimarite-cards .card {
        width: 120px;
        height: 170px;
        padding: 8px;
        flex-shrink: 0;
    }

    .kimarite-cards .card .card-image {
        width: 100px;
        height: 100px;
        object-fit: cover;
        margin-bottom: 5px;
    }

    .kimarite-cards .card .card-name {
        font-size: 0.75rem;
        margin-top: 3px;
        margin-bottom: 2px;
    }

    .kimarite-cards .card .card-attrs {
        font-size: 0.5rem;
        max-height: 2.5em;
        overflow: hidden;
        line-height: 1.3;
    }

    .kimarite-cards .result-arrow {
        font-size: 1.2rem;
        flex-shrink: 0;
        color: #8b5a3c;
    }

    .share-buttons {
        flex-wrap: wrap;
        gap: 5px;
    }

    .share-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    /* 広告 */
    .ad-container {
        max-width: 300px;
        min-height: 50px;
        margin: 5px auto;
    }

    /* ランキング */
    .ranking-modal-content {
        max-width: 95vw;
        max-height: 85vh;
        padding: 10px;
    }

    .ranking-tabs {
        gap: 5px;
    }

    .ranking-tab {
        padding: 8px 15px;
        font-size: 0.8rem;
    }

    .ranking-item {
        padding: 8px;
        font-size: 0.8rem;
    }

    .ranking-name {
        font-size: 0.75rem;
    }

    /* トグルスイッチ */
    .toggle-switch {
        width: 44px;
        height: 24px;
    }

    .toggle-switch::after {
        width: 18px;
        height: 18px;
    }

    .sound-option input:checked + .toggle-switch::after {
        left: 23px;
    }

    .toggle-label {
        font-size: 0.85rem;
    }

    /* はじめるボタン */
    .start-btn {
        padding: 14px 40px;
        font-size: 1.1rem;
    }

    /* もう一度プレイするボタン */
    .play-again-btn {
        padding: 12px 30px;
        font-size: 1rem;
    }

    /* タイトル装飾 */
    .title-decoration {
        font-size: 1rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    /* 確認ダイアログ */
    .confirm-modal-content {
        padding: 25px 30px;
        max-width: 85vw;
    }

    .confirm-icon {
        width: 50px;
        height: 50px;
        line-height: 50px;
        font-size: 2rem;
    }

    .confirm-message {
        font-size: 1rem;
    }

    .confirm-yes, .confirm-no {
        padding: 10px 24px;
        font-size: 0.9rem;
    }

    /* ランキング順位 */
    .ranking-rank {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    /* ヘルプボタン */
    .help-btn {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }

    /* ヘルプモーダル */
    .help-modal-content {
        max-width: 90vw;
    }

    .help-body {
        padding: 20px;
    }

    .help-body p {
        font-size: 0.9rem;
    }

    .help-note {
        font-size: 0.75rem !important;
    }
}

/* ============================================
   スマホ横向き & タブレット対応
   ============================================ */
@media (max-width: 900px) and (orientation: landscape) {
    header {
        padding: 5px;
    }

    h1 {
        font-size: 1.2rem;
        letter-spacing: 0.15em;
    }

    .play-area {
        padding: 5px;
        gap: 2px;
    }

    /* CPU手札エリア */
    .cpu-area {
        margin-bottom: -30px;
        padding: 5px 0;
    }

    .cpu-hand {
        height: 80px;
    }

    .cpu-hand .card {
        width: 55px;
        height: 75px;
    }

    /* プレイヤー手札エリア */
    .player-area {
        margin-top: -25px;
        padding: 5px 0;
    }

    .player-hand {
        height: 150px;
    }

    .player-hand .card {
        width: 105px;
        height: 140px;
        overflow: hidden;
    }

    .player-hand .card .card-image {
        width: 90px;
        height: 85px;
        object-fit: cover;
    }

    .player-hand .card .card-name {
        font-size: 0.75rem;
        white-space: nowrap;
        overflow: hidden;
    }

    .player-hand .card .card-attrs {
        font-size: 0.55rem;
        overflow: hidden;
        max-height: 2.8em;
    }

    /* フィールドエリア */
    .field-area {
        min-height: 55px;
        padding: 5px;
        gap: 10px;
    }

    .last-pair {
        transform: scale(0.6);
        transform-origin: center;
    }

    .pair-comment-window {
        padding: 5px 8px;
        font-size: 0.7rem;
        max-width: 150px;
    }

    .comment-window-header {
        padding: 2px 5px;
        font-size: 0.6rem;
    }

    .comment-window-body {
        padding: 3px;
        font-size: 0.6rem;
    }

    /* アクションボタン */
    .action-buttons {
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        gap: 5px;
    }

    .pass-btn, .surrender-btn {
        padding: 5px 8px;
        font-size: 0.6rem;
    }

    /* モーダル */
    .pair-modal-content {
        padding: 10px;
        max-width: 95vw;
        max-height: 95vh;
    }

    .pair-modal-cards {
        gap: 5px;
    }

    .pair-modal-cards .card.enlarged {
        width: 100px;
        height: 130px;
    }

    .pair-modal-cards .card.enlarged .card-image {
        width: 80px;
        height: 75px;
    }

    .pair-modal-cards .card.enlarged .card-name {
        font-size: 0.7rem;
    }

    .pair-modal-cards .card.enlarged .card-attrs {
        font-size: 0.5rem;
    }

    .pair-modal-cards .pair-arrow {
        font-size: 1.5rem;
        padding: 0 5px;
    }

    .pair-modal-comment {
        font-size: 0.8rem;
        margin: 8px 0;
    }

    .pair-modal-buttons {
        gap: 8px;
    }

    .pair-modal-ok, .pair-modal-cancel,
    .approve-btn, .reject-btn {
        padding: 8px 15px;
        font-size: 0.8rem;
    }

    .talk-message {
        font-size: 1rem;
    }

    /* 開始・結果画面 */
    .start-screen, .result-screen {
        padding: 15px;
    }

    .start-screen h2, .result-screen h2 {
        font-size: 1.8rem;
    }

    .start-screen p {
        font-size: 0.9rem;
    }

    .start-screen button, .result-screen button {
        padding: 10px 25px;
        font-size: 0.9rem;
    }

    .result-kimarite {
        padding: 10px;
    }

    .kimarite-cards {
        gap: 8px;
    }

    .kimarite-cards .card {
        width: 80px;
        height: 105px;
    }

    .kimarite-cards .card .card-image {
        width: 65px;
        height: 60px;
    }

    .share-buttons {
        flex-wrap: wrap;
        gap: 5px;
    }

    .share-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    /* 広告 */
    .ad-container {
        max-width: 320px;
        min-height: 50px;
        margin: 5px auto;
    }

    /* ランキングモーダル */
    .ranking-modal-content {
        max-width: 95vw;
        max-height: 80vh;
    }

    .ranking-item {
        padding: 8px;
        font-size: 0.85rem;
    }
}

/* ============================================
   非常に小さい画面（横向き時）
   ============================================ */
@media (max-height: 400px) and (orientation: landscape) {
    header {
        padding: 2px;
    }

    h1 {
        font-size: 1rem;
    }

    .cpu-hand {
        height: 55px;
    }

    .cpu-hand .card {
        width: 40px;
        height: 52px;
    }

    .player-hand {
        height: 90px;
    }

    .player-hand .card {
        width: 70px;
        height: 90px;
    }

    .player-hand .card .card-image {
        width: 58px;
        height: 52px;
    }

    .player-hand .card .card-name {
        font-size: 0.55rem;
    }

    .player-hand .card .card-attrs {
        font-size: 0.45rem;
    }

    .field-area {
        min-height: 45px;
        padding: 3px;
    }

    .last-pair {
        transform: scale(0.45);
    }

    .ad-container {
        display: none;
    }
}

/* 確認ダイアログ */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(60, 50, 40, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
    animation: confirm-fade-in 0.2s ease-out;
}

.confirm-modal.hidden {
    display: none;
}

@keyframes confirm-fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.confirm-modal-content {
    background: linear-gradient(145deg, #fff8f0, #f5ebe0);
    border-radius: 16px;
    padding: 30px 40px;
    text-align: center;
    box-shadow:
        0 10px 40px rgba(139, 90, 60, 0.3),
        0 0 0 3px rgba(196, 128, 64, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    animation: confirm-pop 0.3s ease-out;
    max-width: 320px;
}

@keyframes confirm-pop {
    0% {
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }
    70% {
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.confirm-icon {
    font-size: 2.5rem;
    font-weight: bold;
    width: 60px;
    height: 60px;
    line-height: 60px;
    margin: 0 auto 15px;
    background: linear-gradient(145deg, #e8a0a0, #d88080);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(200, 100, 100, 0.3);
}

.confirm-message {
    font-family: 'Zen Maru Gothic', sans-serif;
    font-size: 1.1rem;
    color: #5a4a3a;
    margin-bottom: 25px;
    line-height: 1.6;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-yes, .confirm-no {
    padding: 12px 30px;
    font-size: 1rem;
    font-family: 'Zen Maru Gothic', sans-serif;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease-out;
    border: 2px solid transparent;
}

.confirm-yes {
    background: linear-gradient(145deg, #e8a0a0, #d88080);
    border-color: #c07070;
    color: #fff;
    box-shadow: 0 4px 12px rgba(200, 100, 100, 0.3);
}

.confirm-yes:hover {
    background: linear-gradient(145deg, #d88080, #c87070);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(200, 100, 100, 0.4);
}

.confirm-no {
    background: linear-gradient(145deg, #f5f0e8, #e8e0d8);
    border-color: rgba(139, 90, 60, 0.3);
    color: #7a6a5a;
    box-shadow: 0 4px 12px rgba(139, 90, 60, 0.15);
}

.confirm-no:hover {
    background: linear-gradient(145deg, #fff8f0, #f0e8e0);
    border-color: rgba(139, 90, 60, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 90, 60, 0.25);
}

/* スマホ対応 */
@media (max-width: 480px) {
    .confirm-modal-content {
        padding: 25px 30px;
        max-width: 85vw;
    }

    .confirm-icon {
        font-size: 2.5rem;
    }

    .confirm-message {
        font-size: 1rem;
    }

    .confirm-yes, .confirm-no {
        padding: 10px 24px;
        font-size: 0.9rem;
    }
}

/* 結果画面の広告 */
.result-ad-container {
    text-align: center;
    padding: 10px 0;
    margin-top: 20px;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}
