/* 听力练习 lobby — 书架 (listening-lobby.blade.php + partials/listening-lobby, user's pick 2026-11-01):
   English / Bahasa Melayu switch, one sideways shelf per section, then "Paper 4 考什么".
   Neutrals are the --pa-* colours of the listening page (main.pui-a); the macaron tones are
   the speaking lobby's, set here for light and (by hand) dark — no gen.py needed. */

/* Spacing as the speaking lobby: no padding of our own on the sides or top — the page's 24px
   (phones: 5px on top, see the media query), so the tabs sit right under the header bar. */
.ll { display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 760px; margin: 0 auto; padding: 0 0 48px; box-sizing: border-box; color: var(--pa-text); }
.ll [hidden] { display: none !important; }
.llv a { color: inherit; text-decoration: none; }

.llv { --t-aqua: #dcf3f1; --t-aqua-ink: #2c7470; --t-lilac: #ece8fb; --t-lilac-ink: #5b4fa3; --t-peach: #ffe9e0; --t-peach-ink: #a2462a;
       --t-butter: #fff5cf; --t-butter-ink: #8a6b00; --t-mint: #e3f5e6; --t-mint-ink: #2f7a45; --t-pink: #fde7ec; --t-pink-ink: #b0485f; }
:root[data-theme="dark"] .llv { --t-aqua: #1b2a29; --t-aqua-ink: #7bc2bd; --t-lilac: #2a2733; --t-lilac-ink: #b5afff; --t-peach: #30221d; --t-peach-ink: #f99576;
       --t-butter: #251e04; --t-butter-ink: #c7a752; --t-mint: #1c281f; --t-mint-ink: #7bc58c; --t-pink: #302226; --t-pink-ink: #f28398; }
.llv [data-tone="aqua"] { --bg: var(--t-aqua); --ink: var(--t-aqua-ink); }
.llv [data-tone="lilac"] { --bg: var(--t-lilac); --ink: var(--t-lilac-ink); }
.llv [data-tone="peach"] { --bg: var(--t-peach); --ink: var(--t-peach-ink); }
.llv [data-tone="butter"] { --bg: var(--t-butter); --ink: var(--t-butter-ink); }
.llv [data-tone="mint"] { --bg: var(--t-mint); --ink: var(--t-mint-ink); }
.llv [data-tone="pink"] { --bg: var(--t-pink); --ink: var(--t-pink-ink); }

/* English / Bahasa Melayu + 练习记录: the speaking lobby's row (320px tabs with a sliding pill, a 46px round button). */
.llv-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.llv-lang { position: relative; display: flex; flex: 0 1 320px; min-width: 0; padding: 4px; border-radius: 999px; background: var(--pa-soft); }
.llv-lang button { position: relative; z-index: 1; flex: 1; padding: 9px 0; border: 0; background: none; color: var(--pa-muted); font: inherit; font-size: 14px; line-height: 21px; font-weight: 600; cursor: pointer; transition: color 0.25s; }
.llv-lang button.is-on { color: var(--pa-ink); }
.llv-lang i { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--pa-card); transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.llv[data-lang="ms"] .llv-lang i { transform: translateX(100%); }
.llv-hist { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--pa-soft); color: var(--pa-ink) !important; transition: background 0.2s, color 0.2s, transform 0.2s; }
.llv-hist .material-symbols-outlined { font-size: 20px; }
.llv-hist:hover { background: var(--t-peach); color: var(--t-peach-ink) !important; }
.llv-hist:active { transform: scale(0.94); }
.llv-pane { display: none; flex-direction: column; gap: 22px; }
.llv[data-lang="en"] .llv-pane[data-lang="en"], .llv[data-lang="ms"] .llv-pane[data-lang="ms"] { display: flex; }

/* Sections */
.llv-sec { display: flex; flex-direction: column; gap: 10px; }
.llv-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 4px; }
.llv-sec-head h2 { margin: 0; color: var(--pa-ink); font-size: 16px; font-weight: 800; }
.llv-sec-head h2 small { color: var(--pa-muted); font-size: 12.5px; font-weight: 600; }
.llv-sec-count { color: var(--pa-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.llv-cerdek { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--t-peach); color: var(--t-peach-ink); font-size: 13px; line-height: 22px; vertical-align: 1px; }
.llv-empty { margin: 4px; color: var(--pa-muted); font-size: 14px; }

/* Shelf: small covers that swipe sideways */
/* The shelf runs to the page's edges (its 24px padding), its first cover lined up with the content. */
.lld-shelf { display: flex; gap: 10px; margin: 0 -24px; padding: 2px 24px 6px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 24px; scrollbar-width: none; }
.lld-shelf::-webkit-scrollbar { display: none; }
.lld-item { flex: 0 0 116px; display: flex; flex-direction: column; gap: 3px; min-width: 0; scroll-snap-align: start; }
.lld-cover { position: relative; display: grid; place-items: center; height: 132px; border-radius: 22px; background: var(--bg); color: var(--ink); }
.lld-cover .material-symbols-outlined { font-size: 30px; }
.lld-cover b { font-size: 24px; }
.lld-cover b small { font-size: 13px; opacity: 0.7; }
.lld-cover-tag { position: absolute; top: 10px; left: 10px; padding: 0 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.7); font-size: 11px; font-weight: 800; line-height: 18px; }
:root[data-theme="dark"] .lld-cover-tag { background: rgba(20, 20, 20, 0.6); }
/* Done: the same pastel card (user 2026-11-01: the dark solid one clashed) — best score in the
   card's ink, a small check top right, a thin bar for how much was right. */
.lld-item.is-done .lld-cover b { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.lld-item.is-done .lld-cover b small { margin-left: 1px; font-size: 14px; font-weight: 700; opacity: 0.55; }
.lld-done-check { position: absolute; top: 9px; right: 9px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 15px !important; font-weight: 700; }
.lld-cover-bar { position: absolute; left: 14px; right: 14px; bottom: 14px; height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 16%, transparent); overflow: hidden; }
.lld-cover-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.lld-item strong { overflow: hidden; color: var(--pa-ink); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.lld-item small { overflow: hidden; color: var(--pa-muted); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.lld-item.is-soon .lld-cover { background: var(--pa-soft); color: var(--pa-muted); }
.lld-item.is-soon strong { color: var(--pa-muted); }
a.lld-item:hover .lld-cover { filter: brightness(0.97); }

/* Paper 4 / Kertas 4 考什么 */
.llf-parts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.llf-part { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 20px; background: var(--bg); color: var(--ink); }
.llf-part-icon { margin-bottom: 6px; font-size: 22px; }
.llf-part-top { font-size: 12px; opacity: 0.8; }
.llf-part strong { font-size: 16px; }
.llf-part small { font-size: 12px; line-height: 1.45; opacity: 0.8; }
.llf-note { margin: 0 4px; color: var(--pa-muted); font-size: 12.5px; }

/* Phones: like the speaking lobby (2026-10-30), the tabs start 5px under the header bar. */
@media (max-width: 720px) {
    .chat-scroll:has(> #llv) { padding-top: 5px; }
}
@media (max-width: 600px) {
    .ll { gap: 14px; }
    .llf-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Shelves on a computer: ← → beside the title, drag sideways (listening-lobby.blade.php). */
.llv-sec-head { align-items: center; }
.lld-arrows { display: none; gap: 4px; margin-left: 4px; }
@media (min-width: 721px) {
    .lld-arrows { display: inline-flex; }
    .lld-arrows[hidden] { display: none; }
    .llv-sec-count { margin-left: auto; }
}
@media (hover: hover) and (pointer: fine) {
    .lld-shelf { cursor: grab; scroll-snap-type: none; }
    .lld-shelf.is-dragging { cursor: grabbing; }
    .lld-shelf.is-dragging .lld-item { pointer-events: none; }
}
.lld-arrow { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: var(--pa-soft); color: var(--pa-ink); font-size: 20px !important; cursor: pointer; transition: background 0.15s, opacity 0.15s; }
.lld-arrow:hover:not(:disabled) { background: var(--pa-line); }
.lld-arrow:disabled { opacity: 0.35; cursor: default; }

/* One colour (user 2026-11-01: "颜色太多太杂看着很乱"): every card and format tile the page's light
   grey with ink text, the headphones muted; a done card stands out only by its dark score, check and bar.
   The macaron tones above stay defined but no longer paint the shelves. */
.llv [data-tone] { --bg: var(--pa-soft); --ink: var(--pa-ink); }
.lld-cover .material-symbols-outlined { color: var(--pa-muted); }
.lld-item.is-done .lld-cover .lld-done-check { color: var(--pa-card); }
.lld-cover-tag { background: var(--pa-card); color: var(--pa-muted); }
:root[data-theme="dark"] .lld-cover-tag { background: rgba(255, 255, 255, 0.08); color: var(--pa-muted); }
.llf-part-icon { color: var(--pa-muted); }
.lld-item.is-soon .lld-cover { background: transparent; box-shadow: inset 0 0 0 1px var(--pa-line); }

/* ---------- 按年份一色 (user's pick 2026-11-01, after "全部灰色又太普通了"): each year's shelf one soft colour,
   ListeningPapers::yearTone() — 2026 mint, 2025 lilac, 2024 peach, 2023 butter, 2022 pink, 2021 aqua.
   The "Paper 4 考什么" tiles stay grey. ---------- */
.llv-sec[data-sec-tone="mint"] { --sec-bg: var(--t-mint); --sec-ink: var(--t-mint-ink); }
.llv-sec[data-sec-tone="lilac"] { --sec-bg: var(--t-lilac); --sec-ink: var(--t-lilac-ink); }
.llv-sec[data-sec-tone="peach"] { --sec-bg: var(--t-peach); --sec-ink: var(--t-peach-ink); }
.llv-sec[data-sec-tone="butter"] { --sec-bg: var(--t-butter); --sec-ink: var(--t-butter-ink); }
.llv-sec[data-sec-tone="pink"] { --sec-bg: var(--t-pink); --sec-ink: var(--t-pink-ink); }
.llv-sec[data-sec-tone="aqua"] { --sec-bg: var(--t-aqua); --sec-ink: var(--t-aqua-ink); }
.llv-sec[data-sec-tone] .lld-item { --bg: var(--sec-bg); --ink: var(--sec-ink); }
.llv-sec[data-sec-tone] .lld-cover .material-symbols-outlined:not(.lld-done-check) { color: var(--ink); }
.llv-sec[data-sec-tone] .lld-cover-tag { color: var(--ink); }

/* ⓘ 试卷说明 (2026-11-01): the format sheet beside 练习记录 — centred card on computers, bottom sheet on phones. */
button.llv-hist { border: 0; font: inherit; cursor: pointer; }
.llv-info-sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20, 20, 20, 0.38); }
.llv-info-sheet[hidden] { display: none; }
.llv-info-card { width: 100%; max-width: 560px; max-height: calc(100dvh - 40px); overflow: auto; padding: 18px 18px 20px; border-radius: 24px; background: var(--pa-card); color: var(--pa-text); box-sizing: border-box; }
.llv-info-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.llv-info-head h2 { margin: 0; color: var(--pa-ink); font-size: 17px; font-weight: 800; }
.llv-info-close { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--pa-soft); color: var(--pa-ink); cursor: pointer; }
.llv-info-pane, .llv-info-head h2 span { display: none; }
.llv[data-lang="en"] .llv-info-pane[data-lang="en"], .llv[data-lang="ms"] .llv-info-pane[data-lang="ms"] { display: flex; flex-direction: column; gap: 10px; }
.llv[data-lang="en"] .llv-info-head h2 span[data-lang="en"], .llv[data-lang="ms"] .llv-info-head h2 span[data-lang="ms"] { display: inline; }
.llv-info-card .llf-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.llv-info-open { overflow: hidden; }
@media (max-width: 600px) {
    .llv-info-sheet { align-items: flex-end; padding: 0; }
    .llv-info-card { max-width: none; max-height: 86dvh; border-radius: 24px 24px 0 0; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}
/* With ⓘ and 练习记录 both beside the tabs, phones keep "Bahasa Melayu" on one line. */
.llv-lang button { white-space: nowrap; }
@media (max-width: 480px) {
    .llv-row { gap: 6px; }
    .llv-lang button { font-size: 13px; }
    .llv-hist { width: 42px; height: 42px; }
}
/* The sheet's button + a simple fade-and-rise (user 2026-11-01: "弹窗需要有按钮 我明白了", "要有简单动效"). */
.llv-info-ok { width: 100%; height: 48px; margin-top: 16px; border: 0; border-radius: 14px; background: var(--pa-ink); color: var(--pa-card); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; transition: transform 0.12s; }
.llv-info-ok:active { transform: scale(0.98); }
.llv-info-sheet { opacity: 0; transition: opacity 0.22s ease; }
.llv-info-sheet.is-open { opacity: 1; }
.llv-info-card { transform: translateY(14px) scale(0.98); transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1); }
.llv-info-sheet.is-open .llv-info-card { transform: none; }
@media (max-width: 600px) {
    .llv-info-card { transform: translateY(100%); transition-duration: 0.3s; }
}
@media (prefers-reduced-motion: reduce) {
    .llv-info-sheet, .llv-info-card { transition: none; }
}
/* BM 考什么: how a Petikan runs (steps), what kinds of questions, three tips. */
.llf-h { margin: 0 2px; color: var(--pa-ink); font-size: 14px; font-weight: 800; }
.llf-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px; }
.llf-step { padding: 4px 10px; border-radius: 999px; background: var(--pa-soft); color: var(--pa-ink); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.llf-arrow { color: var(--pa-muted); font-size: 16px !important; }
.llf-tips { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 0; padding-left: 18px; color: var(--pa-text); font-size: 13px; line-height: 1.55; }
/* The sheet's four items as a tidy list (user 2026-11-01: "四个卡片排版…现在很乱"): one row each —
   icon chip | name … Part / Malay name on the right | the description under the name. */
.llv-info-card .llf-parts { display: flex; flex-direction: column; gap: 6px; }
.llv-info-card .llf-part { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "icon name top" "icon desc desc"; align-items: center; column-gap: 12px; row-gap: 1px; padding: 12px 14px; border-radius: 16px; background: var(--pa-soft); color: var(--pa-text); }
.llv-info-card .llf-part-icon { grid-area: icon; align-self: start; display: grid; place-items: center; width: 40px; height: 40px; margin: 0; border-radius: 12px; background: var(--pa-card); color: var(--pa-ink); font-size: 21px !important; }
.llv-info-card .llf-part strong { grid-area: name; color: var(--pa-ink); font-size: 15px; font-weight: 800; }
.llv-info-card .llf-part-top { grid-area: top; color: var(--pa-muted); font-size: 12px; font-weight: 600; opacity: 1; white-space: nowrap; }
.llv-info-card .llf-part-top b { color: var(--pa-ink); font-weight: 700; }
.llv-info-card .llf-part small { grid-area: desc; color: var(--pa-muted); font-size: 13px; line-height: 1.45; opacity: 1; }
/* "Bahasa Melayu" → "BM" when the tab pill is too narrow for it (small phones; user 2026-11-01). */
.llv-lang { container-type: inline-size; }
.llv-lang-short { display: none; }
@container (max-width: 250px) {
    .llv-lang-long { display: none; }
    .llv-lang-short { display: inline; }
}
