*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--iwg-soft); color: var(--iwg-ink); font: 15px/1.5 var(--iwg-font); }
button, select { font: inherit; }
a { color: var(--iwg-blue); }
.cd-page { max-width: 1220px; padding-block: 28px 40px; }
.cd-page :is(h1,h2,p), #dialog :is(h2,p) { margin: 0; }
.cd-heading, .cd-board-heading, .cd-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cd-heading h1 { font-size: clamp(28px,4vw,38px); letter-spacing: -.045em; line-height: 1.2; }
.cd-heading p { color: var(--iwg-muted); }
.cd-breadcrumb { font-size: 12px; padding-bottom: 6px; }
.cd-modes, .cd-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.cd-modes { margin: 18px 0 14px; }
.cd-page .iwg-button, #dialog .iwg-button { border-radius: 11px; padding: 8px 14px; }
.cd-page .iwg-button[aria-pressed="true"] { border-color: var(--iwg-blue); color: var(--iwg-blue); background: var(--iwg-soft); }
.cd-layout { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(250px,.75fr); gap: 18px; align-items: start; }
.cd-main, .cd-panel, .cd-guide { padding: 16px; }
.cd-side { display: grid; gap: 14px; }
.cd-page h2 { font-size: 18px; line-height: 1.25; letter-spacing: -.02em; }
.cd-board-heading { width: min(100%,480px); margin: 0 auto 10px; }
#difficulty, .cd-muted, #feedback { color: var(--iwg-muted); font-size: 13px; }
#clock { font-variant-numeric: tabular-nums; font-weight: 800; }
.cd-tutorial { width: min(100%,480px); margin: 0 auto 10px; padding: 7px 10px; background: var(--iwg-soft); border-radius: 8px; font-size: 12px; }
#board {
  width: min(100%,480px); margin: auto; border-radius: 8px; display: grid;
  --edge: #465670; --hairline: #35486a30; --piece-ink: #152545;
  user-select: none; touch-action: pan-y pinch-zoom;
}
#board.mark-mode { touch-action: pinch-zoom; }
#board [role="row"] { display: grid; grid-template-columns: repeat(var(--columns),minmax(0,1fr)); }
.cd-cell, .cd-tray-piece { --region-bg: #e1edff; position: relative; color: var(--piece-ink,#152545); background: var(--region-bg); cursor: pointer; }
[data-theme="dark"] :is(.cd-cell,.cd-tray-piece) { color: #f4f7ff; --region-bg: #243e63; --edge: #93a9ca; --hairline: #eff5ff32; }
.cd-cell { display: grid; place-items: center; padding: 0; aspect-ratio: 1; border: 0 solid var(--edge); box-shadow: inset -1px -1px var(--hairline); }
.cd-cell.west { border-left-width: 2px; }
.cd-cell.north { border-top-width: 2px; }
.cd-cell.east { border-right-width: 2px; }
.cd-cell.south { border-bottom-width: 2px; }
.cd-cell.wall { background: var(--iwg-soft); color: var(--iwg-muted); cursor: default; }
.cd-cell small { position: absolute; top: 1px; left: 4px; font-size: clamp(8px,1.5vw,11px); font-weight: 800; }
.cd-piece { width: 62%; height: 62%; max-width: 55px; max-height: 55px; fill: currentColor; stroke: currentColor; pointer-events: none; }
.cd-piece .cut { fill: none; stroke: var(--region-bg); stroke-width: 2; }
.cd-cell.wall .cut { stroke: var(--iwg-soft); }
.cd-cell.attacked { background-image: repeating-linear-gradient(135deg, transparent 0 7px, #657e9d38 7px 9px); }
/* Use the region's own color to guide placement without obscuring grid lines. */
.cd-cell:is(.available,.selected,.tutorial-cell) {
  background-color: color-mix(in srgb, var(--region-bg) 86%, currentColor);
}
.cd-cell.available:not(.has-piece)::before {
  content: "";
  position: absolute;
  right: 9%;
  bottom: 9%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .45;
}
.cd-cell, .cd-tray-piece { -webkit-tap-highlight-color: transparent; }
.cd-cell.hinted { outline: 3px dashed #846000; outline-offset: -5px; }
[data-theme="dark"] .cd-cell.hinted { outline-color: #ffd878; }
.cd-cell.conflict { outline: 3px solid #aa193c; outline-offset: -4px; }
.cd-conflict-icon { position: absolute; bottom: 2px; right: 2px; width: 15px; height: 15px; line-height: 15px; border-radius: 12px; background: #aa193c; color: white; font-weight: 700; }
.cd-x { font-size: clamp(16px, 4vw, 28px); font-weight: 650; }
.cd-cell:focus-visible, .cd-tray-piece:focus-visible { outline: 2px dashed currentColor; outline-offset: -4px; z-index: 1; }
@media (hover:hover) { .cd-cell:hover:not(.wall) { filter: brightness(.92); } }
.cd-cell[data-color="1"], .cd-tray-piece[data-color="1"] { --region-bg:#deefe2; }
.cd-cell[data-color="2"], .cd-tray-piece[data-color="2"] { --region-bg:#fae2ee; }
.cd-cell[data-color="3"], .cd-tray-piece[data-color="3"] { --region-bg:#ffedc8; }
.cd-cell[data-color="4"], .cd-tray-piece[data-color="4"] { --region-bg:#e9e1fa; }
.cd-cell[data-color="5"], .cd-tray-piece[data-color="5"] { --region-bg:#d8f0ef; }
.cd-cell[data-color="6"], .cd-tray-piece[data-color="6"] { --region-bg:#ffe3d9; }
.cd-cell[data-color="7"], .cd-tray-piece[data-color="7"] { --region-bg:#e7ecd0; }
[data-theme="dark"] [data-color="1"] { --region-bg:#234739; }
[data-theme="dark"] [data-color="2"] { --region-bg:#592e48; }
[data-theme="dark"] [data-color="3"] { --region-bg:#574321; }
[data-theme="dark"] [data-color="4"] { --region-bg:#443961; }
[data-theme="dark"] [data-color="5"] { --region-bg:#214b53; }
[data-theme="dark"] [data-color="6"] { --region-bg:#5b3833; }
[data-theme="dark"] [data-color="7"] { --region-bg:#414929; }
.cd-main .cd-controls, #feedback { width: min(100%,480px); margin: 10px auto 0; }
#feedback:empty { display: none; }
#tray { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; touch-action: pinch-zoom; }
.cd-tray-piece { display: flex; align-items: center; border: 1px solid var(--iwg-border); border-radius: 9px; min-height: 44px; min-width: 49px; gap: 1px; padding: 4px; font-weight: 800; }
.cd-tray-piece .cd-piece { width: 28px; height: 28px; }
.cd-tray-piece.placed::after { content:'✓'; font-size: 10px; align-self: flex-start; }
.cd-tray-piece[aria-pressed="true"] { background-color: color-mix(in srgb, var(--region-bg) 82%, currentColor); box-shadow: inset 0 -3px currentColor; }
.cd-panel .cd-controls, #progress, #stats { margin-block: 8px; }
.cd-overlay { display: flex; min-height: 32px; align-items: center; gap: 6px; }
.cd-page select, #dialog select { color: var(--iwg-ink); background: var(--iwg-paper); border: 1px solid var(--iwg-border); min-height: 44px; border-radius: 8px; padding: 4px 8px; }
#practice-options label, #next-daily { display: block; margin: 6px 0; }
.cd-guide { margin-top: 18px; }
.cd-guide summary { font-weight: 800; cursor: pointer; padding-block: 6px; }
.cd-guide p { margin: 8px 0; }
.cd-related { margin-top: 24px; }
.cd-related-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.cd-related-grid a { display: flex; gap: 10px; align-items: center; padding: 12px; text-decoration: none; }
.cd-related-grid svg { width: 58px; max-width: 22%; flex-shrink: 0; background: var(--iwg-soft); border-radius: 8px; }
.cd-related-grid p { font-size: 12px; color: var(--iwg-muted); }
#dialog { width: min(560px,calc(100% - 24px)); max-height: 85dvh; padding: 20px; border-radius: 18px; border: 1px solid var(--iwg-border); background: var(--iwg-paper); color: var(--iwg-ink); }
#dialog::backdrop { background: #15213c99; }
#dialog-body { margin: 10px 0 16px; white-space: pre-line; }
.cd-level-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(125px,1fr)); gap: 8px; margin-top: 10px; }
.cd-level-grid button { min-height: 44px; border: 1px solid var(--iwg-border); border-radius: 8px; color: var(--iwg-ink); background: var(--iwg-soft); cursor: pointer; }
.cd-level-grid button:disabled { opacity: .55; cursor: default; }
.cd-level-grid [aria-current="true"] { border-color: var(--iwg-blue); }
.cd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media(max-width:740px) {
  .cd-page { padding-block-start: 16px; }
  .cd-layout, .cd-related-grid { grid-template-columns: 1fr; }
  .cd-main { padding: 10px; }
  .cd-modes, .cd-controls { gap: 6px; }
  .cd-page .iwg-button { padding-inline: 10px; }
}
@media(prefers-reduced-motion:no-preference) {
  #dialog[open] { animation: cd-show .18s ease-out; }
  @keyframes cd-show { from { opacity: 0; transform: translateY(5px); } }
}

.cd-movement { display: flex; align-items: center; gap: 10px; margin-block: 6px; }
#movement-preview { display: grid; grid-template-columns: repeat(5, 8px); gap: 1px; flex-shrink: 0; }
#movement-preview span { width: 8px; height: 8px; background: var(--iwg-border); }
#movement-preview .reaches { background: var(--iwg-blue); border-radius: 3px; }
#movement-preview .origin { background: var(--iwg-ink); }

/* One focused game box, using the platform's shared theme tokens. */
html.iwg-design .cd-page { max-width:1184px; padding:24px 24px 40px; }
.cd-breadcrumb { margin-bottom:14px !important; }
.cd-game-shell { overflow:hidden; }
.cd-heading { padding:20px 24px; border-bottom:1px solid var(--iwg-border); }
.cd-heading h1 { font-size:28px; }
.cd-heading p { font-size:13px; margin-top:3px; }
.cd-game-title { display:flex; align-items:center; gap:12px; min-width:0; }
.cd-game-title > svg { width:56px; height:48px; flex-shrink:0; border-radius:12px; background:var(--iwg-soft); }
.cd-header-actions { display:flex; gap:8px; flex-shrink:0; }
.iwg-design .cd-header-actions .iwg-button { height:44px; min-width:44px; padding:0 16px; }
.iwg-design .cd-header-actions .cd-fullscreen { padding:0; }
.cd-fullscreen svg { width:20px; height:20px; }
.cd-layout { grid-template-columns:minmax(0,1fr) 288px; gap:0; align-items:stretch; }
.cd-main { min-width:0; padding:0; }
.cd-modes { justify-content:center; margin:0; padding:12px; border-bottom:1px solid var(--iwg-border); background:var(--iwg-soft); }
.iwg-design .cd-modes .iwg-button { background:transparent; border-color:transparent; color:var(--iwg-muted); padding-inline:16px; border-radius:12px; }
.iwg-design .cd-modes .iwg-button[aria-pressed="true"] { background:var(--iwg-paper); color:var(--iwg-blue); border-color:var(--iwg-border); box-shadow:var(--iwg-shadow); }
.cd-board-content { --cd-board-width:400px; padding:20px 24px; }
.cd-board-content :is(.cd-board-heading,#board,.cd-input,.cd-play-actions,#feedback) { width:min(100%,var(--cd-board-width)); margin-inline:auto; }
.cd-board-heading { margin-bottom:16px; }
.cd-board-heading h2 { font-size:18px; }
#clock { background:var(--iwg-soft); border:1px solid var(--iwg-border); border-radius:10px; padding:6px 10px; font-size:14px; }
#board { border-radius:10px; overflow:hidden; box-shadow:0 0 0 1px var(--iwg-border),0 8px 24px #172b4910; }
.cd-cell { transition:filter .1s; }
.cd-cell .cd-piece { width:66%; height:66%; }
.cd-play-actions { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:6px; margin-top:16px !important; }
.iwg-design .cd-play-actions .iwg-button { padding-inline:3px; font-size:12px; }
.cd-side { display:flex; flex-direction:column; gap:0; border-left:1px solid var(--iwg-border); background:var(--iwg-soft); }
.cd-panel { padding:20px; border-bottom:1px solid var(--iwg-border); }
.cd-panel:last-child { border-bottom:0; }
.cd-panel h2 { font-size:15px; margin-bottom:10px; }
.cd-panel > :is(p,a,label) { margin-block:8px; }
.cd-panel > a { display:inline-block; font-size:12px; }
.cd-input { display:grid; grid-template-columns:1fr 1fr; gap:6px; margin:12px 0; }
.iwg-design .cd-input .iwg-button { padding:8px; font-size:12px; background:var(--iwg-paper); }
.iwg-design .cd-input .iwg-button[aria-pressed="true"] { background:var(--iwg-blue); border-color:var(--iwg-blue); color:white; }
.cd-piece-strip h2 { font-size:12px; color:var(--iwg-muted); margin:0; }
#placed { font-size:12px; color:var(--iwg-muted); }
#tray { gap:6px; margin:8px 0 0; }
.cd-tray-piece { min-width:46px; border-radius:10px; }
.cd-movement { margin-top:10px; }
.cd-movement:not(:has(#preview:not([hidden]))) { display:none; }
.cd-overlay input { accent-color:var(--iwg-blue); width:18px; height:18px; }
.cd-overlay { min-height:44px; }
.cd-panel select { width:100%; margin-bottom:8px; }
.cd-panel #new-puzzle { width:100%; }
#loading { padding:24px !important; }
.cd-game-shell:fullscreen,.cd-game-shell.cd-expanded { width:100%; height:100dvh; overflow:auto; border:0; border-radius:0; background:var(--iwg-paper); }
.cd-game-shell.cd-expanded { position:fixed; inset:0; z-index:1000; }
body.cd-focus-mode { overflow:hidden; }
.cd-game-shell:is(:fullscreen,.cd-expanded) .cd-layout { max-width:1100px; margin:auto; }
.cd-game-shell:is(:fullscreen,.cd-expanded) .cd-board-content { --cd-board-width:min(540px,calc(100dvh - 270px)); }
.cd-game-shell:is(:fullscreen,.cd-expanded) .cd-heading { padding:12px 24px; }
@media(max-width:760px) {
  html.iwg-design .cd-page { padding:16px 12px 28px; }
  .cd-heading { padding:14px 12px; gap:8px; }
  .cd-heading h1 { font-size:23px; }
  .cd-heading p { display:none; }
  .cd-game-title { gap:7px; }
  .cd-game-title > svg { width:38px; height:38px; }
  .cd-header-actions { gap:5px; }
  .iwg-design .cd-header-actions .iwg-button { padding-inline:10px; }
  .iwg-design .cd-header-actions .cd-fullscreen { padding:0; }
  .cd-layout { grid-template-columns:1fr; }
  .cd-board-content { padding:14px 12px; --cd-board-width:380px; }
  .cd-modes { display:grid; grid-template-columns:1fr 1.4fr 1fr; gap:3px; padding:6px; }
  .iwg-design .cd-modes .iwg-button { font-size:12px; padding-inline:3px; white-space:nowrap; }
  .cd-side { border-left:0; border-top:1px solid var(--iwg-border); }
  .cd-panel { padding:14px; }
  .cd-tool-panel { display:grid; grid-template-columns:1fr; }
  .cd-tool-panel > h2 { display:none; }
  .cd-input { margin:0 0 12px; }
  .cd-related > .cd-panel-head { align-items:start; flex-direction:column; }
  .cd-game-shell:is(:fullscreen,.cd-expanded) .cd-board-content { --cd-board-width:min(380px,calc(100dvh - 260px)); }
}
@media(prefers-reduced-motion:reduce) { .cd-cell { transition:none; } }

.cd-board-content .cd-input { margin-bottom:12px; }
.cd-game-shell:is(:fullscreen,.cd-expanded) .cd-board-content { --cd-board-width:min(480px,calc(100dvh - 330px)); }
@media(max-width:760px) {
  .cd-game-shell:is(:fullscreen,.cd-expanded) .cd-board-content { --cd-board-width:min(380px,max(180px,calc(100dvh - 320px))); }
}
@media(max-width:360px) {
  .cd-heading h1 { font-size:19px; }
  .cd-game-title > svg { width:28px; height:32px; }
  .cd-heading { padding-inline:10px; }
}

/* Match the muted navigation and numbered instruction cards used across games. */
.cd-page .cd-breadcrumb { display:flex; flex-wrap:wrap; align-items:center; gap:8px; color:var(--iwg-muted); font-size:12px; line-height:1.5; padding:0; margin-bottom:20px !important; }
.cd-breadcrumb a { color:inherit; text-decoration:none; padding-block:5px; }
.cd-breadcrumb a:hover { color:var(--iwg-blue); }
.cd-breadcrumb svg { width:14px; height:14px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.cd-breadcrumb [aria-current] { color:var(--iwg-ink); font-weight:650; }
 .cd-page .cd-breadcrumb { gap:12px; margin:0 0 23px !important; }
.cd-breadcrumb [aria-current] { color:inherit; font-weight:inherit; }
.cd-side :is(.cd-puzzle,.cd-how-to) { margin:12px; padding:20px; }
.cd-side :is(.cd-puzzle,.cd-how-to) h2 { font-size:19px; font-weight:800; margin:0 0 9px; }
.cd-how-to > p,.cd-legend dd { color:var(--iwg-muted); font-size:12px; line-height:1.7; }
.cd-legend { margin:16px 0; }
.cd-legend > div { position:relative; padding-left:48px; margin:16px 0; min-height:38px; }
.cd-legend dt { font-weight:750; font-size:13px; }
.cd-legend dd { margin:2px 0 0; }
.cd-sample { position:absolute; inset:0 auto auto 0; display:grid; place-items:center; width:36px; height:36px; border-radius:8px; font:700 23px/1 system-ui; }
.cd-sample-piece { background:#deefe2; color:#214933; }
.cd-sample-wall { background:var(--iwg-soft); color:var(--iwg-muted); }
.cd-sample-mark { background:#e9e1fa; color:#493463; }
.cd-how-to .cd-guide { box-shadow:none; border-radius:12px; margin-top:10px; background:var(--iwg-soft); }
.cd-how-to .cd-guide summary { padding:12px; font-size:12px; }
.cd-how-to .cd-guide-content { padding:4px 12px 12px; }
.cd-how-to .cd-overlay { border-top:1px solid var(--iwg-border); padding-top:12px; font-size:12px; }
.cd-guide { padding:0; overflow:hidden; }
.cd-guide summary { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 20px; list-style:none; font-size:15px; font-weight:750; }
.cd-guide summary::-webkit-details-marker { display:none; }
.cd-guide summary svg { width:20px; height:20px; flex-shrink:0; fill:none; stroke:var(--iwg-muted); stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.cd-guide[open] summary { border-bottom:1px solid var(--iwg-border); }
.cd-guide[open] summary svg { transform:rotate(180deg); }
.cd-guide-content { padding:12px 20px 20px; font-size:13px; line-height:1.75; color:var(--iwg-muted); }
.cd-guide-content ul { padding-left:20px; }
.cd-breadcrumb a:focus-visible,.cd-guide summary:focus-visible { outline:2px solid var(--iwg-blue); outline-offset:3px; border-radius:4px; }

.cd-timer { display:flex; align-items:center; gap:4px; border:1px solid var(--iwg-border); border-radius:24px; background:var(--iwg-soft); padding-left:10px; }
.cd-timer #clock { padding:0; border:0; background:transparent; }
.cd-page #pause { min-width:44px; min-height:44px; padding:0; border-radius:50%; }
#board { border:2px solid var(--edge); background:var(--iwg-paper); }
#board [role=row]:first-child > * { border-top-width:0; }
#board [role=row]:last-child > * { border-bottom-width:0; }
#board [role=row] > :first-child { border-left-width:0; }
#board [role=row] > :last-child { border-right-width:0; }
.cd-game-shell { isolation:isolate; }
.cd-related .cd-panel-head h2 { font:800 20px/1.3 var(--iwg-font); }
.cd-related .cd-panel-head a { font:700 11px/1.5 var(--iwg-font); color:var(--iwg-blue); text-decoration:none; padding-block:8px; }
.cd-related .cd-panel-head a:hover { color:var(--iwg-blue-hover); text-decoration:none; }
.iwg-design :is(.cd-game-shell,#dialog) .iwg-button:hover:not(:disabled),
.iwg-design .cd-game-shell .iwg-button[aria-pressed=true]:is(:hover,:focus-visible),
.iwg-design .cd-input .iwg-button[aria-pressed=true] { background:var(--iwg-blue); color:var(--iwg-paper); border-color:var(--iwg-blue); transform:none; }
#dialog { font-family:var(--iwg-font); border-radius:var(--iwg-radius); box-shadow:0 20px 64px #101c3d33; }
#dialog.cd-level-picker[open] { display:flex; flex-direction:column; gap:12px; padding:clamp(14px,3vw,24px); overflow:hidden; }
.cd-level-picker #dialog-body { display:flex; flex-direction:column; gap:12px; margin:0; min-height:0; color:var(--iwg-muted); font-size:13px; }
.cd-level-picker select { flex:none; width:100%; }
.cd-level-picker .cd-level-grid { overflow:auto; overscroll-behavior:contain; margin:0; padding:3px; grid-template-columns:repeat(auto-fill,minmax(min(100%,106px),1fr)); grid-auto-rows:max-content; align-content:start; }
.cd-level-grid button { display:grid; grid-template-columns:minmax(0,1fr); align-content:start; gap:4px; padding:10px; min-block-size:max-content; font:inherit; line-height:1.4; text-align:left; }
.cd-level-grid button small { color:var(--iwg-muted); }
.cd-level-grid button:disabled { opacity:1; background:var(--iwg-paper); color:var(--iwg-muted); }
.cd-level-grid button:not(:disabled):is(:hover,:focus-visible),.cd-level-grid [aria-current=true] { background:var(--iwg-soft); color:var(--iwg-blue); border-color:var(--iwg-blue); }
.cd-level-picker #dialog-actions { justify-content:flex-end; }

#dialog:is(.cd-paused,.cd-restart) {
  width:min(360px,calc(100% - 32px));
  padding:28px 24px;
  text-align:center;
}
#dialog.cd-paused::before {
  content:"";
  display:block;
  width:48px;
  height:48px;
  margin:0 auto 14px;
  border-radius:50%;
  background:linear-gradient(var(--iwg-blue),var(--iwg-blue)) 18px center / 4px 16px no-repeat,
             linear-gradient(var(--iwg-blue),var(--iwg-blue)) 26px center / 4px 16px no-repeat,
             var(--iwg-soft);
}
:is(.cd-paused,.cd-restart) #dialog-title { font-size:22px; letter-spacing:-.03em; }
:is(.cd-paused,.cd-restart) #dialog-body { color:var(--iwg-muted); font-size:14px; margin:8px 0 20px; }
:is(.cd-paused,.cd-restart) #dialog-actions { justify-content:center; }

iwebgames-header[data-chessdoku]::part(search-box) { border-color:transparent; outline:none; box-shadow:none; }
iwebgames-header[data-chessdoku]::part(search-input) { outline:none; box-shadow:none; }
.cd-game-title > svg { width:72px; height:56px; border:1px solid var(--iwg-border); border-radius:14px; }
@media(max-width:600px) { .cd-game-title > svg { width:56px; height:48px; border-radius:12px; } }
@media(max-width:360px) { .cd-game-title > svg { width:40px; height:38px; } }

#dialog.cd-restart::before {
  content:"↺" / "";
  display:grid;
  place-items:center;
  width:48px;
  height:48px;
  margin:0 auto 14px;
  border-radius:50%;
  background:var(--iwg-soft);
  color:var(--iwg-blue);
  font:600 28px/1 var(--iwg-font);
}

.cd-side .cd-puzzle { margin-bottom:0; }
.cd-puzzle #levels { width:100%; min-height:44px; margin-top:6px; border-radius:24px; }
.cd-level-grid button { min-width:0; white-space:normal; overflow-wrap:anywhere; }
#dialog.cd-result { width:min(420px,calc(100% - 24px)); text-align:center; }
.cd-result-metrics,.cd-result #dialog-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.cd-result-metrics { margin:12px 0; }
.cd-result-metrics div { padding:10px; border-radius:12px; background:var(--iwg-soft); overflow-wrap:anywhere; }
.cd-result-metrics dt { font-size:12px; color:var(--iwg-muted); }
.cd-result-metrics dd { margin:2px 0 0; font-weight:750; }
.cd-result #dialog-actions .iwg-button { min-width:0; white-space:normal; overflow-wrap:anywhere; }
.cd-result #dialog-actions .iwg-button:not(.iwg-button-secondary) { grid-column:1 / -1; }

.cd-level-grid strong { display:flex; align-items:center; justify-content:space-between; gap:4px; }
.cd-level-grid .cd-level-complete {
  --cd-achievement:#206642;
  background:color-mix(in srgb,var(--iwg-paper) 86%,#39bb77);
  border-color:color-mix(in srgb,var(--iwg-border) 50%,#39bb77);
}
[data-theme="dark"] .cd-level-complete { --cd-achievement:#97e7b8; }
.cd-level-complete strong span,.cd-level-complete small:last-child { color:var(--cd-achievement); }

/* Chessdoku playing surface */
.cd-board-content {
  --cd-board-width: clamp(400px, 41vw, 490px);
  background: radial-gradient(ellipse at top, color-mix(in srgb,var(--iwg-blue) 7%,transparent), transparent 64%);
}
.cd-board-content .cd-board-heading { margin-bottom: 12px; }
.cd-level-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cd-level-id > svg {
  flex: none; width: 41px; height: 41px; padding: 8px; box-sizing: border-box;
  border-radius: 13px; background: #303c78; fill: #ffda87; stroke: #ffda87;
  stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round;
}
.cd-level-id h2 { margin: 0; font-size: clamp(16px,2vw,22px); line-height: 1.2; }
.cd-board-content .cd-goal {
  width: min(100%,var(--cd-board-width)); margin: 0 auto 12px;
  padding: 9px 12px; box-sizing: border-box; background: var(--iwg-paper);
  border: 1px solid var(--iwg-border); border-radius: 12px;
}
.cd-goal > div { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; }
#safe-tally { font-variant-numeric: tabular-nums; }
#safe-progress { appearance: none; display: block; border: 0; width: 100%; height: 6px; margin-top: 7px; border-radius: 10px; overflow: hidden; background: var(--iwg-border); }
#safe-progress::-webkit-progress-bar { background: var(--iwg-border); }
#safe-progress::-webkit-progress-value { background: #278965; border-radius: 10px; }
#safe-progress::-moz-progress-bar { background: #278965; border-radius: 10px; }
.cd-board-content #board { box-sizing: border-box; box-shadow: 0 0 0 3px var(--iwg-paper), 0 6px 20px #18244921; }
.cd-board-content .cd-input { background: var(--iwg-soft); border-radius: 14px; padding: 3px; box-sizing: border-box; gap: 3px; }
.cd-board-content .cd-input button { border-radius: 11px; gap: 7px; }
.cd-board-content .cd-tool-icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cd-board-content .cd-play-actions button {
  display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0;
  padding: 6px 2px; min-height: 48px; line-height: 1.2; white-space: normal; border-radius: 12px;
}
.cd-board-content #feedback:not(:empty) { background: var(--iwg-soft); padding: 8px 12px; border-radius: 10px; box-sizing: border-box; }
@media (max-width: 650px) {
  .cd-board-content { --cd-board-width: 430px; }
  .cd-board-content .cd-play-actions { gap: 4px; }
  .cd-board-content .cd-play-actions button { font-size: 11px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .cd-game-shell:is(:fullscreen,.cd-expanded) .cd-board-content { --cd-board-width: 300px; }
}

.cd-board-frame {
  display:grid;
  grid-template-columns:minmax(0,auto) minmax(0,1fr);
  width:min(100%,var(--cd-board-width));
  margin-inline:auto;
  column-gap:4px;
  row-gap:4px;
}
.cd-board-content .cd-board-frame #board { grid-area:2 / 2; width:100%; }
.cd-column-quotas,.cd-row-quotas { display:grid; align-items:center; }
.cd-column-quotas { grid-area:1 / 2; grid-template-columns:repeat(var(--columns),minmax(0,1fr)); }
.cd-row-quotas { grid-area:2 / 1; grid-template-rows:repeat(var(--rows),minmax(0,1fr)); }
.cd-column-quotas span,.cd-row-quotas span {
  text-align:center;
  padding:2px 3px;
  color:var(--iwg-muted);
  font-size:clamp(8px,1.7vw,11px);
  font-weight:750;
  font-variant-numeric:tabular-nums;
}
.cd-row-quotas span { max-width:42px; }
.cd-board-frame [data-status=satisfied] { --cd-clue-ink:#185b42; }
.cd-board-frame :is([data-status=exceeded],[data-status=impossible],[data-status=conflict]) { --cd-clue-ink:#a82646; }
[data-theme=dark] .cd-board-frame [data-status=satisfied] { --cd-clue-ink:#a6f2cc; }
[data-theme=dark] .cd-board-frame :is([data-status=exceeded],[data-status=impossible],[data-status=conflict]) { --cd-clue-ink:#ffc1cd; }
.cd-board-frame [data-status] { color:var(--cd-clue-ink,var(--iwg-muted)); }
.cd-clue-cell { background:color-mix(in srgb,var(--region-bg) 70%,var(--iwg-paper)); }
.cd-clue-number {
  display:grid;place-items:center;min-width:48%;min-height:48%;
  border-radius:8px;background:var(--iwg-paper);font-weight:800;font-size:clamp(12px,2.7vw,22px);
}
.cd-clue-status { position:absolute;right:5%;bottom:1%;font-size:clamp(8px,1.8vw,13px);font-weight:800; }
.cd-cell.cd-wall-piece .cd-piece { color:var(--iwg-ink); }
.cd-cell:is(.cd-clue-focus,.cd-clue-attacker),.cd-tray-piece.cd-lesson-piece {
  outline:2px solid currentColor;outline-offset:-4px;
}
.cd-lesson { width:min(100%,var(--cd-board-width)); }
.cd-board-content .cd-lesson:not([hidden]) ~ .cd-board-frame .tutorial-cell {
  outline:3px dashed currentColor;outline-offset:-5px;
}
.cd-active-rules { width:min(100%,var(--cd-board-width)); margin:12px auto 0;color:var(--iwg-muted);font-size:12px; }
.cd-active-rules summary { cursor:pointer;min-height:36px;align-content:center;color:var(--iwg-ink);font-weight:750; }
.cd-active-rules ul { margin:0;padding-left:18px; }
#lesson-back { display:block;margin:12px auto 0; }
#variant-summary { margin:4px 0 8px; }
