.demo-root {
  --demo-navy: #102c43;
  --demo-deep: #0a2033;
  --demo-gold: #f7cd68;
  --demo-cream: #fff9ed;
  width: 100%;
  max-width: 520px;
  min-width: 0;
  margin-inline: auto;
  padding: 24px;
  color: var(--demo-cream);
  background: linear-gradient(145deg, #173a53, var(--demo-deep) 70%);
  border: 1px solid #405569;
  border-radius: 24px;
  box-shadow: 0 22px 60px #102c4329, inset 0 1px 0 #ffffff12;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}
.demo-root *, .demo-root *::before, .demo-root *::after { box-sizing: border-box; }
.demo-root button, .demo-root a { -webkit-tap-highlight-color: transparent; }
.demo-root button { font: inherit; cursor: pointer; }
.demo-root button:disabled { opacity: .48; cursor: default; }
.demo-root :is(button, a, summary):focus-visible { outline: 3px solid #fff9ed; outline-offset: 4px; }
.demo-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.demo-kicker { display: block; color: #f7cd68; font-size: .65rem; font-weight: 800; letter-spacing: .12em; line-height: 1.5; }
.demo-heading h3 { margin: 3px 0 0; color: #fff9ed; font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 800; line-height: 1.2; letter-spacing: -.025em; }
.demo-difficulty { padding: 6px 9px; border: 1px solid #617486; border-radius: 7px; color: #f9e6b8; font-size: .75rem; font-weight: 700; text-align: center; }
.demo-progress { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; padding: 0; margin: 21px 0; list-style: none; }
.demo-progress li { display: grid; }
.demo-progress button { display: grid; place-items: center; height: 25px; border: 1px solid #53697b; border-radius: 5px; background: #102a3e; color: #d0dce5; font-size: .7rem; font-weight: 700; font-family: inherit; cursor: pointer; }
.demo-progress button:hover, .demo-progress button:focus-visible { border-color: #f7cd68; outline: none; }
.demo-progress li.is-current button { color: #172b3d; background: #f7cd68; border-color: #f7cd68; box-shadow: 0 0 0 3px #f7cd681c; }
.demo-progress li.is-done button { color: #0b3024; background: #a6dcc1; border-color: #a6dcc1; }
.demo-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border: 1px solid #566879; border-radius: 12px; background: #091e2e; }
.demo-mode { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 7px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #d9e4ed; font-size: .85rem !important; font-weight: 700 !important; }
.demo-mode span { font-size: 1.4rem; line-height: 1; }
.demo-mode[aria-pressed="true"] { color: #14293c; background: #f7cd68; box-shadow: 0 2px 5px #0003; }
.demo-mode.demo-classic { grid-column: 1 / -1; min-height: 36px; font-size: .72rem !important; padding-block: 5px; }
.demo-mode-help { min-height: 2.9em; margin: 10px 2px 13px; color: #d6e1e9; font-size: .77rem; line-height: 1.45; }
/* The board is drawn by the game's own stylesheet (shared/puzzleBoard.css: .board-wrap, .board,
   .cell, .xmark, .target). Only demo additions live here. */
.demo-board-frame { position: relative; width: 100%; isolation: isolate; }
.demo-row { display: contents; } /* rows keep grid semantics for keyboards and screen readers */
.demo-board .cell:focus-visible { z-index: 2; outline: 3px solid #0a2033; outline-offset: -3px; }
.demo-zone-label { position: absolute; top: 2px; left: 2px; z-index: 1; display: grid; place-items: center; min-width: 12px; height: 12px; padding: 0 2px; border-radius: 2px; color: #102c43; background: #fff9ed; font-size: 9px; font-weight: 800; line-height: 1; pointer-events: none; }
.demo-labels-hidden .demo-zone-label { visibility: hidden; }
.demo-underboard { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; color: #e0e8ed; font-size: .75rem; }
.demo-label-toggle { min-height: 40px; border: 0; padding: 3px 0 3px 6px; color: #f7cd68; background: transparent; text-decoration: underline; text-underline-offset: 3px; font-size: .75rem !important; }
.demo-status { display: flex; align-items: center; min-height: 78px; margin: 2px 0 12px; padding: 12px 14px; color: #ebf0f5; background: #ffffff09; border: 1px solid #ffffff1c; border-radius: 9px; font-size: .84rem; line-height: 1.45; }
.demo-status.is-success { color: #d5f4df; border-color: #729b83; background: #22604033; }
.demo-status.is-correction { color: #ffedcc; border-color: #b19059; }
.demo-actions { display: grid; grid-template-columns: .7fr 1fr 1.3fr; gap: 7px; }
.demo-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 12px; border: 1px solid #71808a; border-radius: 9px; color: #fff9ed; background: #1b3a51; font-size: .8rem !important; font-weight: 750 !important; text-align: center; text-decoration: none; line-height: 1.25; }
.demo-primary { background: #f7cd68; color: #132c40; border-color: #f7cd68; }
.demo-button:hover:not(:disabled) { filter: brightness(1.1); }
.demo-rules { margin-top: 20px; padding-top: 16px; border-top: 1px solid #ffffff20; }
.demo-rules p { margin: 0; color: #d3e0e9; font-size: .82rem; line-height: 1.65; }
.demo-rules strong { color: #fff9ed; font-weight: 700; }
.demo-keyboard { margin-top: 12px; color: #cad9e5; font-size: .75rem; line-height: 1.65; }
.demo-keyboard summary { padding-block: 6px; cursor: pointer; color: #f7cd68; }
.demo-keyboard p { margin: 8px 0; }
.demo-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 3px 12px; margin-top: 13px; padding-top: 9px; border-top: 1px solid #ffffff20; color: #bfccd7; font-size: .67rem; }
.demo-footer button { min-height: 36px; padding: 4px 0; border: 0; color: #f7cd68; background: transparent; text-decoration: underline; text-underline-offset: 3px; font-size: .73rem; }
.demo-finale { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 11px; padding: 22px; overflow: auto; overscroll-behavior: contain; border: 2px solid #f7cd68; border-radius: 9px; color: #fff9ed; background: radial-gradient(ellipse at top, #34515a, #102c43 70%); text-align: center; }
.demo-finale > * { flex-shrink: 0; }
.demo-finale[hidden] { display: none; }
.demo-trophy { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; color: #1a3347; background: #f7cd68; font-size: 29px; box-shadow: 0 0 0 7px #f7cd6815; }
.demo-finale h3 { max-width: 16em; margin: 0; color: #fff9ed; font-size: clamp(1.2rem, 3vw, 1.8rem); line-height: 1.22; }
.demo-finale p { max-width: 25em; margin: 0; color: #d6e2e8; font-size: .85rem; line-height: 1.5; }
.demo-finale-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.demo-loading, .demo-load-error { padding: 30px 12px; text-align: center; }
.demo-load-error h3 { color: #fff9ed; }
@keyframes demo-pop { from { transform: scale(.7); opacity: .5; } to { transform: scale(1); opacity: 1; } }
@media (max-width: 600px) {
  .demo-root { padding: 16px; border-radius: 18px; }
  .demo-progress { margin-block: 16px; }
}
@media (max-width: 374px) {
  .demo-root { padding: 10px; border-radius: 14px; }
  .demo-kicker { font-size: .58rem; letter-spacing: .08em; }
  .demo-heading h3 { font-size: 1.3rem; }
  .demo-difficulty { padding: 5px 6px; font-size: .66rem; }
  .demo-progress { gap: 3px; }
  .demo-mode { gap: 4px; font-size: .78rem !important; }
  .demo-status { min-height: 88px; padding: 10px; font-size: .8rem; }
  .demo-button { padding-inline: 6px; font-size: .73rem !important; }
  .demo-finale { gap: 8px; padding: 12px; }
  .demo-finale p { font-size: .74rem; }
  .demo-trophy { width: 34px; height: 34px; font-size: 22px; }
  .demo-zone-label { top: 1px; left: 1px; min-width: 10px; height: 10px; font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) { .demo-root *, .demo-root *::before, .demo-root *::after { animation: none !important; transition: none !important; } }
