.imsc-game {
  --game-ink: #161616;
  --game-gold: #c9a227;
  --game-ivory: #f8f5ee;
  color: var(--game-ink);
  background: #fff;
  border: 1px solid #e8e1d2;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(17, 17, 17, .06);
  width: min(100%, 920px);
  margin: 28px auto;
  overflow: hidden;
  font-family: Inter, Arial, sans-serif;
}
.imsc-game * { box-sizing: border-box; }
.imsc-game__header { background: var(--game-ink); color: #fff; padding: 16px 20px; }
.imsc-game__brand { color: var(--game-gold); font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.imsc-game__title { font: 700 clamp(19px, 2vw, 25px)/1.25 Georgia, serif; margin: 5px 0 3px; }
.imsc-game__context { color: #d9d0bb; font-size: 12px; }
.imsc-game__layout { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 20px; padding: 20px; }
.imsc-game__board-wrap { min-width: 0; }
.imsc-game__board-frame.has-eval { display: grid; grid-template-columns: minmax(0, 1fr) 16px; align-items: stretch; gap: 6px; }
.imsc-game__evalbar { position: relative; min-height: 0; overflow: hidden; background: #242424; border: 1px solid #242424; border-radius: 5px; }
.imsc-game__evalbar-white { position: absolute; inset: auto 0 0; height: 50%; background: #f5f2e9; transition: height .15s ease; }
.imsc-game__player { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; padding: 7px 2px; }
.imsc-game__player strong { overflow-wrap: anywhere; }
.imsc-game__player span { color: #625d52; font-size: 12px; white-space: nowrap; }
.imsc-game__board { display: grid; width: 100%; aspect-ratio: 1 / 1; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); border: 3px solid var(--game-ink); overflow: hidden; }
.imsc-game__square { position: relative; display: grid; place-items: center; width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; }
.imsc-game__square.is-light { background: #f4ebd9; }
.imsc-game__square.is-dark { background: #837557; }
.imsc-game__square.is-last { box-shadow: inset 0 0 0 999px rgba(201, 162, 39, .43); }
.imsc-game__square.is-focus { outline: 3px solid #fff; outline-offset: -4px; }
.imsc-game__piece { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; pointer-events: none; }
.imsc-game__coord { position: absolute; bottom: 2px; right: 3px; color: #161616; font-size: clamp(8px, 1.4vw, 11px); font-weight: 800; line-height: 1; opacity: .7; }
.imsc-game__square.is-dark .imsc-game__coord { color: #fff; }
.imsc-game__side { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.imsc-game__eval-summary { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 4px 0 8px; border-bottom: 1px solid #e8e1d2; }
.imsc-game__eval-summary span { color: #625d52; font-size: 11px; line-height: 1.3; }
.imsc-game__eval-summary strong { color: #171717; font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.imsc-game__position { background: var(--game-ivory); border-left: 4px solid var(--game-gold); border-radius: 0 8px 8px 0; padding: 13px; }
.imsc-game__position small { display: block; color: #625d52; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.imsc-game__position strong { display: block; font-size: 19px; margin: 3px 0; }
.imsc-game__position p { color: #514a3e; font-size: 13px; line-height: 1.45; margin: 5px 0 0; }
.imsc-game__moves { position: relative; overflow-y: auto; max-height: 304px; padding-right: 4px; border: 1px solid #ece6d9; border-radius: 6px; }
.imsc-game__move-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr); min-height: 35px; }
.imsc-game__move-row:nth-child(even) { background: #faf8f3; }
.imsc-game__move-number { display: grid; place-items: center; color: #8a8272; font-size: 12px; font-variant-numeric: tabular-nums; background: rgba(232, 225, 210, .4); }
.imsc-game__move { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; width: 100%; min-width: 0; min-height: 35px; padding: 6px 8px; border: 0; border-radius: 0; background: transparent; color: #2e2a24; text-align: left; cursor: pointer; font: inherit; font-size: 14px; }
.imsc-game__move-san { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imsc-game__move-score { color: #898173; font-size: 11px; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.imsc-game__move:hover, .imsc-game__move:focus-visible { background: #eee7d9; }
.imsc-game__move[aria-current="step"] { background: var(--game-gold); color: #111; font-weight: 900; }
.imsc-game__move[aria-current="step"] .imsc-game__move-score { color: #29251c; }
.imsc-game__move-empty { min-height: 35px; }
.imsc-game__controls { display: flex; gap: 6px; flex-wrap: wrap; }
.imsc-game__controls button { min-width: 40px; min-height: 42px; border: 1px solid #d8cfbd; border-radius: 8px; background: #fff; color: #161616; cursor: pointer; font: inherit; font-weight: 800; }
.imsc-game__controls button:hover:not(:disabled), .imsc-game__controls button:focus-visible { border-color: var(--game-gold); background: #f8f0d7; }
.imsc-game__controls button:disabled { cursor: default; opacity: .4; }
.imsc-game__controls .imsc-game__flip { margin-left: auto; padding: 0 10px; }
.imsc-game__source { margin-top: auto; font-size: 12px; line-height: 1.5; }
.imsc-game__source a { color: #765b04; text-decoration: underline; text-underline-offset: 2px; }
.imsc-game__error { padding: 18px; color: #5c301f; }
@media (max-width: 760px) {
  .imsc-game__layout { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
  .imsc-game__board-wrap { width: min(100%, 400px); margin: auto; }
  .imsc-game__moves { max-height: 210px; }
  .imsc-game__header { padding: 14px 16px; }
}
