/* ExcelUstad practice page: lesson + live spreadsheet in the browser */
.wrap.xl { max-width: 1320px; }
body.practice { padding-top: 28px; }

.p-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.p-head { margin: 18px 0 16px; display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.p-head h1 { margin: 4px 0 0; font: 800 clamp(26px, 4vw, 38px)/1.1 var(--display); letter-spacing: -0.03em; color: var(--ink); }
.p-head .kicker { margin: 0; }
.p-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.pbtn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--card2); color: var(--ink); text-decoration: none; font: 700 12px/1 var(--mono); letter-spacing: .04em;
  box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }
.pbtn:hover { background: #333b44; }
.pbtn.pri { background: var(--accent); color: #04222e; box-shadow: 0 3px 0 var(--accent-dim); }
.pbtn.pri:hover { background: #2cbdf3; }
.pbtn[disabled], .pbtn.off { opacity: .4; pointer-events: none; }
.pbtn svg { width: 14px; height: 14px; }

.prog { display: flex; align-items: center; gap: 10px; font: 700 11px/1 var(--mono); color: var(--muted); letter-spacing: .06em; }
.prog .bar { width: 160px; height: 8px; border-radius: 9px; background: #15191e; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.prog .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3ccf7a, #8fe3ad); transition: width .3s; }

/* learn box */
details.learn { background: linear-gradient(180deg, var(--card2), var(--card)); border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 18px; }
details.learn > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; align-items: center; gap: 10px; font: 800 15px/1.2 var(--display); color: var(--ink); }
details.learn > summary::-webkit-details-marker { display: none; }
details.learn > summary .chev { margin-left: auto; transition: transform .15s; color: var(--muted); }
details.learn[open] > summary .chev { transform: rotate(90deg); }
.learn-body { padding: 0 18px 18px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; }
.learn-body p { margin: 0 0 10px; font-size: 14.5px; }
.learn-body .urdu { color: #b9e6ff; font-style: italic; }
.learn-body h3 { margin: 0 0 8px; font: 700 10.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.learn-body code.syn { display: block; white-space: pre-wrap; word-break: break-word; }
.learn-body ul { margin: 0; padding-left: 18px; font-size: 14px; }
.learn-body li { margin-bottom: 6px; }
.learn-body .args { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13.5px; }
.learn-body .args b { font: 700 12.5px/1.5 var(--mono); color: #ffc27a; white-space: nowrap; }
.example { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: #1a1e24; box-shadow: inset 0 0 0 1px var(--line); font-size: 13.5px; }
.example .fx { font: 700 13px/1.5 var(--mono); color: #ffc27a; word-break: break-word; }
.example .exres { color: #8fe3ad; font: 700 13px var(--mono); }

/* main layout: tasks | sheet */
.p-main { display: grid; grid-template-columns: minmax(330px, 420px) 1fr; gap: 18px; align-items: start; }
.p-sheet { position: sticky; top: 12px; min-width: 0; }

/* task cards */
.tasks { display: grid; gap: 10px; }
.task { background: var(--card); border-radius: 14px; padding: 14px; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s; }
.task.ok { box-shadow: inset 0 0 0 1px rgba(110,220,150,.55), 0 0 0 3px rgba(110,220,150,.08); }
.task.bad { box-shadow: inset 0 0 0 1px rgba(255,110,110,.5); }
.task .q { display: flex; gap: 10px; font-size: 14px; color: var(--ink); line-height: 1.5; }
.task .n { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font: 800 11px/1 var(--mono); background: #1a1e24; color: var(--orange); box-shadow: inset 0 0 0 1px rgba(255,168,63,.3); }
.task.ok .n { background: #1f3a2a; color: #8fe3ad; box-shadow: inset 0 0 0 1px rgba(110,220,150,.4); }
.ans { margin-top: 10px; display: flex; align-items: stretch; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px #c8ccd1; }
.ans:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.ans .cellname { flex: none; display: grid; place-items: center; padding: 0 9px; font: 700 11px/1 var(--mono); color: #4b5563; background: #f1f3f5; border-right: 1px solid #d7dbe0; }
.ans input { flex: 1; min-width: 0; border: 0; outline: 0; border-radius: 0; box-shadow: none; height: auto; padding: 9px 10px; font: 600 14px/1.2 var(--mono); color: #111; background: #fffbe8; }
.ans .go { flex: none; border: 0; cursor: pointer; padding: 0 12px; font: 800 11px/1 var(--mono); letter-spacing: .06em; background: #217346; color: #fff; }
.ans .go:hover { background: #1b5e39; }
.res { margin-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font: 600 12.5px/1.4 var(--mono); }
.res .val { color: var(--body); word-break: break-word; }
.res .val b { color: var(--ink); }
.st { font: 800 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 5px 8px; border-radius: 99px; white-space: nowrap; }
.st.pend { color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.st.ok { color: #8fe3ad; background: rgba(110,220,150,.12); box-shadow: inset 0 0 0 1px rgba(110,220,150,.4); }
.st.bad { color: #ff9b9b; background: rgba(255,110,110,.1); box-shadow: inset 0 0 0 1px rgba(255,110,110,.4); }
.msg { margin-top: 6px; font-size: 12.5px; color: #ffcf8a; }
.msg:empty { display: none; }
.task .tools2 { margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.link { background: none; border: 0; padding: 0; cursor: pointer; font: 700 11px/1.4 var(--mono); letter-spacing: .04em; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.reveal { margin-top: 8px; padding: 9px 11px; border-radius: 9px; background: #1a1e24; box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; }
.reveal code { font: 700 12.5px/1.5 var(--mono); color: #ffc27a; word-break: break-word; }
.how { margin-top: 8px; font-size: 13px; color: var(--muted); }
.how b { color: var(--body); }
.need { display: inline-block; margin-top: 8px; font: 700 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #ffc27a; padding: 4px 7px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255,168,63,.35); }

/* the spreadsheet */
.xlbox { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px #3a424b, 0 14px 36px rgba(0,0,0,.45); color: #1f2328; }
.ribbon { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: #f3f4f6; border-bottom: 1px solid #dadde1; }
.rb { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; cursor: pointer;
  font: 600 12px/1 var(--display); color: #24292f; white-space: nowrap; }
.rb:hover { background: #e2e5e9; }
.rb svg { width: 15px; height: 15px; fill: none; stroke: #217346; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rb[disabled] { opacity: .4; pointer-events: none; }
.rsep { width: 1px; margin: 4px 3px; background: #d7dbe0; }
.rb select { border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; padding: 0; }
.fbar { display: flex; align-items: stretch; border-bottom: 1px solid #dadde1; background: #fff; }
.fbar .nb { flex: none; width: 74px; display: grid; place-items: center; font: 700 12px/1 var(--mono); color: #24292f; border-right: 1px solid #e3e6ea; }
.fbar .fx { flex: none; display: grid; place-items: center; width: 34px; font: italic 700 14px/1 Georgia, serif; color: #6b7280; border-right: 1px solid #e3e6ea; }
.fbar input { flex: 1; min-width: 0; border: 0; outline: 0; border-radius: 0; box-shadow: none; height: auto; background: #fff; padding: 8px 10px; font: 500 13.5px/1.2 var(--mono); color: #111; }
.fbar input:focus { background: #fffbe8; }
.gridwrap { overflow: auto; max-height: calc(100vh - 220px); min-height: 280px; background: #fff; }
table.grid { border-collapse: separate; border-spacing: 0; font: 13px/1.2 Calibri, "Segoe UI", Arial, sans-serif; table-layout: fixed; }
.grid th { position: sticky; z-index: 2; background: #f1f3f5; color: #57606a; font: 600 11.5px/1 "Segoe UI", Arial, sans-serif; border-right: 1px solid #d7dbe0; border-bottom: 1px solid #d7dbe0; user-select: none; }
.grid thead th { top: 0; height: 24px; }
.grid tbody th { left: 0; width: 42px; min-width: 42px; text-align: center; z-index: 1; }
.grid thead th.corner { left: 0; z-index: 3; }
.grid th.on { background: #d3eadb; color: #0f5132; }
.grid td { height: 24px; padding: 0 6px; border-right: 1px solid #e3e6ea; border-bottom: 1px solid #e3e6ea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; cursor: cell; background: #fff; }
.grid td.num { text-align: right; }
.grid td.bool, .grid td.err { text-align: center; }
.grid td.err { color: #b42318; font-weight: 700; }
.grid td.head { background: #2f5597; color: #fff; font-weight: 700; text-align: center; }
.grid tr.alt td:not(.head) { background: #f7f8f9; }
.grid td.fx { color: #0b5394; }
.grid td.spill { color: #0b5394; background: #f3f9ff !important; }
.grid td.sel { outline: 2px solid #217346; outline-offset: -2px; position: relative; z-index: 0; }
.grid td.pick { background: #e8f5ee !important; outline: 1px dashed #217346; outline-offset: -1px; }
.grid tr.hidden { display: none; }
.sbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 10px; background: #217346; color: #e8f5ee; font: 600 11.5px/1.3 "Segoe UI", Arial, sans-serif; }
.sbar b { color: #fff; }
.tip { margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); }
.tip kbd { font-size: 10.5px; }

.p-tips { margin-top: 18px; }
.p-tips ul { margin: 0; padding-left: 18px; font-size: 14px; }
.p-foot { margin-top: 26px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

@media (max-width: 1060px) {
  .p-main { grid-template-columns: 1fr; }
  .p-sheet { position: static; order: -1; }
  .gridwrap { max-height: 56vh; }
  .learn-body { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body.practice { padding: 18px 10px 48px; }
  .prog .bar { width: 100px; }
  .rb span.t { display: none; }
  .fbar .nb { width: 56px; }
}
