/* Virtual lab pages (/labo, /labo/<id>) — page shell around the experiments. Uses the site tokens from site.css. */
.lb { --t1: #2f6f9f; --t1-bg: #e7f0f8; --t2: #a0522d; --t2-bg: #f7ece4; --t3: #4f7a2a; --t3-bg: #ebf3e3; }
.lb [data-tri="1"], .lb-tc1 { --tc: var(--t1); --tc-bg: var(--t1-bg); }
.lb [data-tri="2"], .lb-tc2 { --tc: var(--t2); --tc-bg: var(--t2-bg); }
.lb [data-tri="3"], .lb-tc3 { --tc: var(--t3); --tc-bg: var(--t3-bg); }

/* ---------- head band ---------- */
.lb-head .yl-meta span b { color: #fff; font-weight: 700; }
@media (min-width: 861px) { .lb-head .yl-pagehead-grid { grid-template-columns: 1fr 240px; } }
@media (max-width: 600px) { .lb-head h1 { font-size: 1.55rem; } .lb-head .yl-meta span { font-size: .8rem; } }
.lb-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.lb-tags span { font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 2px 12px; background: rgba(255, 255, 255, .1); color: #dbe6ee; }
.lb-tags .lb-tag-tri { background: var(--tc); color: #fff; }
.lb-tags .lb-tag-ex { background: var(--yl-chalk); color: #1d1606; }
.lb-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.lb-head-row .yl-meta { margin-top: 0; }
.lb-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-actions .yl-btn { background: rgba(255, 255, 255, .1); color: #fff !important; border: 1px solid rgba(255, 255, 255, .18); }
.lb-actions .yl-btn:hover { background: rgba(255, 255, 255, .18); }
.lb-done-badge { background: #1f7a4d !important; color: #fff !important; }
@media (max-width: 600px) {
    .lb-head-row { flex-direction: column; align-items: stretch; }
    .lb-actions .yl-btn { flex: 1 1 0; padding: 0 10px; }
    .lb-actions .lb-hide-sm { display: none; }
}

/* ---------- catalog toolbar ---------- */
.lb-hub { padding: 28px 0 56px; }
.lb-toolbar { position: sticky; top: var(--yl-head-h); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 0; margin-bottom: 8px; background: var(--yl-bg); }
.lb-search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; background: #fff; border: 1px solid var(--yl-line); border-radius: 12px; }
.lb-search:focus-within { border-color: var(--yl-brand); box-shadow: 0 0 0 3px rgba(55, 101, 129, .15); }
.lb-search svg { width: 18px; height: 18px; color: var(--yl-muted); flex: none; }
.lb-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 600 1rem var(--yl-font); color: var(--yl-ink); }
.lb-search input::-webkit-search-cancel-button { cursor: pointer; }
.lb-seg { display: flex; gap: 4px; padding: 4px; background: #fff; border: 1px solid var(--yl-line); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.lb-seg::-webkit-scrollbar { display: none; }
.lb-seg button { flex: none; height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--yl-text); font: 700 .88rem var(--yl-font); cursor: pointer; white-space: nowrap; }
.lb-seg button:hover { background: var(--yl-soft); }
.lb-seg button[aria-pressed="true"] { background: var(--yl-navy); color: #fff; }
@media (max-width: 600px) {
    .lb-toolbar { gap: 8px; }
    .lb-search { flex-basis: 100%; }
    .lb-seg { flex: 1 1 auto; }
    .lb-seg button { flex: 1 0 auto; padding: 0 10px; }
}
.lb-count { color: var(--yl-muted); font-size: .9rem; margin: 2px 0 6px; }

/* continue + progress */
.lb-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 0 0 18px; }
.lb-continue { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; background: var(--yl-navy); color: #fff; text-decoration: none !important; transition: transform .15s; }
.lb-continue:hover { transform: translateY(-1px); }
.lb-continue .ic { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--yl-chalk); color: #1d1606; }
.lb-continue .ic svg { width: 22px; height: 22px; }
.lb-continue small { display: block; color: #b9cbd8; font-size: .8rem; }
.lb-continue b { display: block; font-size: 1rem; line-height: 1.4; }
.lb-continue > svg { margin-inline-start: auto; width: 20px; height: 20px; flex: none; }
.lb-progress { padding: 14px 16px; }
.lb-progress p { display: flex; justify-content: space-between; gap: 8px; font-size: .92rem; color: var(--yl-text); }
.lb-progress p b { color: var(--yl-ink); }
.lb-bar { height: 10px; border-radius: 99px; background: var(--yl-soft); overflow: hidden; margin-top: 8px; }
.lb-bar i { display: block; height: 100%; width: 0; background: #1f7a4d; border-radius: 99px; transition: width .4s; }

/* trimester + axis groups */
.lb-tri { margin-top: 26px; }
.lb-tri-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.lb-tri-head h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); font-weight: 800; }
.lb-tri-head .dot { width: 14px; height: 14px; border-radius: 4px; background: var(--tc); flex: none; }
.lb-tri-head small { color: var(--yl-muted); font-size: .9rem; font-weight: 600; }
.lb-axis { margin-top: 14px; }
.lb-axis h3 { display: flex; align-items: baseline; gap: 8px; font-size: 1rem; font-weight: 800; color: var(--tc); margin: 0 0 10px; }
.lb-axis h3 small { color: var(--yl-muted); font-weight: 600; font-size: .82rem; }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
@media (max-width: 600px) { .lb-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; } }

/* experiment card */
.lb-card { position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr); grid-template-rows: auto 1fr auto; column-gap: 12px; row-gap: 4px; padding: 14px; background: #fff; border: 1px solid var(--yl-line); border-radius: 16px; text-decoration: none !important; color: var(--yl-ink); transition: border-color .15s, box-shadow .15s, transform .15s; min-height: 132px; }
.lb-card:hover { border-color: var(--tc); box-shadow: 0 6px 20px rgba(20, 50, 74, .08); transform: translateY(-1px); }
.lb-card-ic { grid-row: 1 / 4; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--tc-bg); color: var(--tc); font-weight: 800; }
.lb-card-ic svg { width: 22px; height: 22px; }
.lb-card b { font-size: 1rem; font-weight: 800; line-height: 1.45; }
.lb-card small { color: var(--yl-muted); font-size: .85rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lb-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; font-size: .8rem; color: var(--yl-muted); font-weight: 700; }
.lb-card-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.lb-card-meta svg { width: 15px; height: 15px; }
.lb-pill-ex { background: #fdf3dc; color: #7a5208; border-radius: 999px; padding: 1px 9px; }
.lb-check { display: none !important; color: #1f7a4d; }
.is-done .lb-check { display: inline-flex !important; }
.lb-card.is-done { border-color: #b9dcc7; }
.lb-card.is-done .lb-card-ic { background: #e2f2e8; color: #1f7a4d; }
.lb-card.is-current { border-color: var(--yl-navy); box-shadow: 0 0 0 2px var(--yl-navy) inset; }
.lb-empty { text-align: center; padding: 40px 16px; color: var(--yl-muted); }
.lb-empty b { display: block; color: var(--yl-ink); font-size: 1.1rem; margin-bottom: 4px; }

.lb-about { margin-top: 44px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.lb-about .yl-card { padding: 18px; }
.lb-about h3 { font-size: 1rem; font-weight: 800; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.lb-about h3 span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--yl-navy); color: #fff; font-size: .85rem; }
.lb-about p { color: var(--yl-text); font-size: .93rem; }

/* ---------- experiment page ---------- */
.lb-exp-main { padding: 22px 0 40px; }
.lb-exp { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.lb-exp.is-ex { grid-template-columns: minmax(0, 1fr); max-width: 980px; margin: 0 auto; }
@media (max-width: 1000px) { .lb-exp { grid-template-columns: minmax(0, 1fr); gap: 14px; } }
.lb-work { display: grid; gap: 16px; min-width: 0; }

.lb-proto { padding: 18px; position: sticky; top: calc(var(--yl-head-h) + 14px); max-height: calc(100vh - var(--yl-head-h) - 28px); overflow: auto; }
@media (max-width: 1000px) { .lb-proto { position: static; max-height: none; padding: 16px; } }
.lb-proto h2 { font-size: .8rem; font-weight: 800; color: var(--yl-brand-ink); letter-spacing: .01em; margin-bottom: 4px; }
.lb-proto .lb-problem { font-size: 1.02rem; font-weight: 700; color: var(--yl-ink); line-height: 1.75; }
.lb-proto details { margin-top: 12px; border-top: 1px solid var(--yl-line); padding-top: 10px; }
.lb-proto summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 800; color: var(--yl-navy); font-size: .92rem; padding: 4px 0; }
.lb-proto summary::-webkit-details-marker { display: none; }
.lb-proto summary svg { width: 18px; height: 18px; transition: transform .2s; transform: rotate(90deg); }
.lb-proto details[open] summary svg { transform: rotate(-90deg); }
.lb-proto dl { margin: 8px 0 0; display: grid; gap: 12px; }
.lb-proto dt { font-size: .8rem; font-weight: 800; color: var(--yl-brand-ink); margin: 0; }
.lb-proto dd { margin: 2px 0 0; color: var(--yl-text); line-height: 1.8; font-size: .95rem; }
.lb-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: st; }
.lb-steps li { position: relative; padding-inline-start: 32px; line-height: 1.75; color: var(--yl-text); font-size: .95rem; counter-increment: st; }
.lb-steps li::before { content: counter(st); position: absolute; inset-inline-start: 0; top: 2px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--yl-soft); color: var(--yl-navy); font-size: .78rem; font-weight: 800; }
.lb-warn { display: flex; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #fff4e5; color: #7a3a07; font-size: .88rem; line-height: 1.7; }
.lb-warn svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }

.lb-bench, .lb-quiz { padding: 18px; min-width: 0; }
@media (max-width: 600px) { .lb-bench { padding: 12px 10px; border-radius: 14px; } .lb-quiz { padding: 14px 12px; } }
.lb-bench-head, .lb-quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.lb-bench-head h2, .lb-quiz-head h2 { font-size: 1.1rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.lb-bench-head h2 svg, .lb-quiz-head h2 svg { width: 20px; height: 20px; color: var(--yl-brand); }
.lb-hint { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: #fff8e6; border: 1px solid #f5dfa6; color: #4a3605; font-weight: 700; font-size: .95rem; line-height: 1.7; }
.lb-hint svg { width: 20px; height: 20px; flex: none; margin-top: 3px; color: #b07b00; }
.lb-status { margin: 12px 0 0; font-size: .88rem; color: var(--yl-muted); font-variant-numeric: tabular-nums; }
.lb-quiz-head span { font-size: .85rem; color: var(--yl-muted); font-weight: 700; }
.lb-lock { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; background: var(--yl-soft); color: var(--yl-text); }
.lb-lock > svg { width: 22px; height: 22px; color: var(--yl-muted); flex: none; }
.lb-lock p { flex: 1 1 220px; font-size: .93rem; line-height: 1.7; }
.lb-quiz.is-open { border-color: #b9dcc7; }

.lb-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.lb-pager a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--yl-line); border-radius: 16px; text-decoration: none !important; color: var(--yl-ink); min-width: 0; transition: border-color .15s; }
.lb-pager a:hover { border-color: var(--yl-brand); }
.lb-pager a > svg { width: 22px; height: 22px; flex: none; color: var(--yl-brand); }
.lb-pager a > span { flex: 1 1 auto; min-width: 0; }
.lb-pager small { display: block; color: var(--yl-muted); font-size: .8rem; font-weight: 700; }
.lb-pager b { display: block; font-size: .95rem; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pager .nx { justify-content: flex-end; text-align: end; grid-column: 2; }
.lb-pager .pv + .nx { grid-column: auto; }
@media (max-width: 600px) { .lb-pager { grid-template-columns: 1fr; } .lb-pager .nx { grid-column: auto; } }
.lb-related { margin-top: 26px; }
.lb-related h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: 10px; }

/* ---------- index drawer ---------- */
.lb-index { position: fixed; inset: 0; z-index: 1100; }
.lb-index-bg { position: absolute; inset: 0; background: rgba(10, 25, 36, .45); opacity: 0; transition: opacity .25s; }
.lb-index-panel { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: min(420px, 92vw); background: #fff; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .28s ease; box-shadow: -10px 0 30px rgba(10, 25, 36, .2); }
.lb-index.open .lb-index-bg { opacity: 1; }
.lb-index.open .lb-index-panel { transform: none; }
.lb-index-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--yl-line); }
.lb-index-head b { font-size: 1.05rem; }
.lb-index-head button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--yl-line); background: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-index-head button svg { width: 20px; height: 20px; }
.lb-index .lb-search { margin: 12px 16px 4px; flex: none; }
.lb-index-body { flex: 1; overflow: auto; padding: 4px 8px 24px; }
.lb-index-body h4 { font-size: .8rem; font-weight: 800; color: var(--tc); margin: 14px 8px 4px; }
.lb-index-body a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--yl-ink); text-decoration: none !important; font-size: .93rem; line-height: 1.5; }
.lb-index-body a:hover { background: var(--yl-soft); }
.lb-index-body a.is-current { background: var(--yl-navy); color: #fff; }
.lb-index-body a .n { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--tc-bg); color: var(--tc); font-size: .78rem; font-weight: 800; }
.lb-index-body a.is-done .n { background: #e2f2e8; color: #1f7a4d; }
.lb-index-body a .v { margin-inline-start: auto; color: var(--yl-muted); font-size: .76rem; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.lb-index-body a.is-current .v { color: #b9cbd8; }
.lb-index-body a .v svg { width: 13px; height: 13px; }
body.lb-noscroll { overflow: hidden; }

.lb-toast { position: fixed; z-index: 1200; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--yl-navy); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: .92rem; transition: opacity .2s, transform .2s; }
.lb-toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) { .lb-toast { bottom: calc(var(--yl-tab-h) + 16px + env(safe-area-inset-bottom)); } }

/* ---------- lab widgets tuned to the site look (overrides lab.css) ---------- */
.lab6 { --paper: #f2f5f7; --card: #ffffff; --line: #dbe3e8; --ink: #15232e; --muted: #5f6f7b; --display: 'Cairo', Tahoma, sans-serif; --body: 'Cairo', Tahoma, sans-serif; font-family: var(--yl-font); }
.lab6 .btn { border-radius: 12px; min-height: 44px; font-family: var(--yl-font); font-weight: 700; }
.lab6 .chip { font-family: var(--yl-font); min-height: 36px; font-weight: 600; }
.lab6 .obs { border-radius: 12px; line-height: 1.8; }
.lab6 .q p { line-height: 1.7; }
.lab6 .opt { min-height: 46px; border-radius: 12px; font-weight: 600; line-height: 1.6; padding: 10px 14px; }
.lab6 .score { border-radius: 12px; }
.lab6 .concl { border-radius: 12px; border-color: #b9dcc7; background: #f1f9f4; line-height: 1.85; }
.lab6 .concl b { font-family: var(--yl-font); font-weight: 800; }
.lab6 .scene { border-radius: 12px; }
.lab6 input[type="range"] { height: 28px; }
.cf-ghost, .gx-ghost { z-index: 1200 !important; }
@media (max-width: 760px) { .lab6 .exk-sum { bottom: calc(var(--yl-tab-h) + env(safe-area-inset-bottom) + 6px); } }
@media (prefers-reduced-motion: reduce) { .lb-card, .lb-continue, .lb-index-panel, .lb-index-bg { transition: none !important; } }

/* ---------- picture cards (all experiments in one grid) ---------- */
.lb-pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; margin-top: 6px; }
@media (max-width: 600px) { .lb-pgrid { grid-template-columns: minmax(0, 1fr); gap: 14px; } }
.lb-pc { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--yl-line); border-radius: 18px; overflow: hidden; transition: box-shadow .18s, transform .18s, border-color .18s; }
.lb-pc:hover { box-shadow: 0 10px 28px rgba(20, 50, 74, .12); transform: translateY(-2px); border-color: var(--tc); }
.lb-pc-img { position: relative; display: block; aspect-ratio: 16 / 10; background: #e4ebe8; border-bottom: 3px solid var(--tc); overflow: hidden; }
.lb-pc-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.lb-pc:hover .lb-pc-img img { transform: scale(1.04); }
.lb-pc-n { position: absolute; top: 10px; left: 10px; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center; background: rgba(20, 50, 74, .88); color: #fff; font-weight: 800; font-size: .9rem; }
.lb-pc-img .lb-check { position: absolute; top: 10px; right: 10px; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: #1f7a4d; color: #fff; font-size: .8rem; font-weight: 800; }
.lb-pc-img .lb-check svg { width: 15px; height: 15px; }
.lb-pc-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; flex: 1; }
.lb-pc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lb-pc-tags span { font-size: .74rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--yl-soft); color: var(--yl-text); }
.lb-pc-tags .tri { background: var(--tc-bg); color: var(--tc); }
.lb-pc h3 { font-size: 1.08rem; font-weight: 800; line-height: 1.45; }
.lb-pc h3 a:hover { color: var(--tc); }
.lb-pc p { color: var(--yl-muted); font-size: .88rem; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lb-pc-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; font-weight: 700; color: var(--yl-muted); margin-top: auto; }
.lb-pc-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.lb-pc-meta svg { width: 15px; height: 15px; }
.lb-pc-btn { margin-top: 4px; height: 44px; }
.lb-pc.is-done { border-color: #b9dcc7; }
.lb-pc.is-done .lb-pc-btn { background: #1f7a4d; }

/* ---------- left-to-right layout ---------- */
html[dir="ltr"] .lb .yl-crumbs li + li::before { content: '›'; }
html[dir="ltr"] .lb :is(h1, h2, h3, p, b, small, dd, li, .lb-pc-tags span, .lb-tags span, .yl-meta span, .lb-hint span) { unicode-bidi: plaintext; }
html[dir="ltr"] .lb-index-panel { inset-inline-start: auto; right: 0; }
html[dir="ltr"] .lb-continue > svg { transform: scaleX(-1); }
