/* === Quiz Master Frontend === */

.qm-quiz-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 680px;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
}

/* Screens */
.qm-screen { display: none; }
.qm-screen.qm-active { display: block; }

/* Card */
.qm-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
}

/* Title */
.qm-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 12px;
    color: #1a1a2e;
    line-height: 1.3;
}

.qm-intro {
    font-size: 16px;
    color: #555;
    line-height: 1.7;
    margin: 0 0 20px;
}

.qm-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.qm-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #888;
}

/* Buttons */
.qm-btn {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-sizing: border-box;
}

.qm-btn:hover { transform: translateY(-1px); }
.qm-btn:active { transform: translateY(0); }
.qm-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.qm-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    width: 100%;
    margin-top: 8px;
}

.qm-btn-secondary {
    background: #f0f0f5;
    color: #333;
    width: 100%;
    margin-top: 12px;
}

.qm-btn-secondary:hover { background: #e4e4ec; }

.qm-btn-ghost {
    background: transparent;
    color: #888;
    width: 100%;
    margin-top: 8px;
    font-size: 14px;
    padding: 10px;
}

.qm-btn-ghost:hover { color: #555; }

.qm-btn-bonus {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    width: 100%;
    margin-top: 16px;
    font-size: 18px;
    padding: 16px;
    border-radius: 12px;
    animation: qm-pulse 2s infinite;
}

@keyframes qm-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4); }
    50%       { box-shadow: 0 4px 30px rgba(245, 87, 108, 0.7); }
}

/* Progress */
.qm-progress-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.qm-progress-bar {
    flex: 1;
    height: 8px;
    background: #e8e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.qm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.qm-progress-text {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
}

/* Question card */
.qm-question-counter {
    font-size: 13px;
    color: #aaa;
    margin: 0 0 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qm-question-text {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 24px;
    line-height: 1.4;
}

/* Answers */
.qm-answers-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.qm-answer-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid #e8e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #fafafa;
}

.qm-answer-item:hover {
    border-color: #667eea;
    background: #f5f4ff;
}

.qm-answer-item input { 
    margin-top: 2px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.qm-answer-item:has(input:checked) {
    border-color: #667eea;
    background: #f0effe;
}

.qm-answer-text {
    font-size: 16px;
    color: #333;
    line-height: 1.4;
}

/* Score circle */
.qm-result-card { text-align: center; }

.qm-score-circle {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
}

.qm-score-svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.qm-score-track {
    fill: none;
    stroke: #f0f0f5;
    stroke-width: 10;
}

.qm-score-fill {
    fill: none;
    stroke: url(#qm-gradient);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-in-out;
}

.qm-score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.qm-score-num {
    font-size: 36px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1;
}

.qm-score-label {
    font-size: 18px;
    font-weight: 600;
    color: #888;
}

.qm-correct-count {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
}

.qm-result-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
}

.qm-result-text {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin: 0 0 16px;
}

/* SVG gradient definition */
.qm-quiz-container::before {
    content: '';
    display: none;
}

/* Review */
.qm-review-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px;
    color: #1a1a2e;
}

.qm-review-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }

.qm-review-block {
    padding: 16px;
    border-radius: 10px;
    border-left: 4px solid #e0e0e0;
    background: #fafafa;
}

.qm-review-block.qm-correct { border-left-color: #22c55e; background: #f0fdf4; }
.qm-review-block.qm-wrong   { border-left-color: #ef4444; background: #fef2f2; }

.qm-review-question {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px;
}

.qm-review-answer {
    font-size: 14px;
    color: #888;
    padding: 4px 0;
}

.qm-answer-correct { color: #16a34a; font-weight: 600; }
.qm-answer-wrong   { color: #dc2626; text-decoration: line-through; }
.qm-answer-missed  { color: #16a34a; font-style: italic; }

/* SVG gradient hack via defs */
.qm-score-svg defs { display: block; }

/* Responsive */
@media (max-width: 480px) {
    .qm-card { padding: 20px 16px; }
    .qm-title { font-size: 20px; }
    .qm-question-text { font-size: 17px; }
    .qm-answer-text { font-size: 15px; }
    .qm-btn { padding: 12px 20px; font-size: 15px; }
    .qm-score-num { font-size: 28px; }
}
