/*
 * Project: Japanese Learning System
 * Copyright (c) 2026 合同会社BEWIND (LLC BEWIND)
 * All Rights Reserved.
 */

:root {
    --primary: #4A90E2;
    --secondary: #50E3C2;
    --bg: #F4F7F6;
    --text: #333;
    --panel-left: #2C3E50;
    --panel-right: #ECF0F1;
    --cute-btn-bg: #e0f7fa; /* かわいいボタンの背景色 */
    --cute-btn-border: #b2ebf2; /* かわいいボタンの枠線 */
    --cute-btn-hover: #80deea; /* かわいいボタンのホバー時 */
}
body { font-family: 'Segoe UI', sans-serif; margin: 0; background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; }

/* --- 共通コンポーネント --- */
.app-footer { width: 100%; text-align: center; font-size: 0.8rem; color: #999; padding: 10px 0; margin-top: auto; }
.btn { padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; font-size: 1rem; transition: 0.2s; font-weight: bold; text-decoration: none; display: inline-block; text-align: center;}
.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--secondary); color: #004d40; }
.btn-danger { background: #E74C3C; color: white; }
.btn-warning { background: #F39C12; color: white; }
.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- ログイン・登録画面 --- */
.center-container { display: flex; justify-content: center; align-items: center; height: 100vh; flex-direction: column; overflow-y: auto; }
.card { background: white; padding: 40px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); width: 90%; max-width: 400px; margin-bottom: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; }

/* --- ダッシュボード --- */
.dashboard-body { background: #ECF0F1; }
.dashboard-container { height: 100vh; display: flex; flex-direction: column; padding: 20px; box-sizing: border-box; max-width: 1200px; margin: 0 auto; }
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-shrink: 0; }
.user-welcome { font-size: 1.5rem; margin: 0; color: #2C3E50; }
.user-name { color: var(--primary); font-weight: bold; }
.btn-logout { padding: 8px 20px; font-size: 0.9rem; }
.dash-progress { background: white; padding: 10px 20px; border-radius: 8px; display: flex; align-items: center; gap: 20px; margin-bottom: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); flex-shrink: 0; }
.progress-info { white-space: nowrap; font-size: 1rem; }
.badge { background: var(--secondary); padding: 3px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: bold; margin-right: 5px; }
.progress-bar-bg { flex-grow: 1; height: 12px; background: #eee; border-radius: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); transition: width 0.5s ease; }
.dash-grid { flex-grow: 1; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: 10px; overflow: hidden; }
@media (max-width: 768px) { .dash-grid { grid-template-columns: repeat(2, 1fr); overflow-y: auto; } }

/* カテゴリカード (修正: ホバー時の可読性向上) */
.cat-card { 
    background: white; border: 1px solid #ddd; border-radius: 8px; transition: 0.2s; 
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); height: 100%; width: 100%; padding: 10px; 
    box-sizing: border-box; position: relative; text-decoration: none; color: #333; cursor: pointer;
}
.cat-card:hover { 
    background: skyblue !important; /* 背景を空色に */
    border-color: skyblue !important; 
    transform: translateY(-2px); 
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    color: #333 !important; /* 文字色を黒で固定 */
}
/* グラデーション背景のカードに対応するための記述 */
.cat-card[style*="linear-gradient"]:hover {
     background: skyblue !important; /* グラデーションを上書き */
}

.cat-card span { z-index: 2; position: relative; pointer-events: none;}
.cat-jp { font-size: 1.1rem; font-weight: bold; margin-bottom: 2px; text-align: center; }
.cat-pt { font-size: 0.85rem; text-align: center; }

/* --- 学習画面レイアウト --- */
.classroom-layout { display: flex; height: 100vh; width: 100vw; }
.left-pane { width: 250px; background: var(--panel-left); color: white; display: flex; flex-direction: column; flex-shrink: 0; }
.pane-header { padding: 20px; background: #1A252F; text-align: center; border-bottom: 1px solid #34495E; }
.word-list { overflow-y: auto; flex: 1; list-style: none; padding: 0; margin: 0; }
.word-item { padding: 15px 20px; cursor: grab; border-bottom: 1px solid #34495E; transition: background-color 0.2s; display: flex; align-items: center;}
.word-item:active { cursor: grabbing; }
.word-item.dragging { opacity: 0.5; background: #34495E; }
.drag-handle { margin-right: 10px; cursor: grab; opacity: 0.5; font-size: 1.2rem; }
.word-item:hover { background: #34495E; }
.word-item.active { background: var(--primary); border-left: 5px solid var(--secondary); }
.word-item.learned::before { content: '✔ '; color: var(--secondary); font-weight: bold; margin-right: 5px; }

.center-pane { flex: 1; background: white; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; position: relative; }
.word-display { text-align: center; width: 100%; max-width: 700px; }
.lang-pt { font-size: 2.5rem; color: var(--primary); font-weight: bold; margin-bottom: 10px; }
.lang-jp { font-size: 2rem; color: #333; margin-top: 10px; }
.media-container { width: 100%; height: 350px; background: #eee; border-radius: 10px; overflow: hidden; margin: 15px 0; display: flex; align-items: center; justify-content: center; border: 2px dashed #ddd; cursor: pointer; transition: 0.3s; position: relative; }
.media-container:hover { border-color: var(--primary); background: #f9f9f9; }
.media-container img, .media-container video { max-width: 100%; max-height: 100%; object-fit: contain; }
.media-placeholder { display: flex; flex-direction: column; align-items: center; color: #aaa; }
.stamp-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-15deg); border: 5px solid #E74C3C; color: #E74C3C; font-size: 3rem; font-weight: bold; padding: 10px 20px; border-radius: 10px; opacity: 0.9; pointer-events: none; z-index: 10; text-transform: uppercase; letter-spacing: 2px; background: rgba(255, 255, 255, 0.7); box-shadow: 0 0 10px rgba(0,0,0,0.1); white-space: nowrap; }
.speaker-btn { background: none; border: none; font-size: 1.8rem; cursor: pointer; color: #555; transition: 0.2s; }
.speaker-btn:hover { color: var(--primary); transform: scale(1.1); }
.right-pane { width: 220px; background: var(--panel-right); padding: 20px; display: flex; flex-direction: column; gap: 15px; border-left: 1px solid #ccc; flex-shrink: 0; overflow-y: auto;}
.right-pane button { width: 100%; height: 50px; }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; padding: 30px; border-radius: 10px; width: 400px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }

/* --- テストモード用スタイル --- */
.test-item { display: flex; align-items: center; cursor: pointer; }
.status-icon { display: inline-block; width: 24px; text-align: center; font-weight: bold; margin-right: 8px; }

/* 修正: 〇印を緑、✖印を赤に */
.status-icon.green { color: var(--secondary); }
.status-icon.red { color: #E74C3C; }
.status-icon.gray { color: #ccc; }

.test-item.disabled { color: #ccc; cursor: not-allowed; pointer-events: none; }
.word-item.correct { background-color: rgba(80, 227, 194, 0.1); }
.word-item.wrong { background-color: rgba(231, 76, 60, 0.1); }
.test-area { display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.question-card { width: 100%; height: 100%; max-width: 800px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; padding: 20px; box-sizing: border-box; }
.options-grid { display: grid; grid-template-columns: 1fr; gap: 15px; width: 100%; max-width: 500px; }

/* 修正: 選択肢ボタンを大きく、かわいく */
.option-btn { 
    padding: 25px; /* サイズアップ */
    font-size: 1.8rem; /* 文字サイズアップ */
    background: var(--cute-btn-bg); /* かわいい背景色 */
    border: 3px solid var(--cute-btn-border); /* かわいい枠線 */
    border-radius: 15px; /* 丸みを強く */
    cursor: pointer; 
    transition: all 0.2s ease; 
    color: #00796b; /* テキスト色も調整 */
    box-shadow: 0 5px 0 #80cbc4; /* 立体感のある影 */
    font-weight: bold;
}
.option-btn:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 8px 0 #4db6ac; 
    background: var(--cute-btn-hover);
    border-color: var(--cute-btn-hover);
}
.option-btn:active { 
    transform: translateY(3px); 
    box-shadow: 0 0 0; 
}

.feedback-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.9); z-index: 10; border-radius: 12px; }
.correct-bg { background: rgba(218, 247, 166, 0.95); } 
.wrong-bg { background: rgba(250, 219, 216, 0.95); } 
.feedback-content { text-align: center; animation: popIn 0.3s ease; }
.fb-icon { font-size: 5rem; margin-bottom: 10px; }
.correct-bg .fb-icon { color: #27AE60; }
.wrong-bg .fb-icon { color: #C0392B; }
.fb-text { font-size: 2.5rem; font-weight: bold; margin-bottom: 5px; color: #333; }
.fb-sub { font-size: 1.5rem; color: #555; margin-bottom: 15px; }
.fb-ans { font-size: 1.5rem; font-weight: bold; color: #C0392B; background: white; padding: 10px 20px; border-radius: 8px; }
@keyframes popIn { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* 修正: 右ペインの円グラフ用スタイルを追加 */
.stats-box { background: white; padding: 15px; border-radius: 8px; margin-bottom: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); text-align: center;}
.stats-box h4 { margin: 0 0 15px 0; text-align: center; font-size: 1.1rem; color: #555; }
.pie-chart-container { position: relative; width: 120px; height: 120px; margin: 0 auto 20px auto; }
.pie-chart { 
    width: 100%; height: 100%; border-radius: 50%; 
    border: 5px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    background: #eee; /* 初期値 */
    transition: background 0.5s ease;
}
.pie-chart-center {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 60%; height: 60%; background: white; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-weight: bold; font-size: 1.2rem; color: #333;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.stat-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; border-bottom: 1px dashed #eee; padding-bottom: 5px;}
.stat-row:last-child { border-bottom: none; }

/* 証明書 */
.certificate-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.certificate { background: white; width: 80%; max-width: 600px; padding: 40px; border: 10px double #F1C40F; text-align: center; box-shadow: 0 0 30px rgba(255, 215, 0, 0.5); background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.05"><text x="10" y="50" font-size="20">MASTER</text></svg>'); }
.cert-header { font-size: 2rem; color: #F39C12; margin-bottom: 20px; font-weight: bold; }
.cert-title { font-size: 3rem; font-weight: bold; margin-bottom: 30px; border-bottom: 2px solid #333; display: inline-block; padding-bottom: 10px; }
.cert-body { font-size: 1.2rem; line-height: 1.8; margin-bottom: 30px; }
.cert-date { text-align: right; font-size: 1rem; color: #666; margin-top: 40px; }
.cert-footer { margin-top: 20px; font-size: 0.9rem; color: #999; }
@media print { body * { visibility: hidden; } .certificate-container, .certificate-container * { visibility: visible; } .certificate-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: white; } .certificate { width: 100%; border: 5px solid #000; box-shadow: none; } .no-print { display: none !important; } }