/* ═══════════════════════════════════════════════════════════
   HOOHUI Story Engine — Front-End Styles
   Brand: #1B3A6B (blue) · #FF6B4A (orange) · #fff (white)
   ═══════════════════════════════════════════════════════════ */

:root {
    --hh-blue:   #1B3A6B;
    --hh-orange: #FF6B4A;
    --hh-green:  #38a169;
    --hh-bg:     #f7fafc;
    --hh-card:   #ffffff;
    --hh-border: #e2e8f0;
    --hh-text:   #2d3748;
    --hh-muted:  #718096;
    --hh-radius: 16px;
    --hh-font:   'Nunito Sans', 'Segoe UI', sans-serif;
}

/* ── Wrapper ─────────────────────────────────────────────── */
#hoohui-story-engine {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 16px 60px;
    font-family: var(--hh-font);
    color: var(--hh-text);
    font-size: 16px;
    line-height: 1.7;
}

/* ── Cover Card ──────────────────────────────────────────── */
.hh-cover {
    background: var(--hh-blue);
    border-radius: var(--hh-radius);
    overflow: hidden;
    margin-bottom: 28px;
    position: relative;
    min-height: 180px;
}

.hh-cover-img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
    opacity: 0.75;
}

.hh-cover-content {
    padding: 24px 28px;
    color: #fff;
}

.hh-cover-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.hh-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.hh-badge-blue   { background: var(--hh-blue);   color: #fff; }
.hh-badge-orange { background: var(--hh-orange);  color: #fff; }
.hh-badge-gray   { background: rgba(255,255,255,.2); color: #fff; }
.hh-badge-green  { background: var(--hh-green);   color: #fff; }

.hh-title {
    font-size: clamp(22px, 5vw, 32px);
    font-weight: 800;
    margin: 0 0 8px;
    line-height: 1.2;
}

.hh-excerpt {
    font-size: 15px;
    opacity: 0.85;
    margin: 0;
}

/* ── Start Button ────────────────────────────────────────── */
.hh-start-btn {
    display: block;
    width: 100%;
    background: var(--hh-orange);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    margin-bottom: 28px;
    font-family: var(--hh-font);
}
.hh-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255,107,74,.35);
}

/* ── Story Engine ────────────────────────────────────────── */
#hh-engine { display: none; }

/* ── Scene ───────────────────────────────────────────────── */
.hh-scene {
    animation: hhFadeIn 0.4s ease;
}

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

.hh-scene-text {
    background: var(--hh-card);
    border-radius: var(--hh-radius);
    padding: 28px 32px;
    font-size: 17px;
    line-height: 1.8;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    margin-bottom: 20px;
    border-left: 4px solid var(--hh-blue);
}

/* ── Choices ─────────────────────────────────────────────── */
.hh-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.hh-choice-btn {
    background: var(--hh-card);
    border: 2px solid var(--hh-border);
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-family: var(--hh-font);
    color: var(--hh-text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.hh-choice-btn:hover {
    border-color: var(--hh-blue);
    background: #ebf4ff;
    transform: translateX(4px);
}

.hh-choice-btn:focus {
    outline: 3px solid var(--hh-orange);
    outline-offset: 2px;
}

.hh-choice-emoji { font-size: 22px; flex-shrink: 0; }

/* ── Ending ──────────────────────────────────────────────── */
.hh-ending {
    border-radius: var(--hh-radius);
    padding: 28px;
    margin-bottom: 20px;
    animation: hhFadeIn 0.4s ease;
}

.hh-ending-positive { background: #f0fff4; border: 2px solid #9ae6b4; }
.hh-ending-lesson   { background: #fffaf0; border: 2px solid #fbd38d; }
.hh-ending-neutral  { background: #ebf8ff; border: 2px solid #90cdf4; }

.hh-ending-message {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.5;
}

.hh-moral {
    background: #fff8e1;
    border-left: 4px solid var(--hh-orange);
    border-radius: 8px;
    padding: 14px 18px;
    font-style: italic;
    font-size: 15px;
    margin-top: 12px;
}

.hh-moral-label {
    font-weight: 700;
    color: var(--hh-orange);
    font-style: normal;
}

/* ── Restart / Quiz Buttons ──────────────────────────────── */
.hh-action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.hh-action-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--hh-font);
}

.hh-action-btn-blue   { background: var(--hh-blue); color: #fff; }
.hh-action-btn-orange { background: var(--hh-orange); color: #fff; }
.hh-action-btn:hover  { opacity: 0.88; transform: translateY(-1px); }
.hh-action-btn:focus  { outline: 3px solid var(--hh-orange); outline-offset: 2px; }

/* ── Simplified version ──────────────────────────────────── */
.hh-simplified {
    margin-top: 20px;
}

.hh-simplified-toggle {
    background: none;
    border: 1px solid var(--hh-border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--hh-blue);
    font-weight: 600;
    font-family: var(--hh-font);
}

.hh-simplified-text {
    display: none;
    background: #f7fafc;
    border-radius: 8px;
    padding: 14px;
    margin-top: 8px;
    font-size: 15px;
    line-height: 1.7;
    border: 1px solid var(--hh-border);
}

/* ── Quiz ────────────────────────────────────────────────── */
#hh-quiz {
    display: none;
    animation: hhFadeIn 0.4s ease;
}

.hh-quiz-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--hh-blue);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hh-quiz-q {
    background: var(--hh-card);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.hh-quiz-question {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--hh-blue);
}

.hh-quiz-answers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hh-quiz-answer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 2px solid var(--hh-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    background: #fff;
}

.hh-quiz-answer:hover:not(.answered) {
    border-color: var(--hh-blue);
    background: #ebf4ff;
}

.hh-quiz-answer input[type="radio"] { display: none; }

.hh-quiz-answer.correct  { border-color: var(--hh-green); background: #f0fff4; }
.hh-quiz-answer.wrong    { border-color: #fc8181; background: #fff5f5; opacity: .7; }
.hh-quiz-answer.answered { cursor: default; }

.hh-quiz-feedback {
    font-size: 14px;
    margin-top: 10px;
    font-weight: 700;
    min-height: 20px;
    padding: 6px 12px;
    border-radius: 6px;
}

.hh-feedback-correct { background: #c6f6d5; color: #276749; }
.hh-feedback-wrong   { background: #fed7d7; color: #c53030; }

.hh-quiz-check-btn {
    background: var(--hh-blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    font-family: var(--hh-font);
}
.hh-quiz-check-btn:hover { opacity: 0.88; }

/* ── Quiz Result ─────────────────────────────────────────── */
.hh-quiz-result {
    text-align: center;
    padding: 28px;
    background: linear-gradient(135deg, #ebf4ff, #f0fff4);
    border-radius: var(--hh-radius);
    margin-top: 20px;
    display: none;
}

.hh-result-score {
    font-size: 48px;
    font-weight: 800;
    color: var(--hh-blue);
    line-height: 1;
    margin-bottom: 8px;
}

.hh-result-msg {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

/* ── Progress bar ────────────────────────────────────────── */
.hh-progress-wrap {
    background: var(--hh-border);
    border-radius: 99px;
    height: 6px;
    margin-bottom: 20px;
    overflow: hidden;
}

.hh-progress-bar {
    background: var(--hh-orange);
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
}

/* ── TTS Button ──────────────────────────────────────────── */
#hh-tts-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    border-radius: 10px;
    transition: all 0.2s;
}

#hh-tts-btn[aria-pressed="true"] {
    background: #e53e3e;
}

/* ── Accessibility ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .hh-scene, .hh-ending, #hh-quiz { animation: none; }
}

@media (max-width: 600px) {
    .hh-scene-text { padding: 18px; font-size: 16px; }
    .hh-title      { font-size: 22px; }
    .hh-action-row { flex-direction: column; }
}

/* ── Discussion & Activity ───────────────────────────────── */
.hh-discussion, .hh-activity {
    background: #fff;
    border: 2px solid var(--hh-border);
    border-radius: var(--hh-radius);
    padding: 20px 24px;
    margin-top: 20px;
}
.hh-discussion { border-left: 5px solid #1B3A6B; }
.hh-activity   { border-left: 5px solid #FF6B4A; }
.hh-discussion-title, .hh-activity-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 17px;
    margin-bottom: 12px;
    color: var(--hh-text);
}
.hh-discussion-list {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.hh-discussion-list li {
    font-size: 15px;
    line-height: 1.6;
    color: var(--hh-text);
}
.hh-activity-text {
    font-size: 15px;
    margin: 0;
    color: var(--hh-text);
    font-weight: 600;
}
.hh-draw-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    background: linear-gradient(135deg, #E91E8C, #C2185B);
    color: #fff;
    text-decoration: none;
    border-radius: 14px;
    padding: 12px 22px;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(194, 24, 91, .35);
    transition: transform .18s, box-shadow .18s;
}
.hh-draw-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(194, 24, 91, .45);
    color: #fff;
    text-decoration: none;
}
