/* The listening/reading exam screen (practice/attempt.html) and the marked paper on
   the result page. Modelled on itongzhuo's computer-delivered listening/reading
   practice page: white top bar, plain Arial question paper, thin-bordered
   controls, and a question navigator pinned to the bottom. The site's global
   button/input/table styles are reset inside .lt so the paper looks like an
   exam, not like the rest of dearKiwi. */

body:has(.lt) { background: #fff; }
body:has(.lt) .topnav, body:has(.lt) .messages { display: none !important; }
main.lt-fullbleed { max-width: none; width: 100%; margin: 0; padding: 0; }

.lt, .lt-paper {
    --lt-ink: #111; --lt-bg: #fff; --lt-line: #d9d9d9; --lt-soft: #f6f6f6; --lt-muted: #666;
    --lt-focus: #2f6fd6; --lt-ok: #1e9e4a; --lt-bad: #d93025; --lt-answered: #1e9e4a; --lt-flag: #e8710a;
    --lt-fs: 15px;
    font-family: Arial, Helvetica, sans-serif; color: var(--lt-ink);
}
.lt { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--lt-bg); z-index: 10; }
.lt[data-size="l"], .lt-paper[data-size="l"] { --lt-fs: 17.5px; }
.lt[data-size="xl"], .lt-paper[data-size="xl"] { --lt-fs: 21px; }
.lt[data-contrast="wob"] { --lt-ink: #fff; --lt-bg: #000; --lt-line: #777; --lt-soft: #1b1b1b; --lt-muted: #ccc; }
.lt[data-contrast="yob"] { --lt-ink: #ffeb3b; --lt-bg: #000; --lt-line: #8a7d1e; --lt-soft: #1b1b00; --lt-muted: #e6d55a; }

.lt [hidden] { display: none !important; }

/* Reset the site-wide control styles. */
.lt button, .lt-paper button {
    background: none; color: inherit; border: none; box-shadow: none; padding: 0; border-radius: 0;
    font: inherit; font-weight: inherit; transform: none; transition: none; cursor: pointer;
}
.lt button:hover, .lt-paper button:hover { opacity: 1; transform: none; color: inherit; }
.lt label, .lt-paper label { font-weight: 400; display: flex; margin: 0; color: inherit; }
.lt table, .lt-paper table { width: auto; margin: 0; }
.lt th, .lt td, .lt-paper th, .lt-paper td { text-transform: none; letter-spacing: normal; color: inherit; font-size: inherit; text-align: left; }
.lt input[type=text], .lt-paper input[type=text] { width: auto; }
.lt input:focus, .lt-paper input:focus { box-shadow: none; }
.lt svg { width: 100%; height: 100%; fill: currentColor; }

/* ── Top bar ── */
.lt-top { flex: 0 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
    min-height: 56px; padding: 4px 18px; border-bottom: 1px solid var(--lt-line); background: var(--lt-bg); position: relative; z-index: 30; }
.lt-top-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.lt-brand { font-family: Inter, system-ui, sans-serif; font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em;
    color: var(--second); white-space: nowrap; }
.lt-brand span { color: var(--primary); }
.lt-brand .lt-brand-tld { color: var(--second); font-size: .6em; font-weight: 700; letter-spacing: 0; margin-left: 1px; }
.lt-brand:hover { text-decoration: none; }
.lt[data-contrast] .lt-brand, .lt[data-contrast] .lt-brand .lt-brand-tld { color: var(--lt-ink); }
.lt[data-contrast=""] .lt-brand, .lt[data-contrast=""] .lt-brand .lt-brand-tld { color: var(--second); }
.lt-meta { font-size: 14px; line-height: 1.45; min-width: 0; }
.lt-meta-line { display: flex; gap: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-meta-line span { overflow: hidden; text-overflow: ellipsis; }
.lt-elapsed { font-variant-numeric: tabular-nums; }

.lt-audio { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.lt .lt-play { width: 27px; height: 27px; border-radius: 50%; background: var(--lt-ink); color: var(--lt-bg); display: grid; place-items: center; flex: 0 0 auto; }
.lt-play svg { width: 15px; height: 15px; }
.lt-play .i-pause, .lt-play.playing .i-play { display: none; }
.lt-play.playing .i-pause { display: block; }
.lt-seek { -webkit-appearance: none; appearance: none; width: clamp(140px, 18vw, 250px); height: 2px; background: #c8c8c8; border: none; padding: 0; margin: 0; border-radius: 2px; cursor: pointer; }
.lt-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%; background: var(--lt-ink); border: none; }
.lt-seek::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--lt-ink); border: none; }
.lt-time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lt .lt-textbtn { font-size: 12px; padding: 2px 4px; }
.lt .lt-iconbtn { width: 24px; height: 24px; display: inline-grid; place-items: center; color: var(--lt-ink); flex: 0 0 auto; }
.lt .lt-iconbtn svg { width: 22px; height: 22px; }
.lt .lt-vol-btn { width: 18px; height: 18px; }
.lt-vol-btn .vol-mute, .lt-vol-btn.muted .vol-wave { display: none; }
.lt-vol-btn.muted .vol-mute { display: inline; }
.lt-pop-wrap { position: relative; display: inline-flex; }
.lt-pop { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--lt-bg); color: var(--lt-ink);
    border: 1px solid var(--lt-line); border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.14); padding: 6px; z-index: 60; font-size: 13px; white-space: nowrap; }
.lt-speed-menu { display: flex; flex-direction: column; min-width: 74px; }
.lt-speed-menu button { padding: 5px 10px !important; text-align: left; }
.lt-speed-menu button:hover, .lt-speed-menu button.on { background: var(--lt-soft) !important; font-weight: 700; }
.lt-vol-menu { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.lt-vol-menu input { width: 110px; }
.lt-bell-menu { left: auto; right: 0; transform: none; padding: 10px 14px; color: var(--lt-muted); }

.lt-top-right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.lt .lt-btn { height: 28px; padding: 0 12px; font-size: 13px; background: #faf6f6; color: #000; border: 1px solid #000; border-radius: 4px; white-space: nowrap; }
.lt .lt-btn:hover { background: #ebe6e6; color: #000; }
.lt[data-contrast="wob"] .lt-btn, .lt[data-contrast="yob"] .lt-btn { background: #000; color: var(--lt-ink); border-color: var(--lt-ink); }
.lt-wifi { cursor: default; }

/* ── Paper ── */
.lt-main { flex: 1; min-height: 0; position: relative; display: flex; }
.lt-scroll { flex: 1; overflow-y: auto; padding: 14px 70px 40px 28px; font-size: var(--lt-fs); line-height: 1.55; }
.lt-group { margin: 0 0 42px; max-width: 1240px; }
.lt-qrange { font-size: 1em; font-weight: 700; margin: 0 0 22px; color: var(--lt-ink); letter-spacing: 0; }
.lt-instr { margin: 0 0 20px; font-style: italic; }
.lt-instr b, .lt-instr strong { font-style: normal; font-weight: 700; }
.lt-instr p { margin: 0 0 14px; }
.lt-gtitle { text-align: center; font-weight: 700; font-size: 1.1em; margin: 0 0 18px; }

.lt-gapbody p { margin: 0 0 12px; }
.lt-gapbody h4 { font-size: 1em; margin: 18px 0 8px; }
.lt-gapbody ul { margin: 0 0 12px; padding-left: 22px; }
.lt-gapbody li { margin-bottom: 8px; }
.lt-gapbody table { border-collapse: collapse; width: 100%; margin: 4px 0 8px; }
.lt-gapbody th, .lt-gapbody td { border: 1px solid var(--lt-ink); padding: 6px 4px; vertical-align: middle; line-height: 2.1; border-bottom: 1px solid var(--lt-ink); }
.lt-gapbody th { text-align: center; font-weight: 700; }
.lt-scroll .lt-gap { display: inline-block; width: 150px; height: 21px; margin: 0 4px; padding: 0 6px; border: 1px solid #8a8a8a; border-radius: 2px;
    font: inherit; font-size: .92em; text-align: center; background: var(--lt-bg); color: var(--lt-ink); vertical-align: middle; }
.lt-scroll .lt-gap::placeholder { color: var(--lt-muted); font-weight: 700; opacity: 1; }
.lt-scroll .lt-gap:focus { border: 1.5px solid var(--lt-focus); outline: none; box-shadow: none; }
.lt-scroll .lt-gap.lt-current, .lt-scroll .lt-gap:focus { border-color: var(--lt-focus); }

.lt-q { margin: 0 0 30px; padding: 2px 0; }
.lt-q-text { margin: 0 0 12px; display: flex; gap: 10px; align-items: baseline; }
.lt-qnum { display: inline-block; min-width: 26px; padding: 0 5px; text-align: center; border: 1px solid transparent; line-height: 1.35; }
.lt-q.lt-current .lt-qnum { border-color: var(--lt-focus); color: var(--lt-focus); }
.lt-opt { align-items: center; gap: 8px; margin: 0 0 12px 22px !important; cursor: pointer; width: fit-content; }
.lt-opt input { width: 15px; height: 15px; margin: 0; accent-color: var(--lt-focus); cursor: pointer; flex: 0 0 auto; }
.lt-opt-key { display: none; }
.lt-g-multi_choice .lt-opt-key, .lt-paper .lt-opt-key { display: inline; font-weight: 700; min-width: 14px; }

.lt-match { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 18px 60px; align-items: start; }
.lt-match-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 9px; }
.lt-drop { display: inline-flex; align-items: center; justify-content: center; min-width: 200px; min-height: 27px; padding: 2px 14px;
    border: 1px dashed #8a8a8a; background: var(--lt-bg); cursor: pointer; font-size: .95em; }
.lt-drop.filled { border-style: solid; border-color: var(--lt-ink); }
.lt-drop.over, .lt-drop.lt-current { border-color: var(--lt-focus); border-style: solid; box-shadow: 0 0 0 1px var(--lt-focus) inset; }
.lt-drop.target-ready { border-color: var(--lt-focus); }
.lt-match-bank { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.lt-bank-title { font-weight: 700; margin-bottom: 4px; }
.lt-drag { display: inline-block; padding: 3px 14px; border: 1px solid var(--lt-ink); background: var(--lt-bg); cursor: grab; user-select: none; font-size: .95em; }
.lt-drag.picked { outline: 2px solid var(--lt-focus); outline-offset: 1px; }
.lt-drag.used { display: none; }
.lt-drag.dragging { opacity: .4; }

.lt-map { display: flex; flex-wrap: wrap; gap: 26px; align-items: flex-start; }
.lt-map-img { max-width: min(520px, 100%); height: auto; border: 1px solid var(--lt-line); }
.lt-map-grid { border-collapse: collapse; font-size: .92em; }
.lt-map-grid th, .lt-map-grid td { border: 1px solid var(--lt-line) !important; padding: 9px 12px !important; text-align: center !important; }
.lt-map-grid th { font-weight: 700; }
.lt-map-grid .lt-map-label { text-align: left !important; min-width: 180px; }
.lt-map-grid input { width: 15px; height: 15px; margin: 0; accent-color: var(--lt-focus); cursor: pointer; }
.lt-map-grid tr.lt-current .lt-map-label { color: var(--lt-focus); font-weight: 700; }

/* Highlights */
mark.lt-hl { background: #ffe94d; color: #000; padding: 0; }
mark.lt-hl.has-note { background: #ffd28a; border-bottom: 2px solid var(--lt-flag); }

/* Flag that tracks the current question */
.lt .lt-flag { position: absolute; right: 26px; top: 40px; width: 26px; height: 26px; color: #999; z-index: 5; transition: top .15s; }
.lt .lt-flag svg { fill: none; }
.lt .lt-flag.on { color: var(--lt-flag); }
.lt .lt-flag.on svg { fill: currentColor; }

/* Notes panel */
.lt-notes { flex: 0 0 300px; border-left: 1px solid var(--lt-line); background: var(--lt-soft); overflow-y: auto; padding: 12px 14px; font-size: 14px; }
.lt-notes-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.lt-notes-head .lt-iconbtn { font-size: 22px; }
.lt-notes-empty { color: var(--lt-muted); }
.lt-note { background: var(--lt-bg); border: 1px solid var(--lt-line); border-radius: 4px; padding: 8px; margin-bottom: 10px; }
.lt-note q { display: block; font-style: italic; color: var(--lt-muted); margin-bottom: 6px; cursor: pointer; }
.lt-note textarea { width: 100%; min-height: 64px; font: inherit; font-size: 13px; border: 1px solid var(--lt-line); border-radius: 3px; padding: 6px; background: var(--lt-bg); color: var(--lt-ink); resize: vertical; }
.lt-note-del { font-size: 12px; color: var(--lt-bad) !important; margin-top: 4px; }

/* ── Bottom navigator ── */
.lt-foot { flex: 0 0 auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 16px 8px; position: relative; min-height: 50px; }
.lt-nav { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 0 1px; font-size: 12px; }
.lt-nav-part { padding: 6px 22px 1px 8px; border-top: 2px solid var(--lt-line); margin-right: 4px; }
.lt .lt-nav-q { min-width: 22px; padding: 4px 3px 1px !important; border-top: 3px solid var(--lt-line) !important; text-align: center; position: relative; line-height: 1.2; font-size: 12px; }
.lt .lt-nav-q.answered { border-top-color: var(--lt-answered) !important; }
.lt .lt-nav-q.current { outline: 1.5px solid var(--lt-focus); outline-offset: -1px; }
.lt .lt-nav-q.flagged::after { content: ""; position: absolute; top: -9px; right: 1px; width: 6px; height: 6px; border-radius: 50%; background: var(--lt-flag); }
.lt-arrows { display: flex; gap: 6px; position: absolute; right: 16px; bottom: 58px; z-index: 6; }
.lt .lt-arrow { width: 40px; height: 40px; display: grid; place-items: center; background: #111; color: #fff; border-radius: 3px; }
.lt .lt-arrow svg { width: 22px; height: 22px; }
.lt .lt-arrow:disabled { background: #e9e9e9; color: #c4c4c4; cursor: default; }

/* ── Options menu ── */
.lt-options { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); width: min(420px, 92vw); background: var(--lt-bg); color: var(--lt-ink);
    border: 1px solid var(--lt-line); box-shadow: 0 10px 34px rgba(0,0,0,.22); z-index: 70; }
.lt-options-head { position: relative; text-align: center; padding: 10px; border-bottom: 1px solid var(--lt-line); font-size: 15px; }
.lt .lt-options-back { position: absolute; left: 12px; top: 4px; font-size: 26px; line-height: 1; }
.lt-options-page { display: flex; flex-direction: column; padding: 6px 14px 12px; }
.lt-options-page button { display: flex !important; align-items: center; gap: 12px; padding: 12px 6px !important; border-bottom: 1px solid var(--lt-line) !important; font-size: 14px; text-align: left; }
.lt-options-page button:last-child { border-bottom: none !important; }
.lt-options-page button span { width: 18px; text-align: center; color: var(--lt-muted); }
.lt-options-page button i { margin-left: auto; font-style: normal; font-size: 20px; color: var(--lt-muted); }
.lt-options-page button.on { font-weight: 700; }
.lt-options-page button.on::after { content: "✓"; margin-left: auto; color: var(--lt-ok); }
.lt-options-text { font-size: 14px; line-height: 1.55; padding-top: 12px; }
.lt-options-text p { margin: 0 0 10px; }

/* Selection menu */
.lt-ctx { position: fixed; z-index: 80; display: flex; background: #222; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.25); overflow: hidden; }
.lt .lt-ctx button { color: #fff; font-size: 13px; padding: 7px 12px; }
.lt .lt-ctx button:hover { background: #444; color: #fff; }
.lt .lt-ctx button[hidden] { display: none; }

/* Overlays */
.lt-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 90; }
.lt-overlay[hidden] { display: none; }
.lt-modal { background: #fff; color: #111; width: min(400px, 90vw); padding: 26px 26px 22px; border-radius: 4px; text-align: center; box-shadow: 0 18px 50px rgba(0,0,0,.3); font-family: Arial, sans-serif; }
.lt-modal h2 { margin: 0 0 8px; font-size: 19px; color: #111; }
.lt-modal p { margin: 0 0 20px; color: #444; font-size: 14px; line-height: 1.5; }
.lt-modal-actions { display: flex; justify-content: center; gap: 12px; }
.lt .lt-modal-primary, .lt .lt-modal-secondary { height: 34px; padding: 0 22px; font-size: 14px; border-radius: 4px; border: 1px solid #111; font-weight: 700; }
.lt .lt-modal-primary { background: #111; color: #fff; }
.lt .lt-modal-primary:hover { background: #333; color: #fff; }
.lt .lt-modal-secondary { background: #fff; color: #111; }

.lt-toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #222; color: #fff; padding: 8px 16px; border-radius: 4px; font-size: 13px; z-index: 95; }

/* ── Marked paper on the result page ── */
.lt-paper { font-size: var(--lt-fs); line-height: 1.55; }
.lt-paper .lt-gap-review { display: inline-block; min-width: 110px; padding: 0 8px; margin: 0 4px; border: 1px solid; border-radius: 2px; text-align: center; font-size: .92em; }
.lt-paper .lt-gap-review b { margin-right: 4px; }
.lt-paper .ok { border-color: var(--lt-ok); color: var(--lt-ok); }
.lt-paper .bad { border-color: var(--lt-bad); color: var(--lt-bad); }
.lt-paper .lt-gap-key { color: var(--lt-ok); font-weight: 700; margin-right: 6px; font-size: .92em; }
.lt-paper .lt-gap-key::before { content: "✓ "; }
.lt-paper .lt-opt { margin: 0 0 10px 22px; cursor: default; padding: 1px 8px; border-radius: 3px; }
.lt-paper .lt-opt.is-key { background: rgba(30,158,74,.12); color: var(--lt-ok); font-weight: 700; }
.lt-paper .lt-opt.is-wrong { background: rgba(217,48,37,.10); color: var(--lt-bad); text-decoration: line-through; }
.lt-paper .lt-drop { cursor: default; }
.lt-paper .lt-drag { cursor: default; }
.lt-paper .lt-map-grid td.is-key { background: rgba(30,158,74,.16); }
.lt-paper .lt-map-grid td.is-wrong { background: rgba(217,48,37,.14); }
.lt-paper .lt-map-grid tr.ok .lt-map-label { color: var(--lt-ok); }
.lt-paper .lt-map-grid tr.bad .lt-map-label { color: var(--lt-bad); }

@media (max-width: 980px) {
    .lt-top { grid-template-columns: 1fr auto; grid-template-areas: "left right" "audio audio"; padding: 6px 12px; row-gap: 4px; }
    .lt-top-left { grid-area: left; } .lt-top-right { grid-area: right; gap: 8px; } .lt-audio { grid-area: audio; justify-content: center; }
    .lt-wifi, #lt-bell-btn { display: none !important; }
}
@media (max-width: 640px) {
    .lt-meta { display: none; }
    .lt-scroll { padding: 12px 44px 30px 14px; }
    .lt .lt-btn { padding: 0 8px; font-size: 12px; }
    .lt-match { grid-template-columns: 1fr; }
    .lt-drop { min-width: 150px; }
    .lt-notes { position: absolute; inset: 0 0 0 auto; width: 88vw; z-index: 20; }
    .lt-arrows { bottom: 64px; }
    .lt-gapbody table { display: block; overflow-x: auto; }
    .lt-map-grid { display: block; overflow-x: auto; }
}

/* ── Reading: passage | divider | questions (itongzhuo's reading screen) ── */
.lt-reading .lt-passage { flex: 0 0 58%; padding: 14px 34px 40px 28px; }
.lt-reading .lt-questions { flex: 1 1 0; min-width: 0; padding: 14px 60px 40px 22px; }
.lt-ptitle { text-align: center; font-size: 1.06em; font-weight: 700; margin: 0 0 4px; color: var(--lt-ink); letter-spacing: 0; }
.lt-psub { text-align: center; margin: 0 0 18px; font-size: .95em; }
.lt-ptext { font-size: .93em; line-height: 1.6; }
.lt-ptext p { margin: 0 0 16px; }
.lt-ptext h4, .lt-ptext .lt-para { font-size: 1em; font-weight: 700; margin: 18px 0 4px; }
.lt-ptext img { max-width: 100%; height: auto; }
.lt-divider { flex: 0 0 12px; position: relative; cursor: col-resize; background: transparent; touch-action: none; }
.lt-divider::before { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 4px; background: #c9c9c9; border-radius: 2px; }
.lt-divider span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 26px; height: 22px;
    display: grid; place-items: center; background: var(--lt-bg); color: var(--lt-ink); border: 1px solid var(--lt-ink); border-radius: 2px; }
.lt-divider span svg { width: 16px; height: 16px; }
.lt-divider:focus-visible span, .lt-divider.dragging span { outline: 2px solid var(--lt-focus); }
.lt.resizing, .lt.resizing * { cursor: col-resize !important; user-select: none !important; }

/* Heading slots across the top of each passage section */
.lt-drop.lt-drop-heading { display: flex; width: calc(100% - 40px); min-height: 22px; margin: 2px 0 6px; padding: 1px 12px;
    border: 1px dashed var(--lt-focus); color: var(--lt-ink); font-size: .95em; }
.lt-drop.lt-drop-heading.filled { border-style: solid; border-color: var(--lt-ink); font-weight: 700; }
.lt-match-headings { display: block; }
.lt-reading .lt-match { grid-template-columns: minmax(0, 1fr) auto; gap: 14px 28px; }
.lt-reading .lt-questions, .lt-reading .lt-passage { padding-bottom: 110px; }
.lt-match-headings .lt-match-bank { gap: 10px; }

/* Reading choice questions show their letters, like itongzhuo */
.lt-reading .lt-opt-key { display: inline; }
.lt-reading .lt-opt-key::after { content: "."; }
.lt-reading .lt-q-text { font-weight: 700; }
.lt-g-tfng .lt-q { margin-bottom: 26px; }

.lt-paper-passage { max-height: 520px; overflow-y: auto; padding-right: 8px; }
.lt-paper .lt-drop.lt-drop-heading { width: auto; }
.lt-paper .lt-drop.filled.ok { border-color: var(--lt-ok); color: var(--lt-ok); }
.lt-paper .lt-drop.filled.bad { border-color: var(--lt-bad); color: var(--lt-bad); }

@media (max-width: 860px) {
    .lt-reading .lt-main { flex-direction: column; }
    .lt-reading .lt-passage { flex: 0 0 45% !important; padding: 12px 16px; border-bottom: 2px solid var(--lt-line); }
    .lt-reading .lt-divider { display: none; }
    .lt-reading .lt-questions { padding: 12px 44px 30px 14px; }
}
