/* Estilos compartilhados da aplicação: tabuleiros, controles e estados visuais. */
/* Interface original produzida com IA. Sem fontes, imagens ou bibliotecas externas. */
:root {
  --paper:#f6f4ef;
  --ink:#25372e;
  --muted:#647269;
  --line:#dedfd6;
  --green:#486c4d;
  --lime:#dce9bb;
  --orange:#c76b42;
  --purple:#8475b6;
  --white:#fffefa;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--font-ui);
}
button,input,select {
  font: inherit;
}
button,a,input,select,summary {
  -webkit-tap-highlight-color: transparent;
}
button,select,summary {
  cursor: pointer;
}
button {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: 10px;
  min-height: 44px;
  padding: 9px 14px;
  font-size: .88rem;
  font-weight: 600;
}
button:hover {
  border-color: var(--green);
}
button:disabled {
  opacity: .45;
  cursor: default;
}
a {
  color: inherit;
}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 4px;
}
header,main,footer {
  max-width: 1280px;
  margin: auto;
}
header {
  padding: 30px 40px;
  display: flex;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -1.5px;
  text-decoration: none;
}
.brand-icon {
  display: inline-block;
  transform: rotate(-35deg);
  margin-right: 8px;
  color: var(--green);
}
.brand-dot {
  color: var(--orange);
}
.tag,.eyebrow {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.8px;
}
.tag {
  color: var(--muted);
  padding-top: 6px;
}
.doc-link {
  margin-left: auto;
  text-decoration: none;
  font-size: 12px;
  color: var(--muted);
}
main {
  padding: 0 40px;
}
.intro {
  padding: 53px 0 34px;
}
.eyebrow {
  color: var(--green);
  margin: 0 0 14px;
}
h1 {
  font-size: clamp(38px,4.5vw,62px);
  font-weight: 450;
  line-height: 1.08;
  letter-spacing: -2.4px;
  margin: 0 0 20px;
}
h1 em {
  font-family:var(--font-title);
  font-weight: 400;
  color: var(--green);
}
.intro>p:last-child {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
}
.games {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 14px;
  margin-bottom: 32px;
}
.games button {
  padding: 18px 20px;
  text-align: left;
  font-size: 16px;
  border-radius: 13px;
  background: transparent;
}
.games button[aria-pressed=true] {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.games button>span {
  font-size: 10px;
  opacity: .65;
  margin-right: 13px;
}
.games small {
  font-size: 11px;
  display: block;
  margin-left: 30px;
  font-weight: 400;
  opacity: .65;
}
.lab {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 19px;
  overflow: hidden;
}
.lab-heading {
  padding: 26px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid var(--line);
}
.lab-heading .eyebrow {
  font-size: 9px;
  margin-bottom: 6px;
}
h2 {
  font-weight: 500;
  font-size: 21px;
  letter-spacing: -.6px;
  margin: 0;
}
.modes {
  display: flex;
  padding: 4px;
  background: #eeeee7;
  border-radius: 10px;
  gap: 3px;
  flex-shrink: 0;
}
.modes button {
  border: 0;
  background: none;
  min-height: 36px;
  font-size: 11px;
  padding: 7px 12px;
}
.modes button[aria-pressed=true] {
  background: var(--white);
  box-shadow: 0 1px 4px #0001;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0,1fr) 290px;
}
.experiment {
  min-width: 0;
  background: #f8f9f3;
}
.stage-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 23px;
  font-size: 11px;
  color: var(--muted);
}
.quiet {
  border: 0;
  background: none;
  min-height: 44px;
  font-size: 11px;
  padding: 6px;
}
.stage-top button {
  min-height: 32px;
}
svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  user-select: none;
}
svg text {
  font-family:var(--font-ui);
  fill: var(--ink);
}
svg .handle {
  cursor: grab;
}
svg .handle:focus {
  outline: none;
  stroke: var(--orange);
  stroke-width: 4;
}
svg .selected {
  stroke: var(--orange);
  stroke-width: 3;
}
.readout {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  min-height: 98px;
  border-top: 1px solid var(--line);
  padding: 18px 24px;
}
.metric-label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}
.readout strong {
  font-size: 23px;
  font-weight: 500;
  white-space: nowrap;
}
.readout p {
  font-size: 12px;
  max-width: 240px;
  color: var(--muted);
  margin: 0;
  text-align: right;
}
.readout p.success {
  color: var(--green);
  font-weight: 700;
}
.controls {
  padding: 24px;
  border-left: 1px solid var(--line);
  font-size: 12px;
}
.controls label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 6px;
}
.controls select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
  color: var(--ink);
  min-height: 44px;
  font-size: 12px;
}
.controls #mission {
  min-height: 52px;
  margin: 16px 0 22px;
  color: var(--muted);
}
.field {
  margin: 16px 0;
}
.field header {
  padding: 0;
  border: 0;
  font-size: 11px;
  justify-content: space-between;
  gap: 8px;
}
.field output {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.field input[type=range] {
  width: 100%;
  accent-color: var(--green);
  min-height: 36px;
  margin: 0;
}
.inline-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.inline-buttons button {
  flex: 1;
  font-size: 11px;
  padding: 7px;
  white-space: nowrap;
}
.actions {
  margin-top: 20px;
  display: flex;
  gap: 5px;
  justify-content: space-between;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
  font-size: 11px;
}
.hint {
  font-size: 11px;
  color: var(--green);
  border-left: 2px solid var(--lime);
  padding-left: 10px;
  min-height: 16px;
}
.explanation {
  padding: 16px 26px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.explanation summary {
  min-height: 30px;
  padding: 6px 0;
  font-weight: 600;
}
.explanation div {
  color: var(--muted);
  max-width: 880px;
  line-height: 1.8;
}
.note {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  margin: 30px 0;
  color: var(--muted);
  font-size: 12px;
}
.note>span {
  color: var(--orange);
  font-size: 32px;
}
.note strong {
  font-weight: 500;
  color: var(--ink);
}
footer {
  padding: 25px 40px 35px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
footer>span {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -1px;
}
footer small {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0;
  margin-left: 10px;
}
footer p {
  font-size: 10px;
  color: var(--muted);
  text-align: right;
}
.skip {
  position: absolute;
  left: 15px;
  top: -60px;
  padding: 10px;
  background: white;
  z-index: 2;
}
.skip:focus {
  top: 10px;
}
[hidden] {
  display: none!important;
}
.precision {
  display: flex;
  gap: 10px;
  align-items: center;
}
.precision input[type=range] {
  min-width: 0;
  flex: 1;
}
.precision input[type=number] {
  width: 68px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  padding: 7px;
  font-size: 12px;
  color: var(--ink);
}
@media(max-width:760px) {
  header {
    padding: 20px;
  }
  .tag {
    display: none;
  }
  main {
    padding: 0 16px;
  }
  .intro {
    padding: 34px 5px 22px;
  }
  h1 {
    letter-spacing: -1.5px;
  }
  .intro>p:last-child {
    font-size: 12px;
  }
  .games {
    gap: 7px;
    margin-bottom: 20px;
  }
  .games button {
    font-size: 12px;
    padding: 12px 10px;
  }
  .games button>span {
    display: block;
    margin-bottom: 5px;
  }
  .games small {
    font-size: 9px;
    margin: 4px 0 0;
  }
  .lab-heading {
    padding: 19px;
    display: block;
  }
  h2 {
    font-size: 19px;
  }
  .modes {
    display: inline-flex;
    margin-top: 16px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .controls {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 20px;
  }
  .controls #mission {
    min-height: 0;
    margin: 12px 0;
  }
  .stage-top {
    padding: 12px 16px;
  }
  .readout {
    padding: 14px 16px;
    gap: 12px;
  }
  .readout strong {
    font-size: 21px;
  }
  .readout p {
    font-size: 11px;
  }
  .field {
    margin: 12px 0;
  }
  .field input[type=range] {
    min-height: 44px;
  }
  .explanation {
    padding: 15px 20px;
  }
  .note {
    padding: 0 8px;
    font-size: 11px;
  }
  footer {
    padding: 22px;
    display: block;
  }
  footer p {
    text-align: left;
    margin-top: 14px;
  }
  .desktop {
    display: none;
  }
}
@media(prefers-reduced-motion:no-preference) {
  button {
    transition: background .15s,border-color .15s;
  }
  .lab {
    animation: appear .25s ease-out;
  }
  @keyframes appear {
    from {
      opacity: .6;
    }
    to {
      opacity: 1;
    }
  }
}
.confirm {
  width: 100%;
  min-height: 48px;
  margin: 18px 0 12px;
}
.mirror-glass {
  stroke: #dbeef1;
  stroke-width: 3;
  stroke-linecap: butt;
}
.mirror-frame {
  stroke: #687e88;
  stroke-width: 6;
  stroke-linecap: butt;
}
[data-rotate] {
  cursor: grab;
}
#scene[aria-busy="true"] {
  outline: 2px solid #e4a845;
}
[hidden] {
  display: none!important;
}
.level-screen {
  padding: 28px;
  background: #fffefa;
  border: 1px solid #dfdfd5;
  border-radius: 24px;
  margin-bottom: 30px;
}
.level-screen h2 {
  font-size: clamp(26px,4vw,40px);
}
.level-group {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(90px,1fr));
  gap: 14px;
  margin: 18px 0 30px;
}
.level-tile {
  aspect-ratio: 1;
  border-radius: 28%;
  background: #f1f0e8;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  gap: 5px;
  font-size: 24px;
  color: #25372e;
}
.level-tile small {
  font-size: 11px;
}
.level-tile[aria-current="true"] {
  border-color: #c76b42;
}
.level-tile.done {
  background: #dce9cb;
}
.level-tile:focus-visible {
  outline: 3px solid #c76b42;
  outline-offset: 3px;
}
#back-selection {
  margin: 18px 24px 0;
}
#level,label[for="level"] {
  display: none;
}
.stage-heading {
  font-size: 17px;
  margin: 26px 0 8px;
}
@media(max-width:600px) {
  .level-screen {
    padding: 18px;
  }
  .level-group {
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 10px;
  }
  .level-tile {
    min-height: 58px;
    font-size: 21px;
  }
}
.block-list {
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.6;
  margin: 12px 0;
}
.block-list li {
  padding: 5px 0;
  border-bottom: 1px solid #e5e8df;
}
/* Resultado não modal: só o reinício explícito recebe cliques. */
.result-motion {
  min-height: var(--result-reserved-height,86px);
  padding: 0 24px;
  pointer-events: none;
  user-select: none;
}
.result-retry-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  padding: 10px 0;
  box-sizing: border-box;
}
.result-motion .result-retry,:is(#cerco) .result-retry {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  border: 1px solid #304b37;
  border-radius: 50%;
  background: #405e49;
  color: #fffefa;
  box-shadow: 0 3px 0 #263f2e26;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.result-motion .result-retry:hover,:is(#cerco) .result-retry:hover {
  background: #304b37;
  box-shadow: 0 4px 8px #263f2e26;
}
.result-motion .result-retry:active,:is(#cerco) .result-retry:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #263f2e26;
}
.result-motion .result-retry:focus-visible,:is(#cerco) .result-retry:focus-visible {
  outline: 3px solid #b17c45;
  outline-offset: 4px;
}
.result-motion .result-retry:disabled,:is(#cerco) .result-retry:disabled {
  opacity: .65;
  cursor: default;
}
.result-motion .result-retry svg,:is(#cerco) .result-retry svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.board-navigation:has(.result-motion[data-retry="true"]),#collection .board-navigation:has(#c-motion[data-retry="true"]),:is(#sintonia,#repasse,#orbita) .board-navigation:has(.result-motion[data-retry="true"]) {
  --result-reserved-height:76px;
}
.result-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 80px;
  color: var(--green);
}
.result-badge>svg {
  width: 76px;
  height: 68px;
  flex: 0 0 76px;
  overflow: visible;
}
.result-badge strong {
  display: block;
  font-size: 15px;
  line-height: 1.4;
}
.result-badge span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.result-badge svg path,.result-badge svg rect,.result-badge svg circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.result-badge .fx-base {
  fill: #dce9bb;
  stroke: none;
}
.result-badge .fx-piece {
  fill: #e3dced;
  stroke: #8475b6;
}
.result-badge .fx-cut {
  stroke-dasharray: 3 4;
}
.result-badge .fx-wall {
  stroke-width: 5;
}
.result-badge .fx-mirror {
  stroke: #839aa2;
  stroke-width: 4;
}
@media(prefers-reduced-motion:no-preference) {
  .result-badge {
    animation: result-enter .32s ease-out both;
  }
  .result-light .fx-ray {
    stroke-dasharray: 110;
    animation: ray-result 1.1s ease-out both;
  }
  .result-win.result-light .fx-target {
    transform-origin: 64px 17px;
    animation: target-result 1.1s ease-out both;
  }
  .result-win.result-cut .fx-piece-a {
    animation: piece-left 1.1s ease-in-out both;
  }
  .result-win.result-cut .fx-piece-b {
    animation: piece-right 1.1s ease-in-out both;
  }
  @keyframes result-enter {
    from {
      opacity: 0;
      transform: translateY(5px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
  @keyframes ray-result {
    from {
      stroke-dashoffset: 110;
    }
    to {
      stroke-dashoffset: 0;
    }
  }
  @keyframes target-result {
    0%,100% {
      transform: scale(1);
    }
    55% {
      transform: scale(1.2);
    }
  }
  @keyframes piece-left {
    0%,100% {
      transform: translateX(0);
    }
    50% {
      transform: translateX(-5px);
    }
  }
  @keyframes piece-right {
    0%,100% {
      transform: translateX(0);
    }
    50% {
      transform: translateX(5px);
    }
  }
}
@media(max-width:600px) {
  .result-motion {
    padding: 0 16px;
  }
  .result-badge {
    gap: 8px;
  }
  .result-badge span {
    font-size: 11px;
  }
}
/* Erro rápido: palco apenas, sem cobrir ou bloquear os controles. */
.experiment {
  position: relative;
}
.experiment.result-failure {
  box-shadow: inset 0 0 0 2px #c74646,inset 0 0 18px #c7464633;
}
.sr-only {
  position: absolute!important;
  width: 1px!important;
  height: 1px!important;
  padding: 0!important;
  margin: -1px!important;
  overflow: hidden!important;
  clip: rect(0,0,0,0)!important;
  white-space: nowrap!important;
  border: 0!important;
}
@media(prefers-reduced-motion:no-preference) {
  .experiment.result-failure {
    animation: failure-shake .3s ease-out;
  }
  .experiment.result-failure #scene {
    animation: failure-blur .3s ease-out;
  }
  @keyframes failure-shake {
    0%,100% {
      transform: translateX(0);
    }
    20% {
      transform: translateX(-2px);
    }
    40% {
      transform: translateX(2px);
    }
    60% {
      transform: translateX(-1px);
    }
    80% {
      transform: translateX(1px);
    }
  }
  @keyframes failure-blur {
    0%,100% {
      filter: blur(0);
    }
    35% {
      filter: blur(1px);
    }
  }
}
/* Alças do corte: forma + ícone + nome, sem depender exclusivamente da cor. */
.cut-grip-hit {
  fill: #fff;
  opacity: 0;
  stroke: none;
  pointer-events: all;
}
.cut-grip-face {
  fill: #fffefa;
  stroke: #8c819e;
  stroke-width: 1.6;
  filter: drop-shadow(0 2px 3px #30244222);
  pointer-events: none;
}
.cut-grip-rotate .cut-grip-face {
  fill: #f5d28e;
  stroke: #b89450;
}
.cut-grip-icon {
  fill: none;
  stroke: #584976;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.cut-grip-rotate .cut-grip-icon {
  stroke: #684c22;
}
.cut-grip-tip {
  opacity: 0;
  pointer-events: none;
  stroke: none;
}
.cut-grip-tip rect {
  fill: #fffefa;
  stroke: #d7d0df;
  stroke-width: 1;
}
.cut-grip-tip text {
  fill: #584976;
  font-size: 11px;
  font-weight: 600;
}
.cut-grip:hover .cut-grip-face,.cut-grip:focus .cut-grip-face {
  stroke: #584976;
  stroke-width: 2.6;
}
.cut-grip:hover .cut-grip-tip,.cut-grip:focus .cut-grip-tip {
  opacity: 1;
}
svg .cut-grip:focus {
  outline: none;
  stroke: none;
}
.cut-grip:active {
  cursor: grabbing;
}
.cut-control-guide {
  padding: 13px;
  background: #f6f3f8;
  border: 1px solid #e6e0ec;
  border-radius: 12px;
  margin-bottom: 18px;
}
.cut-control-guide>strong {
  font-size: 11px;
  color: #584976;
}
.cut-guide-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.cut-guide-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #b6a9c5;
  border-radius: 50%;
  background: #fffefa;
  color: #584976;
  font-size: 19px;
  line-height: 1;
}
.cut-guide-move {
  border-radius: 8px;
}
.cut-guide-rotate {
  background: #f5d28e;
  color: #684c22;
  border-color: #c3a367;
}
.cut-guide-row b {
  display: block;
  font-size: 11px;
  font-weight: 650;
  color: #584976;
}
.cut-guide-row small {
  display: block;
  font-size: 10px;
  line-height: 1.5;
  color: #647269;
  margin-top: 2px;
}
.cut-control-guide p {
  font-size: 10px;
  color: #647269;
  line-height: 1.6;
  margin: 13px 0 0;
}
/* Portais: rotação contínua sincronizada mesmo quando o SVG é redesenhado. */
.portal {
  pointer-events: none;
}
.portal-label {
  font-size: 8px;
  letter-spacing: .5px;
  fill: #526274;
  font-weight: 650;
}
.portal-spin {
  transform-origin: 0 0;
  animation: portal-orbit 12s linear infinite;
}
@keyframes portal-orbit {
  to {
    transform: rotate(360deg);
  }
}
.light-collision {
  pointer-events: none;
}
.collision-ring {
  fill: #ef9baa;
  fill-opacity: .15;
  stroke: #ac4054;
  stroke-width: 1.5;
  animation: collision-pop .45s ease-out both;
  transform-origin: 0 0;
}
@keyframes collision-pop {
  0% {
    transform: scale(.3);
    opacity: 1;
  }
  100% {
    transform: scale(1.8);
    opacity: .25;
  }
}
.light-note {
  padding: 12px 14px;
  border: 1px solid #d4dce7;
  border-radius: 12px;
  background: #f2f5f9;
  font-size: 12px;
  line-height: 1.55;
  color: #40536b;
  margin: 12px 0;
}
.light-note strong {
  display: block;
  margin-bottom: 4px;
}
@media(prefers-reduced-motion:reduce) {
  .portal-spin,.collision-ring {
    animation: none;
  }
  .collision-ring {
    opacity: .5;
  }
}
/* Vitória: preserva os desenhos de canto e adiciona celebração leve no palco. */
.experiment.result-success {
  box-shadow: inset 0 0 0 3px #5b9565,inset 0 0 20px #5b956529;
}
.victory-celebration {
  display: none;
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 44%;
  transform: translate(-50%,-50%);
  width: min(88%,500px);
  pointer-events: none;
  user-select: none;
}
.result-success .victory-celebration {
  display: block;
}
.victory-celebration svg {
  overflow: visible;
  filter: drop-shadow(0 2px 8px #fffefa);
}
.victory-word text {
  text-anchor: middle;
  fill: #386b45;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0;
  paint-order: stroke;
  stroke: #fffefa;
  stroke-width: 5px;
  stroke-linejoin: round;
}
.victory-sparkle {
  fill: #b39439;
  stroke: none;
  transform-box: fill-box;
  transform-origin: center;
}
@media(prefers-reduced-motion:no-preference) {
  .experiment.result-success #scene {
    transform-origin: center;
    animation: victory-zoom 1.1s ease-in-out;
  }
  .result-success .victory-celebration {
    animation: victory-arrive 1.1s ease-out both;
  }
  .result-success .victory-sparkle {
    animation: victory-spark 850ms ease-in-out both;
    animation-delay: var(--spark-delay);
  }
  @keyframes victory-zoom {
    0%,100% {
      transform: scale(1);
    }
    38%,62% {
      transform: scale(1.018);
    }
  }
  @keyframes victory-arrive {
    0% {
      opacity: 0;
      transform: translate(-50%,-48%) scale(.96);
    }
    20%,80% {
      opacity: 1;
      transform: translate(-50%,-50%) scale(1);
    }
    100% {
      opacity: 0;
      transform: translate(-50%,-50%) scale(1);
    }
  }
  @keyframes victory-spark {
    0% {
      opacity: 0;
      transform: scale(.65);
    }
    35%,70% {
      opacity: 1;
      transform: scale(1);
    }
    100% {
      opacity: 0;
      transform: scale(.8);
    }
  }
}
/* Paredes sólidas e portais luminosos, sem preenchimento escuro pesado. */
.light-wall-body {
  fill: #87938b;
  stroke: #64736b;
  stroke-width: 1;
  stroke-linejoin: round;
}
.light-wall-inset {
  stroke: #c5cec5;
  stroke-width: 1;
  stroke-opacity: .65;
  stroke-linecap: butt;
  pointer-events: none;
}
.portal-halo,.portal-rim,.portal-window {
  pointer-events: none;
}
/* O nível permanece utilizável com os ajustes precisos recolhidos. */
.workspace.controls-hidden {
  grid-template-columns: minmax(0,1fr);
}
.stage-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.panel-toggle {
  background: #fffefa;
  border: 1px solid #d9dfd7;
  border-radius: 8px;
  color: #52645a;
  font-size: 11px;
  padding: 7px 10px;
  min-height: 36px!important;
}
.controls-title {
  font-size: 13px;
  font-weight: 650;
  margin: 0 0 20px;
  color: #43584b;
}
.level-brief {
  padding: 0 24px 12px;
}
.level-brief #mission {
  font-size: 12px;
  line-height: 1.65;
  color: #596a60;
  margin: 0;
  max-width: 850px;
}
.level-actions {
  padding: 16px 24px 8px;
  border-top: 1px solid #e0e4db;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.level-actions .confirm {
  width: auto;
  margin: 0;
  min-width: 170px;
}
.level-actions .actions {
  margin: 0 0 0 auto;
  gap: 12px;
}
.level-actions .hint {
  flex-basis: 100%;
  margin: 0;
}
.level-actions .hint:empty {
  display: none;
}
.level-notes {
  padding: 0 24px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,240px),1fr));
  gap: 10px;
}
.level-notes .light-note {
  margin: 8px 0 0;
  background: #f7f9f6;
  border-color: #dce3db;
  color: #50645a;
}
.level-notes .cut-control-guide {
  margin: 8px 0 0;
}
.level-notes .cut-control-guide>strong {
  font-size: 12px;
}
@media(max-width:760px) {
  .stage-top {
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
  }
  .stage-tools {
    flex-wrap: wrap;
    gap: 8px;
  }
  .level-brief {
    padding: 0 16px 12px;
  }
  .level-actions {
    padding: 14px 16px 8px;
  }
  .level-actions .confirm {
    flex: 1;
  }
  .level-actions .actions {
    margin-left: 0;
    flex: 1;
    justify-content: flex-end;
  }
  .level-notes {
    padding: 0 16px 16px;
  }
  .controls-title {
    margin-bottom: 12px;
  }
}
.level-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.level-picker label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.level-picker select {
  max-width: 100%;
  min-width: 0;
  min-height: 40px;
  flex: 1;
  border: 1px solid #d9dfd7;
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 12px;
}
/* Celebração centrada no SVG, independente da altura das notas. */
.scene-wrap {
  position: relative;
}
.scene-wrap .victory-celebration {
  top: calc(50% - 43px);
}
/* Coleção lógica: mesma linguagem visual, grades legíveis e controles de toque. */
.games {
  grid-template-columns: repeat(3,minmax(0,1fr));
}
.collection-lab {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
}
.collection-lab>#c-back {
  margin: 12px 24px 0;
}
.collection-workspace {
  display: grid;
  grid-template-columns: minmax(0,1fr) 300px;
}
.collection-workspace.closed {
  grid-template-columns: minmax(0,1fr);
}
.collection-surface {
  padding-bottom: 20px;
  position: relative;
}
.collection-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 14px 24px;
}
.collection-toolbar button[aria-pressed=true] {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.collection-toolbar button[data-value] {
  min-width: 60px;
}
.collection-toolbar select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 8px;
}
.collection-toolbar label {
  font-size: 12px;
}
.collection-small,.collection-notes {
  font-size: 12px;
  color: var(--muted);
  max-width: 820px;
}
.collection-notes {
  padding: 10px 14px;
  background: #eff0e7;
  border-radius: 10px;
  margin-top: 12px;
}
.file-button {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 44px;
  cursor: pointer;
}
.file-button input {
  max-width: 180px;
  margin-left: 8px;
  font-size: 11px;
}
.collection-board-wrap {
  position: relative;
  max-width: 680px;
  margin: 24px auto 0;
  padding: 0 24px;
}
.collection-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols),minmax(0,1fr));
  width: 100%;
  aspect-ratio: var(--cols)/var(--rows);
  border-radius: 12px;
  overflow: visible;
  background: var(--line);
  border: 1px solid #79887b;
  touch-action: pan-y;
}
.grid-cell {
  position: relative;
  aspect-ratio: 1;
  min-height: 0;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  border: 1px solid #bac4b7;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: var(--ink);
  z-index: 1;
  user-select: none;
}
.grid-cell:hover {
  box-shadow: inset 0 0 0 2px #486c4d66;
}
.grid-cell:focus-visible {
  z-index: 4;
  outline: 3px solid var(--orange);
  outline-offset: -4px;
}
.board-pacto .grid-cell.fixed {
  background-color: #e8ece2!important;
}
.fixed-dot {
  position: absolute;
  right: 7%;
  top: 3%;
  font-size: 16px;
  color: #566950;
}
.symbol {
  font-size: clamp(20px,4.5vw,34px);
  line-height: 1;
  display: inline-block;
}
.symbol-0 {
  color: #3c715d;
}
.symbol-1 {
  color: #b16c3d;
}
.symbol-2 {
  color: #746699;
}
.symbol-3 {
  color: #447b8e;
}
.collection-toolbar .symbol {
  font-size: 22px;
}
.collection-toolbar [aria-pressed=true] .symbol {
  color: #fff;
}
.button-label {
  font-size: 10px;
}
.pencil {
  font-size: clamp(9px,2vw,14px);
  line-height: 1.5;
  letter-spacing: 2px;
  padding: 4px;
  color: #526455;
  max-width: 90%;
  overflow-wrap: anywhere;
}
.board-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}
.elo-edge {
  stroke: #425b49;
  stroke-width: 5;
  stroke-linecap: round;
}
.pair-edge {
  stroke: #6f837055;
  stroke-width: 4;
  stroke-linecap: round;
}
.region-letter {
  position: absolute;
  left: 8%;
  top: 8%;
  font-size: 12px;
  font-weight: 500;
  opacity: .75;
}
.elo-token {
  font-size: 35px;
  position: relative;
  z-index: 3;
  color: #263f2e;
  text-shadow: 0 0 0 #fff;
}
.discarded {
  font-size: 30px;
  opacity: .4;
}
.assignment-letter {
  font-size: 26px;
  opacity: .42;
  font-weight: 500;
}
.board-prumo {
  touch-action: none;
}
.board-prumo .grid-cell {
  border-color: #5b6d5a;
}
.board-elo .grid-cell {
  border-color: #657764;
}
.grid-cell.hint-cell {
  box-shadow: inset 0 0 0 4px #ce9959;
}
.collection-feedback {
  padding: 0 24px;
  min-height: 58px;
  font-size: 13px;
}
.collection-feedback p {
  margin: 8px 0;
}
.collection-feedback #c-details {
  font-size: 11px;
  color: var(--muted);
}
.collection-lab .level-actions {
  border-top: 1px solid var(--line);
}
.collection-lab .level-actions .collection-toolbar {
  margin: 0;
}
.collection-lab .controls textarea {
  width: 100%;
  font: 11px/1.5 ui-monospace,monospace;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  background: #f7f7f1;
  color: var(--ink);
}
.collection-lab .controls button {
  margin: 7px 4px 0 0;
  font-size: 11px;
}
.duel-maps {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 14px;
  margin-top: 22px;
}
.duel-maps button {
  border-radius: 22px;
  padding: 18px;
  text-align: left;
}
.duel-maps strong,.duel-maps small {
  display: block;
}
.duel-maps small {
  font-size: 10px;
  color: var(--muted);
}
.map-preview {
  font: 23px/1.6 ui-monospace,monospace;
  display: block;
  max-width: 110px;
  margin: 10px auto;
  white-space: normal;
  word-spacing: 3px;
}
.board-desvio {
  max-width: 460px;
  margin: auto;
}
.duel-arrow {
  font-size: clamp(32px,7vw,54px);
}
.board-desvio .legal {
  background: #e5edda!important;
}
.board-desvio .unavailable.available {
  color: #aab3a6;
  background: #f2f3ee!important;
}
.board-desvio .consumed {
  color: #b3baae;
  background: #eceee7!important;
  font-size: 30px;
}
.board-desvio .preview {
  box-shadow: inset 0 0 0 4px var(--orange);
}
.collection-replay {
  margin: 10px 24px;
  font-size: 12px;
}
.collection-replay input {
  vertical-align: middle;
  width: 180px;
  min-height: 44px;
  accent-color: var(--green);
}
.collection-replay p {
  font-size: 11px;
  color: var(--muted);
}
.collection-board-wrap .victory-celebration {
  top: calc(50% - 43px);
}
@media(max-width:850px) {
  .collection-workspace {
    grid-template-columns: 1fr;
  }
  .collection-workspace>.controls {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .games {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
  .duel-maps {
    grid-template-columns: repeat(2,1fr);
  }
}
@media(max-width:560px) {
  .games {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .games button>span {
    display: inline;
  }
  .collection-board-wrap {
    padding: 0 10px;
    margin-top: 15px;
  }
  .collection-toolbar {
    margin: 12px 14px;
    gap: 6px;
  }
  .collection-toolbar button {
    padding: 7px 9px;
    font-size: 11px;
  }
  .button-label {
    display: none;
  }
  .collection-feedback {
    padding: 0 14px;
  }
  .region-letter {
    font-size: 10px;
  }
  .elo-token {
    font-size: 25px;
  }
  .fixed-dot {
    font-size: 11px;
  }
  .collection-lab .lab-heading>button {
    margin-top: 10px;
  }
  .file-button {
    display: block;
  }
  .collection-lab .level-brief {
    padding: 15px;
  }
  .collection-board {
    min-width: 0;
  }
  .duel-maps button {
    padding: 13px;
  }
}
.axis-label {
  font-size: 15px;
  fill: #708071;
  font-weight: 500;
}
.collection-board-wrap {
  padding-top: 14px;
  padding-left: 34px;
}
.collection-board .grid-cell {
  transition: box-shadow .12s;
}
.collection-board-wrap .board-overlay {
  touch-action: auto;
}
@media(prefers-reduced-motion:reduce) {
  .collection-board .grid-cell {
    transition: none;
  }
}
@media(max-width:560px) {
  .collection-board-wrap {
    padding-left: 27px;
    padding-right: 10px;
  }
}
.duel-arrow {
  display: block;
  width: 70%;
  max-width: 70px;
}
.duel-arrow svg {
  width: 100%;
  height: auto;
}
.map-preview {
  font-variant-emoji: text;
}
/* ELO: pistas explicitas e conexoes sempre acima das casas, sem capturar cliques. */
.board-elo .grid-cell.fixed-region {
  background-image: none;
}
.board-elo .grid-cell:focus-visible {
  z-index: 1;
}
.board-elo .board-overlay,.board-elo .board-overlay * {
  pointer-events: none;
}
.board-elo .elo-edge {
  stroke: #234c38;
  stroke-width: 6;
  filter: drop-shadow(0 1px 1px #fffefa);
}
.board-elo .grid-cell {
  touch-action: manipulation;
}
/* A coleção usa tabuleiro HTML: os efeitos não podem depender do SVG #scene. */
.collection-board-wrap.result-success,.collection-board-wrap.result-failure {
  border-radius: 16px;
}
.collection-board-wrap .victory-celebration {
  z-index: 10;
}
.collection-board-wrap .result-motion {
  position: static;
}
.collection-board-wrap .result-motion .victory-celebration {
  position: absolute;
  top: calc(50% - 43px);
  left: 50%;
}
@media(prefers-reduced-motion:no-preference) {
  .collection-board-wrap.result-failure .collection-board {
    animation: failure-blur .3s ease-out;
  }
  .collection-board-wrap.result-success .collection-board {
    transform-origin: center;
    animation: victory-zoom 1.1s ease-in-out;
  }
}
.level-actions .actions {
  flex-wrap: wrap;
}
.answer-key,#c-answer {
  border-color: #b8a271;
  background: #f7f0df;
  color: #594c31;
}
/* Revisão interativa: marca opcional, sem cadeados e sem alterar a cor das regiões. */
.board-options {
  display: flex;
  justify-content: flex-end;
  max-width: 680px;
  margin: 4px auto -12px;
  padding: 0 24px;
}
.board-options button {
  font-size: 12px;
  min-height: 44px;
  border: 1px solid var(--line);
}
.board-options button[aria-pressed=true] {
  color: #284e38;
  background: #e9efe3;
  border-color: #7d987a;
}
.blocked-marker {
  position: absolute;
  right: 8%;
  bottom: 8%;
  width: 9px;
  height: 9px;
  border: 1.5px solid #52664b;
  border-radius: 2px;
  opacity: .7;
  pointer-events: none;
}
.blocked-marker::after {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 7px;
  height: 1px;
  background: #52664b;
  transform: rotate(-45deg);
}
/* A hachura se sobrepõe ao fundo, não ao conteúdo; a cor sozinha não é a indicação. */
.grid-cell.cell-conflict::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(135deg,transparent 0 7px,#c5434336 7px 8px);
  box-shadow: inset 0 0 0 1px #b94242a6;
  z-index: 0;
}
.grid-cell.cell-conflict .symbol,.grid-cell.cell-conflict .pencil,.grid-cell.cell-conflict .fixed-dot {
  position: relative;
  z-index: 1;
}
.grid-cell.cell-conflict .fixed-dot {
  position: absolute;
}
.live-errors {
  color: #a33131;
  font-size: 12px;
  line-height: 1.5;
}
@media(forced-colors:active) {
  .grid-cell.cell-conflict {
    outline: 2px dashed Mark;
    outline-offset: -3px;
  }
  .blocked-marker {
    border-color: CanvasText;
  }
  .blocked-marker::after {
    background: CanvasText;
  }
}
/* Disparadores individuais: área clicável de 48 unidades; espelhos mantêm prioridade. */
.light-source {
  cursor: pointer;
  outline: none;
}
.light-source-hit {
  pointer-events: all;
}
.light-source-ring {
  pointer-events: none;
  transition: opacity .15s,stroke-width .15s;
}
.light-source:hover .light-source-ring,.light-source:focus-visible .light-source-ring {
  opacity: 1;
  stroke-width: 3;
}
.light-source:focus-visible .light-source-hit {
  stroke: #25372e;
  stroke-width: 2;
  stroke-dasharray: 3 3;
}
.light-source[aria-disabled="true"] {
  cursor: default;
}
.light-source-check {
  font: 700 12px var(--font-ui);
}
@media(prefers-reduced-motion:reduce) {
  .light-source-ring {
    transition: none;
  }
}
/* Cada tentativa básica tem exatamente um eixo; exploração livre fica em outra aba. */
.cut-mode-tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid #d9ded3;
  border-radius: 14px;
  background: #eff1e9;
  margin-bottom: 14px;
}
.cut-mode-tabs button {
  flex: 1;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 12px 14px;
  color: #58614e;
  font-weight: 650;
}
.cut-mode-tabs button[aria-selected="true"] {
  background: #fffefa;
  color: #35452d;
  box-shadow: 0 2px 7px #28392412;
}
.cut-mode-tabs button:focus-visible {
  outline: 3px solid #8b78a6;
  outline-offset: 2px;
}
.cut-basic-panel {
  padding: 15px 18px;
  border: 1px solid #dcd8e6;
  border-radius: 14px;
  background: #f7f5fb;
}
.cut-basic-panel p,.cut-basic-panel small,.cut-panel-note {
  color: #65636e;
  font-size: .85rem;
  line-height: 1.55;
}
.cut-basic-panel .field {
  margin: 16px 0 10px;
}
.cut-direction {
  pointer-events: none;
}
.cut-grip:focus {
  outline: none;
}
.cut-grip:focus .cut-grip-face {
  stroke: #584976;
  stroke-width: 3;
}
/* Interação direta: ferramentas próximas, camadas passivas e navegação visual. */
.direct-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px auto;
  max-width: 680px;
  position: relative;
  z-index: 3;
}
.direct-controls button {
  min-width: 42px;
  min-height: 42px;
  padding: 7px 10px;
  font-size: 13px;
}
.collection-board-wrap {
  overflow: hidden;
  padding: 24px;
  isolation: isolate;
  min-height: 240px;
}
.collection-board .grid-cell {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.collection-board .grid-cell.active-cell {
  outline: 2px solid #6d8075;
  outline-offset: -4px;
}
.collection-board .grid-cell:focus-visible {
  outline: 3px solid #645379;
  outline-offset: -4px;
  z-index: 2;
}
.collection-board .cell-coordinate {
  position: absolute;
  bottom: 3px;
  left: 3px;
  font-size: 8px;
  opacity: .65;
  pointer-events: none;
}
.collection-board .board-overlay,.collection-board .board-overlay * {
  pointer-events: none;
}
.board-prumo .board-overlay .support-marker,.board-prumo .board-overlay .support-marker * {
  pointer-events: all;
  cursor: pointer;
}
.support-marker:focus-visible circle,.support-marker.selected-support circle {
  stroke: #72598b;
  stroke-width: 5;
}
.support-marker {
  outline: none;
}
.protected-support .fixed-dot {
  font-size: 9px;
  opacity: .65;
}
.board-desvio .grid-cell.next-region {
  box-shadow: inset 0 0 0 3px #af92be;
  background-image: repeating-linear-gradient(45deg,transparent 0 12px,#b99ac61c 12px 14px);
}
.board-desvio .grid-cell.preview {
  outline: 3px solid #74518b;
  outline-offset: -5px;
}
.board-desvio .consumed-arrow {
  opacity: .2;
}
.board-desvio .grid-cell.consumed {
  opacity: .65;
}
.local-palette {
  max-width: 680px;
  margin: 12px auto;
  padding: 12px 16px;
  border: 1px solid #c9c3d0;
  border-radius: 14px;
  background: #f8f5fb;
  box-shadow: 0 5px 18px #34264610;
}
.local-palette[hidden] {
  display: none;
}
.local-palette div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.local-palette button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
}
.local-palette button[aria-pressed=true] {
  background: #e3d8ed;
  border-color: #8c739c;
}
#c-tools [data-value] {
  border-left: 7px solid var(--piece);
}
#c-tools [data-value][aria-pressed=true] {
  outline: 2px solid #715780;
  outline-offset: 1px;
}
@media(max-width:600px) {
  .direct-controls {
    gap: 4px;
  }
  .direct-controls button {
    min-height: 44px;
  }
  .collection-board-wrap {
    padding: 18px 6px;
  }
  .local-palette {
    padding: 10px;
  }
  .collection-board .cell-coordinate {
    font-size: 7px;
  }
}
.local-palette {
  z-index: 30;
  max-height: calc(100vh - 24px);
  overflow: auto;
}
.local-palette button {
  touch-action: manipulation;
}
.brush-cursor {
  position: fixed;
  z-index: 35;
  pointer-events: none;
  border: 1.5px solid #665975;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 750;
  box-shadow: 0 2px 6px #0002;
}
.brush-cursor[hidden] {
  display: none;
}
/* Regras separadas do tabuleiro; ações de apoio com identidades suaves. */
.rules-card {
  margin: 18px 24px;
  border: 1px solid #ccd5c5;
  border-radius: 16px;
  background: #fffefa;
  box-shadow: 0 3px 10px #26382c05;
  font-size: 13px;
  overflow: hidden;
}
.rules-card>summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 14px 18px;
  list-style: none;
  font-weight: 700;
  color: #354e3d;
  background: #edf1e7;
}
.rules-card>summary::-webkit-details-marker {
  display: none;
}
.rules-card>summary:focus-visible {
  outline-offset: -4px;
}
.rules-card .rules-show,.rules-card .rules-hide {
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #c7d2c0;
  border-radius: 20px;
  padding: 4px 11px;
  background: #fffefa;
  white-space: nowrap;
}
.rules-card:not([open]) .rules-hide,.rules-card[open] .rules-show {
  display: none;
}
.rules-body {
  padding: 2px 18px 16px;
  color: #536153;
  line-height: 1.8;
}
.rules-body p {
  margin: 12px 0;
}
.rules-body .collection-notes {
  margin: 10px 0;
  background: #f4f5ee;
  padding: 12px 14px;
}
.rules-more {
  margin-top: 14px;
  border-top: 1px solid #e2e7dc;
  padding-top: 8px;
}
.rules-more>summary {
  min-height: 44px;
  padding: 10px 0;
  font-weight: 600;
}
button.action-reset,button.action-hint {
  min-height: 44px;
  padding: 10px 16px;
  border-width: 1px;
  border-style: solid;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 4px #29352708;
}
button.action-reset {
  background: #fbefe7;
  border-color: #d9b9a5;
  color: #7d472c;
}
button.action-hint {
  background: #eeeaf7;
  border-color: #c9bcdf;
  color: #574475;
}
button.action-reset:hover {
  background: #f5e3d6;
  border-color: #af7e60;
}
button.action-hint:hover {
  background: #e4dcf1;
  border-color: #9c85bb;
}
.direct-controls {
  padding: 0 24px;
  gap: 8px;
}
.direct-controls .action-hint {
  margin-left: 8px;
}
.collection-toolbar button.action-reset,.collection-toolbar button.action-hint {
  font-size: 13px;
  padding: 10px 16px;
}
@media(max-width:600px) {
  .rules-card {
    margin: 14px;
  }
  .rules-card>summary {
    padding: 12px 14px;
    gap: 8px;
  }
  .rules-body {
    padding: 2px 14px 14px;
  }
  .direct-controls {
    padding: 0 14px;
    gap: 6px;
  }
  .direct-controls .action-hint {
    margin-left: 0;
  }
  .stage-tools {
    flex-wrap: wrap;
  }
  button.action-reset,button.action-hint {
    min-height: 44px;
  }
}
/* Reinício local: mesma paleta e botões do jogo, sem confirmação do navegador. */
.restart-dialog {
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 28px;
  width: min(420px,calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-shadow: 0 18px 70px #25372e26;
}
.restart-dialog::backdrop {
  background: #25372e59;
}
.restart-dialog .eyebrow {
  margin-bottom: 12px;
}
.restart-dialog>p:not(.eyebrow) {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin: 14px 0 24px;
}
.restart-dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}
.restart-dialog-actions button {
  min-height: 44px;
}
@media(max-width:380px) {
  .restart-dialog {
    padding: 22px;
  }
  .restart-dialog-actions {
    flex-direction: column;
  }
  .restart-dialog-actions button {
    width: 100%;
  }
}
/* Só a camada de hachuras aparece suavemente; símbolo e célula ficam estáveis. */
@media(prefers-reduced-motion:no-preference) {
  .board-pacto .grid-cell.pacto-conflict-enter::after {
    animation: pacto-hatch-enter .3s ease-out both;
    animation-delay: var(--pacto-fade-offset,0ms);
  }
  @keyframes pacto-hatch-enter {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}
/* Navegação lateral fora do tabuleiro, sem sobreposição ou zoom artificial. */
.level-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.level-stepper .eyebrow {
  margin: 0;
}
.level-arrow {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  line-height: 1;
}
.level-arrow:disabled {
  opacity: .35;
  cursor: default;
}
.level-arrow:focus-visible {
  outline: 3px solid #75618d;
  outline-offset: 3px;
}
.level-arrow[hidden] {
  display: none;
}
@media(max-width:540px) {
  .stage-top {
    flex-wrap: wrap;
  }
  .level-stepper {
    gap: 7px;
  }
  .level-stepper .eyebrow {
    font-size: 10px;
  }
}
.board-navigation {
  min-width: 0;
  --result-reserved-height:86px;
}
.board-navigation:has(> .level-arrow:not([hidden])) {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 44px;
  gap: 8px;
  align-items: center;
  padding: 0 6px;
}
.board-navigation> .level-arrow {
  align-self: center;
  position: static;
  margin-bottom: var(--result-reserved-height);
}
.board-navigation> .scene-wrap,.board-navigation> .collection-board-wrap {
  min-width: 0;
  width: 100%;
}
@media(max-width:600px) {
  .board-navigation:has(> .level-arrow:not([hidden])) {
    gap: 2px;
    padding: 0 2px;
  }
  .board-navigation:has(> .level-arrow)> .collection-board-wrap {
    padding-left: 2px;
    padding-right: 2px;
  }
}
/* Mantém os 680 px máximos da superfície da coleção quando há espaço. */
.board-navigation:has(> .collection-board-wrap):has(> .level-arrow) {
  max-width: 796px;
  margin: 24px auto 0;
}
.board-navigation:has(> .level-arrow)> .collection-board-wrap {
  margin-top: 0;
}
@media(max-width:560px) {
  .board-navigation:has(> .collection-board-wrap):has(> .level-arrow) {
    margin-top: 15px;
  }
}
/* PACTO: manual reference check; input and rule-validation remain independent. */
.pacto-check-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .65rem;
  margin: .8rem 0;
}
.pacto-check-controls .pacto-check-status {
  flex-basis: 100%;
  text-align: center;
  margin: .2rem 0;
  color: var(--ink);
}
.pacto-check-ring {
  position: absolute;
  inset: -4px;
  border: 3px solid #548361;
  border-radius: inherit;
  box-shadow: 0 0 0 4px #54836126;
  pointer-events: none;
  z-index: 4;
}
@media(prefers-reduced-motion:no-preference) {
  .pacto-check-controls .pacto-check-status,.pacto-check-ring {
    animation: pacto-check-window 10s linear both;
    animation-delay: var(--pacto-check-offset,0ms);
  }
  @keyframes pacto-check-window {
    0% {
      opacity: 0;
    }
    3%,97% {
      opacity: 1;
    }
    100% {
      opacity: 0;
    }
  }
}
/* ELO v3 only: clues augment the existing board, never erase its connections. */
.elo-stage {
  margin-top: 28px;
}
.elo-stage .stage-heading {
  margin-bottom: 4px;
}
.elo-stage .stage-heading small {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 8px;
}
.elo-stage-mechanic {
  font-size: 13px;
  color: #56684e;
  margin: 0 0 12px;
}
.elo-level-tile {
  min-height: 80px;
}
.elo-level-tile small {
  display: block;
  font-size: 10px;
  line-height: 1.5;
}
.elo-rule-list {
  padding-left: 20px;
}
.elo-rule-list li {
  margin: 10px 0;
}
.elo-clue-legend {
  margin: 14px 24px;
  padding: 14px;
  border: 1px solid #cbd6c4;
  border-radius: 12px;
  background: #f7f8f1;
  font-size: 12px;
  line-height: 1.65;
}
.elo-clue-legend>strong {
  font-size: 13px;
  color: #304c38;
}
.elo-region-clues {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.elo-region-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  border: 1px solid #becbb6;
  border-left: 8px solid var(--elo-region);
  padding: 5px 9px;
  background: #fffefa;
  border-radius: 7px;
}
.elo-region-chip span {
  white-space: nowrap;
}
.elo-region-help {
  font-size: 11px;
  color: #52614d;
}
.elo-specific-clues {
  padding-left: 18px;
  margin-bottom: 0;
}
.elo-specific-clues li {
  margin: 4px 0;
}
.elo-viewport-help {
  font-size: 12px;
  line-height: 1.6;
  color: #52614d;
  margin: 12px 24px;
}
.elo-board-surface {
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}
.elo-board-surface.elo-has-gutter,.elo-board-surface:has(.elo-large),.elo-board-surface:has(.elo-board-label) {
  padding: 32px 32px 32px 64px;
  scroll-padding: 32px 32px 32px 64px;
}
.elo-board-surface:has(.elo-board-label) .board-elo {
  min-width: calc(var(--cols) * 44px);
}
.board-elo.elo-large {
  min-width: calc(var(--cols) * 44px);
  margin-right: 0;
}
.board-elo.elo-large .grid-cell {
  min-height: 44px;
  min-width: 44px;
}
.board-elo .elo-passage,.board-elo .elo-exclusive {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: 34px;
  color: #7c5828;
  font-weight: 500;
}
.board-elo .elo-exclusive {
  color: #785089;
  font-size: 39px;
}
.board-elo .elo-exclusive small {
  position: absolute;
  bottom: 5%;
  right: 6%;
  font-size: 10px;
  font-weight: 750;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-elo .elo-passage-cell .discarded {
  position: absolute;
  left: 5%;
  bottom: 3%;
  font-size: 19px;
}
.board-elo .elo-board-label {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  font: 700 12px/18px var(--font-ui);
  color: #4b6040;
  text-shadow: 0 1px 2px #fffefa;
}
.board-elo .elo-label-row {
  right: calc(100% + 8px);
  transform: translateY(-50%);
}
.board-elo .elo-label-col {
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
}
.board-elo .elo-label-cut-row {
  left: calc(100% + 8px);
  transform: translateY(-50%);
  color: #785089;
}
.board-elo .elo-label-cut-col {
  top: calc(100% + 8px);
  transform: translateX(-50%);
  color: #785089;
}
.board-elo .elo-forbidden line {
  stroke: #a34836;
  stroke-width: 8;
  stroke-linecap: round;
}
.board-elo .elo-forbidden circle {
  fill: #fffefa;
  stroke: #a34836;
  stroke-width: 3;
}
.board-elo .elo-cut line {
  stroke: #8b6ba2;
  stroke-width: 3;
  stroke-dasharray: 10 10;
  opacity: .85;
}
.board-elo .elo-token,.board-elo .region-letter,.board-elo .fixed-dot {
  pointer-events: none;
}
.elo-board-surface .board-elo {
  isolation: isolate;
}
.elo-board-surface .board-elo .board-overlay {
  z-index: 2;
}
@media(max-width:600px) {
  .elo-clue-legend {
    margin: 12px 14px;
    padding: 12px;
  }
  .elo-viewport-help {
    margin: 12px 14px;
  }
  .elo-stage .stage-heading small {
    display: block;
    margin: 5px 0 0;
  }
  .elo-lab .board-navigation:has(> .level-arrow)>.elo-board-surface.elo-has-gutter,.elo-lab .board-navigation:has(> .level-arrow)>.elo-board-surface:has(.elo-large),.elo-board-surface.elo-has-gutter,.elo-board-surface:has(.elo-large),.elo-lab .board-navigation:has(> .level-arrow)>.elo-board-surface:has(.elo-board-label),.elo-board-surface:has(.elo-board-label) {
    padding: 32px 32px 32px 64px;
  }
  .board-elo.elo-large .elo-token {
    font-size: 27px;
  }
  .board-elo.elo-large .region-letter {
    font-size: 10px;
  }
  .board-elo.elo-large .fixed-dot {
    font-size: 11px;
  }
  .board-elo .elo-passage {
    font-size: 30px;
  }
  .board-elo .elo-exclusive {
    font-size: 34px;
  }
}
@media(forced-colors:active) {
  .board-elo .elo-forbidden line,.board-elo .elo-forbidden circle {
    stroke: Mark;
  }
  .board-elo .elo-cut line {
    stroke: LinkText;
  }
  .board-elo .elo-board-label {
    color: CanvasText;
    text-shadow: none;
  }
  .elo-region-chip {
    border-color: CanvasText;
  }
}
/* Manual checks share the same map outline; only its verdict color changes. */
.pacto-check-ring.manual-check-error {
  border-color: #b94242;
  box-shadow: 0 0 0 4px #b9424226;
}
@media(prefers-reduced-motion:no-preference) {
  :is(.board-elo,.board-prumo) .grid-cell.manual-check-enter::after {
    animation: pacto-hatch-enter .3s ease-out both;
    animation-delay: var(--pacto-fade-offset,0ms);
  }
}
/* JSON import panels only: placed after the campaign or duel configuration. */
.level-json-import {
  margin-top: 32px;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
  max-width: 100%;
  font-size: 13px;
  line-height: 1.6;
}
.level-json-import h3 {
  font-size: 19px;
  margin: 0 0 10px;
}
.level-json-import p {
  max-width: 850px;
}
.level-json-import .file-button {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 16px 0;
}
.level-json-import input[type=file] {
  max-width: 100%;
  min-height: 44px;
  margin: 0;
}
.level-json-import details {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8f9f3;
  min-width: 0;
}
.level-json-import summary {
  cursor: pointer;
  min-height: 32px;
  font-weight: 650;
}
.level-json-import pre {
  max-width: 100%;
  max-height: 300px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #fffefa;
  font: 12px/1.5 ui-monospace,monospace;
  white-space: pre;
}
.level-json-import textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 160px;
  margin: 8px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  font: 12px/1.5 ui-monospace,monospace;
  resize: vertical;
}
.level-json-import [role=status],.level-json-import [role=alert] {
  overflow-wrap: anywhere;
  color: var(--ink);
  min-height: 24px;
}
.level-json-import button {
  min-height: 44px;
}
.level-json-import label {
  display: block;
}
@media(max-width:600px) {
  .level-json-import {
    margin-top: 24px;
    padding-top: 18px;
  }
  .level-json-import details {
    padding: 10px;
  }
  .level-json-import .file-button {
    width: 100%;
  }
}
/* The same direct campaign/Endless mode switch for the collection games. */
.collection-mode-switch {
  display: flex;
  width: fit-content;
  margin-top: 12px;
}
.collection-mode-switch button {
  min-height: 44px;
}
/* Manual check stays near the map; keep the full result area only for victory. */
.board-navigation:has(> .collection-board-wrap > :is(.board-elo,.board-prumo,.board-pacto)):not(:has(#c-motion[data-outcome="win"])) {
  --result-reserved-height:24px;
}
/* The shared top toolbar keeps the former collection touch targets. */
.stage-top>.stage-tools>button {
  min-width: 44px;
  min-height: 44px;
}
/* Legacy panel-toggle used !important; keep its original toolbar target 44px too. */
.stage-top>.stage-tools>#toggle-controls {
  min-height: 44px!important;
}
/* Keep the action sequence directly before the map, after game-specific tools. */
.experiment>.stage-top {
  padding-top: 8px;
  padding-bottom: 8px;
  gap: 8px;
}
.experiment>.stage-top>.stage-tools {
  justify-content: flex-end;
  margin-left: auto;
  flex-wrap: wrap;
}
.experiment>.stage-top+.board-navigation {
  margin-top: 0;
}
.collection-surface>.collection-stage-top>.level-stepper:empty {
  display: none;
}
@media(max-width:600px) {
  .experiment>.stage-top {
    padding-left: 14px;
    padding-right: 14px;
  }
  .experiment>.stage-top>.stage-tools {
    width: 100%;
    justify-content: flex-end;
  }
}
/* Hints remain below the play area, with readable body-size text in all games. */
#hint-text,#c-hint-text {
  font-size: 16px;
  line-height: 1.55;
}
/* Align actions with the visible map, without resizing its cells or scroll area. */
.experiment:has(>.board-navigation>.scene-wrap)>.stage-top {
  width: 100%;
  margin-inline: auto;
  padding-inline: 0;
}
.experiment:has(>.board-navigation>.scene-wrap):has(>.board-navigation>.level-arrow:not([hidden]))>.stage-top {
  width: calc(100% - 116px);
}
.collection-surface>.stage-top {
  width: calc(100% - 48px);
  max-width: 632px;
  margin-inline: auto;
  padding-inline: 0;
}
.collection-surface:has(>.board-navigation>.level-arrow)>.stage-top {
  width: calc(100% - 164px);
}
.collection-surface:has(>.board-navigation .board-desvio)>.stage-top {
  max-width: 460px;
}
.collection-surface:has(>.board-navigation>.elo-board-surface.elo-has-gutter,>.board-navigation>.elo-board-surface .elo-large,>.board-navigation>.elo-board-surface .elo-board-label)>.stage-top {
  width: calc(100% - 64px);
  max-width: 616px;
  padding-left: 32px;
}
.collection-surface:has(>.board-navigation>.level-arrow):has(>.board-navigation>.elo-board-surface.elo-has-gutter,>.board-navigation>.elo-board-surface .elo-large,>.board-navigation>.elo-board-surface .elo-board-label)>.stage-top {
  width: calc(100% - 180px);
}
.experiment>.stage-top>.stage-tools {
  max-width: 100%;
  min-width: 0;
}
.experiment>.stage-top+.board-navigation>.collection-board-wrap {
  margin-top: 0;
}
@media(max-width:600px) {
  .experiment:has(>.board-navigation>.scene-wrap):has(>.board-navigation>.level-arrow:not([hidden]))>.stage-top {
    width: calc(100% - 96px);
  }
  .collection-surface>.stage-top {
    width: calc(100% - 12px);
  }
  .collection-surface:has(>.board-navigation>.level-arrow)>.stage-top {
    width: calc(100% - 100px);
  }
  .collection-surface:has(>.board-navigation>.elo-board-surface.elo-has-gutter,>.board-navigation>.elo-board-surface .elo-large,>.board-navigation>.elo-board-surface .elo-board-label)>.stage-top {
    width: calc(100% - 64px);
  }
  .collection-surface:has(>.board-navigation>.level-arrow):has(>.board-navigation>.elo-board-surface.elo-has-gutter,>.board-navigation>.elo-board-surface .elo-large,>.board-navigation>.elo-board-surface .elo-board-label)>.stage-top {
    width: calc(100% - 160px);
  }
}
/* ELO clue meanings live beside their unchanged codes inside the rules sidebar. */
.rules-sidebar .elo-clue-legend {
  margin: 18px 0;
  padding: 12px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.6;
}
.elo-clue-legend #c-elo-explanations-toggle {
  display: block;
  min-height: 44px;
  max-width: 100%;
  margin: 10px 0 14px;
  font-size: 12px;
}
.elo-clue-legend .elo-region-clues {
  display: block;
  margin: 12px 0;
  padding: 0;
}
.elo-clue-legend .elo-region-chip {
  margin: 10px 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.elo-clue-legend .elo-clue-explanation {
  display: block;
  flex-basis: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 6px 0 2px;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.6;
  color: #435440;
}
.elo-clue-legend .elo-specific-clues {
  padding-left: 16px;
  overflow-wrap: anywhere;
}
.elo-clue-legend .elo-specific-clues>li {
  margin: 12px 0;
}
.elo-clue-legend .elo-clue-explanation[hidden] {
  display: none;
}
/* Atalhos da seleção: mesma linha em todos os jogos, inclusive no celular. */
.level-screen > .selection-actions {
  margin: 14px 0;
  flex-wrap: nowrap;
  align-items: stretch;
}
.level-screen > .selection-actions > button {
  min-width: 0;
  white-space: normal;
}
