:root {
  --module-max-width: 1180px; --text: #111827; --muted: #64748b; --border: #d9e2ec; --soft: #f8fafc;
  --accent: #0f766e; --blue: #2563eb; --good: #15803d; --bad: #dc2626; --warn: #d97706; --role-a: #2563eb; --role-b: #15803d;
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body { min-height: 100vh; margin: 0; color: var(--text); background: #f4f7fb; font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
.page-header { padding: 28px 18px 18px; text-align: center; }
h1 { margin: 0 0 8px; font-size: 3rem; letter-spacing: 0; }
.page-header p { margin: 0; color: var(--muted); font-size: 1.06rem; }
main { width: min(1180px, 94vw); min-height: 520px; margin: 0 auto 42px; }
.learning-content { display: grid; gap: 18px; }
.card { padding: 22px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 14px 34px rgba(15, 23, 42, .08); }
.dialog-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.section-title { margin: 0 0 12px; font-size: 1.35rem; letter-spacing: 0; }
.scenario-pill { display: inline-flex; max-width: 100%; margin-bottom: 12px; padding: 7px 11px; color: #115e59; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 999px; font-weight: 900; overflow-wrap: anywhere; }

.scene { margin-bottom: 15px; padding: 16px; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 8px; text-align: center; }
.scene-emoji { min-height: 88px; display: grid; place-items: center; font-size: 5.2rem; line-height: 1; filter: drop-shadow(0 10px 14px rgba(15, 23, 42, .12)); overflow-wrap: anywhere; }
.scene-title { margin-top: 7px; font-size: 2rem; font-weight: 950; line-height: 1.25; overflow-wrap: anywhere; }
.scene-text { margin-top: 5px; color: var(--muted); font-weight: 800; overflow-wrap: anywhere; }
.dialog-box { display: grid; gap: 10px; }
.line { min-width: 0; min-height: 76px; display: grid; grid-template-columns: 48px minmax(0, 1fr) 44px; gap: 10px; align-items: center; padding: 11px; background: var(--soft); border: 1px solid var(--border); border-inline-start: 5px solid var(--role-a); border-radius: 8px; }
.line.role-b { border-inline-start-color: var(--role-b); }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; color: #fff; background: var(--role-a); border-radius: 50%; font-weight: 950; }
.role-b .avatar { background: var(--role-b); }
.line-body { min-width: 0; }
.speaker { margin-bottom: 2px; color: var(--muted); font-size: .78rem; font-weight: 850; overflow-wrap: anywhere; }
.line-text { font-size: 1.05rem; font-weight: 850; line-height: 1.45; overflow-wrap: anywhere; }
.translation { margin-top: 3px; color: var(--muted); font-size: .9rem; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.line-listen { width: 42px; min-height: 42px; padding: 0; color: #115e59; background: #f0fdfa; border: 1px solid #99f6e4; box-shadow: none; }
.blank { width: 100%; min-height: 48px; padding: 8px 11px; color: #475569; background: #fff; border: 2px dashed #94a3b8; box-shadow: none; overflow-wrap: anywhere; }
.blank.filled { color: #14532d; background: #ecfdf5; border-color: var(--good); }
.choice-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 12px; }
.choice-chip { min-width: 0; color: var(--text); background: #fff; border: 2px solid var(--border); box-shadow: none; overflow-wrap: anywhere; }
.choice-chip.selected { color: #fff; background: var(--accent); border-color: var(--accent); }
.choice-chip.used { opacity: .45; }

.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 13px; }
button, select { font: inherit; }
button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 14px; color: #fff; background: var(--accent); border: 0; border-radius: 8px; font-weight: 900; cursor: pointer; box-shadow: 0 8px 16px rgba(15, 118, 110, .15); }
button:hover { filter: brightness(.98); }
button:disabled { opacity: .6; cursor: not-allowed; }
.secondary { background: #111827; box-shadow: 0 8px 16px rgba(15, 23, 42, .12); }
.blue { background: var(--blue); box-shadow: 0 8px 16px rgba(37, 99, 235, .15); }
.light { color: #115e59; background: #f0fdfa; border: 1px solid #99f6e4; box-shadow: none; }
.good-btn { background: var(--good); box-shadow: 0 8px 16px rgba(21, 128, 61, .15); }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(37, 99, 235, .28); outline-offset: 3px; }
.feedback { min-height: 32px; margin-top: 10px; font-size: 1.05rem; font-weight: 900; text-align: center; }
.feedback.ok { color: var(--good); }
.feedback.no { color: var(--bad); }

.filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.filter-row label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: .83rem; font-weight: 900; }
select { width: 100%; min-height: 44px; padding: 10px 11px; color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: 8px; font-weight: 800; }
.small { margin: 14px 0; color: var(--muted); font-size: .94rem; line-height: 1.5; }
.role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 14px 0; }
.role-card { min-width: 0; padding: 13px; background: var(--soft); border: 1px solid var(--border); border-radius: 8px; line-height: 1.45; }
.role-card strong, .role-card span { display: block; overflow-wrap: anywhere; }
.role-card strong { margin-bottom: 4px; }
.role-a-text { color: var(--role-a); }
.role-b-text { color: var(--role-b); }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 17px; }
.list-heading > span { color: var(--muted); font-size: .86rem; font-weight: 850; white-space: nowrap; }
.scenario-list { max-height: 500px; overflow: auto; border-top: 1px solid var(--border); }
.scenario-card { width: 100%; min-width: 0; min-height: 64px; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; align-items: center; padding: 9px 4px; color: var(--text); background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; text-align: start; box-shadow: none; }
.scenario-card:hover, .scenario-card.active { color: #115e59; background: #f0fdfa; }
.scenario-emoji { font-size: 1.8rem; text-align: center; }
.scenario-name, .scenario-meta { display: block; overflow-wrap: anywhere; }
.scenario-name { font-weight: 900; }
.scenario-meta { margin-top: 3px; color: var(--muted); font-size: .84rem; font-weight: 750; }

.quiz-area { display: grid; gap: 14px; }
.quiz-controls { margin-top: 0; }
.quiz-question { min-height: 150px; display: grid; place-items: center; align-content: center; padding: 18px; background: var(--soft); border: 1px dashed #aebccd; border-radius: 8px; text-align: center; }
.quiz-big { max-width: 100%; min-height: 66px; display: grid; place-items: center; margin-bottom: 7px; color: var(--accent); font-size: 1.8rem; font-weight: 950; line-height: 1.35; overflow-wrap: anywhere; }
.quiz-prompt { color: var(--muted); font-weight: 850; line-height: 1.4; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.answer { min-width: 0; min-height: 66px; justify-content: flex-start; padding: 12px 14px; color: var(--text); background: #fff; border: 2px solid var(--border); text-align: start; line-height: 1.35; box-shadow: none; overflow-wrap: anywhere; }
.answer.correct { color: #14532d; background: #ecfdf5; border-color: var(--good); }
.answer.wrong { color: #7f1d1d; background: #fef2f2; border-color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; text-align: center; }
.stat { min-width: 0; padding: 12px 8px; background: var(--soft); border: 1px solid var(--border); border-radius: 8px; }
.num { font-size: 1.85rem; font-weight: 950; }
.label { color: var(--muted); font-size: .86rem; font-weight: 800; overflow-wrap: anywhere; }
.phrase-box { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.phrase-card { min-width: 0; padding: 14px; background: var(--soft); border: 1px solid var(--border); border-radius: 8px; line-height: 1.45; }
.phrase-card strong, .phrase-card span { display: block; overflow-wrap: anywhere; }
.phrase-card strong { margin-bottom: 7px; color: var(--accent); }
.phrase-card span + span { margin-top: 5px; }
footer { padding: 10px 18px 32px; color: var(--muted); text-align: center; }

@media (min-width: 960px) { .dialog-layout { grid-template-columns: minmax(0, 1fr) minmax(360px, .92fr); align-items: start; } }
@media (max-width: 760px) { h1 { font-size: 2rem; } .page-header { padding-top: 22px; } .card { padding: 16px; } .filter-row, .role-grid, .answers, .phrase-box { grid-template-columns: minmax(0, 1fr); } .scene-emoji { font-size: 4.2rem; } .scene-title { font-size: 1.55rem; } }
@media (max-width: 520px) { .line { grid-template-columns: 42px minmax(0, 1fr); } .line-listen { grid-column: 1 / -1; width: 100%; } .dialog-controls > *, .quiz-controls > * { flex: 1 1 100%; } }
