/* Chess Mix public demo stylesheet.
   Refactored after step561: mix component geometry comes from per-combination CSS variables.
   CSS keeps one generic transform source; TypeScript assigns each component x/y/rotate/scale/z. */
:root {
  /* Board colors */
  --chess-mix-light: #f0d9b5;
  --chess-mix-dark: #897c72;
  --chess-mix-selected: #f6e05e;
  --chess-mix-target: #68d391;
  --chess-mix-capture: #fc8181;
  --chess-mix-panel: #ffffff;
  --chess-mix-border: #2d3748;
  --chess-mix-text: #1a202c;
  /* Target markers */
  --chess-mix-target-size: 28%;
  --chess-mix-target-opacity: 0.48;
  --chess-mix-target-fill: color-mix(in srgb, var(--chess-mix-target) 44%, transparent);
  /* Mix piece layout: size is global, geometry is assigned per component. */
  --chess-mix-piece-size: 98%;
  --chess-mix-piece-size-mobile: 100%;
  --chess-mix-component-size: 58%;
  --chess-mix-component-size-2: 60%;
  --chess-mix-component-size-3: 56%;
  --chess-mix-component-size-2-mobile: 62%;
  --chess-mix-component-size-3-mobile: 58%;
}

.chess-mix-app {
  display: grid;
  grid-template-columns: minmax(320px, 640px) minmax(220px, 320px);
  gap: 16px;
  align-items: start;
  color: var(--chess-mix-text);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}


.chess-mix-dev-layout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(320px, 640px) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}

.chess-mix-dev-main,
.chess-mix-dev-sidebar {
  display: grid;
  gap: 12px;
  align-items: start;
}

.chess-mix-dev-main .chess-mix-board-wrap {
  width: 100%;
}

.chess-mix-toolbar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 12px;
  background: var(--chess-mix-panel);
}

.chess-mix-status {
  font-size: 1.125rem;
  font-weight: 700;
}

.chess-mix-meta,
.chess-mix-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chess-mix-control,
.chess-mix-choice {
  cursor: pointer;
  border: 1px solid var(--chess-mix-border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.chess-mix-control-secondary {
  background: color-mix(in srgb, var(--chess-mix-panel) 88%, #ffffff);
}

.chess-mix-control-secondary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--chess-mix-panel) 78%, #ffffff);
}

.chess-mix-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(36px, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  aspect-ratio: 1 / 1;
  border: 2px solid var(--chess-mix-border);
  border-radius: 12px;
  overflow: hidden;
}

.chess-mix-square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  border: 0;
  padding: 0;
  color: inherit;
}

.chess-mix-square-light {
  background: var(--chess-mix-light);
}

.chess-mix-square-dark {
  background: var(--chess-mix-dark);
}

.chess-mix-choice-panel,
.chess-mix-history,
.chess-mix-save-load,
.chess-mix-mix-visual-check,
.chess-mix-keyboard {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 12px;
  background: var(--chess-mix-panel);
}

.chess-mix-panel-title {
  margin: 0;
  font-size: 1rem;
}

.chess-mix-history-summary,
.chess-mix-legend-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  list-style: none;
}

.chess-mix-history-summary::-webkit-details-marker,
.chess-mix-legend-summary::-webkit-details-marker {
  display: none;
}

.chess-mix-history-toggle,
.chess-mix-legend-toggle {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: var(--chess-mix-border);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1;
}

.chess-mix-history[open] .chess-mix-history-toggle,
.chess-mix-legend[open] .chess-mix-legend-toggle {
  transform: rotate(180deg);
}

.chess-mix-history-body {
  display: grid;
  gap: 8px;
}

.chess-mix-legend-details {
  grid-column: 1 / -1;
  gap: 8px;
}

.chess-mix-online-settings .chess-mix-legend {
  grid-column: 1 / -1;
}


.chess-mix-empty-panel {
  margin: 0;
  opacity: 0.7;
}

@media (max-width: 760px) {
.chess-mix-app,
.chess-mix-dev-layout {
  grid-template-columns: 1fr;
}

.chess-mix-board-wrap {
  width: 100%;
}

}

.chess-mix-status-block {
  display: grid;
  gap: 8px;
  min-width: min(100%, 520px);
}

.chess-mix-status-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.chess-mix-status-detail {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 25%, transparent);
  border-radius: 999px;
  padding: 3px 8px;
  background: color-mix(in srgb, #ffffff 84%, transparent);
  font-size: 0.78rem;
}

.chess-mix-status-detail dt,
.chess-mix-status-detail dd {
  margin: 0;
}

.chess-mix-status-detail dt {
  opacity: 0.7;
}

.chess-mix-status-detail dd {
  font-weight: 650;
}

.chess-mix-board-frame {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  grid-template-rows: 24px minmax(0, 1fr) 24px;
  align-items: stretch;
  justify-items: stretch;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.chess-mix-board-corner {
  min-width: 24px;
  min-height: 24px;
}

/* Step1614b: keep the central board area fixed in the middle grid cell even when outer labels are hidden. */
.chess-mix-board-frame > .chess-mix-board-corner:nth-child(1) {
  grid-column: 1;
  grid-row: 1;
}

.chess-mix-board-frame > .chess-mix-file-labels:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.chess-mix-board-frame > .chess-mix-board-corner:nth-child(3) {
  grid-column: 3;
  grid-row: 1;
}

.chess-mix-board-frame > .chess-mix-rank-labels:nth-child(4) {
  grid-column: 1;
  grid-row: 2;
}

.chess-mix-board-frame > .chess-mix-board-area {
  grid-column: 2;
  grid-row: 2;
}

.chess-mix-board-frame > .chess-mix-rank-labels:nth-child(6) {
  grid-column: 3;
  grid-row: 2;
}

.chess-mix-board-frame > .chess-mix-board-corner:nth-child(7) {
  grid-column: 1;
  grid-row: 3;
}

.chess-mix-board-frame > .chess-mix-file-labels:nth-child(8) {
  grid-column: 2;
  grid-row: 3;
}

.chess-mix-board-frame > .chess-mix-board-corner:nth-child(9) {
  grid-column: 3;
  grid-row: 3;
}

.chess-mix-file-labels,
.chess-mix-rank-labels {
  display: grid;
  color: var(--chess-mix-border);
  font-size: 0.78rem;
  font-weight: 700;
  user-select: none;
}

.chess-mix-file-labels {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.chess-mix-rank-labels {
  grid-template-rows: repeat(8, minmax(0, 1fr));
}

.chess-mix-board-label {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chess-mix-square-last-move-from .chess-mix-square-coordinate::after,
.chess-mix-square-last-move-to .chess-mix-square-coordinate::after {
  content: "•";
  margin-left: 2px;
  font-size: 0.65rem;
  font-weight: 700;
}

.chess-mix-choice-panel[data-pending="true"] {
  border-width: 2px;
}

.chess-mix-choice-help {
  margin: 0;
  font-size: 0.86rem;
  opacity: 0.78;
}

.chess-mix-choice {
  display: grid;
  gap: 2px;
  text-align: left;
}

.chess-mix-choice-title {
  font-weight: 700;
}

.chess-mix-choice-notation {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
}

.chess-mix-choice-description {
  font-size: 0.78rem;
  opacity: 0.76;
}

.chess-mix-history-list {
  margin: 0;
  display: grid;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
  padding-left: 0;
  list-style-position: inside;
}

.chess-mix-scenario-select-wrap {
  display: grid;
  gap: 3px;
  font-size: 0.76rem;
  font-weight: 700;
}

.chess-mix-scenario-select {
  min-width: 180px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
  color: var(--chess-mix-text);
  font: inherit;
  font-weight: 600;
}

.chess-mix-scenario-panel {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 12px;
  background: var(--chess-mix-panel);
}

.chess-mix-scenario-description,
.chess-mix-scenario-instruction,
.chess-mix-scenario-path {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.35;
}

.chess-mix-scenario-instruction {
  font-weight: 650;
}

.chess-mix-scenario-path {
  border-top:
    1px solid
    color-mix(in srgb, var(--chess-mix-border) 16%, transparent);
  padding-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.chess-mix-board-wrap {
  width: min(80vw, 640px);
  grid-row: span 4;
}

.chess-mix-square-scenario::before {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: 1;
  pointer-events: none;
  border-radius: 10px;
}

.chess-mix-square-scenario-focus::before {
  border: 3px dashed #2b6cb0;
}

.chess-mix-square-scenario-target::before {
  border: 3px dotted #805ad5;
}

.chess-mix-square-scenario-focus.chess-mix-square-scenario-target::before {
  border-style: solid;
}

.chess-mix-legend {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 12px;
  background: var(--chess-mix-panel);
}

.chess-mix-legend-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chess-mix-legend-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
}

.chess-mix-legend-swatch {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #ffffff;
}

.chess-mix-legend-scenario-focus {
  border: 3px dashed #2b6cb0;
}

.chess-mix-legend-scenario-target {
  border: 3px dotted #805ad5;
}

.chess-mix-legend-selected {
  border: 4px solid var(--chess-mix-selected);
}

.chess-mix-legend-legal,
.chess-mix-legend-available {
  background: color-mix(in srgb, var(--chess-mix-target) 70%, transparent);
  border-radius: 999px;
}

.chess-mix-legend-capture {
  border: 4px solid var(--chess-mix-capture);
}

.chess-mix-legend-last {
  box-shadow:
    inset 0 0 0 4px
    color-mix(in srgb, var(--chess-mix-selected) 55%, transparent);
}


.chess-mix-legend-assistant-attacker {
  border: 3px solid color-mix(in srgb, var(--chess-mix-capture) 72%, transparent);
  background: color-mix(in srgb, var(--chess-mix-capture) 14%, #ffffff);
}

.chess-mix-legend-assistant-defender {
  border: 3px solid color-mix(in srgb, var(--chess-mix-selected) 76%, transparent);
  background: color-mix(in srgb, var(--chess-mix-selected) 16%, #ffffff);
}

.chess-mix-legend-assistant-target {
  border: 3px dashed color-mix(in srgb, var(--chess-mix-capture) 58%, transparent);
  background: color-mix(in srgb, var(--chess-mix-capture) 10%, #ffffff);
}

.chess-mix-legend-assistant-safe {
  border: 3px dashed color-mix(in srgb, var(--chess-mix-target) 62%, transparent);
  background: color-mix(in srgb, var(--chess-mix-target) 10%, #ffffff);
}

.chess-mix-board-area {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.chess-mix-board-area .chess-mix-board {
  width: 100%;
  height: 100%;
}

.chess-mix-board-part-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  pointer-events: none;
}

.chess-mix-board-part-popover[data-horizontal-placement="left"] {
  justify-self: start;
}

.chess-mix-board-part-popover[data-horizontal-placement="right"] {
  justify-self: end;
}

.chess-mix-board-part-popover[data-vertical-placement="above"] {
  transform: translateY(-68%);
}

.chess-mix-board-part-popover[data-vertical-placement="below"] {
  transform: translateY(68%);
}

.chess-mix-board-part-title {
  grid-column: 1 / -1;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0.76;
}

.chess-mix-mix-part-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 12px;
  background: var(--chess-mix-panel);
}

.chess-mix-mix-part-panel[data-active="true"] {
  border-width: 2px;
}

.chess-mix-part-choice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 56%, transparent);
  border-radius: 14px;
  padding: 7px 8px;
  background: color-mix(in srgb, #ffffff 90%, transparent);
  color: var(--chess-mix-text);
  cursor: pointer;
  text-align: left;
}

.chess-mix-part-choice[data-selected="true"] {
  outline: 3px solid var(--chess-mix-selected);
  outline-offset: 1px;
}

.chess-mix-part-choice:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.chess-mix-part-choice-symbols {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--chess-mix-selected) 22%, #ffffff);
  font-size: 1.42rem;
  line-height: 1;
  letter-spacing: -0.12em;
  text-indent: -0.12em;
}

.chess-mix-part-choice-body {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.chess-mix-part-choice-title {
  font-size: 0.78rem;
  font-weight: 800;
}

.chess-mix-part-choice-label {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

.chess-mix-part-choice-description {
  font-size: 0.72rem;
  opacity: 0.76;
}

.chess-mix-part-choice[data-part-choice-context="overlay"] .chess-mix-part-choice-title,
.chess-mix-part-choice[data-part-choice-context="overlay"] .chess-mix-part-choice-description {
  display: none;
}

@media (max-width: 760px) {
.chess-mix-board-part-popover[data-vertical-placement="above"] {
  transform: translateY(-68%);
}

.chess-mix-board-part-popover[data-vertical-placement="below"] {
  transform: translateY(68%);
}

.chess-mix-board-part-title {
  grid-column: 1 / -1;
}

}

.chess-mix-board-part-popover .chess-mix-board-part-title {
  grid-column: 1 / -1;
  grid-row: 1;
  margin-bottom: 2px;
}

.chess-mix-part-choice[data-part-choice-context="overlay"][data-selected="true"] {
  background: color-mix(in srgb, var(--chess-mix-selected) 42%, #ffffff);
  box-shadow:
    inset 0 0 0 4px
    color-mix(in srgb, var(--chess-mix-selected) 92%, var(--chess-mix-border)),
    0 6px 14px rgba(0, 0, 0, 0.22);
}

.chess-mix-part-choice[data-part-choice-context="overlay"] .chess-mix-part-choice-symbols {
  min-width: 30px;
  min-height: 30px;
  background: transparent;
  font-size: 1.58rem;
}

.chess-mix-part-choice[data-part-choice-context="overlay"] .chess-mix-part-choice-body {
  display: block;
  max-width: 56px;
}

.chess-mix-part-choice[data-part-choice-context="overlay"] .chess-mix-part-choice-label {
  white-space: nowrap;
  display: block;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.58rem;
  line-height: 1.05;
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-top {
  grid-column: 2;
  grid-row: 2;
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-left {
  grid-column: 1;
  grid-row: 3;
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-right {
  grid-column: 3;
  grid-row: 3;
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-center {
  grid-column: 2;
  grid-row: 3;
  width: 82px;
  min-height: 76px;
  z-index: 2;
  background: color-mix(in srgb, #ffffff 82%, var(--chess-mix-dark));
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-center .chess-mix-part-choice-symbols {
  font-size: 1.85rem;
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-center .chess-mix-part-choice-label {
  max-width: 72px;
  font-size: 0.6rem;
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-bottom-left {
  grid-column: 1;
  grid-row: 4;
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-bottom {
  grid-column: 2;
  grid-row: 4;
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-bottom-right {
  grid-column: 3;
  grid-row: 4;
}

.chess-mix-square[data-selected-part]:not([data-selected-part=""]) .chess-mix-piece-mix .chess-mix-piece-component {
  opacity: 0.4;
}

.chess-mix-part-choice[data-part-choice-context="panel"] .chess-mix-part-choice-symbols {
  letter-spacing: -0.18em;
  text-indent: -0.18em;
}

@media (max-width: 760px) {
.chess-mix-board-part-popover {
  grid-template-columns: 56px 74px 56px;
  grid-template-rows: auto 52px 68px 52px;
  gap: 3px 5px;
  padding: 8px 10px 10px;
  max-width: calc(100vw - 12px);
}

.chess-mix-part-choice[data-part-choice-context="overlay"] {
  width: 56px;
  min-height: 52px;
  padding: 5px 4px;
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-center {
  width: 74px;
  min-height: 68px;
}

.chess-mix-part-choice[data-part-choice-context="overlay"] .chess-mix-part-choice-symbols {
  font-size: 1.35rem;
}

.chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-part-choice-slot-center .chess-mix-part-choice-symbols {
  font-size: 1.6rem;
}

}

.chess-mix-board-promotion-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  pointer-events: none;
}

.chess-mix-board-promotion-popover {
  grid-column: var(--promotion-column);
  grid-row: var(--promotion-row);
  align-self: center;
  justify-self: center;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 64px 82px 64px;
  grid-template-rows: auto 58px 76px;
  place-items: center;
  gap: 4px 7px;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  padding: 10px 12px 12px;
  border: 2px solid color-mix(in srgb, var(--chess-mix-border) 72%, transparent);
  border-radius: 28px;
  background: color-mix(in srgb, #ffffff 88%, transparent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  pointer-events: auto;
}

.chess-mix-board-promotion-popover[data-horizontal-placement="left"] {
  justify-self: start;
}

.chess-mix-board-promotion-popover[data-horizontal-placement="right"] {
  justify-self: end;
}

.chess-mix-board-promotion-popover[data-vertical-placement="above"] {
  transform: translateY(-68%);
}

.chess-mix-board-promotion-popover[data-vertical-placement="below"] {
  transform: translateY(68%);
}

.chess-mix-board-promotion-title {
  grid-column: 1 / -1;
  grid-row: 1;
  margin-bottom: 2px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0.76;
}

.chess-mix-promotion-choice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 56%, transparent);
  border-radius: 14px;
  padding: 7px 8px;
  background: color-mix(in srgb, #ffffff 90%, transparent);
  color: var(--chess-mix-text);
  cursor: pointer;
  text-align: left;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"] {
  grid-template-columns: 1fr;
  justify-items: center;
  width: 64px;
  min-height: 58px;
  box-sizing: border-box;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 48%, transparent);
  border-radius: 10px;
  padding: 6px 5px;
  clip-path: none;
  background: color-mix(in srgb, #ffffff 92%, var(--chess-mix-selected));
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--chess-mix-border) 68%, transparent),
    0 4px 8px rgba(0, 0, 0, 0.16);
  text-align: center;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"]:hover,
.chess-mix-promotion-choice[data-promotion-choice-context="overlay"]:focus-visible {
  transform: translateY(-1px);
  background: color-mix(in srgb, #ffffff 78%, var(--chess-mix-selected));
  outline: none;
  box-shadow:
    inset 0 0 0 3px color-mix(in srgb, var(--chess-mix-border) 76%, transparent),
    0 6px 12px rgba(0, 0, 0, 0.2);
}

.chess-mix-promotion-choice-symbols {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--chess-mix-selected) 22%, #ffffff);
  font-size: 1.42rem;
  line-height: 1;
}

.chess-mix-promotion-choice-body {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.chess-mix-promotion-choice-title {
  font-size: 0.78rem;
  font-weight: 800;
}

.chess-mix-promotion-choice-label {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
}

.chess-mix-promotion-choice-description {
  font-size: 0.72rem;
  opacity: 0.76;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"] .chess-mix-promotion-choice-title,
.chess-mix-promotion-choice[data-promotion-choice-context="overlay"] .chess-mix-promotion-choice-description {
  display: none;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"] .chess-mix-promotion-choice-symbols {
  min-width: 30px;
  min-height: 30px;
  background: transparent;
  font-size: 1.58rem;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"] .chess-mix-promotion-choice-label {
  display: block;
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.58rem;
  line-height: 1.05;
  white-space: nowrap;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"].chess-mix-promotion-choice-slot-top {
  grid-column: 2;
  grid-row: 2;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"].chess-mix-promotion-choice-slot-left {
  grid-column: 1;
  grid-row: 3;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"].chess-mix-promotion-choice-slot-right {
  grid-column: 3;
  grid-row: 3;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"].chess-mix-promotion-choice-slot-center {
  grid-column: 2;
  grid-row: 3;
  width: 82px;
  min-height: 76px;
  z-index: 2;
  background: color-mix(in srgb, #ffffff 82%, var(--chess-mix-dark));
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"].chess-mix-promotion-choice-slot-center .chess-mix-promotion-choice-symbols {
  font-size: 1.85rem;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"].chess-mix-promotion-choice-slot-center .chess-mix-promotion-choice-label {
  max-width: 72px;
  font-size: 0.6rem;
}

@media (max-width: 760px) {
.chess-mix-board-promotion-popover {
  grid-template-columns: 56px 74px 56px;
  grid-template-rows: auto 52px 68px;
  gap: 3px 5px;
  padding: 8px 10px 10px;
  max-width: calc(100vw - 12px);
}

.chess-mix-board-promotion-popover[data-vertical-placement="above"] {
  transform: translateY(-52%);
}

.chess-mix-board-promotion-popover[data-vertical-placement="below"] {
  transform: translateY(52%);
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"] {
  width: 56px;
  min-height: 52px;
  padding: 5px 4px;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"].chess-mix-promotion-choice-slot-center {
  width: 74px;
  min-height: 68px;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"] .chess-mix-promotion-choice-symbols {
  font-size: 1.35rem;
}

.chess-mix-promotion-choice[data-promotion-choice-context="overlay"].chess-mix-promotion-choice-slot-center .chess-mix-promotion-choice-symbols {
  font-size: 1.6rem;
}

}

.chess-mix-move-context {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 12px;
  background: var(--chess-mix-panel);
}

.chess-mix-move-context-list {
  display: grid;
  gap: 6px;
  margin: 0;
}

.chess-mix-move-context-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  border-bottom:
    1px solid
    color-mix(in srgb, var(--chess-mix-border) 14%, transparent);
  padding-bottom: 4px;
  font-size: 0.82rem;
}

.chess-mix-move-context-row dt,
.chess-mix-move-context-row dd {
  margin: 0;
}

.chess-mix-move-context-row dt {
  font-weight: 750;
  opacity: 0.7;
}

.chess-mix-move-context-row dd {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.chess-mix-board-last-move-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  pointer-events: none;
}

.chess-mix-board-last-move-layer[data-active="false"] {
  display: none;
}

.chess-mix-last-move-marker-from,
.chess-mix-last-move-marker-to {
  align-self: end;
  justify-self: end;
  margin: 4px;
}

.chess-mix-part-clear {
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 60%, transparent);
  border-radius: 999px;
  padding: 6px 10px;
  background: color-mix(in srgb, #ffffff 86%, var(--chess-mix-selected));
  color: var(--chess-mix-text);
  font-size: 0.76rem;
  font-weight: 750;
}

.chess-mix-part-clear-overlay {
  grid-column: 1 / -1;
  grid-row: 5;
  justify-self: center;
  margin-top: 2px;
}

.chess-mix-part-clear-panel {
  justify-self: start;
}

.chess-mix-history-item {
  display: grid;
  border-bottom:
    1px solid
    color-mix(in srgb, var(--chess-mix-border) 16%, transparent);
  padding-bottom: 5px;
  grid-template-columns: 40px 58px minmax(70px, auto) minmax(0, 1fr) auto;
  gap: 5px 8px;
  align-items: baseline;
  list-style: none;
  border-radius: 10px;
  padding: 6px 6px 6px 0;
}

.chess-mix-history-item[data-history-latest="true"] {
  background: color-mix(in srgb, var(--chess-mix-selected) 11%, transparent);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--chess-mix-selected) 72%, var(--chess-mix-border));
}

.chess-mix-history-index {
  grid-column: 1;
  grid-row: 1 / 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--chess-mix-border) 12%, transparent);
  font-size: 0.7rem;
  font-weight: 850;
}

.chess-mix-history-side {
  font-size: 0.75rem;
  font-weight: 700;
  opacity: 0.7;
  grid-column: 2;
}

.chess-mix-history-type {
  grid-column: 3;
  border-radius: 999px;
  padding: 1px 6px;
  background: color-mix(in srgb, var(--chess-mix-target) 24%, #ffffff);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.chess-mix-history-notation {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  grid-column: 4;
}

.chess-mix-history-latest {
  grid-column: 5;
  grid-row: 1;
  align-self: center;
  border: 1px solid color-mix(in srgb, var(--chess-mix-selected) 40%, transparent);
  border-radius: 999px;
  padding: 1px 6px;
  background: color-mix(in srgb, var(--chess-mix-selected) 13%, #ffffff);
  font-size: 0.66rem;
  font-weight: 850;
  white-space: nowrap;
}

.chess-mix-history-route {
  grid-column: 2 / 4;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  opacity: 0.76;
}

.chess-mix-history-description {
  grid-column: 4;
  overflow-wrap: anywhere;
  font-size: 0.72rem;
  opacity: 0.76;
}

.chess-mix-replay {
  display: grid;
  gap: 0.55rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 32%, transparent);
  border-radius: 14px;
  padding: 0.65rem;
  background: color-mix(in srgb, #ffffff 88%, var(--chess-mix-light));
}

.chess-mix-replay-header {
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) minmax(0, 2fr) minmax(max-content, 1fr);
  gap: 0.45rem 0.75rem;
  align-items: baseline;
  color: var(--chess-mix-muted);
  font-size: 0.82rem;
}

.chess-mix-replay-header strong {
  color: var(--chess-mix-text);
  font-size: 0.9rem;
}

.chess-mix-replay-last-move {
  min-width: 0;
  justify-self: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--chess-mix-text);
  font-weight: 800;
  text-align: center;
}

.chess-mix-replay-header > span:last-child {
  justify-self: end;
}

.chess-mix-replay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chess-mix-replay-control {
  flex: 1 1 auto;
  min-width: 74px;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.chess-mix-replay-control-primary {
  background: color-mix(in srgb, var(--chess-mix-target) 34%, #ffffff);
}

.chess-mix-replay-control:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}


.chess-mix-history-export {
  display: grid;
  gap: 6px;
  border-top: 1px solid color-mix(in srgb, var(--chess-mix-border) 16%, transparent);
  padding-top: 8px;
}

.chess-mix-history-export summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.chess-mix-history-export-text {
  box-sizing: border-box;
  width: 100%;
  min-height: 64px;
  resize: vertical;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 34%, transparent);
  border-radius: 8px;
  padding: 8px;
  background: color-mix(in srgb, #ffffff 92%, var(--chess-mix-target));
  color: var(--chess-mix-text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
}

.chess-mix-history-export-actions,
.chess-mix-state-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chess-mix-history-copy-button,
.chess-mix-state-copy-button {
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.chess-mix-history-copy-status,
.chess-mix-state-copy-status {
  flex: 1 1 160px;
  font-size: 0.74rem;
  line-height: 1.35;
  opacity: 0.74;
}

.chess-mix-history-copy-status[data-copy-status="copied"],
.chess-mix-state-copy-status[data-copy-status="copied"] {
  font-weight: 800;
  color: color-mix(in srgb, var(--chess-mix-target) 42%, var(--chess-mix-text));
  opacity: 1;
}

.chess-mix-history-copy-status[data-copy-status="failed"],
.chess-mix-state-copy-status[data-copy-status="failed"] {
  font-weight: 750;
  color: color-mix(in srgb, var(--chess-mix-capture) 55%, var(--chess-mix-text));
  opacity: 1;
}


.chess-mix-save-load-help,
.chess-mix-save-load-status {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  opacity: 0.78;
}

.chess-mix-save-load-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chess-mix-visual-check-summary {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  opacity: 0.78;
}

.chess-mix-visual-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chess-mix-visual-check-item {
  display: grid;
  justify-items: center;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 22%, transparent);
  border-radius: 10px;
  padding: 6px;
  background: color-mix(in srgb, #ffffff 88%, var(--chess-mix-light));
}

.chess-mix-visual-check-item[data-layout-complete="false"] {
  background: color-mix(in srgb, #ffffff 76%, var(--chess-mix-capture));
  border-color: color-mix(in srgb, var(--chess-mix-capture) 78%, var(--chess-mix-border));
}

.chess-mix-visual-check-square {
  width: 72px;
  height: 72px;
  min-width: 72px;
  min-height: 72px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--chess-mix-border) 35%, transparent);
  overflow: visible;
}

.chess-mix-visual-check-signature,
.chess-mix-visual-check-status {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.chess-mix-visual-check-signature {
  font-size: 0.68rem;
  font-weight: 850;
}

.chess-mix-visual-check-status {
  font-size: 0.62rem;
  opacity: 0.74;
}

.chess-mix-state-export {
  display: grid;
  gap: 6px;
  border-top: 1px solid color-mix(in srgb, var(--chess-mix-border) 16%, transparent);
  padding-top: 8px;
}

.chess-mix-state-export summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.chess-mix-state-text-label {
  display: grid;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 800;
}

.chess-mix-state-text {
  box-sizing: border-box;
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 34%, transparent);
  border-radius: 8px;
  padding: 8px;
  background: color-mix(in srgb, #ffffff 94%, var(--chess-mix-target));
  color: var(--chess-mix-text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.35;
}

@media (max-width: 760px) {
.chess-mix-move-context-row {
  grid-template-columns: 74px minmax(0, 1fr);
}

.chess-mix-last-move-route {
  display: none;
}

.chess-mix-history-item {
  grid-template-columns: 34px 50px minmax(0, 1fr);
}

.chess-mix-history-latest {
  grid-column: 2 / 4;
  grid-row: 3;
  justify-self: start;
}

.chess-mix-history-type,
.chess-mix-history-notation,
.chess-mix-history-description {
  grid-column: 3;
}

.chess-mix-history-route {
  grid-column: 2 / 4;
}

}

.chess-mix-app:focus-visible {
  outline:
    3px solid
    color-mix(in srgb, var(--chess-mix-selected) 70%, var(--chess-mix-border));
  outline-offset: 4px;
}

.chess-mix-keyboard-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chess-mix-keyboard-shortcut {
  display: grid;
  grid-template-columns: minmax(84px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  font-size: 0.82rem;
}

.chess-mix-keyboard-shortcut kbd {
  display: inline-flex;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 36%, transparent);
  border-radius: 6px;
  padding: 2px 6px;
  background: color-mix(in srgb, #ffffff 82%, var(--chess-mix-light));
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.74rem;
  font-weight: 800;
}

.chess-mix-piece {
  z-index: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 80%;
  height: 80%;
  font-size: clamp(1.2rem, 7vw, 3.2rem);
  line-height: 1;
  position: relative;
}

.chess-mix-piece-single {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chess-mix-piece-svg {
  align-items: center;
  justify-content: center;
  width: 92%;
  height: 92%;
  font-size: inherit;
  line-height: 1;
}

.chess-mix-piece-svg-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.chess-mix-piece-svg[data-piece-asset-kind="mix"] {
  width: var(--chess-mix-piece-size-mobile);
  height: var(--chess-mix-piece-size-mobile);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.28));
}

.chess-mix-piece-svg[data-selected-components]:not([data-selected-components=""]) {
  filter:
    drop-shadow(0 0 0.12rem rgba(255, 255, 255, 0.98))
    drop-shadow(0 0 0.34rem rgba(246, 224, 94, 0.92));
}

.chess-mix-piece-component-selected {
  background: color-mix(in srgb, var(--chess-mix-selected) 26%, #ffffff);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.92),
    0 0 0 4px color-mix(in srgb, var(--chess-mix-selected) 80%, transparent);
}

.chess-mix-square:hover .chess-mix-piece-mix .chess-mix-piece-component,
.chess-mix-square:focus-visible .chess-mix-piece-mix .chess-mix-piece-component {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.18));
}

.chess-mix-square-target {
  cursor: pointer;
}

.chess-mix-action-marker[data-action-marker="none"] {
  display: none;
}

.chess-mix-action-marker-promotion {
  border-color: color-mix(in srgb, #805ad5 68%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 72%, #805ad5);
}

.chess-mix-action-marker-castling {
  min-width: 42%;
  padding-inline: 3px;
  border-color: color-mix(in srgb, #2b6cb0 72%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 76%, #2b6cb0);
  font-size: clamp(0.52rem, 1.7vw, 0.82rem);
  white-space: nowrap;
}

.chess-mix-action-multiple .chess-mix-action-badge {
  font-weight: 800;
}

.chess-mix-square-target.chess-mix-action-primary-move::after {
  opacity: 0.35;
}

.chess-mix-legend-action-move {
  background: color-mix(in srgb, var(--chess-mix-target) 70%, transparent);
  border-radius: 999px;
}

.chess-mix-legend-action-merge {
  border:
    2px solid
    color-mix(in srgb, var(--chess-mix-target) 70%, var(--chess-mix-border));
  background: color-mix(in srgb, var(--chess-mix-target) 42%, #ffffff);
}

.chess-mix-legend-action-split {
  border:
    2px solid
    color-mix(in srgb, var(--chess-mix-selected) 70%, var(--chess-mix-border));
  background: color-mix(in srgb, var(--chess-mix-selected) 38%, #ffffff);
}

.chess-mix-legend-action-promotion {
  border: 2px solid color-mix(in srgb, #805ad5 68%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 72%, #805ad5);
}

.chess-mix-legend-action-castling {
  border: 2px solid color-mix(in srgb, #2b6cb0 72%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 76%, #2b6cb0);
}

.chess-mix-action-summary-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 12px;
  background: var(--chess-mix-panel);
}

.chess-mix-action-summary-panel[data-active="true"] {
  border-width: 2px;
}

.chess-mix-action-summary-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.chess-mix-action-summary-item {
  display: grid;
  grid-template-columns: 42px minmax(80px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  border-bottom:
    1px solid
    color-mix(in srgb, var(--chess-mix-border) 14%, transparent);
  padding-bottom: 5px;
  font-size: 0.8rem;
}

.chess-mix-action-summary-square {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 6px;
  background: color-mix(in srgb, var(--chess-mix-border) 10%, transparent);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-weight: 850;
}

.chess-mix-action-summary-type {
  border-radius: 999px;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--chess-mix-target) 24%, #ffffff);
  font-weight: 850;
  white-space: nowrap;
}

.chess-mix-action-summary-notation {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  opacity: 0.8;
}

.chess-mix-action-summary-capture .chess-mix-action-summary-type,
.chess-mix-action-summary-enPassant .chess-mix-action-summary-type {
  background: color-mix(in srgb, var(--chess-mix-capture) 26%, #ffffff);
}

.chess-mix-action-summary-promotion .chess-mix-action-summary-type,
.chess-mix-action-summary-splitPromotion .chess-mix-action-summary-type {
  background: color-mix(in srgb, #805ad5 24%, #ffffff);
}

.chess-mix-action-summary-split .chess-mix-action-summary-type {
  background: color-mix(in srgb, var(--chess-mix-selected) 34%, #ffffff);
}

.chess-mix-action-summary-castling .chess-mix-action-summary-type {
  background: color-mix(in srgb, #2b6cb0 24%, #ffffff);
}

@media (max-width: 760px) {
.chess-mix-action-summary-item {
  grid-template-columns: 40px minmax(0, 1fr);
}

.chess-mix-action-summary-notation {
  grid-column: 1 / -1;
}

}

.chess-mix-scenario-heading {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.chess-mix-scenario-nav,
.chess-mix-scenario-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chess-mix-scenario-control {
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 56%, transparent);
  border-radius: 999px;
  padding: 5px 9px;
  background: color-mix(in srgb, #ffffff 88%, var(--chess-mix-light));
  color: var(--chess-mix-text);
  font-size: 0.78rem;
  font-weight: 800;
}

.chess-mix-scenario-control:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.chess-mix-scenario-progress {
  display: grid;
  gap: 5px;
  margin: 0;
  border-top:
    1px solid
    color-mix(in srgb, var(--chess-mix-border) 16%, transparent);
  padding-top: 7px;
}

.chess-mix-scenario-progress-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  font-size: 0.8rem;
}

.chess-mix-scenario-progress-row dt,
.chess-mix-scenario-progress-row dd {
  margin: 0;
}

.chess-mix-scenario-progress-row dt {
  font-weight: 800;
  opacity: 0.72;
}

.chess-mix-scenario-progress-row dd {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.chess-mix-scenario-progress-description {
  margin: 0;
  border-radius: 10px;
  padding: 7px 8px;
  background: color-mix(in srgb, var(--chess-mix-target) 14%, #ffffff);
  font-size: 0.82rem;
  line-height: 1.3;
}

.chess-mix-scenario-panel[data-scenario-progress="ready"] .chess-mix-scenario-progress-description,
.chess-mix-scenario-panel[data-scenario-progress="applied"] .chess-mix-scenario-progress-description {
  background: color-mix(in srgb, var(--chess-mix-target) 30%, #ffffff);
}

.chess-mix-scenario-panel[data-scenario-progress="choosePart"] .chess-mix-scenario-progress-description,
.chess-mix-scenario-panel[data-scenario-progress="pendingChoice"] .chess-mix-scenario-progress-description {
  background: color-mix(in srgb, var(--chess-mix-selected) 28%, #ffffff);
}

.chess-mix-scenario-panel[data-scenario-progress="mismatch"] .chess-mix-scenario-progress-description,
.chess-mix-scenario-panel[data-scenario-progress="targetMissing"] .chess-mix-scenario-progress-description {
  background: color-mix(in srgb, var(--chess-mix-capture) 16%, #ffffff);
}

.chess-mix-action-summary-button {
  display: grid;
  grid-template-columns: 42px minmax(80px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 4px 5px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.chess-mix-action-summary-button:hover,
.chess-mix-action-summary-button:focus-visible {
  background: color-mix(in srgb, var(--chess-mix-target) 18%, #ffffff);
  outline:
    2px solid
    color-mix(in srgb, var(--chess-mix-target) 68%, var(--chess-mix-border));
  outline-offset: 1px;
}

@media (max-width: 760px) {
.chess-mix-action-summary-button {
  grid-template-columns: 40px minmax(0, 1fr);
}

}

.chess-mix-scenario-panel[data-scenario-progress="blockedExpected"] .chess-mix-scenario-progress-description {
  background: color-mix(in srgb, var(--chess-mix-target) 22%, #ffffff);
  border:
    1px dashed
    color-mix(in srgb, var(--chess-mix-border) 72%, transparent);
}

.chess-mix-scenario-panel[data-scenario-progress="blockedExpected"] .chess-mix-scenario-control[data-chess-mix-scenario-control="target"] {
  opacity: 0.72;
}

.chess-mix-scenario-progress[data-scenario-result-verified="true"] [data-scenario-progress-key="result"] dd {
  font-weight: 800;
}

.chess-mix-scenario-panel[data-scenario-progress="resultMismatch"] .chess-mix-scenario-progress-description {
  background: color-mix(in srgb, var(--chess-mix-capture) 22%, #ffffff);
  border:
    1px solid
    color-mix(in srgb, var(--chess-mix-capture) 58%, var(--chess-mix-border));
}

.chess-mix-scenario-control-run {
  font-weight: 800;
}

.chess-mix-app[data-dev-tools="disabled"] .chess-mix-mode-switcher-public {
  background: color-mix(in srgb, var(--chess-mix-light) 52%, #ffffff);
}

.chess-mix-mode-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--chess-mix-border);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1;
}

.chess-mix-app-mode-play {
  grid-template-columns: minmax(320px, 680px) minmax(240px, 360px);
}

.chess-mix-toolbar-main {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  min-width: min(100%, 620px);
}

.chess-mix-mode-switcher {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 28%, transparent);
  border-radius: 999px;
  padding: 3px;
  background: color-mix(in srgb, var(--chess-mix-light) 35%, #ffffff);
}

.chess-mix-mode-button {
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 7px 11px;
  background: transparent;
  color: var(--chess-mix-text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
}

.chess-mix-mode-button[data-active="true"] {
  background: var(--chess-mix-border);
  color: #ffffff;
}

.chess-mix-player-intro {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 340px);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--chess-mix-panel) 86%, var(--chess-mix-light));
}

.chess-mix-player-intro h1,
.chess-mix-player-intro p {
  margin: 0;
}

.chess-mix-player-intro h1 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.05;
}

.chess-mix-player-intro-main {
  display: grid;
  gap: 6px;
}

.chess-mix-player-eyebrow {
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.72;
}

.chess-mix-player-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.chess-mix-player-rules {
  grid-column: 1 / -1;
  border-top: 1px solid color-mix(in srgb, var(--chess-mix-border) 18%, transparent);
  padding-top: 10px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.chess-mix-status-details[data-app-mode="play"] .chess-mix-status-detail {
  font-size: 0.82rem;
}

@media (max-width: 760px) {
.chess-mix-app-mode-play {
  grid-template-columns: 1fr;
}

.chess-mix-toolbar-main,
.chess-mix-player-intro {
  grid-template-columns: 1fr;
}

.chess-mix-mode-switcher,
.chess-mix-controls {
  width: 100%;
}

.chess-mix-mode-button,
.chess-mix-control {
  flex: 1 1 auto;
}

}

html {
  background: color-mix(in srgb, var(--chess-mix-light) 28%, #ffffff);
}

body {
  box-sizing: border-box;
  min-width: 320px;
  margin: 0;
  padding: clamp(8px, 2vw, 18px);
  background-color: #293240e8;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

.chess-mix-public-help {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--chess-mix-panel) 90%, var(--chess-mix-target));
}

.chess-mix-public-help-details {
  display: grid;
  gap: 8px;
}

.chess-mix-public-help-details summary {
  cursor: pointer;
  font-weight: 850;
  list-style-position: inside;
}

.chess-mix-public-help-body {
  display: grid;
  gap: 9px;
  margin-top: 8px;
  font-size: 0.88rem;
  line-height: 1.38;
}

.chess-mix-public-help-body p {
  margin: 0;
}

.chess-mix-public-help-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chess-mix-public-help-item {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  border-top: 1px solid color-mix(in srgb, var(--chess-mix-border) 14%, transparent);
  padding-top: 6px;
}

.chess-mix-public-help-item strong {
  font-size: 0.78rem;
  text-transform: uppercase;
  opacity: 0.78;
}

.chess-mix-public-help-note {
  border-radius: 10px;
  padding: 8px;
  background: color-mix(in srgb, #ffffff 78%, var(--chess-mix-selected));
}

@media (max-width: 1020px) {
.chess-mix-app,
.chess-mix-app-mode-play {
  grid-template-columns: minmax(0, 1fr);
}

.chess-mix-board-wrap {
  grid-row: auto;
  width: min(100%, 680px);
  justify-self: center;
}

}

@media (max-width: 560px) {
body {
  padding: 6px;
}

.chess-mix-toolbar,
.chess-mix-player-intro,
.chess-mix-public-help,
.chess-mix-action-summary-panel,
.chess-mix-legend,
.chess-mix-keyboard,
.chess-mix-choice-panel,
.chess-mix-history {
  border-radius: 10px;
  padding: 10px;
}

.chess-mix-board-frame {
  grid-template-columns: 18px minmax(0, 1fr) 18px;
  grid-template-rows: 18px minmax(0, 1fr) 18px;
}

.chess-mix-board-corner {
  min-width: 18px;
  min-height: 18px;
}

.chess-mix-file-labels,
.chess-mix-rank-labels {
  font-size: 0.68rem;
}

.chess-mix-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chess-mix-control {
  min-height: 40px;
  text-align: center;
}

.chess-mix-public-help-item {
  grid-template-columns: 1fr;
  gap: 2px;
}

}

.chess-mix-piece[data-piece-color="white"] .chess-mix-piece-component {
  color: #ffffff;
  -webkit-text-stroke: 0.5px rgb(129 133 140 / 66%);
  text-shadow:
    0 0 2px rgb(0 0 0),
    0 0 2px rgb(0 0 0),
    0 0 2px rgb(0 0 0),
    0 0 2px rgb(0 0 0),
    0 0 2px rgb(0 0 0),
    0 0 2px rgb(0 0 0),
    0 0 2px rgb(0 0 0);
}

.chess-mix-piece[data-piece-color="black"] .chess-mix-piece-component {
  color: #38393b;
  -webkit-text-stroke: 1px rgb(23 21 21 / 0%);
  text-shadow:
    0 1px 0 rgb(3 3 3),
    0 0 2px rgb(255 255 255 / 83%),
    0 0 5px rgb(255 255 255 / 95%);
}

.chess-mix-piece-single .chess-mix-piece-component {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  background: transparent;
  box-shadow: none;
}

.chess-mix-square-selected {
  outline: 4px solid color-mix(in srgb, var(--chess-mix-selected) 72%, transparent);
  outline-offset: -4px;
  box-shadow:
    inset 0 0 0 999px color-mix(in srgb, var(--chess-mix-selected) 20%, transparent),
    inset 0 0 0 2px color-mix(in srgb, #ffffff 62%, transparent);
}

.chess-mix-square-target::after {
  content: "";
  position: absolute;
  width: var(--chess-mix-target-size);
  height: var(--chess-mix-target-size);
  border-radius: 999px;
  background: color-mix(in srgb, var(--chess-mix-target) 70%, transparent);
  opacity: var(--chess-mix-target-opacity);
}

.chess-mix-action-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30%;
  min-height: 30%;
  border: 2px solid color-mix(in srgb, var(--chess-mix-border) 50%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, #ffffff 82%, transparent);
  font-size: clamp(0.65rem, 2.4vw, 1.15rem);
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0.68;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
}

.chess-mix-action-marker-move {
  min-width: 24%;
  min-height: 24%;
  color: transparent;
  background: var(--chess-mix-target-fill);
}

.chess-mix-action-marker-split,
.chess-mix-action-marker-splitPromotion {
  border-color:
    color-mix(
    in srgb,
    var(--chess-mix-selected) 70%,
    var(--chess-mix-border)
    );
  background: color-mix(in srgb, var(--chess-mix-selected) 42%, transparent);
}

.chess-mix-action-marker-merge,
.chess-mix-action-marker-promotion,
.chess-mix-action-marker-castling,
.chess-mix-action-marker-capture,
.chess-mix-action-marker-enPassant {
  background: color-mix(in srgb, #ffffff 52%, transparent);
}

.chess-mix-action-marker-count {
  position: absolute;
  right: -7px;
  top: -7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--chess-mix-border);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0.82;
}

.chess-mix-action-badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 2;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  padding: 1px 4px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.62rem;
  white-space: nowrap;
  display: none;
}

.chess-mix-square-coordinate {
  position: absolute;
  left: 4px;
  top: 3px;
  font-size: 0.7rem;
  opacity: 0.75;
  display: none;
}

.chess-mix-last-move-marker {
  width: 18%;
  min-width: 10px;
  height: 18%;
  min-height: 10px;
  border: 0;
  padding: 0;
  background: color-mix(in srgb, var(--chess-mix-selected) 10%, transparent);
  box-shadow: none;
  font-size: 0;
  opacity: 0.24;
}

.chess-mix-last-move-route {
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  align-self: start;
  justify-self: center;
  margin-top: 4px;
  opacity: 0.9;
  text-transform: none;
  white-space: nowrap;
  display: none;
}

.chess-mix-board-part-popover {
  grid-column: var(--mix-part-column);
  grid-row: var(--mix-part-row);
  align-self: center;
  justify-self: center;
  box-sizing: border-box;
  display: grid;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  border: 2px solid color-mix(in srgb, var(--chess-mix-border) 72%, transparent);
  background: color-mix(in srgb, #ffffff 86%, transparent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  pointer-events: auto;
  grid-template-columns: 64px 82px 64px;
  place-items: center;
  gap: 4px 7px;
  padding: 10px 12px 12px;
  grid-template-rows: auto 58px 76px 58px auto;
  border-radius: 14px;
}

.chess-mix-board-part-popover-castling {
  border-color: color-mix(in srgb, #4f8fd8 72%, var(--chess-mix-border));
  background: linear-gradient(180deg,
    color-mix(in srgb, #cfe4ff 72%, #ffffff),
    color-mix(in srgb, #9fc8f5 44%, #ffffff)
  );
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px color-mix(in srgb, #ffffff 58%, transparent);
}

.chess-mix-board-part-popover-castling .chess-mix-board-part-title {
  color: #143b66;
  opacity: 0.9;
}

.chess-mix-board-part-popover-castling .chess-mix-castling-split-choice {
  background: color-mix(in srgb, #ffffff 86%, #d7ebff);
  border-color: color-mix(in srgb, #4f8fd8 48%, var(--chess-mix-border));
}

.chess-mix-board-part-popover-castling .chess-mix-castling-split-choice:hover,
.chess-mix-board-part-popover-castling .chess-mix-castling-split-choice:focus-visible {
  background: color-mix(in srgb, #ffffff 70%, #a9d2ff);
}

.chess-mix-part-choice[data-part-choice-context="overlay"] {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  width: 64px;
  min-height: 58px;
  box-sizing: border-box;
  padding: 6px 5px;
  background: color-mix(in srgb, #ffffff 92%, var(--chess-mix-selected));
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--chess-mix-border) 68%, transparent),
    0 4px 8px rgba(0, 0, 0, 0.16);
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 48%, transparent);
  border-radius: 10px;
  clip-path: none;
}

.chess-mix-part-choice[data-part-choice-context="overlay"]:hover:not(:disabled),
.chess-mix-part-choice[data-part-choice-context="overlay"]:focus-visible {
  background: color-mix(in srgb, #ffffff 78%, var(--chess-mix-selected));
  outline: none;
  box-shadow:
    inset 0 0 0 3px color-mix(in srgb, var(--chess-mix-border) 76%, transparent),
    0 6px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}


/* step1615b: force castling split menus to share ordinary split-menu structure on mobile/TWA too. */
.chess-mix-choice-panel-castling,
.chess-mix-choice-panel[data-castling-split="true"] {
  border-color: color-mix(in srgb, #4f8fd8 70%, var(--chess-mix-border));
  background: linear-gradient(180deg,
    color-mix(in srgb, #dbeafe 78%, #ffffff),
    color-mix(in srgb, #bfdbfe 54%, #ffffff)
  );
}

.chess-mix-choice-panel-castling .chess-mix-panel-title,
.chess-mix-choice-panel[data-castling-split="true"] .chess-mix-panel-title {
  color: #143b66;
}

.chess-mix-choice-panel-castling .chess-mix-castling-split-choice,
.chess-mix-choice-panel[data-castling-split="true"] .chess-mix-castling-split-choice {
  background: color-mix(in srgb, #ffffff 84%, #dbeafe);
  border-color: color-mix(in srgb, #4f8fd8 52%, var(--chess-mix-border));
}

.chess-mix-board-part-popover.chess-mix-board-part-popover-castling {
  border-color: color-mix(in srgb, #4f8fd8 74%, var(--chess-mix-border));
  background: linear-gradient(180deg,
    color-mix(in srgb, #dbeafe 78%, #ffffff),
    color-mix(in srgb, #bfdbfe 54%, #ffffff)
  );
}

.chess-mix-board-part-popover.chess-mix-board-part-popover-castling .chess-mix-board-part-title {
  color: #143b66;
  opacity: 0.94;
}

.chess-mix-board-part-popover.chess-mix-board-part-popover-castling .chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-castling-split-choice {
  background: color-mix(in srgb, #ffffff 84%, #dbeafe);
  border-color: color-mix(in srgb, #4f8fd8 56%, var(--chess-mix-border));
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, #4f8fd8 34%, transparent),
    0 4px 8px rgba(0, 0, 0, 0.16);
}

.chess-mix-board-part-popover.chess-mix-board-part-popover-castling .chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-castling-split-choice:hover:not(:disabled),
.chess-mix-board-part-popover.chess-mix-board-part-popover-castling .chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-castling-split-choice:focus-visible {
  background: color-mix(in srgb, #ffffff 68%, #bfdbfe);
  box-shadow:
    inset 0 0 0 3px color-mix(in srgb, #4f8fd8 54%, transparent),
    0 6px 12px rgba(0, 0, 0, 0.2);
}

@media (max-width: 760px) {
  .chess-mix-board-part-popover.chess-mix-board-part-popover-castling {
    max-width: calc(100vw - 12px);
    padding: 8px 10px 10px;
  }

  .chess-mix-board-part-popover.chess-mix-board-part-popover-castling .chess-mix-part-choice[data-part-choice-context="overlay"].chess-mix-castling-split-choice {
    background: color-mix(in srgb, #ffffff 82%, #dbeafe);
  }
}

.chess-mix-square-last-move {
  box-shadow: none;
}

.chess-mix-last-move-marker,
.chess-mix-last-move-route {
  grid-column: var(--last-move-column);
  grid-row: var(--last-move-row);
  align-self: end;
  justify-self: center;
  z-index: 4;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 52%, transparent);
  border-radius: 999px;
  padding: 2px 6px;
  background: color-mix(in srgb, #ffffff 82%, var(--chess-mix-selected));
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1.15;
  text-transform: uppercase;
  display: none;
}

.chess-mix-action-marker-move,
.chess-mix-action-marker-split,
.chess-mix-action-marker-splitPromotion,
.chess-mix-action-marker-capture,
.chess-mix-action-marker-enPassant {
  min-width: 24%;
  min-height: 24%;
  border-color: color-mix(in srgb, var(--chess-mix-border) 50%, transparent);
  color: transparent;
  background: var(--chess-mix-target-fill);
}

.chess-mix-action-marker-split,
.chess-mix-action-marker-splitPromotion,
.chess-mix-action-marker-capture,
.chess-mix-action-marker-enPassant {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
}

.chess-mix-action-marker-capture,
.chess-mix-action-marker-enPassant {
  min-width: 24%;
  min-height: 24%;
  color: transparent;
  background: var(--chess-mix-target-fill);
  border-color: color-mix(in srgb, var(--chess-mix-border) 50%, transparent);
}

.chess-mix-legend-capture,
.chess-mix-legend-action-split {
  border: 0;
  border-radius: 999px;
  background: var(--chess-mix-target-fill);
}

.chess-mix-action-capture::after,
.chess-mix-action-enPassant::after {
  width: var(--chess-mix-target-size);
  height: var(--chess-mix-target-size);
  border: 0;
  background: var(--chess-mix-target-fill);
}

.chess-mix-action-marker-merge {
  min-width: 24%;
  min-height: 24%;
  border-color: color-mix(in srgb, var(--chess-mix-border) 50%, transparent);
  color: transparent;
  background: var(--chess-mix-target-fill);
}

/* Mix pieces: per-combination visual geometry
   CSS owns only the generic rendering formula.
   TypeScript assigns --chess-mix-component-x/y/rotate/scale/z for each component.
   data-component-visual-role remains semantic metadata, not a transform selector. */
.chess-mix-piece-mix {
  position: relative;
  display: block;
  overflow: visible;
  isolation: isolate;
  width: var(--chess-mix-piece-size);
  height: var(--chess-mix-piece-size);
  border: 0;
  border-radius: 0;
  background: transparent;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.36));
  font-size: clamp(0.85rem, 4vw, 2.4rem);
  line-height: 1;
}

.chess-mix-piece-mix::before,
.chess-mix-piece-mix .chess-mix-piece-component::after {
  content: none;
}

.chess-mix-piece-mix .chess-mix-piece-component {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: var(--chess-mix-component-z, 2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--chess-mix-component-size);
  height: var(--chess-mix-component-size);
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transform:
    translate(-50%, -50%)
    translate(
      var(--chess-mix-component-x, 0%),
      var(--chess-mix-component-y, 0%)
    )
    rotate(var(--chess-mix-component-rotate, 0deg))
    scale(var(--chess-mix-component-scale, 1));
  transform-origin: center center;
  transition:
    transform 120ms ease,
    filter 120ms ease;
  font-size: 0.98em;
  line-height: 1;
  text-shadow:
    0 1px 2px rgba(255, 255, 255, 0.78),
    0 2px 4px rgba(0, 0, 0, 0.34);
}

.chess-mix-piece-mix[data-component-count="2"] .chess-mix-piece-component {
  width: var(--chess-mix-component-size-2);
  height: var(--chess-mix-component-size-2);
  font-size: 1.35em;
}

.chess-mix-piece-mix[data-component-count="3"] .chess-mix-piece-component {
  width: var(--chess-mix-component-size-3);
  height: var(--chess-mix-component-size-3);
  font-size: 1.35em;
}

.chess-mix-piece[data-piece-color="black"] .chess-mix-piece-mix .chess-mix-piece-component {
  text-shadow:
    0 1px 2px rgba(255, 255, 255, 0.85),
    0 2px 4px rgba(0, 0, 0, 0.36);
}

.chess-mix-square[data-selected-part]:not([data-selected-part=""]) .chess-mix-piece-mix .chess-mix-piece-component-selected {
  opacity: 1;
  border-radius: 999px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  filter:
    drop-shadow(0 0 0.12rem rgba(255, 255, 255, 0.98))
    drop-shadow(0 0 0.34rem rgba(246, 224, 94, 0.92));
}

@media (max-width: 560px) {
  .chess-mix-piece-mix {
    width: var(--chess-mix-piece-size-mobile);
    height: var(--chess-mix-piece-size-mobile);
  }

  .chess-mix-piece-mix[data-component-count="2"] .chess-mix-piece-component {
    width: var(--chess-mix-component-size-2-mobile);
    height: var(--chess-mix-component-size-2-mobile);
  }

  .chess-mix-piece-mix[data-component-count="3"] .chess-mix-piece-component {
    width: var(--chess-mix-component-size-3-mobile);
    height: var(--chess-mix-component-size-3-mobile);
  }
}

/* Step 631-660: centered public layout and language switcher. */
.chess-mix-app {
  width: min(100%, 1180px);
  margin-inline: auto;
}

.chess-mix-app-mode-play {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1180px;
}

.chess-mix-app.chess-mix-app-mode-play {
  background: transparent;
}

.chess-mix-public-layout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(320px, 680px) minmax(260px, 360px);
  gap: 16px;
  align-items: start;
}

.chess-mix-public-main,
.chess-mix-public-online,
.chess-mix-public-underboard,
.chess-mix-public-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.chess-mix-public-main {
  grid-column: 1;
  grid-row: 1;
}

.chess-mix-public-online {
  grid-column: 2;
  grid-row: 1;
}

.chess-mix-public-underboard {
  grid-column: 1;
  grid-row: 2;
}

.chess-mix-public-sidebar {
  grid-column: 2;
  grid-row: 2;
}

.chess-mix-public-layout .chess-mix-board-wrap {
  grid-row: auto;
  width: min(100%, 680px);
  justify-self: center;
}

.chess-mix-locale-switcher,
.chess-mix-piece-graphics-switcher {
  display: grid;
  gap: 3px;
  align-items: center;
  min-width: 118px;
  font-size: 0.76rem;
  font-weight: 800;
}

.chess-mix-locale-select {
  border: 1px solid var(--chess-mix-border);
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
  color: var(--chess-mix-text);
  font: inherit;
  font-weight: 700;
}

.chess-mix-piece-graphics-options {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 10px;
  background: color-mix(in srgb, #ffffff 82%, var(--chess-mix-light));
}

.chess-mix-piece-graphics-option {
  border: 0;
  border-radius: 7px;
  padding: 5px 8px;
  background: transparent;
  color: var(--chess-mix-text);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.chess-mix-piece-graphics-option[data-piece-graphics-option-selected="true"] {
  background: var(--chess-mix-text);
  color: #fff;
  box-shadow: 0 1px 3px rgba(21, 27, 37, 0.16);
}

.chess-mix-piece-graphics-option:hover,
.chess-mix-piece-graphics-option:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--chess-mix-target) 72%, transparent);
  outline-offset: 1px;
}

@media (max-width: 1100px) {
  .chess-mix-app {
    max-width: 760px;
  }

  .chess-mix-public-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chess-mix-public-main,
  .chess-mix-public-online,
  .chess-mix-public-underboard,
  .chess-mix-public-sidebar,
  .chess-mix-public-bottom-panels {
    grid-column: 1;
    grid-row: auto;
  }

  .chess-mix-public-layout .chess-mix-board-wrap {
    width: min(100%, 680px);
  }
}

@media (max-width: 760px) {
  .chess-mix-locale-switcher,
.chess-mix-piece-graphics-switcher {
    width: 100%;
  }

  .chess-mix-locale-select,
.chess-mix-piece-graphics-options {
    width: 100%;
  }

  .chess-mix-piece-graphics-option {
    flex: 1;
  }
}

/* step708-730: board-adjacent player material panels and checkmate banner */
.chess-mix-board-stack {
  display: grid;
  gap: 8px;
  width: min(80vw, 640px);
  align-content: start;
}

.chess-mix-dev-main .chess-mix-board-stack {
  width: 100%;
}

.chess-mix-board-stack .chess-mix-board-wrap {
  grid-row: auto;
  width: 100%;
}

.chess-mix-public-layout .chess-mix-board-stack {
  width: min(100%, 680px);
  justify-self: center;
}

.chess-mix-captured-material {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 24%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--chess-mix-panel) 88%, var(--chess-mix-light));
  box-shadow: 0 1px 4px rgba(21, 27, 37, 0.08);
}

.chess-mix-captured-material[data-board-position="top"] {
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.chess-mix-captured-material[data-board-position="bottom"] {
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.chess-mix-captured-player {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-width: 72px;
  font-size: 0.84rem;
  font-weight: 850;
}

.chess-mix-captured-player-dot {
  width: 12px;
  height: 12px;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 38%, transparent);
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, #ffffff 72%, transparent);
}

.chess-mix-captured-material[data-player-color="black"] .chess-mix-captured-player-dot {
  background: #272b33;
}

.chess-mix-captured-pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  min-width: 0;
  justify-content: flex-end;
}

.chess-mix-captured-empty {
  font-size: 0.78rem;
  font-weight: 650;
  opacity: 0.58;
}

.chess-mix-captured-piece {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.chess-mix-captured-piece .chess-mix-piece {
  width: 100%;
  height: 100%;
  font-size: 1.32rem;
}

.chess-mix-captured-piece .chess-mix-piece-svg {
  width: 100%;
  height: 100%;
}

.chess-mix-captured-piece .chess-mix-piece-svg-image {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 1px rgba(21, 27, 37, 0.22));
}

.chess-mix-material-advantage {
  margin-left: 5px;
  border-radius: 999px;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--chess-mix-target) 26%, #ffffff);
  color: var(--chess-mix-text);
  font-size: 0.78rem;
  font-weight: 900;
}

.chess-mix-game-over-banner {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 12px 14px;
  border: 2px solid color-mix(in srgb, var(--chess-mix-border) 70%, var(--chess-mix-target));
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--chess-mix-target) 30%, transparent), transparent 62%),
    color-mix(in srgb, #ffffff 92%, var(--chess-mix-light));
  box-shadow: 0 10px 26px rgba(21, 27, 37, 0.16);
  text-align: center;
}

.chess-mix-game-over-banner[data-result="draw"] {
  border-color: color-mix(in srgb, var(--chess-mix-border) 66%, #ffffff);
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--chess-mix-dark) 8%, transparent), transparent 64%),
    color-mix(in srgb, #ffffff 94%, var(--chess-mix-panel));
}

.chess-mix-game-over-eyebrow {
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.chess-mix-game-over-title {
  font-size: clamp(1.18rem, 2.6vw, 1.62rem);
  line-height: 1.1;
}

.chess-mix-game-over-reason {
  font-size: 0.86rem;
  font-weight: 750;
  opacity: 0.72;
}

.chess-mix-game-over-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
}

.chess-mix-game-over-action {
  appearance: none;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 34%, transparent);
  border-radius: 999px;
  padding: 6px 11px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.chess-mix-game-over-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(21, 27, 37, 0.14);
}

.chess-mix-game-over-action-primary {
  background: var(--chess-mix-dark);
  color: #fff;
}

.chess-mix-game-over-action-secondary {
  background: color-mix(in srgb, #ffffff 86%, var(--chess-mix-light));
  color: var(--chess-mix-text);
}

@media (max-width: 760px) {
  .chess-mix-board-stack {
    width: 100%;
  }

  .chess-mix-captured-material {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 7px 9px;
  }

  .chess-mix-captured-pieces {
    justify-content: flex-start;
  }

  .chess-mix-captured-piece {
    width: 22px;
    height: 22px;
  }

  .chess-mix-game-over-actions {
    width: 100%;
  }

  .chess-mix-game-over-action {
    flex: 1 1 130px;
  }
}

/* Step1121: online multiplayer panel uses the same light readable theme as the rest of the public UI. */
.chess-mix-online-panel {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 42%, transparent);
  background: var(--chess-mix-panel);
  color: var(--chess-mix-text);
  box-shadow: 0 14px 28px rgb(0 0 0 / 12%);
}

.chess-mix-online-help,
.chess-mix-online-message,
.chess-mix-online-error,
.chess-mix-online-diagnostic,
.chess-mix-online-game-over-hint,
.chess-mix-online-setup-locked-hint,
.chess-mix-online-share-hint,
.chess-mix-online-rejoin-hint,
.chess-mix-online-takeback-hint,
.chess-mix-online-copy-status,
.chess-mix-online-invite-steps,
.chess-mix-online-mode-help {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
}

.chess-mix-online-help,
.chess-mix-online-share-hint,
.chess-mix-online-rejoin-hint,
.chess-mix-online-takeback-hint,
.chess-mix-online-setup-locked-hint,
.chess-mix-online-copy-status {
  color: color-mix(in srgb, var(--chess-mix-text) 78%, transparent);
}

.chess-mix-online-invite-steps {
  display: grid;
  gap: 0.25rem;
  padding: 0.7rem 0.85rem 0.7rem 1.75rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-target) 34%, var(--chess-mix-border));
  border-radius: 0.85rem;
  background: color-mix(in srgb, var(--chess-mix-target) 16%, #ffffff);
  color: var(--chess-mix-text);
}


.chess-mix-online-mode-help {
  display: grid;
  gap: 0.22rem;
  padding: 0.65rem 0.85rem 0.65rem 1.45rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 18%, transparent);
  border-radius: 0.85rem;
  background: color-mix(in srgb, #ffffff 86%, var(--chess-mix-light));
  color: color-mix(in srgb, var(--chess-mix-text) 86%, transparent);
}

.chess-mix-online-mode-help strong {
  color: var(--chess-mix-text);
}

.chess-mix-online-copy-status[data-copy-status="copied"],
.chess-mix-online-copy-status[data-copy-status="inviteCopied"] {
  color: color-mix(in srgb, #087a2a 88%, var(--chess-mix-text));
}

.chess-mix-online-copy-status[data-copy-status="failed"],
.chess-mix-online-copy-status[data-copy-status="inviteFailed"] {
  color: color-mix(in srgb, #b42318 88%, var(--chess-mix-text));
}

.chess-mix-online-message {
  color: color-mix(in srgb, #1d4ed8 86%, var(--chess-mix-text));
}

.chess-mix-online-diagnostic {
  color: color-mix(in srgb, var(--chess-mix-text) 82%, transparent);
}

.chess-mix-online-diagnostic[data-health-status="reachable"] {
  color: color-mix(in srgb, #087a2a 88%, var(--chess-mix-text));
}

.chess-mix-online-diagnostic[data-health-status="unavailable"],
.chess-mix-online-diagnostic[data-health-status="error"] {
  color: color-mix(in srgb, #b42318 88%, var(--chess-mix-text));
}

.chess-mix-online-game-over-hint {
  padding: 0.65rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-target) 48%, var(--chess-mix-border));
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--chess-mix-target) 13%, #ffffff);
  color: color-mix(in srgb, var(--chess-mix-text) 88%, transparent);
  font-weight: 700;
}

.chess-mix-online-error {
  color: color-mix(in srgb, #b42318 92%, var(--chess-mix-text));
}

.chess-mix-online-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.chess-mix-online-field,
.chess-mix-online-check {
  display: grid;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: color-mix(in srgb, var(--chess-mix-text) 82%, transparent);
}

.chess-mix-online-field-wide,
.chess-mix-online-check {
  grid-column: 1 / -1;
}

.chess-mix-online-field input,
.chess-mix-online-field select {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 42%, transparent);
  border-radius: 0.7rem;
  padding: 0.5rem 0.65rem;
  color: var(--chess-mix-text);
  background: #ffffff;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 6%);
}

.chess-mix-online-field input::placeholder {
  color: color-mix(in srgb, var(--chess-mix-text) 48%, transparent);
}

.chess-mix-online-setup-locked-hint {
  padding: 0.6rem 0.7rem;
  border: 1px dashed color-mix(in srgb, var(--chess-mix-border) 52%, transparent);
  border-radius: 0.75rem;
  background: color-mix(in srgb, #ffffff 86%, var(--chess-mix-dark));
  font-weight: 650;
}

.chess-mix-online-field input[readonly],
.chess-mix-online-field select:disabled,
.chess-mix-online-check input:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.chess-mix-online-field input:focus,
.chess-mix-online-field select:focus,
.chess-mix-online-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--chess-mix-selected) 72%, transparent);
  outline-offset: 2px;
}

.chess-mix-online-check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.chess-mix-online-check input {
  accent-color: var(--chess-mix-border);
}

.chess-mix-online-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chess-mix-online-action {
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 48%, transparent);
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  color: var(--chess-mix-text);
  background: color-mix(in srgb, #ffffff 88%, var(--chess-mix-dark));
  cursor: pointer;
  font-weight: 650;
}

.chess-mix-online-action:hover:not(:disabled) {
  background: color-mix(in srgb, #ffffff 74%, var(--chess-mix-selected));
  border-color: color-mix(in srgb, var(--chess-mix-border) 68%, transparent);
}

.chess-mix-online-action-primary {
  background: color-mix(in srgb, var(--chess-mix-target) 34%, #ffffff);
}

.chess-mix-online-action-secondary {
  background: color-mix(in srgb, #ffffff 92%, var(--chess-mix-dark));
}

.chess-mix-online-action:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.chess-mix-online-room-catalog {
  margin-top: 0.75rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 52%, transparent);
  border-radius: 18px;
  padding: 0.75rem;
  background: color-mix(in srgb, #ffffff 94%, var(--chess-mix-light));
  box-shadow: 0 16px 34px rgb(44 32 24 / 12%);
}

.chess-mix-online-room-catalog-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.chess-mix-online-room-catalog-header h3 {
  margin: 0;
  font-size: 1rem;
}

.chess-mix-online-room-catalog-header-actions,
.chess-mix-online-room-catalog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.chess-mix-online-room-catalog-message {
  margin: 0;
  color: var(--chess-mix-muted);
  font-size: 0.92rem;
}

.chess-mix-online-room-catalog-list {
  display: grid;
  gap: 0.55rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.chess-mix-online-room-catalog-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 36%, transparent);
  border-radius: 14px;
  padding: 0.65rem;
  background: rgb(255 255 255 / 72%);
}

.chess-mix-online-room-catalog-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  align-items: center;
  min-width: 0;
  font-size: 0.88rem;
  color: var(--chess-mix-muted);
}

.chess-mix-online-room-catalog-main strong {
  color: var(--chess-mix-text);
  font-size: 0.95rem;
}

.chess-mix-online-room-catalog-link {
  color: var(--chess-mix-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 560px) {
  .chess-mix-online-room-catalog-item {
    grid-template-columns: 1fr;
  }

  .chess-mix-online-room-catalog-header-actions,
  .chess-mix-online-room-catalog-actions {
    width: 100%;
  }

  .chess-mix-online-room-catalog-header-actions .chess-mix-online-action,
  .chess-mix-online-room-catalog-actions .chess-mix-online-action {
    flex: 1 1 auto;
  }
}

.chess-mix-online-status-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0;
}

.chess-mix-online-panel[data-online-status="active"] {
  border-color: color-mix(in srgb, var(--chess-mix-target) 58%, var(--chess-mix-border));
}

.chess-mix-online-panel[data-online-status="error"] {
  border-color: color-mix(in srgb, #b42318 54%, var(--chess-mix-border));
}

@media (max-width: 560px) {
  .chess-mix-online-grid,
  .chess-mix-online-status-list {
    grid-template-columns: 1fr;
  }
}

/* Step1581: production online UX fix — visible board clocks and urgent online alerts. */
.chess-mix-captured-material:has(.chess-mix-board-clock) {
  grid-template-columns: minmax(78px, auto) minmax(112px, auto) minmax(0, 1fr);
}

.chess-mix-board-clock {
  justify-self: center;
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 6px;
  align-items: baseline;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 28%, transparent);
  border-radius: 999px;
  padding: 4px 10px;
  background: color-mix(in srgb, #ffffff 88%, var(--chess-mix-light));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #ffffff 66%, transparent);
}

.chess-mix-board-clock[data-board-clock-active="true"] {
  border-color: color-mix(in srgb, var(--chess-mix-target) 62%, var(--chess-mix-border));
  background: color-mix(in srgb, var(--chess-mix-target) 22%, #ffffff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--chess-mix-target) 16%, transparent);
}

.chess-mix-board-clock-label {
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.62;
}

.chess-mix-board-clock-time {
  font-variant-numeric: tabular-nums;
  font-size: clamp(0.98rem, 2.2vw, 1.18rem);
  line-height: 1;
}

.chess-mix-online-board-alert {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 14px 16px;
  border: 3px solid color-mix(in srgb, #d97706 72%, var(--chess-mix-border));
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, #facc15 38%, transparent), transparent 64%),
    color-mix(in srgb, #fff7ed 86%, #ffffff);
  box-shadow: 0 14px 32px rgba(120, 53, 15, 0.22);
  text-align: center;
}

.chess-mix-online-board-alert[data-online-alert="draw-offer"] {
  animation: chess-mix-urgent-pulse 1s ease-in-out infinite;
}

.chess-mix-online-board-alert[data-online-alert="game-result"] {
  border-color: color-mix(in srgb, var(--chess-mix-target) 72%, var(--chess-mix-border));
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--chess-mix-target) 38%, transparent), transparent 64%),
    color-mix(in srgb, #f0fdf4 76%, #ffffff);
}

.chess-mix-online-board-alert[data-online-alert="disconnect-grace"] {
  border-color: color-mix(in srgb, #dc2626 70%, var(--chess-mix-border));
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, #fecaca 48%, transparent), transparent 64%),
    color-mix(in srgb, #fff1f2 82%, #ffffff);
}

.chess-mix-disconnect-countdown {
  display: grid;
  width: min(100%, 320px);
  gap: 4px;
  justify-items: center;
  margin-top: 6px;
}

.chess-mix-disconnect-countdown-label {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.78;
}

.chess-mix-disconnect-countdown-value {
  font-size: clamp(2rem, 8vw, 3.6rem);
  font-variant-numeric: tabular-nums;
  line-height: 0.95;
}

.chess-mix-disconnect-countdown-unit {
  font-size: 0.82rem;
  font-weight: 800;
  opacity: 0.8;
}

.chess-mix-disconnect-countdown-bar {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, #dc2626 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, #ffffff 76%, #fecaca);
}

.chess-mix-disconnect-countdown-fill {
  display: block;
  width: calc(var(--disconnect-progress, 0) * 100%);
  height: 100%;
  border-radius: inherit;
  background: color-mix(in srgb, #dc2626 76%, #f97316);
  transition: width 0.3s linear;
}

.chess-mix-online-board-alert-eyebrow {
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.78;
}

.chess-mix-online-board-alert-title {
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  line-height: 1.12;
}

.chess-mix-online-board-alert-body {
  max-width: 38rem;
  font-size: 0.95rem;
  font-weight: 750;
}

.chess-mix-online-board-alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}

.chess-mix-online-board-alert-action {
  appearance: none;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 38%, transparent);
  border-radius: 999px;
  padding: 9px 14px;
  background: #ffffff;
  color: var(--chess-mix-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(21, 27, 37, 0.13);
}

.chess-mix-online-board-alert-action-primary {
  background: var(--chess-mix-dark);
  color: #ffffff;
}

.chess-mix-online-board-alert-action:hover,
.chess-mix-online-board-alert-action:focus-visible {
  transform: translateY(-1px);
  outline: 3px solid color-mix(in srgb, #facc15 66%, transparent);
  outline-offset: 2px;
}

@keyframes chess-mix-urgent-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 14px 32px rgba(120, 53, 15, 0.2);
  }
  50% {
    transform: scale(1.018);
    box-shadow: 0 18px 38px rgba(120, 53, 15, 0.34);
  }
}

@media (max-width: 760px) {
  .chess-mix-captured-material:has(.chess-mix-board-clock) {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .chess-mix-captured-material:has(.chess-mix-board-clock) .chess-mix-captured-pieces {
    grid-column: 1 / -1;
  }

  .chess-mix-board-clock {
    justify-self: end;
  }

  .chess-mix-online-board-alert-actions,
  .chess-mix-online-board-alert-action {
    width: 100%;
  }
}

/* Step1141: online hardening keeps the board visibly locked while it is not the local player's turn. */
.chess-mix-board-stack[data-input-locked="true"] .chess-mix-board-frame {
  border-color: color-mix(in srgb, var(--chess-mix-selected) 54%, var(--chess-mix-border));
}

.chess-mix-board[data-input-locked="true"] .chess-mix-square,
.chess-mix-square[data-input-locked="true"] {
  cursor: not-allowed;
}

.chess-mix-board[data-input-locked="true"] .chess-mix-square:disabled {
  opacity: 0.9;
}

.chess-mix-online-panel[data-online-status="disconnected"] {
  border-color: color-mix(in srgb, #d97706 58%, var(--chess-mix-border));
}

/* Step1585: compact language flags, mobile board controls and clickable mix previews. */
.chess-mix-locale-options {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 10px;
  background: color-mix(in srgb, #ffffff 82%, var(--chess-mix-light));
}

.chess-mix-locale-option {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 44px;
  border: 0;
  border-radius: 7px;
  padding: 5px 7px;
  background: transparent;
  color: var(--chess-mix-text);
  font: inherit;
  font-weight: 850;
}

.chess-mix-locale-option[data-locale-selected="true"] {
  background: var(--chess-mix-text);
  color: #fff;
  box-shadow: 0 1px 3px rgba(21, 27, 37, 0.16);
}

.chess-mix-locale-flag {
  font-size: 1.05rem;
  line-height: 1;
}

.chess-mix-locale-code {
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

.chess-mix-mobile-board-controls {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 24%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, #ffffff 88%, var(--chess-mix-light));
}

.chess-mix-online-instructions {
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 22%, transparent);
  border-radius: 0.85rem;
  background: color-mix(in srgb, #ffffff 88%, var(--chess-mix-light));
}

.chess-mix-online-instructions-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0.65rem 0.75rem;
  list-style: none;
}

.chess-mix-online-instructions-summary::-webkit-details-marker {
  display: none;
}

.chess-mix-online-instructions-toggle {
  display: inline-grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: var(--chess-mix-border);
  color: #fff;
  font-weight: 900;
  line-height: 1;
}

.chess-mix-online-instructions[open] .chess-mix-online-instructions-toggle {
  background: color-mix(in srgb, var(--chess-mix-target) 60%, var(--chess-mix-border));
}

.chess-mix-online-instructions-body {
  display: grid;
  gap: 0.6rem;
  padding: 0 0.75rem 0.75rem;
}

.chess-mix-online-settings {
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 20%, transparent);
  border-radius: 0.85rem;
  background: color-mix(in srgb, #ffffff 92%, var(--chess-mix-light));
}

.chess-mix-online-settings-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0.65rem 0.75rem;
  list-style: none;
  font-size: 0.85rem;
  font-weight: 850;
}

.chess-mix-online-settings-summary::-webkit-details-marker {
  display: none;
}

.chess-mix-online-settings-toggle {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: var(--chess-mix-border);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1;
}

.chess-mix-online-settings[open] .chess-mix-online-settings-toggle {
  transform: rotate(180deg);
}

.chess-mix-online-settings-body {
  display: grid;
  gap: 0.6rem;
  padding: 0 0.75rem 0.75rem;
}

.chess-mix-public-sidebar .chess-mix-online-panel {
  position: static;
  top: auto;
}

.chess-mix-visual-check-button {
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.chess-mix-visual-check-item[data-selected="true"] {
  border-color: color-mix(in srgb, var(--chess-mix-target) 84%, var(--chess-mix-border));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--chess-mix-target) 30%, transparent);
}

.chess-mix-visual-preview {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--chess-mix-target) 42%, var(--chess-mix-border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--chess-mix-target) 10%, #ffffff);
}

.chess-mix-visual-preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chess-mix-visual-preview-modes {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--chess-mix-border);
  border-radius: 10px;
  background: #fff;
}

.chess-mix-visual-preview-mode {
  cursor: pointer;
  border: 0;
  border-radius: 7px;
  padding: 5px 8px;
  background: transparent;
  color: var(--chess-mix-text);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 850;
}

.chess-mix-visual-preview-mode[data-visual-preview-mode-selected="true"] {
  background: var(--chess-mix-text);
  color: #fff;
}

.chess-mix-visual-preview-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(96px, 1fr));
  border: 2px solid var(--chess-mix-border);
  border-radius: 12px;
  overflow: hidden;
}

.chess-mix-visual-preview-square {
  height: 120px;
  min-height: 120px;
  overflow: visible;
}

@media (max-width: 760px) {
  .chess-mix-mobile-board-controls {
    display: flex;
    position: static;
    bottom: auto;
    z-index: auto;
    box-shadow: none;
  }

  .chess-mix-mobile-board-controls .chess-mix-control {
    flex: 1 1 86px;
  }

  .chess-mix-public-sidebar .chess-mix-online-panel {
    position: static;
  }

  .chess-mix-locale-options,
  .chess-mix-locale-option {
    width: 100%;
  }

  .chess-mix-locale-option {
    flex: 1 1 54px;
  }
}

/* Step1586: layout cleanup after production UX feedback. */
.chess-mix-player-intro .chess-mix-public-help {
  grid-column: 1 / -1;
  width: 100%;
}

.chess-mix-public-bottom-panels {
  grid-column: 1 / -1;
  grid-row: 3;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.chess-mix-public-bottom-panels .chess-mix-action-summary-list {
  max-height: 220px;
}

.chess-mix-public-bottom-panels .chess-mix-action-summary-button {
  grid-template-columns: 42px minmax(96px, auto) minmax(0, 1fr);
}

.chess-mix-public-bottom-panels .chess-mix-action-summary-notation,
.chess-mix-public-bottom-panels .chess-mix-choice-description,
.chess-mix-public-bottom-panels .chess-mix-choice-notation {
  min-width: 0;
  word-break: normal;
  overflow-wrap: break-word;
}

.chess-mix-public-sidebar .chess-mix-online-panel {
  position: static;
  top: auto;
}

.chess-mix-online-details {
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 20%, transparent);
  border-radius: 0.85rem;
  background: color-mix(in srgb, #ffffff 92%, var(--chess-mix-light));
}

.chess-mix-online-details-summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0.65rem 0.75rem;
  list-style: none;
  font-size: 0.85rem;
  font-weight: 850;
}

.chess-mix-online-details-summary::-webkit-details-marker {
  display: none;
}

.chess-mix-online-details-toggle {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  background: var(--chess-mix-border);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1;
}

.chess-mix-online-details[open] .chess-mix-online-details-toggle {
  transform: rotate(180deg);
}

.chess-mix-online-details-body {
  display: grid;
  gap: 0.6rem;
  padding: 0 0.75rem 0.75rem;
}

.chess-mix-locale-flag {
  display: inline-grid;
  place-items: center;
  min-width: 1.9rem;
  height: 1.22rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 52%, transparent);
  border-radius: 0.22rem;
  overflow: hidden;
  color: #111827;
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  line-height: 1;
  text-shadow: 0 1px 0 rgb(255 255 255 / 70%);
}

.chess-mix-locale-flag[data-locale-flag="en"] {
  background:
    linear-gradient(90deg, transparent 43%, #ffffff 43% 57%, transparent 57%),
    linear-gradient(0deg, transparent 42%, #c8102e 42% 58%, transparent 58%),
    #012169;
  color: #ffffff;
  text-shadow: 0 1px 1px rgb(0 0 0 / 58%);
}

.chess-mix-locale-flag[data-locale-flag="ru"] {
  background: linear-gradient(#ffffff 0 33%, #1f5fbf 33% 66%, #d52b1e 66%);
}

.chess-mix-locale-flag[data-locale-flag="fr"] {
  background: linear-gradient(90deg, #0055a4 0 33%, #ffffff 33% 66%, #ef4135 66%);
}

.chess-mix-locale-flag[data-locale-flag="es"] {
  background: linear-gradient(#aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75%);
}

@media (max-width: 760px) {
  .chess-mix-mobile-board-controls {
    display: flex;
    position: static;
    bottom: auto;
    z-index: auto;
    box-shadow: none;
  }

  .chess-mix-public-bottom-panels .chess-mix-action-summary-button {
    grid-template-columns: 40px minmax(0, 1fr);
  }
}

/* Step1588: corrected responsive placement for public controls and online panel. */
.chess-mix-public-online .chess-mix-online-panel {
  width: 100%;
}

.chess-mix-app-mode-play > .chess-mix-mobile-board-controls {
  grid-column: 1 / -1;
  width: min(100%, 680px);
  justify-self: center;
}

/* Step1589: separate public language bar from game controls/status and fix responsive panel order. */
.chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-status-block,
.chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-status,
.chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-status-details {
  display: none;
}

.chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-controls > .chess-mix-control,
.chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-piece-graphics-switcher {
  display: none;
}

.chess-mix-app-mode-play > .chess-mix-mobile-board-controls {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  width: min(100%, 680px);
  justify-self: center;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 24%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, #ffffff 88%, var(--chess-mix-light));
}

.chess-mix-board-control-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chess-mix-board-control-buttons .chess-mix-control {
  flex: 1 1 106px;
}

.chess-mix-board-control-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  justify-content: space-between;
}

.chess-mix-board-control-meta .chess-mix-piece-graphics-switcher {
  flex: 1 1 180px;
}

.chess-mix-board-control-status {
  flex: 2 1 260px;
  justify-content: flex-end;
}

.chess-mix-player-intro {
  grid-template-columns: minmax(0, 1fr);
}

.chess-mix-player-intro .chess-mix-player-summary {
  display: none;
}

.chess-mix-online-panel,
.chess-mix-online-panel *,
.chess-mix-online-settings,
.chess-mix-online-settings * {
  box-sizing: border-box;
}

.chess-mix-online-grid,
.chess-mix-online-field,
.chess-mix-online-check,
.chess-mix-online-field input,
.chess-mix-online-field select {
  min-width: 0;
}

.chess-mix-online-field input,
.chess-mix-online-field select {
  max-width: 100%;
}

@media (max-width: 760px) {
  .chess-mix-app-mode-play > .chess-mix-mobile-board-controls {
    display: grid;
    width: 100%;
  }

  .chess-mix-board-control-status {
    justify-content: flex-start;
  }
}

/* Step1590: board-column controls and mobile panel order refinement. */
.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "buttons buttons"
    "pieces status";
  width: min(100%, 680px);
  justify-self: center;
  align-items: end;
}

.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls .chess-mix-board-control-buttons {
  grid-area: buttons;
}

.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls .chess-mix-board-control-pieces {
  grid-area: pieces;
}

.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls .chess-mix-board-control-status {
  grid-area: status;
  justify-self: end;
}

.chess-mix-board-control-pieces {
  display: grid;
  min-width: 0;
}

@media (max-width: 760px) {
  .chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "pieces"
      "buttons"
      "status";
    width: 100%;
    justify-self: stretch;
  }

  .chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls .chess-mix-board-control-status {
    justify-self: stretch;
  }
}

/* Step1591: final mobile save/history order and right-aligned language controls. */
.chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-controls {
  justify-content: flex-end;
  margin-left: auto;
}

.chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-locale-switcher {
  grid-template-columns: auto auto;
  justify-content: end;
  justify-items: end;
  text-align: right;
}

.chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-locale-options {
  justify-content: flex-end;
  justify-self: end;
}

@media (max-width: 760px) {
  .chess-mix-app-mode-play .chess-mix-public-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "main"
      "online"
      "underboard"
      "sidebar"
      "bottom";
  }

  .chess-mix-app-mode-play .chess-mix-public-main {
    grid-area: main;
  }

  .chess-mix-app-mode-play .chess-mix-public-online {
    grid-area: online;
  }

  .chess-mix-app-mode-play .chess-mix-public-underboard {
    grid-area: underboard;
  }

  .chess-mix-app-mode-play .chess-mix-public-sidebar {
    grid-area: sidebar;
  }

  .chess-mix-app-mode-play .chess-mix-public-bottom-panels {
    grid-area: bottom;
  }

  .chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-controls {
    display: flex;
    justify-content: flex-end;
  }

  .chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-locale-switcher {
    width: auto;
    max-width: 100%;
  }
}

/* Step1593: move draw/resign into the board controls and remove Clear from public controls. */
.chess-mix-board-control-online-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  justify-content: center;
}

.chess-mix-board-control-online-actions .chess-mix-control {
  flex: 1 1 118px;
  white-space: nowrap;
}

.chess-mix-board-online-control-danger:not(:disabled) {
  border-color: color-mix(in srgb, var(--chess-mix-danger, #b91c1c) 46%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 86%, var(--chess-mix-danger, #b91c1c));
}

.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls {
  grid-template-columns: minmax(150px, auto) minmax(150px, auto) minmax(0, 1fr);
  grid-template-areas:
    "buttons buttons buttons"
    "pieces online status";
}

.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls .chess-mix-board-control-online-actions {
  grid-area: online;
}

@media (max-width: 760px) {
  .chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "pieces"
      "buttons"
      "online"
      "status";
  }

  .chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls .chess-mix-board-control-online-actions {
    justify-content: stretch;
  }
}

/* Step1594: move piece selector into Settings and keep online draw/resign compact near board controls. */
.chess-mix-online-piece-settings {
  grid-column: 1 / -1;
  display: grid;
  min-width: 0;
}

.chess-mix-online-piece-settings .chess-mix-piece-graphics-switcher {
  width: 100%;
  min-width: 0;
}

.chess-mix-online-piece-settings .chess-mix-piece-graphics-options {
  justify-self: start;
  max-width: 100%;
  flex-wrap: wrap;
}

.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls {
  grid-template-columns: minmax(260px, auto) minmax(0, 1fr);
  grid-template-areas:
    "buttons buttons"
    "online status";
}

.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls .chess-mix-board-control-online-actions {
  grid-area: online;
  justify-content: flex-start;
  align-self: end;
  flex-wrap: nowrap;
}

.chess-mix-board-control-online-actions .chess-mix-control {
  flex: 0 1 auto;
}

@media (max-width: 760px) {
  .chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "buttons"
      "online"
      "status";
  }

  .chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls .chess-mix-board-control-online-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .chess-mix-board-control-online-actions .chess-mix-control {
    flex: 1 1 140px;
  }
}

/* Step1596: local Assistant modes. */
.chess-mix-assistant-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.3rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 22%, transparent);
  border-radius: 0.75rem;
  padding: 0.5rem 0.65rem;
  background: color-mix(in srgb, #ffffff 88%, var(--chess-mix-target));
  font-size: 0.85rem;
  font-weight: 750;
  cursor: pointer;
}

.chess-mix-assistant-switcher select {
  min-height: 2rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 32%, transparent);
  border-radius: 0.55rem;
  padding: 0.25rem 0.45rem;
  background: color-mix(in srgb, #ffffff 94%, var(--chess-mix-target));
  font: inherit;
}

.chess-mix-square-assistant-threat {
  isolation: isolate;
}

.chess-mix-square-assistant-attacker {
  box-shadow:
    inset 0 0 0 4px color-mix(in srgb, var(--chess-mix-capture) 72%, transparent),
    inset 0 0 0 999px color-mix(in srgb, var(--chess-mix-capture) 14%, transparent);
}

.chess-mix-square-assistant-attacker .chess-mix-piece,
.chess-mix-square-assistant-attacker .chess-mix-piece-svg {
  filter:
    drop-shadow(0 0 0.18rem rgba(255, 255, 255, 0.98))
    drop-shadow(0 0 0.36rem color-mix(in srgb, var(--chess-mix-capture) 72%, transparent));
}

.chess-mix-square-assistant-defender {
  box-shadow:
    inset 0 0 0 4px color-mix(in srgb, var(--chess-mix-selected) 76%, transparent),
    inset 0 0 0 999px color-mix(in srgb, var(--chess-mix-selected) 16%, transparent);
}

.chess-mix-square-assistant-defender .chess-mix-piece,
.chess-mix-square-assistant-defender .chess-mix-piece-svg {
  filter:
    drop-shadow(0 0 0.18rem rgba(255, 255, 255, 0.98))
    drop-shadow(0 0 0.36rem color-mix(in srgb, var(--chess-mix-selected) 30%, transparent));
}

.chess-mix-square-assistant-target:not(.chess-mix-square-last-move-to) {
  outline: 3px dashed color-mix(in srgb, var(--chess-mix-capture) 58%, transparent);
  outline-offset: -6px;
}

.chess-mix-square-assistant-safe-target {
  outline: 3px dashed color-mix(in srgb, var(--chess-mix-target) 62%, transparent);
  outline-offset: -6px;
  box-shadow:
    inset 0 0 0 999px color-mix(in srgb, var(--chess-mix-target) 10%, transparent);
}

/* Step1607: keep replay controls near the board and make the active turn obvious. */
.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-history {
  width: min(100%, 680px);
  justify-self: center;
}

.chess-mix-captured-material[data-active-turn="true"] {
  border-color: color-mix(in srgb, var(--chess-mix-target) 72%, var(--chess-mix-border));
  background: color-mix(in srgb, var(--chess-mix-target) 16%, #ffffff);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--chess-mix-target) 32%, transparent), 0 10px 24px rgba(21, 27, 37, 0.08);
}

.chess-mix-captured-material[data-active-turn="true"] .chess-mix-captured-player-name {
  font-weight: 950;
}

.chess-mix-square-assistant-opponent-source {
  box-shadow: inset 0 0 0 4px color-mix(in srgb, #8b5cf6 78%, transparent), inset 0 0 24px color-mix(in srgb, #8b5cf6 28%, transparent);
}

.chess-mix-square-assistant-opponent-move::after {
  content: "";
  position: absolute;
  inset: 30%;
  border-radius: 999px;
  border: 3px solid color-mix(in srgb, #8b5cf6 92%, #ffffff);
  background: color-mix(in srgb, #8b5cf6 20%, transparent);
  pointer-events: none;
  z-index: 3;
}

.chess-mix-square-assistant-opponent-move .chess-mix-piece,
.chess-mix-square-assistant-opponent-move .chess-mix-piece-svg {
  filter: drop-shadow(0 0 8px color-mix(in srgb, #8b5cf6 62%, transparent));
}

.chess-mix-legend-assistant-opponent-move {
  border: 3px solid #8b5cf6;
  background: color-mix(in srgb, #8b5cf6 20%, transparent);
}

/* Step1608: app-ready mobile/PWA preparation. */
html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}

.chess-mix-control,
.chess-mix-choice,
.chess-mix-online-action,
.chess-mix-replay-control,
.chess-mix-locale-option,
.chess-mix-piece-graphics-option,
.chess-mix-assistant-switcher,
.chess-mix-assistant-switcher select,
.chess-mix-online-field input,
.chess-mix-online-field select {
  touch-action: manipulation;
}

.chess-mix-replay-actions {
  min-width: 0;
}

.chess-mix-app-mode-play .chess-mix-public-layout,
.chess-mix-app-mode-play .chess-mix-public-main,
.chess-mix-app-mode-play .chess-mix-public-online,
.chess-mix-app-mode-play .chess-mix-public-underboard,
.chess-mix-app-mode-play .chess-mix-public-sidebar,
.chess-mix-app-mode-play .chess-mix-public-bottom-panels {
  max-width: 100%;
}

.chess-mix-app-mode-play .chess-mix-board-stack,
.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-history,
.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-mobile-board-controls {
  max-width: min(100%, calc(100dvw - 12px));
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  body {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-right: max(6px, env(safe-area-inset-right));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-left: max(6px, env(safe-area-inset-left));
  }

  .chess-mix-app-mode-play {
    min-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - max(8px, env(safe-area-inset-bottom)));
  }
}

@media (max-width: 560px) {
  .chess-mix-app {
    width: 100%;
  }

  .chess-mix-app-mode-play .chess-mix-toolbar {
    gap: 8px;
    padding: 8px;
  }

  .chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-controls {
    width: auto;
    margin-left: 0;
  }

  .chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-locale-switcher {
    width: 100%;
    grid-template-columns: 1fr;
    justify-items: stretch;
    text-align: left;
  }

  .chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-locale-options {
    justify-content: stretch;
  }

  .chess-mix-app-mode-play .chess-mix-public-layout {
    gap: 10px;
  }

  .chess-mix-app-mode-play .chess-mix-public-main,
  .chess-mix-app-mode-play .chess-mix-public-online,
  .chess-mix-app-mode-play .chess-mix-public-underboard,
  .chess-mix-app-mode-play .chess-mix-public-sidebar,
  .chess-mix-app-mode-play .chess-mix-public-bottom-panels {
    gap: 10px;
  }

  .chess-mix-app-mode-play .chess-mix-board-stack {
    width: 100%;
    max-width: calc(100dvw - 12px);
    gap: 6px;
  }

  .chess-mix-app-mode-play .chess-mix-board-frame {
    grid-template-columns: 14px minmax(0, 1fr) 14px;
    grid-template-rows: 14px minmax(0, 1fr) 14px;
  }

  .chess-mix-app-mode-play .chess-mix-board-corner {
    min-width: 14px;
    min-height: 14px;
  }

  .chess-mix-app-mode-play .chess-mix-file-labels,
  .chess-mix-app-mode-play .chess-mix-rank-labels {
    font-size: 0.58rem;
  }

  .chess-mix-app-mode-play .chess-mix-captured-material {
    min-height: 36px;
    grid-template-columns: minmax(58px, auto) minmax(0, 1fr);
    gap: 6px;
    padding: 6px 7px;
  }

  .chess-mix-app-mode-play .chess-mix-captured-material:has(.chess-mix-board-clock) {
    grid-template-columns: minmax(58px, 1fr) auto;
  }

  .chess-mix-app-mode-play .chess-mix-captured-player {
    min-width: 0;
    font-size: 0.72rem;
  }

  .chess-mix-app-mode-play .chess-mix-board-clock {
    padding: 3px 7px;
  }

  .chess-mix-app-mode-play .chess-mix-board-clock-time {
    font-size: 0.92rem;
  }

  .chess-mix-app-mode-play .chess-mix-mobile-board-controls {
    width: 100%;
    max-width: calc(100dvw - 12px);
    gap: 8px;
    padding: 8px;
  }

  .chess-mix-board-control-buttons,
  .chess-mix-board-control-online-actions,
  .chess-mix-replay-actions,
  .chess-mix-online-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .chess-mix-board-control-buttons .chess-mix-control,
  .chess-mix-board-control-online-actions .chess-mix-control,
  .chess-mix-replay-control,
  .chess-mix-online-action {
    width: 100%;
    min-height: 42px;
    white-space: normal;
  }

  .chess-mix-replay-control-primary {
    grid-column: span 2;
  }

  .chess-mix-history-list {
    max-height: 38dvh;
    overflow: auto;
  }

  .chess-mix-history-item {
    grid-template-columns: 2.4rem minmax(0, 1fr);
  }

  .chess-mix-online-panel {
    padding: 0.75rem;
    border-radius: 0.85rem;
    box-shadow: 0 8px 18px rgb(0 0 0 / 9%);
  }

  .chess-mix-online-room-catalog-main,
  .chess-mix-online-status-list,
  .chess-mix-online-grid {
    font-size: 0.82rem;
  }

  .chess-mix-online-board-alert {
    padding: 10px;
    border-width: 2px;
  }

  .chess-mix-online-board-alert-title {
    font-size: 1.08rem;
  }

  .chess-mix-square-assistant-opponent-move::after {
    inset: 28%;
    border-width: 2px;
  }
}

/* Step1614: mobile board width, internal coordinates, non-rated last-move trail. */
.chess-mix-board[data-last-move-trail="true"] .chess-mix-square-last-move {
  box-shadow:
    inset 0 0 0 999px color-mix(in srgb, var(--chess-mix-selected) 10%, transparent),
    inset 0 0 0 3px color-mix(in srgb, var(--chess-mix-selected) 30%, transparent);
}

.chess-mix-board[data-last-move-trail="false"] .chess-mix-square-last-move {
  box-shadow: none;
}

.chess-mix-board[data-assistant-clicks-enabled="true"] .chess-mix-square,
.chess-mix-board[data-assistant-clicks-enabled="true"] .chess-mix-square:disabled {
  cursor: pointer;
}

.chess-mix-board[data-assistant-clicks-enabled="true"] .chess-mix-square:disabled {
  opacity: 1;
}

@media (max-width: 760px) {
  body {
    padding-right: 0;
    padding-left: 0;
  }

  .chess-mix-app-mode-play .chess-mix-board-stack,
  .chess-mix-app-mode-play .chess-mix-public-layout .chess-mix-board-wrap,
  .chess-mix-app-mode-play .chess-mix-board-wrap {
    width: 100%;
    max-width: 100dvw;
    justify-self: stretch;
  }

  .chess-mix-app-mode-play .chess-mix-board-frame {
    grid-template-columns: 0 minmax(0, 1fr) 0;
    grid-template-rows: 0 minmax(0, 1fr) 0;
  }

  .chess-mix-app-mode-play .chess-mix-board-corner,
  .chess-mix-app-mode-play .chess-mix-file-labels,
  .chess-mix-app-mode-play .chess-mix-rank-labels {
    display: none;
  }

  .chess-mix-app-mode-play .chess-mix-board-area,
  .chess-mix-app-mode-play .chess-mix-board {
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .chess-mix-app-mode-play .chess-mix-board {
    border: 0;
    border-radius: 0;
  }

  .chess-mix-app-mode-play .chess-mix-square-coordinate {
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.05em;
    min-height: 1.05em;
    border-radius: 999px;
    color: color-mix(in srgb, var(--chess-mix-border) 86%, #000000);
    font-size: clamp(0.56rem, 2.35vw, 0.74rem);
    font-weight: 900;
    line-height: 1;
    opacity: 0.82;
    pointer-events: none;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.55);
  }

  .chess-mix-app-mode-play .chess-mix-square-coordinate-rank {
    left: 3px;
    top: 3px;
  }

  .chess-mix-app-mode-play .chess-mix-square-coordinate-file {
    left: auto;
    right: 3px;
    top: auto;
    bottom: 3px;
  }
}

/* Step1614e: corrected history/replay split, centered board alerts, setup modal, and room create row. */
.chess-mix-history-shell {
  display: grid;
  width: min(100%, 680px);
  justify-self: center;
}

.chess-mix-history-shell > .chess-mix-replay {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.chess-mix-history-shell > .chess-mix-history {
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.chess-mix-history-shell .chess-mix-replay-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
}

.chess-mix-history-shell .chess-mix-replay-control {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 6px 7px;
  white-space: nowrap;
}

.chess-mix-history-shell .chess-mix-replay-control-primary {
  grid-column: auto;
}

.chess-mix-app-mode-play .chess-mix-public-main > .chess-mix-history-shell {
  width: min(100%, 680px);
  max-width: min(100%, calc(100dvw - 12px));
  justify-self: center;
}

.chess-mix-board-stage {
  position: relative;
  display: grid;
  min-width: 0;
}

.chess-mix-board-stage > .chess-mix-board {
  grid-area: 1 / 1;
}

.chess-mix-online-board-alert-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: clamp(0.5rem, 3vw, 1.2rem);
}

.chess-mix-online-board-alert-backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: rgba(15, 23, 42, 0.24);
}

.chess-mix-online-board-alert {
  position: relative;
  z-index: 1;
  width: min(92%, 430px);
  max-width: 430px;
  padding: 1rem 1.1rem;
}

.chess-mix-online-board-alert-close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  display: inline-grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, #ffffff 86%, var(--chess-mix-border));
  color: var(--chess-mix-text);
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
}

.chess-mix-online-board-alert-action-danger {
  background: color-mix(in srgb, #dc2626 86%, #111827);
  color: #ffffff;
}

.chess-mix-online-create-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: end;
}

.chess-mix-online-room-id-inline input {
  min-width: 0;
}

.chess-mix-public-online > .chess-mix-legend {
  width: 100%;
}

.chess-mix-online-setup-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: max(0.8rem, env(safe-area-inset-top)) max(0.8rem, env(safe-area-inset-right)) max(0.8rem, env(safe-area-inset-bottom)) max(0.8rem, env(safe-area-inset-left));
}

.chess-mix-online-setup-modal-backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  background: rgba(15, 23, 42, 0.58);
}

.chess-mix-online-setup-modal-card {
  position: relative;
  z-index: 1;
  width: min(96vw, 560px);
  max-height: 90dvh;
  overflow: auto;
  padding: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 34%, transparent);
  border-radius: 1.1rem;
  background: color-mix(in srgb, #ffffff 94%, var(--chess-mix-light));
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.34);
}

.chess-mix-online-setup-modal-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  background: var(--chess-mix-border);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1;
}

.chess-mix-online-setup-modal-card .chess-mix-online-panel {
  padding-top: 2.4rem;
}

@media (max-width: 560px) {
  .chess-mix-replay-header {
    grid-template-columns: 1fr;
  }

  .chess-mix-replay-last-move,
  .chess-mix-replay-header > span:last-child {
    justify-self: start;
    text-align: left;
  }

  .chess-mix-history-shell .chess-mix-replay-actions {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .chess-mix-history-shell .chess-mix-replay-control,
  .chess-mix-history-shell .chess-mix-replay-control-primary {
    grid-column: auto;
    min-height: 38px;
    padding-inline: 4px;
  }

  .chess-mix-online-create-row {
    grid-template-columns: 1fr;
  }

  .chess-mix-online-board-alert {
    width: min(94%, 360px);
    padding: 0.9rem 0.75rem;
  }
}

/* step1614f: stable online controls, compact language dropdown and spectator row. */
.chess-mix-locale-field {
  display: grid;
  gap: 3px;
}

.chess-mix-locale-select {
  min-width: 8.5rem;
}

.chess-mix-online-grid .chess-mix-online-check {
  grid-column: auto;
  align-self: end;
  min-height: 2.65rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 36%, transparent);
  border-radius: 0.7rem;
  background: color-mix(in srgb, #ffffff 74%, var(--chess-mix-light));
}

.chess-mix-online-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.chess-mix-online-action {
  width: 100%;
  min-height: 2.55rem;
  white-space: normal;
}

.chess-mix-online-create-row .chess-mix-online-action-primary {
  min-width: 10.5rem;
}

@media (min-width: 900px) {
  .chess-mix-online-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .chess-mix-online-actions {
    grid-template-columns: 1fr;
  }

  .chess-mix-online-create-row .chess-mix-online-action-primary {
    min-width: 0;
  }
}

/* step1614g: SVG locale flag, compact mobile controls and stable two-column phone buttons. */
.chess-mix-locale-select-wrap {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.4rem;
  align-items: center;
}

.chess-mix-locale-current-flag {
  width: 1.8rem;
  height: 1.2rem;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 46%, transparent);
  border-radius: 0.22rem;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 14%);
}

.chess-mix-locale-select {
  min-width: 7.8rem;
}

.chess-mix-board-control-status .chess-mix-status-detail[data-status-key="public-last-move"] {
  display: none;
}

@media (max-width: 560px) {
  .chess-mix-control,
  .chess-mix-online-action,
  .chess-mix-online-board-alert-action {
    min-height: 34px;
    padding: 0.38rem 0.48rem;
    font-size: 0.82rem;
    line-height: 1.12;
  }

  .chess-mix-board-control-buttons,
  .chess-mix-board-control-online-actions,
  .chess-mix-online-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .chess-mix-online-create-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: 6px;
  }

  .chess-mix-online-create-row .chess-mix-online-action-primary {
    min-width: 0;
  }

  .chess-mix-online-field input,
  .chess-mix-online-field select {
    padding: 0.38rem 0.5rem;
    min-height: 34px;
    font-size: 0.84rem;
  }

  .chess-mix-online-field,
  .chess-mix-online-check {
    font-size: 0.72rem;
  }

  .chess-mix-online-grid {
    gap: 0.45rem;
  }

  .chess-mix-online-grid .chess-mix-online-check {
    min-height: 34px;
    padding: 0.32rem 0.42rem;
  }

  .chess-mix-app-mode-play .chess-mix-mobile-board-controls {
    gap: 6px;
    padding: 6px;
  }

  .chess-mix-board-control-status {
    margin-top: 0;
  }

  .chess-mix-online-board-alert-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .chess-mix-locale-field {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .chess-mix-locale-select {
    min-width: 0;
    width: 100%;
    min-height: 34px;
    padding: 0.32rem 0.45rem;
    font-size: 0.82rem;
  }

  .chess-mix-locale-current-flag {
    width: 1.55rem;
    height: 1.05rem;
  }
}

/* step1614h: final mobile header and public cleanup polish. */
.chess-mix-save-load-mobile {
  display: none;
}

.chess-mix-save-load-desktop {
  display: grid;
}

.chess-mix-public-underboard:empty {
  display: none;
}

@media (max-width: 760px) {
  .chess-mix-save-load-desktop {
    display: none;
  }

  .chess-mix-save-load-mobile {
    display: grid;
  }
}

@media (max-width: 560px) {
  .chess-mix-app-mode-play .chess-mix-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

  .chess-mix-app-mode-play .chess-mix-toolbar-main,
  .chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-controls {
    width: auto;
    min-width: 0;
  }

  .chess-mix-app-mode-play .chess-mix-toolbar-main {
    justify-content: start;
  }

  .chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-controls {
    justify-self: end;
    margin-left: 0;
  }

  .chess-mix-app-mode-play .chess-mix-mode-switcher-public {
    width: auto;
    max-width: 100%;
  }

  .chess-mix-app-mode-play .chess-mix-mode-badge {
    max-width: 100%;
    padding: 6px 8px;
    font-size: 0.74rem;
    line-height: 1.08;
    white-space: normal;
  }

  .chess-mix-app-mode-play .chess-mix-toolbar .chess-mix-locale-switcher {
    width: auto;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    justify-items: end;
  }

  .chess-mix-app-mode-play .chess-mix-locale-field {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .chess-mix-app-mode-play .chess-mix-locale-field > span:first-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .chess-mix-app-mode-play .chess-mix-locale-select-wrap {
    grid-template-columns: auto minmax(4.8rem, 1fr);
    gap: 0.28rem;
  }

  .chess-mix-app-mode-play .chess-mix-locale-select {
    width: 5.8rem;
    min-width: 0;
  }

  .chess-mix-app-mode-play .chess-mix-player-intro-main {
    gap: 5px;
  }
}


/* step1614i: final desktop coordinate visibility and rules spacing polish. */
@media (min-width: 761px) {
  .chess-mix-app-mode-play .chess-mix-file-labels,
  .chess-mix-app-mode-play .chess-mix-rank-labels {
    color: rgba(236, 244, 255, 0.92);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  }

  .chess-mix-app-mode-play .chess-mix-board-label {
    opacity: 0.96;
  }
}

.chess-mix-public-help-item {
  grid-template-columns: minmax(108px, max-content) minmax(0, 1fr);
  column-gap: 14px;
}

.chess-mix-public-help-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .chess-mix-public-help-item {
    grid-template-columns: 1fr;
    column-gap: 0;
  }
}

/* step1615: board overlay for castling-with-mix choice and other non-promotion move variants */
.chess-mix-board-move-choice-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  pointer-events: none;
}

.chess-mix-board-move-choice-popover {
  grid-column: var(--move-choice-column);
  grid-row: var(--move-choice-row);
  align-self: center;
  justify-self: center;
  box-sizing: border-box;
  display: grid;
  gap: 6px;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  padding: 10px 12px 12px;
  border: 2px solid color-mix(in srgb, var(--chess-mix-border) 72%, transparent);
  border-radius: 20px;
  background: color-mix(in srgb, #ffffff 90%, transparent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  pointer-events: auto;
}

.chess-mix-board-move-choice-popover[data-horizontal-placement="left"] {
  justify-self: start;
}

.chess-mix-board-move-choice-popover[data-horizontal-placement="right"] {
  justify-self: end;
}

.chess-mix-board-move-choice-popover[data-vertical-placement="above"] {
  transform: translateY(-62%);
}

.chess-mix-board-move-choice-popover[data-vertical-placement="below"] {
  transform: translateY(62%);
}

.chess-mix-board-move-choice-title {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0.76;
}

.chess-mix-move-choice,
.chess-mix-choice {
  display: grid;
  gap: 2px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--chess-mix-border) 56%, transparent);
  border-radius: 14px;
  padding: 7px 8px;
  background: color-mix(in srgb, #ffffff 90%, transparent);
  color: var(--chess-mix-text);
  cursor: pointer;
  text-align: left;
}

.chess-mix-move-choice[data-move-choice-context="overlay"] {
  min-width: 160px;
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--chess-mix-border) 58%, transparent),
    0 4px 8px rgba(0, 0, 0, 0.14);
}

.chess-mix-move-choice:hover,
.chess-mix-move-choice:focus-visible {
  background: color-mix(in srgb, #ffffff 78%, var(--chess-mix-selected));
  outline: none;
}

.chess-mix-move-choice-title {
  font-size: 0.74rem;
  font-weight: 800;
}

.chess-mix-move-choice-label {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
}

.chess-mix-move-choice-description {
  font-size: 0.68rem;
  opacity: 0.76;
}

@media (max-width: 760px) {
  .chess-mix-board-move-choice-popover {
    gap: 4px;
    padding: 8px 9px 9px;
    max-width: calc(100vw - 12px);
  }

  .chess-mix-board-move-choice-popover[data-vertical-placement="above"] {
    transform: translateY(-52%);
  }

  .chess-mix-board-move-choice-popover[data-vertical-placement="below"] {
    transform: translateY(52%);
  }

  .chess-mix-move-choice[data-move-choice-context="overlay"] {
    min-width: 142px;
    padding: 6px 7px;
  }
}

/* step1615c: final cosmetic polish before the next planned branch. */
:root {
  --chess-mix-polish-blue: #63b3ed;
  --chess-mix-polish-orange: #f6ad55;
  --chess-mix-polish-orange-strong: #ed8936;
  --chess-mix-polish-red: #fca5a5;
}

/* Hide the small multi-choice counter next to the O-O castling marker. */
.chess-mix-action-marker-castling .chess-mix-action-marker-count {
  display: none;
}

/* Help / About / Rules: replace the former pastel green with an equally soft blue. */
.chess-mix-public-help {
  border-color: color-mix(in srgb, var(--chess-mix-polish-blue) 54%, var(--chess-mix-border));
  background: color-mix(in srgb, var(--chess-mix-panel) 88%, var(--chess-mix-polish-blue));
}

.chess-mix-public-help-note {
  background: color-mix(in srgb, #ffffff 78%, var(--chess-mix-polish-blue));
}

/* Multiplayer buttons: use a pastel orange instead of the old pastel green. */
.chess-mix-online-action:not(.chess-mix-online-board-alert-action-danger):not(.chess-mix-board-online-control-danger),
.chess-mix-board-control-online-actions .chess-mix-control:not(.chess-mix-board-online-control-danger) {
  border-color: color-mix(in srgb, var(--chess-mix-polish-orange) 54%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 78%, var(--chess-mix-polish-orange));
}

.chess-mix-online-action-primary:not(:disabled),
.chess-mix-online-create-row .chess-mix-online-action-primary:not(:disabled) {
  border-color: color-mix(in srgb, var(--chess-mix-polish-orange-strong) 64%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 62%, var(--chess-mix-polish-orange));
}

.chess-mix-online-action:hover:not(:disabled):not(.chess-mix-online-board-alert-action-danger):not(.chess-mix-board-online-control-danger),
.chess-mix-board-control-online-actions .chess-mix-control:hover:not(:disabled):not(.chess-mix-board-online-control-danger) {
  border-color: color-mix(in srgb, var(--chess-mix-polish-orange-strong) 76%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 56%, var(--chess-mix-polish-orange));
}

/* Active player material panel: same orange family as multiplayer actions. */
.chess-mix-captured-material[data-active-turn="true"] {
  border-color: color-mix(in srgb, var(--chess-mix-polish-orange-strong) 70%, var(--chess-mix-border));
  background: color-mix(in srgb, var(--chess-mix-polish-orange) 18%, #ffffff);
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--chess-mix-polish-orange) 30%, transparent),
    0 10px 24px rgba(21, 27, 37, 0.08);
}

/* Replay autoplay: square stop icon is set in TypeScript; make the button reddish while playing. */
.chess-mix-replay[data-replay-playing="true"] .chess-mix-replay-control-primary {
  border-color: color-mix(in srgb, #dc2626 58%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 62%, var(--chess-mix-polish-red));
  color: color-mix(in srgb, #7f1d1d 86%, var(--chess-mix-text));
  box-shadow: 0 0 0 2px color-mix(in srgb, #f87171 28%, transparent);
}

.chess-mix-replay[data-replay-playing="true"] .chess-mix-replay-control-primary:hover:not(:disabled),
.chess-mix-replay[data-replay-playing="true"] .chess-mix-replay-control-primary:focus-visible {
  background: color-mix(in srgb, #ffffff 52%, var(--chess-mix-polish-red));
}

/* Room catalog: orange inner glow and a stronger Z-axis lifted shadow. */
.chess-mix-online-room-catalog {
  border-color: color-mix(in srgb, var(--chess-mix-polish-orange-strong) 66%, var(--chess-mix-border));
  background:
    linear-gradient(180deg,
      color-mix(in srgb, #ffffff 88%, var(--chess-mix-polish-orange)),
      color-mix(in srgb, #ffffff 96%, var(--chess-mix-light))
    );
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--chess-mix-polish-orange) 42%, transparent),
    inset 0 0 26px color-mix(in srgb, var(--chess-mix-polish-orange) 22%, transparent),
    0 18px 36px rgba(21, 27, 37, 0.20),
    0 5px 12px rgba(21, 27, 37, 0.14);
}

.chess-mix-online-room-catalog-item {
  border-color: color-mix(in srgb, var(--chess-mix-polish-orange) 34%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 84%, var(--chess-mix-polish-orange));
  box-shadow: 0 6px 14px rgba(21, 27, 37, 0.10);
}

/* Keep Undo/Redo as one pair on the public board controls. */
.chess-mix-board-control-buttons .chess-mix-control[data-chess-mix-control="undo"] {
  order: 3;
}

.chess-mix-board-control-buttons .chess-mix-control[data-chess-mix-control="redo"] {
  order: 4;
}

.chess-mix-board-control-buttons .chess-mix-control[data-chess-mix-control="flip"] {
  order: 2;
}

.chess-mix-board-control-buttons [data-chess-mix-online-control="openSetup"] {
  order: 1;
}

@media (max-width: 560px) {
  .chess-mix-board-control-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* step1615e: material panel tone-down after final color tuning. */
:root {
  --chess-mix-polish-cyan: #1cc9cc;
  --chess-mix-polish-material-green: #00ff49;
}

/* Multiplayer and board Undo/Redo controls: richer cyan base; keep warm orange hover. */
.chess-mix-online-action:not(.chess-mix-online-board-alert-action-danger):not(.chess-mix-board-online-control-danger),
.chess-mix-board-control-online-actions .chess-mix-control:not(.chess-mix-board-online-control-danger),
.chess-mix-board-control-buttons .chess-mix-control:not(:disabled) {
  border-color: color-mix(in srgb, var(--chess-mix-polish-cyan) 62%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 66%, var(--chess-mix-polish-cyan));
}

.chess-mix-online-action-primary:not(:disabled),
.chess-mix-online-create-row .chess-mix-online-action-primary:not(:disabled) {
  border-color: color-mix(in srgb, var(--chess-mix-polish-cyan) 72%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 58%, var(--chess-mix-polish-cyan));
}

.chess-mix-online-action:hover:not(:disabled):not(.chess-mix-online-board-alert-action-danger):not(.chess-mix-board-online-control-danger),
.chess-mix-board-control-online-actions .chess-mix-control:hover:not(:disabled):not(.chess-mix-board-online-control-danger),
.chess-mix-board-control-buttons .chess-mix-control:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--chess-mix-polish-orange-strong) 76%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 56%, var(--chess-mix-polish-orange));
}

/* Captured material panels: keep the normal panel white and use a softer green active-turn glow. */
.chess-mix-captured-material {
  border-color: color-mix(in srgb, var(--chess-mix-border) 34%, transparent);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(21, 27, 37, 0.08);
}

.chess-mix-captured-material[data-active-turn="true"] {
  border-color: color-mix(in srgb, var(--chess-mix-polish-material-green) 34%, var(--chess-mix-border));
  background: color-mix(in srgb, #ffffff 88%, var(--chess-mix-polish-material-green));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--chess-mix-polish-material-green) 18%, transparent),
    0 8px 18px rgba(21, 27, 37, 0.07);
}

/* Replace cream-tinted UI block backgrounds with white without changing board squares. */
.chess-mix-replay,
.chess-mix-visual-check-item,
.chess-mix-keyboard-shortcut kbd,
.chess-mix-scenario-control,
.chess-mix-app[data-dev-tools="disabled"] .chess-mix-mode-switcher-public,
.chess-mix-mode-switcher,
.chess-mix-player-intro,
.chess-mix-piece-graphics-options,
.chess-mix-game-over-action-secondary,
.chess-mix-online-mode-help,
.chess-mix-board-clock,
.chess-mix-locale-options,
.chess-mix-mobile-board-controls,
.chess-mix-online-instructions,
.chess-mix-online-settings,
.chess-mix-online-details,
.chess-mix-board-controls,
.chess-mix-online-setup-modal-card,
.chess-mix-online-grid .chess-mix-online-check {
  background: #ffffff;
}

.chess-mix-game-over-banner {
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--chess-mix-target) 30%, transparent), transparent 62%),
    #ffffff;
}

.chess-mix-online-room-catalog {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, #ffffff 86%, var(--chess-mix-polish-orange)),
      #ffffff
    );
}


/* step1616b: Play Console legal links and compact language switcher. */
.chess-mix-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chess-mix-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
  margin-top: 0.72rem;
  padding-top: 0.72rem;
  border-top: 1px solid color-mix(in srgb, var(--chess-mix-border) 22%, transparent);
  font-size: 0.78rem;
}

.chess-mix-legal-links a {
  color: color-mix(in srgb, var(--chess-mix-border) 70%, #0f172a);
  font-weight: 750;
  text-decoration: none;
}

.chess-mix-legal-links a:hover,
.chess-mix-legal-links a:focus-visible {
  text-decoration: underline;
}

.chess-mix-locale-field > .chess-mix-sr-only + .chess-mix-locale-select-wrap {
  margin-left: 0;
}

/* step1616d4d: room catalog appears as a centered, wide modal and stays compact on phones. */
.chess-mix-online-room-catalog-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgb(17 24 39 / 46%);
  backdrop-filter: blur(2px);
}

.chess-mix-online-room-catalog-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: default;
}

.chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 2.5rem));
  max-height: min(76vh, 720px);
  overflow: auto;
  margin: 0;
  border-radius: 22px;
}

@media (min-width: 761px) {
  .chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog-list {
    gap: 0.65rem;
  }

  .chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog-item {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog-main {
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
  }

  .chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog-main > * {
    flex: 0 0 auto;
  }
}

@media (max-width: 760px) {
  .chess-mix-online-room-catalog-modal {
    align-items: flex-start;
    padding: max(0.4rem, env(safe-area-inset-top)) 0.4rem max(0.4rem, env(safe-area-inset-bottom));
  }

  .chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog {
    width: calc(100vw - 0.8rem);
    max-height: calc(100dvh - 0.8rem);
    border-radius: 16px;
    padding: 0.7rem;
  }

  .chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog-header {
    gap: 0.5rem;
  }

  .chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog-header h3 {
    font-size: 0.96rem;
  }

  .chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog-item {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    padding: 0.6rem;
  }

  .chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.22rem;
    white-space: normal;
    font-size: 0.82rem;
  }

  .chess-mix-online-room-catalog-modal .chess-mix-online-room-catalog-main strong {
    font-size: 0.92rem;
  }
}
