/* Web Academy: one player-facing design for lessons & deduction practice.
   It extends the existing /learn page and respects Arabic RTL and light/dark. */
.academy-welcome{
  display:grid;grid-template-columns:minmax(0,1fr) 220px;
  gap:22px;align-items:center;margin:16px 0 14px;padding:23px 25px;
  border:1px solid #dce7f9;border-radius:22px;
  background:linear-gradient(120deg,#f3f8ff 0%,#edf4ff 55%,#f5f0ff 100%);
  color:#203c67;position:relative;overflow:hidden;
}
.academy-welcome:before{
  content:"";position:absolute;right:-115px;top:-130px;
  width:300px;height:300px;border-radius:100%;
  background:radial-gradient(circle,#c6d9ff65,transparent 68%);pointer-events:none;
}
.academy-welcome-copy{position:relative;z-index:1;min-width:0}
.academy-eyebrow,.academy-section-kicker{
  font-size:10px;font-weight:850;letter-spacing:.12em;color:#5275ab;
  display:block;margin-bottom:8px;
}
.academy-welcome h2{
  font-size:clamp(22px,3vw,30px);font-weight:900;line-height:1.23;
  letter-spacing:-.025em;margin:0 0 8px;color:#1e3b67;
}
.academy-welcome p{font-size:13px;line-height:1.65;color:#526a8a;margin:0;max-width:680px}
.academy-welcome-stats{display:flex;gap:9px;flex-wrap:wrap;margin-top:20px}
.academy-welcome-stats>span{
  display:grid;grid-template-columns:auto 1fr;align-items:center;gap:8px;
  border:1px solid #d7e2f6;background:#ffffffb9;padding:9px 12px;
  border-radius:12px;min-width:142px;
}
.academy-welcome-stats strong{font-size:21px;color:#355f9b;font-weight:900}
.academy-welcome-stats small{font-size:11px;line-height:1.3;color:#526a8a}
.academy-welcome-orbit{position:relative;z-index:1;display:grid;place-items:center;min-height:190px}
.academy-orbit-board{
  width:163px;height:163px;border:8px solid #fcfdff;border-radius:24px;
  background:#dce9ff;box-shadow:0 13px 35px #567bb02c;
  display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);
  gap:3px;padding:10px;transform:rotate(-8deg);
}
.academy-orbit-board span{
  background:#fff;border-radius:9px;display:grid;place-items:center;
  font-size:24px;font-weight:850;color:#537bb2;
}
.academy-orbit-board span:nth-child(even){color:#a7bbd9}
.academy-orbit-mark{
  position:absolute;right:18px;bottom:17px;width:49px;height:49px;
  background:#5f79c6;color:#fff;border-radius:16px;
  display:grid;place-items:center;font-size:25px;font-weight:900;
  border:4px solid white;box-shadow:0 8px 18px #3d5e9433
}
.academy-view-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:12px 0 18px}
.academy-tab{
  display:flex;align-items:center;gap:12px;text-decoration:none;
  border:1px solid var(--line,#e0e6f0);border-radius:15px;
  padding:13px 16px;min-width:0;min-height:72px;
  background:var(--surface,#fff);color:var(--ink,#263953);
  transition:border-color .15s,transform .15s,box-shadow .15s;
}
.academy-tab:hover{transform:translateY(-1px);border-color:#8fb0e6;box-shadow:0 9px 18px #314f7914}
.academy-tab.active{background:#edf4ff;border-color:#85aceb;box-shadow:inset 0 0 0 1px #a6c5f6}
.academy-tab-glyph{
  display:grid;place-items:center;flex:0 0 39px;width:39px;height:39px;
  border-radius:11px;color:#4778bd;background:#e4edfc;font-size:22px;font-weight:900
}
.academy-tab>span:last-child{display:grid;gap:3px;min-width:0}
.academy-tab strong{font-size:15px;line-height:1.3}
.academy-tab small{font-size:11px;color:var(--muted,#677994)}
.academy-tab.active strong{color:#285b9d}
.academy-practice-view{min-width:0}
.academy-section-heading{
  display:flex;gap:12px;align-items:center;justify-content:space-between;
  flex-wrap:wrap;margin:14px 0 18px
}
.academy-section-heading h2{font-size:clamp(19px,2.5vw,24px);margin:2px 0 6px;line-height:1.3}
.academy-section-heading p{font-size:12px;color:var(--muted,#657387);margin:0;max-width:700px;line-height:1.55}
.academy-section-kicker{margin:0;color:#4d78ad}
.academy-session-pill{
  font-size:11px;line-height:1.5;font-weight:850;background:#edf7f4;color:#206a55;
  padding:8px 12px;border:1px solid #c4e7d8;border-radius:30px;white-space:normal
}
.academy-practice-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:18px}
.academy-exercise-card{
  cursor:pointer;display:flex;align-items:flex-start;gap:11px;
  min-height:126px;padding:16px 13px;text-align:start;
  border:1px solid var(--line,#dce4f0);border-radius:16px;
  background:var(--surface,#fff);color:var(--ink,#283751);
  box-shadow:0 2px 8px #18284d08;
  transition:transform .15s,box-shadow .15s,border-color .15s;
  font:inherit;
}
.academy-exercise-card:hover{transform:translateY(-2px);border-color:#99b8eb;box-shadow:0 8px 22px #27476d1a}
.academy-exercise-card:focus-visible,
.academy-tab:focus-visible,
.academy-practice-detail button:focus-visible,
.academy-complete-btn:focus-visible{outline:2px solid #377ad2;outline-offset:3px}
.academy-exercise-number{
  flex:0 0 38px;width:38px;height:38px;background:#edf4ff;
  display:grid;place-items:center;color:#5279b3;border-radius:12px;
  font-size:16px;font-weight:900;
}
.academy-exercise-card.solved .academy-exercise-number{background:#e5f6ed;color:#217650}
.academy-exercise-description{display:grid;gap:5px;min-width:0;flex:1}
.academy-exercise-description strong{font-size:14px;font-weight:850;line-height:1.35}
.academy-exercise-description small{font-size:11px;line-height:1.4;color:var(--muted,#69758a)}
.academy-exercise-description em{font-style:normal;font-size:11px;color:#557bb2;margin-top:4px;font-weight:750}
.academy-exercise-card.solved .academy-exercise-description em{color:#269461}
.academy-exercise-arrow{font-size:19px;color:#688cbb}
.academy-small-back{
  display:inline-flex;align-items:center;border:0;background:transparent;
  color:#527fb7;font:inherit;font-weight:800;font-size:12px;
  cursor:pointer;padding:8px 0;margin-bottom:9px
}
.academy-practice-workspace{
  display:grid;grid-template-columns:minmax(290px,535px) minmax(260px,1fr);
  justify-content:center;align-items:start;gap:22px;
  border:1px solid var(--line,#dce4f0);border-radius:18px;
  padding:19px;background:var(--surface,#fff)
}
.academy-practice-board-column{min-width:0}
.academy-practice-step{
  display:flex;justify-content:space-between;align-items:baseline;flex-wrap:wrap;gap:7px;
  margin-bottom:11px;font-size:12px;color:var(--muted,#69758a)
}
.academy-practice-step strong{color:var(--ink,#263953);font-size:15px}
.academy-practice-board{
  width:min(100%,535px);aspect-ratio:1;display:grid;
  grid-template-columns:repeat(9,minmax(0,1fr));grid-template-rows:repeat(9,minmax(0,1fr));
  border:3px solid #536582;border-radius:9px;overflow:hidden;gap:0;
  background:#fff;box-shadow:0 12px 26px #1d407617;
  direction:ltr;
}
.academy-practice-cell{
  position:relative;display:grid;place-items:center;
  min-width:0;min-height:0;overflow:hidden;
  border-right:1px solid #ccd6e5;border-bottom:1px solid #ccd6e5;
  font-size:clamp(13px,2.8vw,26px);font-weight:750;color:#324763;
  background:#fff;aspect-ratio:1;box-sizing:border-box
}
.academy-practice-cell.right-box{border-right:2px solid #62718d}
.academy-practice-cell.bottom-box{border-bottom:2px solid #62718d}
.academy-practice-cell.same-box{background:#edf4ff}
.academy-practice-cell.same-line{background:#f3f7ff}
.academy-practice-cell.given{color:#2c4363}
.academy-practice-cell.target{
  background:#dce8ff;color:#1b5ba9;
  outline:3px solid #4e83d4;outline-offset:-3px;
  font-weight:900;z-index:2;
}
.academy-target-caption{font-size:12px;color:var(--muted,#69758a);margin:10px 0 0;line-height:1.45}
.academy-practice-reasoning{
  display:flex;flex-direction:column;min-width:0;align-items:stretch;
  padding:6px 2px
}
.academy-practice-reasoning h3{font-size:clamp(19px,2vw,24px);margin:7px 0 9px;line-height:1.35}
.academy-practice-reasoning>p{font-size:12.5px;color:var(--muted,#69758a);line-height:1.65;margin:0 0 14px}
.academy-digit-options{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:9px;margin:7px 0 17px}
.academy-digit-button{
  height:51px;min-width:0;border:1px solid #bcd0ef;
  background:#edf4ff;color:#2e5a92;border-radius:11px;
  font:inherit;font-size:19px;font-weight:850;cursor:pointer
}
.academy-digit-button.selected{background:#386db5;color:white;border-color:#386db5}
.academy-digit-button.incorrect{border-color:#cf8d8d;box-shadow:inset 0 -3px 0 #cf8d8d}
.academy-digit-button:disabled{cursor:default}
.academy-practice-buttons{display:flex;gap:10px;flex-wrap:wrap}
.academy-practice-buttons>button{flex:1;min-height:45px;white-space:normal}
.academy-hint-button{
  background:transparent;color:#567eb4;
  border:1px solid #b9cfe9;border-radius:10px;padding:11px 13px;
  cursor:pointer;font:inherit;font-weight:800;font-size:12px
}
.academy-practice-feedback{font-size:13px;line-height:1.65;margin:12px 0;min-height:20px;color:var(--muted,#62718d)}
.academy-practice-feedback.error{color:#b7525c}
.academy-practice-feedback.success{color:#258061;font-weight:800}
.academy-evidence{background:#f4f7ff;border:1px solid #dbe7fa;border-radius:13px;padding:13px;margin:3px 0 13px}
.academy-evidence-line{display:flex;gap:9px;justify-content:space-between;align-items:center;padding:7px 0;border-bottom:1px solid #dce5f7}
.academy-evidence-line:last-of-type{border-bottom:0}
.academy-evidence-line strong{font-size:11px;color:#45648b}
.academy-evidence-line span{font-size:12px;color:#2c5d9c;font-weight:800;direction:ltr;white-space:nowrap}
.academy-evidence-tip{font-size:12px;color:#315a8c;margin:10px 0 0;line-height:1.6}
.academy-next-exercise{align-self:flex-start;border-radius:11px;min-height:42px}
.academy-practice-error{padding:25px 15px;background:var(--surface,#fff);border:1px solid var(--line,#ddd);border-radius:12px}
.academy-complete-btn{background:#e5f7ed!important;border-color:#a8dbc3!important;color:#216c4d!important}
#lessonView:not(.hidden)~.academy-welcome{display:none}
@media(max-width:1050px){
  .academy-practice-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .academy-practice-workspace{grid-template-columns:minmax(240px,1fr) minmax(245px,1fr)}
}
@media(max-width:760px){
  .academy-welcome{grid-template-columns:minmax(0,1fr);padding:19px}
  .academy-welcome-orbit{display:none}
  .academy-practice-workspace{grid-template-columns:minmax(0,1fr)}
  .academy-practice-board{max-width:500px;margin-inline:auto}
  .academy-practice-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:510px){
  .academy-welcome{padding:16px;border-radius:17px}
  .academy-welcome h2{font-size:22px}
  .academy-welcome-stats>span{flex:1;min-width:112px;padding:8px 9px;gap:5px}
  .academy-welcome-stats strong{font-size:17px}
  .academy-welcome-stats small{font-size:10px}
  .academy-view-tabs{gap:8px}
  .academy-tab{min-height:68px;padding:9px 10px;gap:8px}
  .academy-tab-glyph{width:30px;height:30px;flex-basis:30px;font-size:18px}
  .academy-tab strong{font-size:13px}
  .academy-tab small{font-size:10px}
  .academy-practice-grid{grid-template-columns:minmax(0,1fr);gap:8px}
  .academy-exercise-card{min-height:89px}
  .academy-practice-workspace{padding:11px;gap:13px}
  .academy-practice-cell{font-size:clamp(15px,5vw,22px)}
  .academy-digit-options{grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}
  .academy-digit-button{height:43px;font-size:18px}
}
body.dark .academy-welcome{
  color:#e6edff;background:linear-gradient(115deg,#202f49,#293451 55%,#3b3158);
  border-color:#46516c
}
body.dark .academy-welcome h2{color:#edf5ff}
body.dark .academy-welcome p,body.dark .academy-welcome-stats small{color:#c2cde6}
body.dark .academy-eyebrow{color:#a5caff}
body.dark .academy-welcome-stats>span{background:#2b3d58;border-color:#526786}
body.dark .academy-welcome-stats strong{color:#d2e3ff}
body.dark .academy-orbit-board{border-color:#40516e;background:#3d5c83}
body.dark .academy-orbit-board span{background:#304360;color:#d4e3ff}
body.dark .academy-tab.active{background:#2e4161;border-color:#719bd3}
body.dark .academy-tab.active strong{color:#c5dfff}
body.dark .academy-tab-glyph{background:#314c72;color:#b3d4ff}
body.dark .academy-exercise-number{background:#324760;color:#b2d6ff}
body.dark .academy-exercise-card.solved .academy-exercise-number{background:#245444;color:#b6e9cd}
body.dark .academy-session-pill{background:#22493f;color:#aee3ca;border-color:#487f71}
body.dark .academy-practice-board{border-color:#7589a8}
body.dark .academy-evidence{background:#253850;border-color:#496384}
body.dark .academy-evidence-line{border-color:#425674}
body.dark .academy-evidence-line strong,body.dark .academy-evidence-line span,body.dark .academy-evidence-tip{color:#d1e0ff}
body.dark .academy-digit-button{background:#334d70;color:#cfe4ff;border-color:#597aac}
body.dark .academy-digit-button.selected{background:#587bc3;color:white}
@media(prefers-reduced-motion:reduce){
 .academy-tab,.academy-exercise-card{transition:none!important}
}
/* Sticky public navigation must not obscure Practice back controls when opening a task. */
#practiceDetail{scroll-margin-top:105px!important}
#practiceDetail .academy-small-back{position:relative;z-index:1}
