/* TTP-style reading layout, header score bar and celebration. Loaded after style.css. */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
[id] { scroll-margin-top: 96px; }

/* ---------- score bar (XP, streak, sound, version) ---------- */
.hud { display: flex; align-items: center; gap: 8px; margin-left: auto; white-space: nowrap; }
.hud-chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border: 1px solid #ffffff2e; border-radius: 99px; background: #ffffff14; color: #fff; font-size: 14px; text-decoration: none; }
a.hud-chip:hover { background: #ffffff26; }
.hud-chip b { font-variant-numeric: tabular-nums; }
.hud-chip.bump { animation: hud-bump .6s cubic-bezier(.2,.8,.2,1.4); }
@keyframes hud-bump { 0% { transform: scale(1); } 40% { transform: scale(1.22); background: #f5c84c55; } 100% { transform: scale(1); } }
.hud-sound { width: 34px; height: 34px; border: 1px solid #ffffff2e; border-radius: 50%; background: #ffffff14; color: #fff; font-size: 15px; line-height: 1; padding: 0; }
.hud-sound[aria-pressed="false"] { opacity: .6; }
.hud-ver { color: #9db4c6; font-size: 11px; letter-spacing: .3px; }
.site-header .hud { margin-right: 14px; }
@media (max-width: 900px) { .site-header .hud { margin-left: auto; margin-right: 4px; } }
@media (max-width: 640px) {
  .hud-long, .hud-ver { display: none; }
  .hud { gap: 6px; }
  .hud-chip { padding: 4px 9px; font-size: 13px; }
  .hud-sound { width: 30px; height: 30px; font-size: 13px; }
}

/* ---------- lesson header: Back to Chapters | index | Chapter Progress ---------- */
.lesson-page .study-head { background: #102f43; color: #fff; position: sticky; top: 0; z-index: 40; box-shadow: 0 2px 8px #0f2d4433; }
.study-head .sh-in { max-width: 1680px; margin: 0 auto; min-height: 76px; padding: 10px clamp(14px, 3vw, 44px); display: flex; align-items: center; gap: clamp(12px, 2vw, 26px); }
.sh-back { color: #8fd0f2 !important; font-weight: 700; font-size: 18px; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.sh-back:hover { color: #fff !important; }
.sh-sep { width: 1px; align-self: stretch; margin: 8px 0; background: #ffffff33; }
.sh-index { background: none; border: 0; color: #8fd0f2; padding: 8px; border-radius: 6px; display: inline-flex; }
.sh-index:hover, .sh-index[aria-expanded="true"] { background: #ffffff18; color: #fff; }
.sh-progress { flex: 1; min-width: 0; max-width: 780px; }
.sh-prow { display: flex; justify-content: space-between; gap: 12px; font-size: 16px; font-weight: 600; color: #e8f3fa; }
.sh-prow b { color: #fff; }
.sh-bar { height: 6px; margin-top: 8px; border-radius: 99px; background: #2f5470; overflow: hidden; }
.sh-bar i { display: block; height: 100%; min-width: 6px; border-radius: inherit; background: #3d93d6; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.sh-progress.done .sh-bar i { background: linear-gradient(90deg, #2fae78, #e3b23c); }
@media (max-width: 760px) {
  .study-head .sh-in { flex-wrap: wrap; row-gap: 6px; min-height: 0; padding-block: 10px; }
  .sh-back { font-size: 16px; }
  .sh-back-text { display: none; }
  .sh-back::after { content: "Chapters"; }
  .sh-progress { order: 5; flex-basis: 100%; max-width: none; }
  .sh-prow { font-size: 14px; }
}

/* ---------- full-width lesson column (no side column; index is a drawer) ---------- */
.lesson-page .lwrap { display: block; max-width: 1240px; margin: 34px auto 0; padding: 0 clamp(12px, 3vw, 40px) 24px; }
.lesson-page .lcard { border: 1px solid #e1e7ec; border-radius: 6px; box-shadow: 0 1px 3px #0f2d440d; padding: clamp(26px, 5vw, 72px) clamp(18px, 7vw, 110px) clamp(30px, 5vw, 64px); }
.lesson-page .chtitle { color: #1b78b4; font-weight: 300; font-size: clamp(34px, 5.4vw, 64px); line-height: 1.12; margin: 0 0 22px; letter-spacing: -.5px; }
.lesson-page .lestitle { color: #1f2f3c; font-weight: 700; font-size: clamp(22px, 2.6vw, 32px); margin: 0 0 24px; }
.lesson-page .blk-text, .lesson-page .blk-text p, .lesson-page .blk-text li { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.75; color: #4a5866; }
.lesson-page .blk-text p, .lesson-page .blk-text ul { max-width: none; }
.lesson-page .blk-hl { background: none; padding: 0; }
.lesson-page .blk-hl strong:first-child { background: #f8eb9e; padding: 2px 4px; }
.lesson-page .blk-must { border: 1.5px solid #1f5e45; border-radius: 6px; background: #f3f9f5; }
.sidenav { z-index: 15; }

/* ---------- slide-out chapter index (same on phone and laptop) ---------- */
.lesson-drawer { position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; width: min(430px, 92vw); background: #fff; box-shadow: 8px 0 30px #0f2d4440; transform: translateX(-104%); transition: transform .32s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; overflow: hidden; outline: none; }
.lesson-drawer.open { transform: none; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 55; background: #0f2d4466; opacity: 0; transition: opacity .3s; }
.drawer-backdrop.show { opacity: 1; }
.drawer-head { display: flex; align-items: center; gap: 16px; padding: 22px 20px 18px 22px; border-bottom: 1px solid #e3e9ee; }
.drawer-head h2 { margin: 0; color: #1b5e8e; font-size: 19px; font-weight: 600; line-height: 1.3; }
.drawer-head p { margin: 3px 0 0; color: #6a7b88; font-size: 14px; }
.drawer-ring { --p: 0; flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #1b5e8e; font-size: 22px; background: radial-gradient(#fff 58%, transparent 60%), conic-gradient(#2fae78 calc(var(--p) * 1%), #e4dec4 0); }
.drawer-x { margin-left: auto; align-self: flex-start; background: none; border: 0; font-size: 32px; line-height: 1; color: #5b6b78; padding: 0 4px; }
.lesson-drawer nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.timeline { list-style: none; margin: 0; padding: 10px 0; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: 33px; top: 0; bottom: 0; width: 2px; background: #dce6ee; }
.timeline li:first-child::before { top: 26px; }
.timeline li:last-child::before { bottom: calc(100% - 26px); }
.timeline li.tl-completed::before { background: #2fae78; }
.timeline a { position: relative; display: grid; grid-template-columns: 26px auto minmax(0, 1fr); gap: 2px 12px; align-items: baseline; padding: 14px 20px 14px 21px; color: #2d4a5e; text-decoration: none; font-size: 16px; line-height: 1.4; border-left: 3px solid transparent; }
.timeline a:hover { background: #f2f8fc; }
.timeline a[aria-current="page"] { background: #eaf4fb; border-left-color: #1b78b4; font-weight: 700; }
.tl-dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #c9d6e0; background: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800; line-height: 1; align-self: center; }
.tl-completed .tl-dot { background: #2fae78; border-color: #2fae78; color: #fff; }
.tl-in_progress .tl-dot { border-color: #c0494a; color: #c0494a; }
.timeline .chapter-link-number { color: #50687a; font-variant-numeric: tabular-nums; }
.timeline .chapter-link-state { grid-column: 3; font-size: 12px; font-weight: 600; color: #6a7b88; }
.timeline .chapter-link-state[data-lesson-state="completed"] { color: #1f7a54; }
.timeline .chapter-link-state[data-lesson-state="in_progress"] { color: #a33d3e; }
.drawer-foot { border-top: 1px solid #e3e9ee; padding: 16px 22px 20px; display: grid; gap: 6px; font-size: 14px; }
.drawer-foot progress { width: 100%; height: 8px; accent-color: #2fae78; }
.drawer-next { font-weight: 700; }
body.drawer-open { overflow: hidden; }

/* ---------- example questions (TTP "Example 1 ———" cards) ---------- */
.lesson-page .blk-ex { border: 1px solid #dfe5ea; border-top: 5px solid #e6eaee; border-radius: 2px; background: #fff; padding: clamp(22px, 3vw, 40px) clamp(18px, 3.4vw, 48px); margin: 40px 0; box-shadow: none; }
.lesson-page .blk-ex .exh { display: flex; align-items: center; gap: 22px; margin-bottom: 18px; }
.lesson-page .blk-ex .exh h3 { margin: 0; color: #1b78b4; font-weight: 400; font-size: clamp(22px, 2.2vw, 30px); white-space: nowrap; }
.lesson-page .blk-ex .exh::after { content: ""; flex: 1; height: 2px; background: #cfe3f0; }
.lesson-page .blk-ex .q { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.7; color: #3e4d59; }
.lesson-page .blk-ex .opt { font-size: clamp(18px, 1.6vw, 21px); padding: 10px 8px; border-radius: 4px; }
.lesson-page .blk-ex .confirm { margin-top: 18px; padding: 16px 38px; border: 1.5px solid #9fb0bd; background: #fff; color: #1b5e8e; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; font-size: 16px; border-radius: 2px; }
.lesson-page .blk-ex .confirm:disabled { color: #9fb0bd; }
.lesson-page .blk-ex .confirm:not(:disabled):hover { background: #1b5e8e; color: #fff; border-color: #1b5e8e; }
.level-tag { display: inline-block; margin-left: 10px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; vertical-align: middle; }
.level-easy { background: #e3f5ec; color: #1f7a54; }
.level-medium { background: #fff3d6; color: #8a6200; }
.level-hard { background: #fde6e6; color: #a33d3e; }

/* ---------- finish box, bottom buttons, progress strip ---------- */
.lesson-page .helpful { border: 1px solid #dfe5ea; border-radius: 2px; }
.lesson-page .botbar { position: static; background: transparent; padding: 10px clamp(12px, 3vw, 40px) 90px; }
.lesson-page .botbar .in { max-width: 1240px; }
.lesson-page .botbar a { border-radius: 2px; padding: 16px 44px; font-size: 16px; letter-spacing: .6px; }
.lesson-page .botbar a.next { background: #1b5e8e; border-color: #1b5e8e; }
.trial { box-shadow: 0 -1px 0 #b9dcf2; }
@media (max-width: 600px) {
  .lesson-page .botbar a { padding: 14px 22px; }
  .lesson-page .lcard { padding-inline: 16px; border-radius: 0; border-inline: 0; }
  .lesson-page .lwrap { padding-inline: 0; margin-top: 0; }
}

/* ---------- chapters page ---------- */
.pagehead { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; }
.pagehead h1 { color: #1b78b4; font-weight: 300; font-size: clamp(38px, 4.6vw, 58px); margin: 18px 0; }
.course-badge { display: inline-block; padding: 6px 16px; border-radius: 4px; background: linear-gradient(180deg, #d7a12e, #b88412); color: #fff; font-weight: 700; letter-spacing: 1.5px; font-size: 16px; box-shadow: inset 0 -2px 0 #0002; border-left: 1px solid #c9d6e0; }
.pagehead h1 + .course-badge { margin-left: -4px; position: relative; }
.pagehead h1 + .course-badge::before { content: ""; position: absolute; left: -18px; top: 6px; bottom: 6px; width: 1px; background: #cfd9e1; }

/* ---------- celebration ---------- */
.ttp-confetti { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.ttp-toast { position: fixed; left: 50%; top: 18%; z-index: 91; transform: translate(-50%, -10px) scale(.9); opacity: 0; background: #fff; border-radius: 14px; box-shadow: 0 18px 50px #0f2d4440; padding: 26px 34px 24px; text-align: center; min-width: min(360px, 88vw); transition: opacity .35s, transform .45s cubic-bezier(.2,.8,.2,1.3); pointer-events: none; }
.ttp-toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.ttp-toast .big { font-size: 46px; line-height: 1; }
.ttp-toast h3 { margin: 10px 0 4px; color: #0f2d44; font-size: 22px; }
.ttp-toast p { margin: 0; color: #4a5866; font-size: 15px; }
.ttp-toast .xp { display: inline-block; margin-top: 12px; padding: 5px 16px; border-radius: 99px; background: #fff6cf; color: #8a6200; font-weight: 800; }
.sparkle-hit { animation: sparkle-hit .7s ease-out; }
@keyframes sparkle-hit { 0% { box-shadow: 0 0 0 0 #2fae7866; } 100% { box-shadow: 0 0 0 14px #2fae7800; } }

/* ---------- fixes after screenshot review ---------- */
.site-header { gap: 16px; }
.site-header .brand { flex: none; }
.menu { gap: 20px; }
.menu a { white-space: nowrap; }
.site-header .hud { order: 0; }
@media (max-width: 1320px) { .site-header .hud-long, .site-header .hud-ver { display: none; } .menu { gap: 16px; } .menu a { font-size: 14px; } }
@media (max-width: 900px) { .site-header { gap: 8px; padding: 0 12px; } .site-header .hud { margin-left: auto; } .burger { flex: none; } }
@media (max-width: 420px) { .brand-main { font-size: 16px; letter-spacing: 1.2px; } .brand-by { font-size: 8.5px; letter-spacing: 2px; } .site-header .hud-sound { display: none; } }
.pagehead h1 + .course-badge { margin-left: 18px; }
.pagehead h1 + .course-badge::before { left: -19px; }
.lesson-page .blk-must .tag { background: none; color: #1f5e45; padding: 0; margin: 0 0 6px; font-size: clamp(20px, 2vw, 24px); font-weight: 700; text-transform: none; letter-spacing: 0; display: block; }
.lesson-page .blk-ex .extool { display: none; }
.lesson-page .blk-ex.answered .extool { display: block; float: right; margin-top: -6px; }
.lesson-page .blk-ex .again { border: 1px solid #dfe5ea; background: #fff; color: #1b5e8e; border-radius: 4px; padding: 6px 12px; font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; box-shadow: none; }
.reading-tools-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 8px; }
.reading-tools-actions::-webkit-scrollbar { display: none; }
.reading-tools-actions > * { flex: none; }
@media (max-width: 600px) { .trial { font-size: 14px; gap: 6px; } .reading-tools-actions button, .reading-tools summary { font-size: 13px; padding: 7px 10px; } }
.drawer-foot progress { appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; background: #e3e9ee; overflow: hidden; }
.drawer-foot progress::-webkit-progress-bar { background: #e3e9ee; border-radius: 99px; }
.drawer-foot progress::-webkit-progress-value { background: #2fae78; border-radius: 99px; }
.drawer-foot progress::-moz-progress-bar { background: #2fae78; border-radius: 99px; }

/* ---------- course switcher (right side of the Chapters heading) ---------- */
.course-switch { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid #d5e2eb; border-radius: 99px; background: #fff; box-shadow: 0 1px 3px #0f2d440f; }
.course-switch .cs-label { padding: 0 8px 0 10px; color: #6a7b88; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.course-switch a { padding: 8px 18px; border-radius: 99px; color: #1b5e8e; text-decoration: none; font-weight: 700; font-size: 15px; transition: background .2s, color .2s; }
.course-switch a:hover { background: #eaf4fb; }
.course-switch a[aria-current="page"] { background: #0f2d44; color: #fff; }
@media (max-width: 640px) { .course-switch { margin-left: 0; width: 100%; justify-content: space-between; } .course-switch a { flex: 1; text-align: center; } }
