body.openings-page{margin:0;min-width:0;color:var(--ink);padding-bottom:96px}
.openings-main{width:min(1100px,calc(100% - 28px));margin:0 auto;padding:18px 0 30px}
.openings-page [hidden]{display:none!important}
.opening-panel,.opening-card{background:var(--panel-cream);border:1px solid #dfcdbb;border-radius:14px;box-shadow:var(--panel-shadow,0 5px 0 #d5c2ab)}
.opening-hero{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 24px;margin-bottom:22px}
.opening-hero h1{margin:0;font-size:clamp(1.8rem,3vw,2.4rem);letter-spacing:-.04em;line-height:1.1}
.opening-hero p{margin:8px 0;color:#665a50;line-height:1.5}
.opening-hero img{width:116px;height:116px;object-fit:contain;flex-shrink:0}
#opening-catalog-count,.opening-muted,.opening-source{color:#776657;font-size:13px;line-height:1.5}
.opening-filters{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:0 0 16px}
.opening-search{flex:1 1 240px;min-width:0}
.opening-filters input,.opening-filters select,.opening-select{width:100%;min-width:0;border:1px solid #d7c4b1;border-radius:10px;background:var(--panel-cream);padding:11px 12px;color:var(--ink);font:600 14px var(--sans);min-height:44px}
.opening-filters label:has(select){flex:0 1 auto;max-width:100%}
.opening-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:9px 15px;border:1px solid #d7b79d;border-radius:10px;background:var(--panel-cream);box-shadow:0 3px 0 #c4a98e;color:#713e29;font:700 14px var(--sans);text-decoration:none;cursor:pointer}
.opening-button.primary{background:var(--brand,#ec795f);border-color:#cd6047;box-shadow:0 3px 0 #ae4936;color:#281d18}
.opening-button:active{translate:0 2px;box-shadow:0 1px 0 #c4a98e}
.opening-button:disabled{opacity:.48;cursor:default;translate:none}
.openings-page :is(a,button,input,select):focus-visible{outline:3px solid #2b67af;outline-offset:3px}
.opening-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.opening-card{display:grid;grid-template-columns:100px minmax(0,1fr);gap:14px;padding:14px;text-decoration:none;color:inherit;align-items:center;transition:transform .15s ease}
.opening-card:hover{transform:translateY(-2px)}
.opening-card h2{margin:5px 0;font-size:16px;line-height:1.3;overflow-wrap:anywhere}
.opening-card p{margin:5px 0;font-size:12px;line-height:1.5;color:#6c5b4d}
.opening-badge{display:inline-block;color:#88552e;background:#faeddc;border-radius:6px;padding:3px 6px;font-size:11px;font-weight:800;margin:0 4px 3px 0}
.opening-badge.guided{background:#edf0df;color:#4d6231}
.opening-progress{font-size:11px;font-weight:800;color:#4c6a33;display:block;margin-top:5px}
.opening-preview{display:grid;grid-template-columns:repeat(8,1fr);aspect-ratio:1;width:100%;border:2px solid #ae9275;border-radius:5px;overflow:hidden;align-self:center;pointer-events:none}
.opening-preview-square{position:relative;aspect-ratio:1;display:grid;place-items:center;background:var(--board-light,#f1d9b5)}
.opening-preview-square.dark{background:var(--board-dark,#8b6650)}
.opening-preview img{display:block;width:90%;height:90%;object-fit:contain}
.opening-pagination{display:flex;justify-content:center;align-items:center;gap:14px;margin:24px 0;flex-wrap:wrap}
.opening-source{margin-top:22px;text-align:center;font-size:11px}
.opening-source a{color:inherit;text-underline-offset:3px}
.opening-detail-heading{display:flex;align-items:center;gap:14px;margin-bottom:16px;flex-wrap:wrap}
.opening-detail-heading h1{margin:0;font-size:clamp(1.3rem,2.4vw,1.9rem);line-height:1.2;letter-spacing:-.025em;overflow-wrap:anywhere;flex:1;min-width:150px}
.opening-tabs{display:flex;gap:6px;margin:0 0 16px}
.opening-tabs button{flex:1;border:1px solid #d4bda5;background:linear-gradient(180deg,#fffdf8,#f4e7d6);box-shadow:inset 0 1px 0 #fff, inset 0 -2px 0 #ead8c3, 0 4px 0 #c4a98e, 0 7px 10px #79451f1a;color:#73523c;padding:10px 8px;font:700 14px var(--sans);border-radius:10px;min-height:44px;cursor:pointer;transition:transform .09s ease,box-shadow .09s ease}
.opening-tabs button[aria-selected=true]{background:linear-gradient(180deg,#ff997b,#ef8069 55%,#eb725d);color:#321c14;border-color:#d7684f;box-shadow:inset 0 1px 0 #ffc4ad,inset 0 -2px 0 #df6752,0 4px 0 #b7523c,0 7px 10px #79451f26}
.opening-tabs button:active{transform:translateY(3px);box-shadow:inset 0 2px 3px #79451f33,0 1px 0 #c4a98e}
.opening-tabs button[aria-selected=true]:active{box-shadow:inset 0 2px 3px #79451f33,0 1px 0 #b7523c}
.opening-workspace{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(265px,1fr);gap:20px;align-items:start}
.opening-board-card{padding:12px;min-width:0}
.openings-page .opening-board-card.shared-board-card{border-color:#cdb59d;background:var(--panel-cream);box-shadow:inset 0 1px 0 #fffdf8,inset 0 -2px 0 #ead8c3,0 7px 0 #c4a98e,0 12px 18px #79451f26}
.opening-board-top{display:flex;align-items:center;justify-content:space-between;gap:6px;margin:0 0 10px;font-size:13px;font-weight:700}
.opening-board-tools{display:flex;gap:6px}
.opening-board-tools .puzzle-sound-toggle{cursor:pointer}.opening-board-tools .opening-flip{width:34px;height:32px}.opening-flip img{width:28px;height:28px;object-fit:contain}
.openings-page .opening-board{width:100%;aspect-ratio:1;display:grid;grid-template-columns:repeat(8,1fr);overflow:hidden;position:relative;margin:0}
.openings-page .opening-board .board-square{min-width:0;min-height:0;padding:0;aspect-ratio:1;border:0;border-radius:0;box-shadow:none;position:relative;display:grid;place-items:center;cursor:pointer}
.openings-page .opening-board .board-square.selected{box-shadow:inset 0 0 0 4px #e97f47}
.openings-page .opening-board .board-square.legal-destination:after{content:'';position:absolute;width:24%;height:24%;border-radius:50%;background:#2b4d3f66;pointer-events:none}
.openings-page .opening-board .board-square.hint{box-shadow:inset 0 0 0 4px #dd6e35}
.openings-page .opening-board .board-square.last{background-image:linear-gradient(#eab85145,#eab85145)}
.openings-page .opening-board .chess-piece{width:90%;height:90%;object-fit:contain;pointer-events:none}
.opening-board .coord{z-index:2;pointer-events:none;font-size:10px;line-height:1;font-weight:800;position:absolute}
.opening-board .coord.file{bottom:3px;right:3px}.opening-board .coord.file.white-side-top{top:3px;bottom:auto}.opening-board .coord.rank{top:3px;left:3px}
.opening-board-nav{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:12px}
.opening-board-nav span{flex:1;text-align:center;font-size:12px;font-weight:700}
.opening-feedback{margin:6px 4px 2px;font-size:14px;line-height:1.5;color:#63442e;font-weight:700;text-align:center}
.opening-side-panel{min-width:0;padding:18px}
.opening-side-panel h2{font-size:19px;margin:0 0 10px}
.opening-side-panel h3{font-size:15px;margin:20px 0 8px}
.opening-side-panel p{font-size:14px;line-height:1.65;margin:8px 0 14px;color:#635348}
.opening-side-panel label{display:block;font-size:13px;font-weight:700;margin-bottom:10px}
.opening-side-panel label select{margin-top:7px}
.opening-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}
.opening-moves{display:flex;gap:4px;flex-wrap:wrap;max-height:180px;overflow-y:auto;margin:14px 0;padding:4px}
.opening-moves button{background:none;border:0;padding:7px 8px;border-radius:6px;font:700 13px var(--sans);color:#655244;cursor:pointer;min-height:36px}
.opening-moves button.current{background:#f8d0b7;color:#55321c}
.opening-move-note{border-left:3px solid #e97c5e;padding:3px 0 3px 12px;min-height:74px}
.opening-fox{width:58px;height:58px;object-fit:contain;float:right;margin:0 0 8px 10px}
.opening-related-list{display:grid;gap:10px}
.opening-related{display:grid;grid-template-columns:64px 1fr;gap:12px;align-items:center;padding:9px;border:1px solid #dec5ae;border-radius:10px;text-decoration:none;color:inherit;background:#fffaf2}
.opening-related strong{font-size:13px;display:block}.opening-related small{display:block;font-size:11px;color:#78624e;margin-top:5px}
.opening-empty{grid-column:1/-1;padding:24px;text-align:center;line-height:1.6}
.opening-save-status{font-size:12px;color:#78624e;text-align:center;min-height:18px;line-height:1.6}
.opening-save-status:empty{min-height:0;margin:0}
.opening-error{color:#a43c29!important}
.opening-score{font-size:30px;font-weight:800;color:#4d6a38;margin:14px 0}
@media(max-width:760px){.opening-grid{grid-template-columns:1fr}.opening-workspace{grid-template-columns:1fr;gap:16px}.opening-board-card{max-width:540px;width:100%;margin:auto}.opening-side-panel{max-width:540px;width:100%;margin:auto}.opening-hero{padding:16px}.opening-hero img{width:84px;height:84px}.opening-hero p{font-size:14px}.opening-filters label:has(select){flex:1 1 120px}.opening-filters>.opening-button{flex:0 0 auto}.opening-detail-heading{gap:10px}.opening-card{grid-template-columns:90px minmax(0,1fr)}.opening-tabs{gap:4px}.opening-tabs button{font-size:12px;padding:10px 4px}.opening-board-tools .opening-button{min-height:40px}.opening-source{line-height:1.6}}
@media(prefers-reduced-motion:reduce){.opening-card{transition:none}}
.openings-page .visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.opening-filters>label{margin:0;width:auto;display:block}

/* Compact surrounding controls while preserving a full-size board. */
.opening-detail-heading{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;margin-bottom:10px;padding:6px 10px;background:var(--mobile-header-cream,#fff7ea);border:1px solid #dfcdbb;border-radius:12px;box-shadow:var(--panel-shadow,0 5px 0 #d5c2ab)}
.opening-detail-heading h1{min-width:0;font-size:clamp(16px,2vw,23px)}
.opening-detail-heading .opening-button{min-height:36px;padding:6px 9px;font-size:12px}
.opening-tabs{margin-bottom:12px}
.opening-board-top{margin:8px 4px 0;text-transform:none;letter-spacing:normal;color:var(--ink);font-family:var(--sans)}
.opening-board-nav.puzzle-move-controls{margin-top:4px;gap:6px}
.opening-workspace:not([data-opening-mode="practice"]) .opening-feedback{display:none}
.opening-workspace[data-opening-mode="explore"] .opening-side-panel{padding:12px}
.opening-board-nav .opening-moves{position:relative;flex:1;min-width:0;flex-wrap:nowrap;align-items:center;overflow-x:auto;overflow-y:hidden;margin:0;padding:0;gap:2px;height:44px;scrollbar-width:thin}
.opening-board-nav .opening-moves button{flex:0 0 auto;padding:5px 7px;min-height:34px;white-space:nowrap}
.opening-board-nav .coach-analysis-step{flex-shrink:0}
.opening-variation-heading{display:flex;justify-content:space-between;align-items:center;gap:8px;margin:4px 0 6px}
.opening-variation-heading h3{margin:0;font-size:13px}
.opening-variation-heading a{font-size:12px;color:#855038;font-weight:700;white-space:nowrap}
.opening-side-panel .opening-variation-label{margin:0}
.opening-variation-label .opening-select{margin-top:0;padding:9px 10px;font-size:13px}
@media(max-width:760px){
 .openings-main:has(#opening-detail:not([hidden])){padding-top:10px}
 .opening-detail-heading{margin-bottom:8px}
 .opening-tabs{margin-bottom:8px}
 .opening-workspace{gap:12px}
 .opening-workspace[data-opening-mode="explore"] .opening-side-panel{max-width:540px;padding:10px}
 .opening-variation-heading{margin:2px 0 4px}
}
@media(max-width:360px){.opening-detail-heading{gap:6px}.opening-detail-heading h1{font-size:16px}}
.openings-main:has(#opening-detail:not([hidden])){max-width:1100px;padding-bottom:16px}
@media(max-width:760px){
 .opening-workspace{grid-template-columns:1fr}
}

.opening-feedback:empty{display:none}
.opening-workspace[data-opening-mode="practice"] .opening-side-panel{padding:12px}
.opening-practice-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}
.opening-practice-heading h2{margin:0;font-size:15px;line-height:1.2}
.opening-side-panel .opening-practice-heading label{margin:0;flex:0 0 110px}
.opening-side-panel .opening-practice-heading select{margin:0;padding:7px 9px;font-size:12px}
.opening-practice-actions{display:flex;gap:8px;margin-top:8px;padding-bottom:3px}
.opening-practice-actions button{display:flex;flex:1;min-width:0;align-items:center;justify-content:center;gap:7px;min-height:48px;padding:6px 8px;border:1px solid #d5bba7;border-radius:10px;background:#fffaf5;box-shadow:0 3px 0 #c7ad99;color:#654633;font:800 12px/1.3 var(--sans);cursor:pointer}
.opening-practice-actions button img{flex:none;width:34px;height:34px;object-fit:contain}
.opening-practice-actions button:hover{background:#fff4e7}
.opening-practice-actions button:active{transform:translateY(2px);box-shadow:0 1px 0 #c7ad99}
@media(prefers-reduced-motion:reduce){.opening-tabs button{transition:none}}

.opening-desktop-overview{display:none}
.opening-desktop-lines{display:grid;gap:7px;margin-bottom:10px}
.opening-line-link{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:8px;padding:10px;border:1px solid #e3d2c0;border-radius:9px;background:var(--mobile-header-cream,#fff7ea);color:#654633;text-decoration:none;font-size:13px;font-weight:700;line-height:1.4;min-height:44px}
.opening-line-link .opening-badge{margin:0}
.opening-line-link>span:nth-child(2){overflow-wrap:anywhere}
.opening-line-link:hover{background:#f9e8d6;border-color:#cda889}
@media(max-width:1023px){
 .opening-desktop-lines .opening-line-link:nth-child(n+4){display:none}
 .opening-workspace[data-opening-mode="explore"] .opening-side-panel:not(:has(.opening-variation-heading)){display:none}
}
/* Desktop library and board-first workspace share the main navigation width. */
@media(min-width:1024px){
 body.openings-page:has(#opening-detail:not([hidden])){padding-bottom:0}
 .openings-main,.openings-main:has(#opening-detail:not([hidden])){width:calc(100% - 32px);max-width:1180px;padding-top:12px}
 .opening-library-header{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;align-items:center;margin-bottom:20px}
 .opening-hero{min-width:0;padding:14px 22px;margin-bottom:0;background:var(--mobile-header-cream,#fff7ea);min-height:120px}
 .opening-hero h1{font-size:30px}
 .opening-hero p{margin:6px 0;font-size:14px}
 .opening-hero img{width:90px;height:90px}
 .opening-filters{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:10px;min-width:0;margin-bottom:0}
 .opening-filters .opening-search{grid-column:1/-1}
 .opening-filters>label{min-width:0}
 .opening-filters input{background:var(--mobile-header-cream,#fff7ea)}
 #opening-results-label{margin:0 0 12px;font-weight:700}
 .opening-grid{gap:16px}
 .opening-card{grid-template-columns:104px minmax(0,1fr);gap:14px;padding:16px;min-height:148px;align-items:center}
 .opening-card h2{font-size:16px;line-height:1.35;margin:5px 0 6px}
 .opening-card p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;margin:0;line-height:1.5}
 .opening-progress:empty{display:none}
 /* Reserve height for the header, board controls, and bottom spacing. */
 #opening-detail{display:grid;grid-template-columns:minmax(0,min(640px,max(320px,calc(100dvh - 230px)))) minmax(340px,1fr);grid-template-rows:auto auto auto 1fr;column-gap:22px;row-gap:14px;align-items:start}
 .opening-detail-heading{grid-column:2;grid-row:1;margin:0;padding:10px 12px;gap:8px;grid-template-columns:minmax(0,1fr) auto}
 .opening-detail-heading .opening-button{grid-column:1;grid-row:1;justify-self:start;min-height:32px;font-size:12px}
 .opening-detail-heading .opening-badge{grid-column:2;grid-row:1;margin:0}
 .opening-detail-heading h1{grid-column:1/-1;grid-row:2;font-size:23px;line-height:1.25;padding:3px 0}
 .opening-tabs{grid-column:2;grid-row:2;margin:0;gap:7px}
 .opening-tabs button{font-size:13px;padding:9px 5px}
 .opening-workspace{display:contents}
 .opening-board-card{grid-column:1;grid-row:1/5;width:100%;margin:0}
 .opening-side-panel{grid-column:2;grid-row:3;width:100%}
 .opening-workspace:is([data-opening-mode="explore"],[data-opening-mode="practice"]) .opening-side-panel{padding:16px}
 .opening-desktop-overview{display:block;margin-bottom:20px}
 .opening-desktop-overview h2{font-size:18px;margin:0 0 8px}
 .opening-desktop-overview p{margin:0;line-height:1.6}
 .opening-desktop-overview .opening-actions{margin-top:12px}
 .opening-desktop-overview:last-child{margin-bottom:0}
 .opening-variation-heading{margin:0 0 10px}
 .opening-variation-heading h3{font-size:14px}
 .opening-practice-heading h2{font-size:17px}
 .opening-practice-actions{margin-top:12px}
 #opening-detail>.opening-empty,#opening-detail>p{grid-column:1/-1}
}
@media(min-width:1200px){
 .opening-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* Continue from the named line without covering live board controls. */
.opening-board .opening-explore-cue{animation:none;font-size:clamp(16px,4vw,22px)}
.opening-position{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:6px 4px 0;font:700 13px/1.35 var(--sans);color:#655244}
#opening-match{min-width:0;overflow-wrap:anywhere}
#opening-evaluation{flex:none;margin-left:auto;font:inherit;font-variant-numeric:tabular-nums;white-space:nowrap}
.opening-workspace:has(.opening-board.is-exploring) .opening-feedback:not(:empty){display:block}

.opening-board-top #opening-turn{min-width:0;white-space:normal;overflow:visible;text-overflow:clip;line-height:1.4}
.opening-board-tools{flex-shrink:0}
