/* Practice Lab. Uses the tokens from gradstack.css. */
:root { --ok: #0b7a5c; --ok-soft: #e3f6ef; --bad: #c92a2a; --bad-soft: #fdecec; }
[data-bs-theme="dark"] { --ok: #4fd8b0; --ok-soft: #0f2a25; --bad: #ff8f8f; --bad-soft: #321619; }

.lab-head { padding: 6.5rem 0 1.5rem; }
.lab-head h1 { font-weight: 800; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.lab-progress { min-width: 12rem; }
.lab-progress .progress { height: 8px; background: var(--gs-line); }
.lab-progress .progress-bar { background: var(--ok); }

.ex-list { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .5rem; }
.ex-btn { display: inline-flex; align-items: center; gap: .55rem; flex: 0 0 auto; padding: .45rem .9rem .45rem .5rem; border-radius: 999px; border: 1px solid var(--gs-line); background: var(--gs-bg); color: var(--gs-ink); font-weight: 600; font-size: .88rem; }
.ex-btn:hover { border-color: var(--gs-primary-text); }
.ex-btn.active { background: var(--gs-primary); border-color: var(--gs-primary); color: #fff; }
.ex-no { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-size: .75rem; background: var(--gs-soft); color: var(--gs-muted); }
.ex-btn.active .ex-no { background: rgba(255, 255, 255, .2); color: #fff; }
.ex-btn.solved:not(.active) .ex-no { background: var(--ok-soft); color: var(--ok); }

.panel { border: 1px solid var(--gs-line); border-radius: 1rem; background: var(--gs-bg); min-width: 0; }
.problem h2 { font-size: 1.5rem; font-weight: 700; }
.problem code, .test code, .example code { font-family: var(--font-mono); font-size: .84em; color: var(--gs-ink); background: var(--gs-soft); padding: .1rem .35rem; border-radius: .3rem; }
.diff { font-family: var(--font-mono); font-size: .72rem; font-weight: 600; padding: .15rem .5rem; border-radius: .35rem; }
.diff-easy { background: var(--ok-soft); color: var(--ok); }
.diff-medium { background: var(--gs-soft); color: var(--gs-primary-text); }
.example { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem 0; border-top: 1px solid var(--gs-line); }
.example .arrow { font-size: .78rem; color: var(--gs-muted); }
.hint summary { cursor: pointer; font-weight: 600; color: var(--gs-primary-text); }
.sub-label { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--gs-muted); }

.ide { border-radius: 1rem; overflow: hidden; border: 1px solid var(--gs-line); background: var(--code-bg); min-width: 0; }
.ide-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem .75rem; background: var(--code-bar); }
.ide-file { font-family: var(--font-mono); font-size: .8rem; color: var(--code-fg); }
.ide-bar .btn-ghost { color: var(--code-fg); border: 1px solid rgba(255, 255, 255, .2); background: transparent; font-size: .85rem; }
.ide-bar .btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.syntax { padding: .5rem .9rem; font-size: .82rem; border-top: 1px solid rgba(255, 255, 255, .08); color: var(--code-dim); overflow-wrap: anywhere; }
.syntax.ok { color: var(--code-fn); }
.syntax.bad { color: #ffb4b4; background: rgba(255, 90, 90, .12); }

.run-summary { margin-bottom: 1rem; padding: .8rem 1rem; border-radius: .7rem; font-size: .93rem; border: 1px solid var(--gs-line); background: var(--gs-soft); color: var(--gs-ink); overflow-wrap: anywhere; }
.run-summary.pass { background: var(--ok-soft); border-color: var(--ok); }
.run-summary.fail { background: var(--bad-soft); border-color: var(--bad); }
.tests { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.test { display: flex; gap: .7rem; padding: .7rem .85rem; border: 1px solid var(--gs-line); border-radius: .7rem; min-width: 0; }
.test > i { font-size: 1.05rem; color: var(--gs-muted); }
.test.pass > i { color: var(--ok); } .test.fail > i { color: var(--bad); }
.test.fail { border-color: var(--bad); }
.test-body { min-width: 0; flex: 1; }
.test-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; }
.test-head code { overflow-wrap: anywhere; }
.test-state { font-family: var(--font-mono); font-size: .72rem; color: var(--gs-muted); }
.test.pass .test-state { color: var(--ok); } .test.fail .test-state { color: var(--bad); }
.kv { display: flex; flex-wrap: wrap; gap: .25rem .6rem; font-size: .84rem; margin-top: .35rem; color: var(--gs-muted); }
.kv code { overflow-wrap: anywhere; }
.kv.bad span { color: var(--bad); font-weight: 600; }
.console-out { margin: 0; padding: .75rem .9rem; border-radius: .7rem; background: var(--code-bg); color: var(--code-fg); font-family: var(--font-mono); font-size: .8rem; max-height: 180px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ----- Languages ----- */
.lang-tabs { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; border: 1px solid var(--gs-line); border-radius: .8rem; background: var(--gs-soft); }
.lang-tab { border: 0; background: transparent; color: var(--gs-ink); font-weight: 600; font-size: .92rem; padding: .45rem .9rem; border-radius: .6rem; display: inline-flex; align-items: center; gap: .4rem; }
.lang-tab:hover { background: var(--gs-bg); }
.lang-tab.active { background: var(--gs-bg); color: var(--gs-primary-text); box-shadow: 0 1px 3px rgba(13, 19, 38, .15); }
.lang-count { font-family: var(--font-mono); font-size: .7rem; font-weight: 600; color: var(--gs-muted); }
.rt { font-family: var(--font-mono); font-size: .72rem; color: var(--code-dim); display: inline-flex; align-items: center; gap: .4rem; }
.rt .spinner-border { width: .75rem; height: .75rem; border-width: .12em; }
.rt-ready i { color: var(--code-fn); font-size: .5rem; }
.rt-error { color: #ffb4b4; }

/* ----- SQL: schema and result tables ----- */
.schema-table { border: 1px solid var(--gs-line); border-radius: .7rem; padding: .6rem .75rem; margin-top: .5rem; }
.schema-name { font-family: var(--font-mono); font-size: .85rem; font-weight: 600; color: var(--gs-ink); }
.schema-name span { font-weight: 400; font-size: .72rem; color: var(--gs-muted); margin-left: .35rem; }
.schema-cols { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.schema-col { font-family: var(--font-mono); font-size: .72rem; padding: .12rem .45rem; border-radius: .35rem; background: var(--gs-soft); color: var(--gs-muted); }
.schema-col b { color: var(--gs-ink); font-weight: 600; }
.res-block + .res-block { margin-top: 1.25rem; }
.res-count { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: .35rem; }
.res-scroll { overflow: auto; max-height: 300px; border: 1px solid var(--gs-line); border-radius: .7rem; }
.res-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.res-table th, .res-table td { padding: .4rem .7rem; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--gs-line); color: var(--gs-ink); }
.res-table th { position: sticky; top: 0; background: var(--gs-soft); font-family: var(--font-mono); font-size: .74rem; font-weight: 600; color: var(--gs-muted); }
.res-table tr:last-child td { border-bottom: 0; }
.res-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.res-table td.null { color: var(--gs-muted); font-style: italic; }
