/* パーセントクイズ CSS - Quiz4スタイル準拠 */

/* ===== 外ラッパー - 中央配置 ===== */
.percent-quiz-outer {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 60vh;
    padding: 20px;
    margin: 0 auto !important;
}

/* ===== ルート要素 ===== */
.percent-quiz-root {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.percent-quiz-root * {
    box-sizing: border-box;
}

/* ===== 読み込み中 ===== */
.percent-quiz-loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
}

/* ===== メインコンテナ（Quiz4準拠） ===== */
.percent-quiz-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 20px;
    margin: 0 auto;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 問題セット選択画面（1カラムレイアウト） ===== */
.percent-quiz-set-select-single {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.percent-quiz-set-select-single h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-align: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.percent-quiz-set-select-single .subtitle {
    text-align: center;
    color: #6b7280;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* 先生用メニュー（1行） */
.percent-quiz-teacher-menu-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8faff, #f0f6fc);
    border-radius: 12px;
    flex-wrap: wrap;
}

.percent-quiz-animation-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
}

.percent-quiz-animation-toggle:hover {
    border-color: #667eea;
}

.percent-quiz-animation-toggle span {
    font-size: 0.9em;
    color: #374151;
    white-space: nowrap;
}

/* ON/OFF状態表示 */
.percent-quiz-toggle-status {
    font-weight: bold;
    font-size: 0.85em;
    color: #ef4444;
    min-width: 35px;
    text-align: center;
}

.percent-quiz-toggle-status.active {
    color: #10b981;
}

/* 問題セットカード（横スクロール1段表記） */
.percent-quiz-set-cards {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
    margin: 0;
    max-width: 100%;
}
    scroll-snap-type: x mandatory;
}

.percent-quiz-set-cards::-webkit-scrollbar {
    height: 10px;
}

.percent-quiz-set-cards::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 10px;
}

.percent-quiz-set-cards::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
}

.percent-quiz-set-card {
    background: linear-gradient(135deg, #f8faff, #f0f6fc);
    border: 3px solid #e5e7eb;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 280px;
    flex-shrink: 0;
    scroll-snap-align: start;
}

.percent-quiz-set-card:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.percent-quiz-set-icon {
    font-size: 3.5em;
    margin-bottom: 15px;
}

.percent-quiz-set-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 10px;
}

.percent-quiz-set-description {
    font-size: 0.85em;
    color: #6b7280;
    margin-bottom: 20px;
    line-height: 1.6;
    flex: 1;
}

.percent-quiz-set-card button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    width: 100%;
}

.percent-quiz-set-card button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.percent-quiz-set-card .delete-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    padding: 8px 16px;
    font-size: 0.85em;
    margin-top: 8px;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.percent-quiz-set-card .delete-btn:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* 先生用メニューボタン */
.percent-quiz-menu-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
}

.percent-quiz-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

/* トグルスイッチ */
.percent-quiz-toggle {
    position: relative;
    width: 50px;
    height: 25px;
    background: #ef4444;
    border-radius: 12.5px;
    transition: background 0.3s;
    flex-shrink: 0;
}

.percent-quiz-toggle.active {
    background: #10b981;
}

/* OFF表示 */
.percent-quiz-toggle::before {
    content: '✕';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: white;
    font-weight: bold;
    opacity: 1;
    transition: opacity 0.3s;
}

.percent-quiz-toggle.active::before {
    opacity: 0;
}

/* トグルの丸 */
.percent-quiz-toggle::after {
    content: '';
    position: absolute;
    top: 2.5px;
    left: 2.5px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: left 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.percent-quiz-toggle.active::after {
    left: 27.5px;
}

/* ON表示（チェックマーク） */
.percent-quiz-animation-toggle .percent-quiz-toggle.active::after {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #10b981;
    font-weight: bold;
}

/* ===== 手動作成・Excel読み込み画面 ===== */
.percent-quiz-create-screen {
    background: white;
    border-radius: 15px;
    padding: 40px;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.percent-quiz-create-screen h2 {
    font-size: 2em;
    color: #1f2937;
    margin-bottom: 30px;
    text-align: center;
}

.percent-quiz-form-group {
    margin-bottom: 25px;
}

.percent-quiz-form-label {
    display: block;
    font-weight: bold;
    color: #374151;
    margin-bottom: 8px;
}

.percent-quiz-form-input,
.percent-quiz-form-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.percent-quiz-form-input:focus,
.percent-quiz-form-textarea:focus {
    outline: none;
    border-color: #667eea;
}

.percent-quiz-form-textarea {
    resize: vertical;
    min-height: 100px;
}

.percent-quiz-question-list {
    margin: 30px 0;
}

.percent-quiz-question-item {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.percent-quiz-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.percent-quiz-question-number {
    font-weight: bold;
    color: #667eea;
    font-size: 1.2em;
}

.percent-quiz-button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
}

/* Excel読み込み */
.percent-quiz-upload-area {
    border: 3px dashed #d1d5db;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
}

.percent-quiz-upload-area:hover {
    border-color: #667eea;
    background: #f3f4f6;
}

.percent-quiz-upload-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.percent-quiz-upload-text {
    font-size: 1.2em;
    color: #374151;
    margin-bottom: 10px;
}

.percent-quiz-upload-subtext {
    font-size: 0.9em;
    color: #6b7280;
}

.percent-quiz-file-info {
    background: #e0f2fe;
    border: 2px solid #0ea5e9;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.percent-quiz-template-link {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    margin: 20px 0;
}

.percent-quiz-template-link:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

/* ===== 開始画面 ===== */
.percent-quiz-start {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    width: 100%;
}

.percent-quiz-start h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.percent-quiz-selected-set {
    background: #f3f4f6;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 1.2em;
    color: #6b7280;
}

/* ボタンエリア（開始画面：2カラム） */
.percent-quiz-start-button-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

/* パーセント説明エリア */
.percent-quiz-rules {
    background: linear-gradient(135deg, #f8faff, #f0f6fc);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #e0e7ff;
    text-align: left;
}

.percent-quiz-rules-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.percent-quiz-rules-title::before,
.percent-quiz-rules-title::after {
    content: '';
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
}

.percent-quiz-percent-explanation {
    background: #e0f2fe;
    border-left: 4px solid #0ea5e9;
    padding: 20px;
    border-radius: 0 12px 12px 0;
}

.percent-quiz-percent-explanation-title {
    font-weight: bold;
    color: #075985;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.percent-quiz-percent-description {
    color: #0c4a6e;
    line-height: 1.8;
    margin-bottom: 15px;
}

/* グラフバー */
.percent-quiz-percent-graph {
    position: relative;
    width: 100%;
    height: 80px;
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 15px 0;
}

.percent-quiz-percent-graph-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    width: 0%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 15px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.5);
    transition: width 1.5s ease-out;
}

.percent-quiz-percent-graph-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.percent-quiz-percent-graph-value {
    font-size: 2em;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-family: 'Courier New', monospace;
}

.percent-quiz-percent-text {
    text-align: center;
    color: #075985;
    font-weight: 600;
    margin-top: 10px;
}

.percent-quiz-percent-examples {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.percent-quiz-percent-example-item {
    background: white;
    padding: 15px 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9em;
    color: #0c4a6e;
}

.percent-quiz-percent-example-item strong {
    display: block;
    font-size: 1.3em;
    color: #0ea5e9;
    margin: 5px 0;
}

/* ===== ゲーム画面（2カラムレイアウト） ===== */
.percent-quiz-game {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    min-height: 500px;
}

/* サイドバー */
.percent-quiz-sidebar {
    background: linear-gradient(135deg, #f8faff, #f0f6fc);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.percent-quiz-sidebar-section {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.percent-quiz-sidebar-section h3 {
    font-size: 0.9em;
    color: #6b7280;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.percent-quiz-round {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 1.3em;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.3);
}

.percent-quiz-score-display {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 1.5em;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.percent-quiz-sidebar-note {
    display: none;
    font-size: 0.85em;
    line-height: 1.6;
    color: #4b5563;
}

.percent-quiz-sidebar-note.show {
    display: block;
}

/* メインエリア */
.percent-quiz-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 25px;
}

/* 問題表示 */
.percent-quiz-question {
    background: #e3f2fd;
    padding: 25px;
    border-radius: 15px;
    font-size: 1.4em;
    font-weight: bold;
    color: #1976d2;
    text-align: center;
    line-height: 1.6;
}

/* 入力エリア */
.percent-quiz-input-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.percent-quiz-input-area input[type="number"] {
    width: 150px;
    font-size: 3em;
    text-align: center;
    border: 3px solid #3498db;
    border-radius: 10px;
    padding: 15px;
    font-weight: bold;
}

.percent-quiz-input-area input[type="number"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
    outline: none;
}

.percent-quiz-percent-symbol {
    font-size: 2.5em;
    font-weight: bold;
    color: #3498db;
}

/* スライダー */
.percent-quiz-slider-container {
    padding: 0 20px;
}

.percent-quiz-slider {
    width: 100%;
    height: 12px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #ef4444, #f59e0b, #10b981);
    border-radius: 5px;
    outline: none;
}

.percent-quiz-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 30px;
    height: 30px;
    background: white;
    border: 3px solid #3498db;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.percent-quiz-slider::-moz-range-thumb {
    width: 30px;
    height: 30px;
    background: white;
    border: 3px solid #3498db;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.percent-quiz-button-area {
    text-align: center;
}

/* ===== 結果画面（2カラムレイアウト） ===== */
.percent-quiz-result-screen {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.percent-quiz-result-header {
    text-align: center;
    margin-bottom: 10px;
}

.percent-quiz-result-header h2 {
    font-size: 1.8rem;
    color: #1f2937;
    margin: 0;
}

.percent-quiz-correct-answer {
    background: #fff3cd;
    border: 3px solid #ffc107;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.percent-quiz-correct-answer .label {
    font-size: 1em;
    color: #856404;
    margin-bottom: 8px;
}

.percent-quiz-correct-answer .value {
    font-size: 2.5em;
    font-weight: bold;
    color: #f39c12;
}

.percent-quiz-your-answer {
    background: #e8f5e9;
    border: 3px solid #4caf50;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.percent-quiz-your-answer .label {
    font-size: 1em;
    color: #2e7d32;
    margin-bottom: 8px;
}

.percent-quiz-your-answer .value {
    font-size: 2.5em;
    font-weight: bold;
    color: #4caf50;
}

.percent-quiz-remaining-score {
    background: white;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.percent-quiz-remaining-score .label {
    font-size: 0.9em;
    color: #6b7280;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.percent-quiz-remaining-score .value {
    font-size: 1.8em;
    color: #3498db;
    font-weight: bold;
}

.percent-quiz-note-box {
    background: #f8f9fa;
    padding: 15px;
    border-left: 4px solid #3498db;
    line-height: 1.6;
    border-radius: 0 10px 10px 0;
    font-size: 0.9em;
}

.percent-quiz-note-label {
    font-weight: bold;
    color: #3498db;
    margin-bottom: 8px;
}

.percent-quiz-result-button-area {
    text-align: center;
    margin-top: 10px;
}

/* ===== カウントアニメーション ===== */
.percent-quiz-count-popup {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 40px 60px;
    border-radius: 20px;
    z-index: 9999;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.percent-quiz-count-label {
    font-size: 1.5em;
    margin-bottom: 10px;
    text-align: center;
}

.percent-quiz-count-number {
    font-size: 5em;
    font-weight: bold;
    text-align: center;
    font-family: 'Courier New', monospace;
    color: #e74c3c;
}

/* ===== 結果ポップアップ ===== */
.percent-quiz-result-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.percent-quiz-result-popup {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
}

.percent-quiz-result-popup h2 {
    font-size: 2rem;
    color: #1f2937;
    text-align: center;
    margin-bottom: 30px;
}

/* 結果ポップアップ: 2カラムレイアウト */
.percent-quiz-result-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
    margin: 20px 0;
    align-items: start;
}

.percent-quiz-result-left {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.percent-quiz-result-answer-error {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.percent-quiz-result-right {
    display: flex;
    align-items: stretch;
    height: 100%;
}

/* アニメーション表示用のポップアップ */
.percent-quiz-animation-popup {
    max-width: 700px;
    min-width: 600px;
}

/* グラフコンテナ */
.percent-quiz-graph-container {
    position: relative;
    width: 100%;
    height: 80px;
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 100%);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 30px 0;
}

.percent-quiz-graph-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 100%);
    width: 0%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 15px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.5);
}

.percent-quiz-graph-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.percent-quiz-graph-value {
    font-size: 2.5em;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-family: 'Courier New', monospace;
    min-width: 120px;
    text-align: right;
    position: relative;
    z-index: 1;
}

.percent-quiz-graph-markers {
    position: absolute;
    top: -25px;
    left: 0;
    width: 100%;
    height: 25px;
}

.percent-quiz-graph-marker {
    position: absolute;
    top: 0;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid #ef4444;
}

.percent-quiz-heartbeat-msg {
    margin-top: 20px;
    font-size: 1.5em;
    font-weight: bold;
    color: #e74c3c;
    text-align: center;
    opacity: 0;
}

.percent-quiz-heartbeat-msg.show {
    opacity: 1;
    animation: heartbeat 1s infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.percent-quiz-result-popup h2 {
    font-size: 2rem;
    color: #1f2937;
    text-align: center;
    margin: 0 0 30px 0;
}

.percent-quiz-result-popup .percent-quiz-correct-answer {
    background: #fff3cd;
    border: 3px solid #ffc107;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin: 0;
}

.percent-quiz-result-popup .percent-quiz-correct-answer .label {
    font-size: 1em;
    color: #856404;
    margin-bottom: 8px;
}

.percent-quiz-result-popup .percent-quiz-correct-answer .value {
    font-size: 2.5em;
    font-weight: bold;
    color: #f39c12;
}

.percent-quiz-result-popup .percent-quiz-your-answer {
    background: #e8f5e9;
    border: 3px solid #4caf50;
    padding: 15px;
    border-radius: 15px;
    text-align: center;
    margin: 0;
}

.percent-quiz-result-popup .percent-quiz-your-answer .label {
    font-size: 0.85em;
    color: #2e7d32;
    margin-bottom: 8px;
}

.percent-quiz-result-popup .percent-quiz-your-answer .value {
    font-size: 2em;
    font-weight: bold;
    color: #4caf50;
}

.percent-quiz-result-popup .percent-quiz-error-display {
    background: #ffebee;
    border: 3px solid #ef4444;
    padding: 15px;
    border-radius: 15px;
    text-align: center;
    margin: 0;
}

.percent-quiz-result-popup .percent-quiz-error-display .label {
    font-size: 0.85em;
    color: #b71c1c;
    margin-bottom: 8px;
}

.percent-quiz-result-popup .percent-quiz-error-display .value {
    font-size: 2em;
    font-weight: bold;
    color: #e74c3c;
}

.percent-quiz-result-popup .percent-quiz-note-box {
    background: #f8f9fa;
    padding: 20px;
    border-left: 4px solid #3498db;
    line-height: 1.7;
    border-radius: 0 10px 10px 0;
    margin: 0;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.percent-quiz-result-popup .percent-quiz-note-label {
    font-weight: bold;
    color: #3498db;
    margin-bottom: 10px;
    font-size: 1.1em;
    flex-shrink: 0;
}

/* 豆知識内のリンクスタイル */
.percent-quiz-note-box a {
    color: #2563eb;
    text-decoration: none;
    word-wrap: break-word;
    word-break: break-all;
}

.percent-quiz-note-box a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.percent-quiz-note-box small {
    display: block;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 0.85em;
    line-height: 1.5;
}

/* 結果ポップアップのボタンエリア（グラフの下、2カラムの前） */
.percent-quiz-result-button-area {
    text-align: center;
    margin: 25px 0;
    padding: 20px 0;
    border-top: 2px solid #e5e7eb;
    border-bottom: 2px solid #e5e7eb;
}

.percent-quiz-result-popup-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.percent-quiz-result-list {
    list-style: none;
    margin: 20px 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

.percent-quiz-result-item {
    background: #f8f9fa;
    padding: 12px 20px;
    margin: 8px 0;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
}

/* パルスアニメーション */
.percent-quiz-pulse {
    animation: percentPulse 0.5s ease-in-out;
}

@keyframes percentPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); color: #e74c3c; }
}

/* ===== ゲームオーバーポップアップ ===== */
.percent-quiz-gameover-popup {
    max-width: 700px;
}

.percent-quiz-gameover-title {
    font-size: 3.5em;
    color: #e74c3c;
    text-align: center;
    margin: 20px 0;
    font-weight: bold;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.percent-quiz-gameover-message {
    background: #ffebee;
    border: 3px solid #e74c3c;
    padding: 30px;
    border-radius: 15px;
    margin: 20px 0;
    text-align: center;
    font-size: 1.2em;
    line-height: 1.8;
}

.percent-quiz-gameover-message p {
    margin: 10px 0;
}

/* ===== 最終結果画面 ===== */
.percent-quiz-final {
    text-align: center;
}

.percent-quiz-final h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #1f2937;
}

.percent-quiz-medal {
    font-size: 5em;
    margin: 20px 0;
}

.percent-quiz-final-score {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    padding: 40px;
    border-radius: 20px;
    margin: 30px 0;
}

.percent-quiz-final-score .label {
    font-size: 1.5em;
    margin-bottom: 15px;
}

.percent-quiz-final-score .value {
    font-size: 5em;
    font-weight: bold;
}

.percent-quiz-result-list {
    list-style: none;
    margin: 30px 0;
    padding: 0;
}

.percent-quiz-result-item {
    background: #f8f9fa;
    padding: 15px 20px;
    margin: 10px 0;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== ゲームオーバー ===== */
.percent-quiz-gameover {
    text-align: center;
}

.percent-quiz-gameover-title {
    font-size: 4em;
    color: #e74c3c;
    margin: 30px 0;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.percent-quiz-gameover-message {
    background: #ffebee;
    border: 3px solid #e74c3c;
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
    font-size: 1.3em;
    line-height: 1.8;
}

/* ===== ボタン ===== */
.percent-quiz-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

.percent-quiz-btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.percent-quiz-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.percent-quiz-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.percent-quiz-btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

/* ===== エラー表示 ===== */
.percent-quiz-error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 2px solid #fecaca;
    border-radius: 15px;
    padding: 25px;
    color: #991b1b;
    text-align: center;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.1);
}

.percent-quiz-error h3 {
    margin: 0 0 10px 0;
    color: #dc2626;
}

/* ===== レスポンシブ ===== */
@media (max-width: 1024px) {
    .percent-quiz-game {
        grid-template-columns: 220px 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .percent-quiz-outer {
        padding: 10px;
        min-height: 50vh;
    }
    
    .percent-quiz-container {
        padding: 15px;
    }
    
    .percent-quiz-set-select-single,
    .percent-quiz-start,
    .percent-quiz-game,
    .percent-quiz-result-screen {
        padding: 20px;
    }
    
    .percent-quiz-teacher-menu-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .percent-quiz-menu-btn,
    .percent-quiz-animation-toggle {
        width: 100%;
    }
    
    .percent-quiz-sidebar {
        order: -1;
    }
    
    .percent-quiz-start-button-area {
        grid-template-columns: 1fr;
    }
    
    .percent-quiz-percent-examples {
        grid-template-columns: 1fr;
    }
    
    .percent-quiz-result-content {
        grid-template-columns: 1fr;
    }
    
    .percent-quiz-result-popup {
        padding: 30px 20px;
    }
    
    .percent-quiz-question {
        font-size: 1.1em;
        padding: 20px;
    }
    
    .percent-quiz-input-area input[type="number"] {
        width: 120px;
        font-size: 2.5em;
    }
    
    .percent-quiz-percent-symbol {
        font-size: 2em;
    }
    
    .percent-quiz-count-popup {
        padding: 30px 40px;
    }
    
    .percent-quiz-count-number {
        font-size: 4em;
    }
}

@media (max-width: 480px) {
    .percent-quiz-set-select-single h1,
    .percent-quiz-start h1 {
        font-size: 1.5rem;
    }
    
    .percent-quiz-input-area {
        flex-direction: column;
    }
    
    .percent-quiz-btn {
        width: 100%;
    }
    
    .percent-quiz-final-score .value {
        font-size: 3.5em;
    }
}
