/* 全体のデザイン */
body {
    background-color: #fffaf0; 
    color: #594a4e; 
    font-family: 'Helvetica Neue', 'Arial', sans-serif;
    text-align: center; padding: 20px;
    overflow-x: hidden; width: 100%; box-sizing: border-box;
    min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.5s, color 0.5s;
}

.title-image { max-width: 100%; height: auto; display: block; margin: 0 auto 30px auto; }
.container { max-width: 600px; width: 100%; position: relative; z-index: 2; padding-bottom: 50px; box-sizing: border-box; }

.input-group { margin-bottom: 20px; text-align: left; }
.input-label { color: #00b386; font-weight: bold; margin-bottom: 5px; display: block; }
.input-label.opponent { color: #ff6b8d; }
.input-label.context { color: #d4a017; }

textarea { 
    width: 100%; height: 100px; 
    background: #ffffff; 
    color: #594a4e; 
    border: 2px solid #e0c0b0; 
    padding: 10px; font-size: 16px; 
    border-radius: 10px; box-sizing: border-box; resize: none;
    transition: border-color 0.3s;
}
textarea:focus { border-color: #00b386; outline: none; background: #faffff; }
textarea.opponent-input:focus { border-color: #ff6b8d; background: #fff0f5; }
textarea.context-input:focus { border-color: #d4a017; background: #fffdf0; }

.vs-mark { font-size: 1.5rem; font-weight: 900; color: #c0a090; margin: 10px 0 20px 0; font-style: italic; }

.button-container { height: 140px; display: flex; justify-content: center; align-items: center; margin-top: 10px; }

/* 画像ボタン共通設定 */
.image-button {
    background: none !important; border: none !important; padding: 0 !important; 
    box-shadow: none !important; width: auto !important; height: auto !important;
    cursor: pointer; outline: none;
    transition: transform 0.1s, filter 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.image-button:active { transform: scale(0.95); filter: brightness(0.9); }

/* JUDGEボタン */
#fight-btn { display: flex; justify-content: center; align-items: center; }
#fight-btn img { width: 150px; height: auto; max-width: 100%; }
#fight-btn:disabled { cursor: not-allowed; filter: grayscale(100%) opacity(0.6); transform: none; }

/* 動画オーバーレイ設定 */
#video-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 10000; display: none;
    justify-content: center; align-items: center;
}
#video-overlay video { width: 100%; height: 100%; object-fit: contain; }

/* SKIPボタンを右下隅に配置 */
.skip-btn {
    position: absolute; 
    bottom: 15px; /* 下からの距離 */
    right: 15px;  /* 右からの距離 */
    z-index: 10001; /* 動画より手前に表示するための優先度 */
    width: 100px !important; height: auto !important;
}

#result-area { display: none; margin-top: 30px; padding-top: 20px; border-top: 1px solid #e0c0b0; width: 100%; }

/* 変更点1：勝利テキストのサイズ調整 */
.winner-text {
    /* 修正後：画面幅13%にするが、最大でも80px（4.5rem）で止める設定 */
    font-size: min(13vw, 4.5rem); 
    
    font-style: italic; font-weight: 900; margin: 0; line-height: 1;
    background: linear-gradient(90deg, #ff4040, #ffb700, #40ff40, #40ffff, #4040ff, #ff40ff, #ff4040);
    background-size: 200% auto; -webkit-background-clip: text; color: transparent;
    animation: rainbowMove 0.5s linear infinite, winnerImpact 0.8s forwards;
    white-space: nowrap;
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.1));
}

/* 変更点2：敗北テキストのサイズ調整 */
.loser-text { 
    /* 修正後：画面幅10%にするが、最大でも60px（3.5rem）で止める設定 */
    font-size: min(10vw, 3.5rem);

    font-family: 'Courier New', monospace; font-weight: bold; color: inherit; white-space: nowrap; 
}

.score-box { font-size: 2.5rem; font-family: 'Impact', sans-serif; margin: 20px 0 30px 0; font-weight: bold; line-height: 1.2; }
.win-score { color: #ffcc00; text-shadow: 1px 1px 0 #d4a017; }
.lose-score { color: #ff6b8d; text-shadow: 1px 1px 0 #c25e75; }

.analysis-box { 
    background: #ffffff; padding: 15px; margin-bottom: 15px; border-left: 5px solid #ccc; 
    border-radius: 8px; text-align: left; box-shadow: 0 2px 5px rgba(0,0,0,0.05); color: #594a4e;
}
.box-title { font-weight: bold; font-size: 0.9rem; margin-bottom: 5px; display: block; }
.win-logic-title { color: #00b386; }
.correction-title { color: #ff6b8d; }

.monetization-box {
    margin-top: 10px; padding: 20px; background: #ffffff; 
    border-radius: 10px; border: 1px solid #e6d0c0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.affiliate-btn {
    width: 100%; max-width: 300px; padding: 15px; font-size: 16px; font-weight: bold;
    background: linear-gradient(45deg, #ffcc33, #ffdd66); border: none; border-radius: 50px;
    color: #594a4e; cursor: pointer; text-decoration: none; text-align: center;
    box-shadow: 0 4px 15px rgba(255, 200, 50, 0.3); transition: transform 0.2s;
    box-sizing: border-box;
}
.affiliate-btn:hover { transform: scale(1.05); }

#history-area { margin-top: 50px; text-align: left; border-top: 1px solid #e0c0b0; padding-top: 20px; width: 100%; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }

.clear-btn { 
    background: #ffc0cb; color: #fff; border: none; padding: 8px 15px; 
    border-radius: 20px; cursor: pointer; font-size: 0.75rem; transition: 0.2s;
    font-weight: bold; box-shadow: 0 2px 5px rgba(255, 182, 193, 0.5);
}
.clear-btn:hover { background: #ffb6c1; transform: translateY(-1px); }

.history-item { 
    background: #ffffff; padding: 15px; border-radius: 10px; margin-bottom: 20px; 
    border: 1px solid #f0e0d0; font-size: 0.85rem; line-height: 1.6; color: #594a4e;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}
.tag-win { background: #ffe4b5; color: #8b4500; padding: 2px 8px; border-radius: 5px; font-weight: bold; margin-right: 10px;}
.tag-lose { background: #ffc0cb; color: #8b0000; padding: 2px 8px; border-radius: 5px; font-weight: bold; margin-right: 10px;}

.log-label-player { color: #00b386; font-weight: bold; }
.log-label-opponent { color: #ff6b8d; font-weight: bold; }
.log-label-judge { color: #d4a017; font-weight: bold; }

.history-summary { color: #594a4e; display: block; margin-top: 10px; border-top: 1px dashed #e0c0b0; padding-top: 10px; white-space: pre-wrap; font-weight: bold; }
.history-text-block { margin: 10px 0; white-space: pre-wrap; word-break: break-all; }

#janken-area { display: none; margin-top: 20px; padding: 20px; border: 3px solid #00b386; border-radius: 15px; background: #fff; }

.hand-btn-row {
    display: flex; align-items: center; justify-content: flex-start;
    width: 100%; padding: 10px 15px; margin-bottom: 10px;
    background: #fff; border: 1px solid #e0c0b0; border-radius: 50px;
    cursor: pointer; transition: 0.2s; text-align: left;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    color: #594a4e; font-size: 1rem;
}
.hand-btn-row:hover { transform: scale(1.02); background: #fffaf0; }
.hand-btn-row:active { transform: scale(0.98); }

.hand-icon { font-size: 2.5rem; margin-right: 15px; line-height: 1; }
.hand-text { font-size: 1rem; font-weight: bold; color: #594a4e; }

@keyframes rainbowMove { to { background-position: 200% center; } }
@keyframes winnerImpact { 0% { opacity: 0; transform: scale(3); } 100% { opacity: 1; transform: scale(1); } }
#flash-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: white; pointer-events: none; opacity: 0; z-index: 999; }