.endgame-studies-workspace{max-width:1380px;margin:0 auto;padding:20px 24px 36px}.endgame-studies-heading{display:flex;justify-content:space-between;align-items:end;gap:22px;margin-bottom:14px}.endgame-studies-heading h1{margin:3px 0 0;font-size:clamp(1.7rem,3vw,2.45rem)}.endgame-study-profile{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px}.endgame-study-stat{min-width:90px;padding:9px 12px;border:1px solid #dce3ed;border-radius:10px;background:#fff;text-align:center}.endgame-study-stat b{display:block;font-size:1.05rem}.endgame-study-stat span{color:#68758a;font-size:.7rem;font-weight:800;text-transform:uppercase}.endgame-study-sourcebar{display:flex;justify-content:space-between;gap:12px;margin-bottom:10px;padding:9px 12px;border:1px solid #dbe5f2;border-radius:9px;background:#f6f9fd;color:#596981}.endgame-study-app{display:grid;grid-template-columns:minmax(430px,680px) minmax(320px,1fr);gap:18px;align-items:start}.endgame-study-board-card,.endgame-study-side{overflow:hidden;border:1px solid #d6dee9;border-radius:14px;background:#fff;box-shadow:0 8px 26px rgba(15,23,42,.07)}.endgame-study-board{display:grid;grid-template-columns:repeat(8,1fr);width:100%;aspect-ratio:1;border:2px solid #263246;container-type:inline-size;touch-action:none;user-select:none}.endgame-study-square{position:relative;display:grid;place-items:center;overflow:hidden}.endgame-study-square.is-light{background:#eeeecf}.endgame-study-square.is-dark{background:#789b59}.endgame-study-square.is-last{box-shadow:inset 0 0 0 999px rgba(238,224,72,.31)}.endgame-study-square.is-selected::after,.endgame-study-square.is-drop::after{content:"";position:absolute;inset:5%;box-sizing:border-box;border:4px solid #f2c21a;z-index:4;pointer-events:none}.endgame-study-square.is-legal:before{content:"";position:absolute;width:23%;aspect-ratio:1;border-radius:50%;background:rgba(20,42,24,.35);z-index:4}.endgame-study-piece,.endgame-study-drag{display:grid;place-items:center;width:100%;height:100%;font-size:clamp(32px,10cqw,74px);cursor:grab}.endgame-study-piece{position:relative;z-index:3}.endgame-study-piece.is-hidden{visibility:hidden}.endgame-study-drag{position:fixed;left:0;top:0;z-index:10000;pointer-events:none}.endgame-study-square .coord{position:absolute;z-index:5;font-size:clamp(8px,1.4cqw,12px);font-weight:850;color:rgba(24,50,24,.72)}.endgame-study-square .rank{left:4px;top:2px}.endgame-study-square .file{right:4px;bottom:2px}.endgame-study-board-card footer{display:flex;justify-content:space-between;gap:10px;padding:11px 13px;color:#64748b}.endgame-study-board-card footer b{color:#17213a}.endgame-study-side{min-height:520px;display:flex;flex-direction:column}.endgame-study-side header{padding:20px;border-bottom:1px solid #dfe5ed}.endgame-study-side h2{margin:5px 0;font-size:1.45rem}.endgame-study-side header p{margin:0;color:#68758a;line-height:1.5}.endgame-study-message{margin:18px;padding:13px 14px;border:1px solid #d9e2ef;border-radius:9px;background:#f2f6fc;font-weight:750}.endgame-study-message.is-good{color:#087a39;background:#edf9f1;border-color:#a8dbb8}.endgame-study-message.is-bad{color:#a92626;background:#fff1f1;border-color:#f0b2b2}.endgame-study-rating-change{margin:0 18px 12px;padding:12px;border:1px solid #e0e6ee;border-radius:9px}.endgame-study-rating-change .positive{color:#07833e}.endgame-study-rating-change .negative{color:#c42a2a}.endgame-study-solution{margin:0 18px;border:1px solid #dfe5ed;border-radius:9px}.endgame-study-solution summary{padding:10px 12px;cursor:pointer;font-weight:750}.endgame-study-solution pre{max-height:170px;overflow:auto;margin:0;padding:12px;border-top:1px solid #e4e9f0;white-space:pre-wrap;font:13px/1.5 ui-monospace,Consolas,monospace}.endgame-study-actions{margin-top:auto;display:flex;gap:8px;padding:16px 18px;border-top:1px solid #e0e6ee}.endgame-study-actions button,.endgame-study-loading button{padding:10px 14px;border:1px solid #b9c5d5;border-radius:8px;background:#fff;font-weight:750;cursor:pointer}.endgame-study-actions .primary{margin-left:auto;color:#fff;background:#155fd7;border-color:#155fd7}.endgame-study-actions button:disabled{opacity:.5}.endgame-study-loading{padding:28px;border:1px solid #d6dee9;border-radius:14px;background:#fff}.endgame-study-loading.is-error{border-color:#e8b8b8;background:#fff7f7}@media(max-width:980px){.endgame-study-app{grid-template-columns:1fr}.endgame-studies-heading{align-items:start;flex-direction:column}.endgame-study-profile{justify-content:flex-start}}@media(min-width:981px) and (min-height:700px){.endgame-studies-workspace{height:calc(100vh - 70px);display:flex;flex-direction:column;overflow:hidden;padding-top:12px;padding-bottom:12px}.endgame-study-app{--study-size:clamp(420px,calc(100vh - 220px),680px);grid-template-columns:var(--study-size) minmax(320px,1fr);height:100%}.endgame-study-board-card{width:var(--study-size)}.endgame-study-side{height:calc(var(--study-size) + 44px);min-height:0;overflow:auto}}


/* v14.5 responsive and rendering stability */
.endgame-study-board{
  grid-template-columns:repeat(8,minmax(0,1fr));
  grid-template-rows:repeat(8,minmax(0,1fr));
  min-width:0;min-height:0;contain:layout paint;
}
.endgame-study-square{min-width:0;min-height:0;aspect-ratio:auto;contain:layout paint;}
.endgame-study-piece{transform:translateZ(0);backface-visibility:hidden;}
@media(min-width:981px){
  .endgame-studies-workspace{height:calc(100dvh - 70px);min-height:0;box-sizing:border-box;}
  .endgame-study-app{
    --study-size:min(680px,calc(100dvh - 300px),calc(100vw - 430px));
    grid-template-columns:var(--study-size) minmax(300px,1fr);
    min-height:0;height:auto;
  }
  .endgame-study-board-card{width:var(--study-size);min-width:0;}
  .endgame-study-side{height:calc(var(--study-size) + 44px);min-height:0;}
}
@media(min-width:981px) and (max-height:760px){
  .endgame-studies-heading{margin-bottom:8px;}
  .endgame-studies-heading h1{font-size:1.75rem;}
  .endgame-study-stat{padding:6px 9px;min-width:76px;}
  .endgame-study-sourcebar{padding:7px 10px;margin-bottom:7px;}
  .endgame-study-side header{padding:14px 16px;}
  .endgame-study-message{margin:12px 14px;padding:10px 12px;}
}


/* v14.5.1: keep legal drop targets inside the grid and stabilize drag images. */
.endgame-study-board{position:relative;}
.endgame-study-drag{box-sizing:border-box;contain:layout paint;overflow:hidden;}
.endgame-study-drag>.tjk-chess-piece{display:block;width:92%!important;height:92%!important;max-width:100%;max-height:100%;object-fit:contain;}

/* v14.7.0 shared board annotations for composed studies */
.endgame-study-board-wrap{position:relative;width:100%;aspect-ratio:1;background:#789b59}
.endgame-study-board-wrap .endgame-study-board{position:absolute;inset:0;width:100%;height:100%;aspect-ratio:auto}
.endgame-study-annotations{position:absolute;inset:0;z-index:7;width:100%;height:100%;pointer-events:none}

/* v14.7.2: exact annotations, complete vertical layout, replay and engine review. */
.endgame-studies-workspace{
  height:auto!important;
  min-height:calc(100dvh - 70px);
  overflow:visible!important;
  padding-bottom:72px;
}
.endgame-study-app{
  height:auto!important;
  align-items:start;
}
.endgame-study-side{
  height:auto!important;
  max-height:none!important;
  min-height:calc(min(680px,calc(100dvh - 245px)) + 44px);
  overflow:visible!important;
}
.endgame-study-features{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.endgame-study-features span{padding:5px 8px;border-radius:999px;background:#eef4ff;color:#174ea6;font-size:.72rem;font-weight:800}
.endgame-study-review{margin:0 18px 14px;border:1px solid #d9e2ef;border-radius:10px;overflow:hidden;background:#f8fafc}
.endgame-study-review-nav{display:flex;gap:6px;padding:10px;border-bottom:1px solid #dfe6ef;background:#fff}
.endgame-study-review-nav button,.endgame-study-engine button,.endgame-study-engine select{min-height:34px;padding:6px 9px;border:1px solid #bdc9d9;border-radius:7px;background:#fff;color:#17213a;font-weight:750;cursor:pointer}
.endgame-study-review-nav button{min-width:38px}
.endgame-study-moves{max-height:170px;overflow:auto;padding:8px 10px;background:#fff}
.endgame-study-move-row{display:grid;grid-template-columns:30px minmax(0,1fr) minmax(0,1fr);gap:5px;align-items:center;min-height:32px}
.endgame-study-move-row>span{color:#7a8799;font-size:.78rem;text-align:right}
.endgame-study-move-row button{min-width:0;padding:5px 7px;border:1px solid transparent;border-radius:6px;background:transparent;color:#26344b;text-align:left;font-weight:750;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.endgame-study-move-row button:hover{background:#edf3fd}
.endgame-study-move-row button.is-current{border-color:#6e9be1;background:#dceaff;color:#0b4db0}
.endgame-study-engine{padding:10px;border-top:1px solid #dfe6ef}
.endgame-study-engine-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:8px}
.endgame-study-engine-head label{display:flex;align-items:center;gap:6px;font-weight:750}
.endgame-study-engine-controls{display:flex;flex-wrap:wrap;gap:6px}
.endgame-study-engine-controls button.is-active{border-color:#4c88e3;background:#e5efff;color:#0755c9}
.endgame-study-engine-state{margin:8px 0;color:#657287;font-size:.78rem}
.endgame-study-engine-lines{display:grid;gap:5px;max-height:170px;overflow:auto}
.endgame-study-engine-line{display:grid;grid-template-columns:62px minmax(0,1fr) auto;gap:8px;align-items:center;width:100%;padding:9px;border:1px solid transparent;border-radius:7px;background:#fff;color:inherit;text-align:left;cursor:pointer}
.endgame-study-engine-line:hover,.endgame-study-engine-line:focus-visible{border-color:#bcd0ff;background:#edf3ff;outline:none}
.endgame-study-engine-line:disabled{cursor:default;opacity:.72}
.endgame-study-engine-lines b{color:#124fa8}.endgame-study-engine-lines span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:inherit;font-size:.86rem;font-weight:650}.endgame-study-engine-lines small{color:#64748b;font-size:.72rem}
.endgame-study-engine-empty{padding:8px;color:#718096;background:#fff;border-radius:7px}
.endgame-study-empty-line{color:#718096;font-size:.82rem}
.endgame-study-actions{position:static}
@media(min-width:981px){
  .endgame-study-app{--study-size:min(680px,calc(100dvh - 245px),calc(100vw - 430px));}
  .endgame-study-board-card{position:sticky;top:84px}
}
@media(max-width:980px){
  .endgame-study-side{min-height:0}
  .endgame-study-board-card{position:static}
}


/* v14.7.6 — keep the complete composed-study board inside laptop viewports. */
@media(min-width:981px){
  .endgame-study-app{--study-size:min(660px,calc(100dvh - 275px),calc(100vw - 430px))}
  .endgame-study-board-card{top:76px}
}
@media(min-width:981px) and (max-height:820px){
  .endgame-studies-workspace{padding-top:8px}
  .endgame-studies-heading{margin-bottom:7px}
  .endgame-studies-heading h1{font-size:1.65rem}
  .endgame-study-sourcebar{margin-bottom:6px;padding:6px 9px}
  .endgame-study-app{--study-size:min(600px,calc(100dvh - 285px),calc(100vw - 430px))}
}
@media(max-width:980px){
  .endgame-studies-workspace{padding-inline:12px;padding-bottom:42px}
  .endgame-study-board-card{width:min(100%,680px);margin-inline:auto}
}

/* v15.0.1 — studies use an approximate difficulty selector instead of Elo. */
.endgame-study-difficulty{display:grid;gap:5px;min-width:140px;padding:8px 10px;border:1px solid #dce3ed;border-radius:10px;background:#fff;color:#68758a;font-size:.7rem;font-weight:800;text-transform:uppercase;letter-spacing:.04em}
.endgame-study-difficulty select{min-height:34px;padding:5px 28px 5px 8px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;color:#17213a;font-size:.82rem;font-weight:750;text-transform:none;letter-spacing:0}
@media(max-width:760px){.endgame-study-difficulty{min-width:0;flex:1 1 170px}}

/* v15.0.2 — keep imported study metadata in the site typeface. */
.endgame-study-side,.endgame-study-side *{font-family:inherit}
.endgame-study-side>header>p{overflow-wrap:anywhere;line-height:1.45}

/* v15.1.75 — never clip the composed-study board at the bottom. */
.endgame-studies-workspace{height:auto!important;min-height:calc(100dvh - 70px)!important;overflow:visible!important}
.endgame-study-app{height:auto!important;overflow:visible!important}
.endgame-study-board-card{position:static!important;overflow:visible!important}
@media(min-width:981px){
  .endgame-study-app{--study-size:min(680px,calc(100vw - 430px),calc(100dvh - 210px))!important;grid-template-columns:var(--study-size) minmax(300px,1fr)}
  .endgame-study-board-card{width:var(--study-size)!important}
  .endgame-study-side{height:auto!important;min-height:calc(var(--study-size) + 44px)!important;overflow:visible!important}
}
@media(max-width:980px){
  .endgame-study-board-card{width:min(100%,680px)!important;margin-inline:auto}
  .endgame-study-board-wrap{width:100%;max-width:100%;aspect-ratio:1}
}
/* v15.1.76 — use nearly all phone width for composed studies. */
@media(max-width:620px){
  .endgame-studies-workspace{padding-left:4px!important;padding-right:4px!important}
  .endgame-study-app{gap:8px!important}
  .endgame-study-board-card{width:calc(100dvw - 8px)!important;max-width:none!important}
}
