/* --- スタイル設定 (CSS) --- */
@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;700&display=swap');

:root {
    --primary-color: #009849; /* 京葉銀行の緑 */
    --secondary-color: #fdd000; /* インコの黄色 */
    --text-color: #333;
    --bg-color: #f0f8ff;
    --white: #fff;
    --gray: #ccc;
    --light-gray: #f4f4f4;
    --correct-color: #3498db;
    --wrong-color: #e74c3c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

#game-container {
    width: 100%;
    max-width: 420px;
    height: 800px;
    max-height: 90vh;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* ヘッダー */
.game-header {
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--primary-color), #00b358);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.user-info, .rank-info { font-size: 14px; }
.points-info { background: rgba(255,255,255,0.2); padding: 5px 10px; border-radius: 20px; font-weight: bold; }

/* メイン画面 */
.main-screen {
    flex-grow: 1;
    position: relative;
    background: linear-gradient(to bottom, #87CEEB, #D1F0FF);
    overflow: hidden;
}

/* インコ表示エリア */
#inko-area {
    position: absolute;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    cursor: pointer;
    transition: transform 0.2s ease;
}
#inko-area:active { transform: translateX(-50%) scale(0.95); }

#inko-sprite {
    width: 100%;
    height: 100%;
    position: relative;
    animation: float 3s ease-in-out infinite;
}
#inko-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* セリフ */
#speech-bubble {
    position: absolute;
    bottom: calc(200px + 180px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--white);
    padding: 15px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    width: 80%;
    text-align: center;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 10;
}
#speech-bubble.show { opacity: 1; visibility: visible; }
#speech-bubble::after {
    content: ''; position: absolute; bottom: -10px; left: 50%;
    transform: translateX(-50%); border-width: 10px; border-style: solid;
    border-color: var(--white) transparent transparent transparent;
}

/* 経験値バー */
#exp-bar-container {
    position: absolute; bottom: 180px; left: 50%; transform: translateX(-50%);
    width: 70%; background: rgba(0,0,0,0.1); height: 20px; border-radius: 10px; padding: 3px;
}
#exp-bar {
    width: 0%; height: 100%; background: linear-gradient(90deg, #ffd700, #ffec80);
    border-radius: 7px; transition: width 0.5s ease;
}
#level-display {
    position: absolute; left: -35px; top: -2px; background: var(--secondary-color);
    color: var(--primary-color); font-weight: bold; border-radius: 50%;
    width: 24px; height: 24px; display: flex; justify-content: center;
    align-items: center; font-size: 12px; border: 2px solid var(--white);
}

/* UIエリア */
.ui-area { height: 210px; background: var(--light-gray); border-top: 2px solid #e0e0e0; flex-shrink: 0; display: flex; flex-direction: column; }
.ui-tabs { display: flex; background: #e9e9e9; }
.tab-btn {
    flex: 1; padding: 12px 0; text-align: center; cursor: pointer; border: none;
    background: transparent; font-size: 14px; font-weight: bold; color: #888;
    border-bottom: 3px solid transparent; transition: all 0.2s;
}
.tab-btn.active { color: var(--primary-color); background: var(--light-gray); border-bottom-color: var(--primary-color); }
.ui-content { flex-grow: 1; position: relative; }
.tab-panel {
    position: absolute; width: 100%; height: 100%; padding: 15px; opacity: 0;
    visibility: hidden; transition: opacity 0.2s; overflow-y: auto;
}
.tab-panel.active { opacity: 1; visibility: visible; }

/* アクションタブ */
.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; height: 100%; }
.action-btn {
    padding: 15px; border-radius: 10px; border: none; background: var(--primary-color);
    color: var(--white); font-size: 14px; font-weight: bold; cursor: pointer;
    transition: background 0.2s; text-align: center; display: flex; justify-content: center; align-items: center;
}
.action-btn:hover { background: #007a3b; }
.action-btn.login-bonus { background: var(--secondary-color); color: var(--primary-color); }
.action-btn.login-bonus:disabled { background: var(--gray); color: #777; cursor: not-allowed; }

/* モーダル */
.modal-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); display: flex; justify-content: center;
    align-items: center; z-index: 100; opacity: 0; visibility: hidden; transition: opacity 0.3s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-content {
    background: var(--white); padding: 20px; border-radius: 15px; width: 90%;
    text-align: center; transform: scale(0.9); transition: transform 0.3s;
}
.modal-overlay.show .modal-content { transform: scale(1); }
.modal-content h2 { margin-bottom: 15px; color: var(--primary-color); font-size: 18px; }
.modal-content p { margin-bottom: 20px; font-size: 14px; line-height: 1.6; }
.modal-input { width: 100%; padding: 10px; border: 1px solid var(--gray); border-radius: 5px; margin-bottom: 20px; }
.modal-btn {
    display: block; width: 100%; padding: 12px; border: none; border-radius: 8px;
    background: var(--primary-color); color: var(--white); font-size: 16px;
    font-weight: bold; cursor: pointer; margin-top: 10px;
}

/* コンテンツモーダル */
#content-body {
    max-height: 250px; overflow-y: auto; text-align: left; background: #f9f9f9;
    padding: 15px; border-radius: 8px; margin-bottom: 20px; font-size: 13px;
}

/* クイズモーダル */
#quiz-question { font-weight: bold; margin-bottom: 20px; }
#quiz-choices { display: flex; flex-direction: column; gap: 10px; }
.choice-btn {
    border: 2px solid var(--gray); background-color: var(--white);
    color: var(--text-color); transition: all 0.2s;
}
.choice-btn:not(:disabled):hover { background-color: #f0f0f0; }
.choice-btn.correct { background-color: var(--correct-color); color: white; border-color: var(--correct-color); }
.choice-btn.wrong { background-color: var(--wrong-color); color: white; border-color: var(--wrong-color); }
#quiz-feedback { margin-top: 15px; font-weight: bold; min-height: 20px; }
#quiz-feedback.correct { color: var(--correct-color); }
#quiz-feedback.wrong { color: var(--wrong-color); }

/* エフェクト */
.point-get-effect {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: var(--primary-color); font-weight: bold; animation: pointGet 1s ease-out forwards;
    opacity: 0; z-index: 50;
}
@keyframes pointGet {
    0% { transform: translate(-50%, -80px) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -150px) scale(1.2); opacity: 0; }
}