/* Logic puzzles game (assets/play/logic.js): sudoku, math cages, number pyramids, magic squares, logic grids. */
.lg-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 4px 0 10px; }
.lg-tools { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* square boards */
.lg-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); width: min(100%, calc(var(--n) * 66px)); background: #fff;
  border: 4px solid var(--navy); border-radius: 12px; overflow: hidden; touch-action: manipulation; }
.lg-cell { position: relative; aspect-ratio: 1; min-width: 0; min-height: 44px; padding: 0; margin: 0; border: 0; border-right: 1px solid #c3ccdb;
  border-bottom: 1px solid #c3ccdb; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font: 800 clamp(1.35rem, 6.4vw, 2.1rem)/1 var(--display); color: var(--navy); transition: background .15s; -webkit-tap-highlight-color: transparent; }
.lg-grid .lg-cell.br { border-right: 3px solid var(--navy); }
.lg-grid .lg-cell.bb { border-bottom: 3px solid var(--navy); }
.lg-grid .lg-cell.lc { border-right: 0; }
.lg-grid .lg-cell.lr { border-bottom: 0; }
.lg-cell .lg-v { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font: inherit; }
.lg-cell svg { width: 74%; height: 74%; }
.lg-cell.given { background: #f1f4f9; cursor: default; }
.lg-cell.peer { background: var(--soft); }
.lg-cell.sel { background: #fff3c4; box-shadow: inset 0 0 0 4px var(--yellow); }
.lg-cell.ok { background: #e3f7ec; color: #168a56; cursor: default; }
.lg-cell.ok .lg-v { animation: pop .3s ease-out; }
.lg-cell.hinted { background: #fff6d6; color: #a86f00; }
.lg-cell .lg-v.no { color: var(--red); }
.lg-cell .lg-v.typing { color: var(--blue); }
.lg-cell:focus-visible, .lg-gc:focus-visible { outline: 3px solid var(--blue); outline-offset: -3px; }

/* math cages: the target sits in the corner of each cage */
.lg-cages .lg-cell { font-size: clamp(1.25rem, 5.6vw, 1.9rem); }
.lg-cages .lg-cell .lg-v { padding-top: 10%; }
.lg-tag { position: absolute; left: 4px; top: 2px; font: 800 clamp(.72rem, 2.8vw, .95rem)/1.1 var(--body); color: var(--navy); pointer-events: none; }

/* number pyramids */
.lg-pyr { display: flex; flex-direction: column; align-items: center; gap: 5px; touch-action: manipulation; }
.lg-prow { display: flex; gap: 5px; }
.lg-pyr .lg-cell { width: clamp(50px, 16vw, 78px); height: clamp(46px, 12vw, 60px); aspect-ratio: auto; border: 3px solid var(--navy);
  border-radius: 10px; font-size: clamp(1.15rem, 4.8vw, 1.65rem); }
.lg-pyr .lg-cell.sel { box-shadow: 0 0 0 4px var(--yellow); }

/* magic squares */
.lg-magic { width: min(100%, 270px); }
.lg-sum { font: 800 1.25rem var(--display); color: var(--navy); background: var(--soft); border-radius: 999px; padding: 4px 18px; }
.lg-sum b { color: var(--red); }

/* the answer pad: big buttons, only the values this puzzle uses */
.lg-pad { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 440px; }
.lg-pad button { width: 60px; height: 60px; border: 0; border-radius: 16px; background: #fff; cursor: pointer; padding: 0;
  font: 800 1.7rem var(--display); color: var(--navy); box-shadow: 0 5px 0 #c9d3e2, inset 0 0 0 3px #d4dce8; display: flex;
  align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
.lg-pad button:active { transform: translateY(3px); box-shadow: 0 2px 0 #c9d3e2, inset 0 0 0 3px #d4dce8; }
.lg-pad button:disabled { opacity: .3; cursor: default; }
.lg-pad button svg { width: 44px; height: 44px; }
.lg-sudoku .lg-pad button:has(svg) { width: 70px; height: 70px; }
.lg-keys { display: grid; grid-template-columns: repeat(5, 56px); gap: 9px; }
.lg-keys button { width: 56px; height: 56px; }
.lg-keys .lg-back { grid-column: span 2; width: auto; }
.lg-keys .lg-go { grid-column: span 3; width: auto; background: var(--green); color: #fff; font-size: 1.3rem; box-shadow: 0 5px 0 #168a56; }

/* logic grids */
.lg-story { border: 0; background: none; text-align: left; font: 600 1.05rem/1.5 var(--body); color: var(--text, #22314f); max-width: 720px;
  cursor: pointer; padding: 0 4px; }
.lg-clues { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; width: 100%; max-width: 720px; }
.lg-clue { display: flex; gap: 10px; align-items: flex-start; width: 100%; min-height: 44px; border: 0; border-radius: 12px; background: var(--soft);
  padding: 8px 12px; text-align: left; font: 600 1rem/1.4 var(--body); color: var(--navy); cursor: pointer; transition: opacity .2s; }
.lg-clue b { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-size: .85rem; margin-top: 1px; }
.lg-clue.used { opacity: .5; }
.lg-clue.used b { background: var(--green); }
.lg-how { margin: 0; font: 700 1rem var(--body); color: var(--muted); text-align: center; }
.lg-x { color: var(--red); }
.lg-y { color: #168a56; }
.lg-blocks { display: flex; flex-wrap: wrap; gap: 18px 26px; justify-content: center; }
.lg-block { display: grid; grid-template-columns: auto repeat(var(--n), 46px); align-items: stretch; touch-action: manipulation; }
.lg-block h3 { grid-column: 1 / -1; font-size: 1.05rem; margin: 0 0 4px; text-align: center; }
.lg-ch { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; padding-bottom: 5px;
  font: 700 .8rem/1 var(--body); color: var(--navy); }
.lg-ch .w { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.lg-rh { display: flex; align-items: center; justify-content: flex-end; gap: 5px; padding-right: 7px; font: 700 .9rem/1.1 var(--body);
  color: var(--navy); white-space: nowrap; }
.lg-rh.nm { font-size: 1rem; }
.lg-sw { display: inline-block; flex: none; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .18); }
.lg-emo { font-style: normal; font-size: 1.2rem; line-height: 1; }
.lg-gc { width: 46px; height: 46px; padding: 0; margin: 0; border: 1px solid #b8c3d6; border-width: 0 1px 1px 0; background: #fff; cursor: pointer;
  font: 800 1.55rem/1 var(--display); color: var(--navy); -webkit-tap-highlight-color: transparent; }
.lg-gc.et { border-top: 3px solid var(--navy); }
.lg-gc.el { border-left: 3px solid var(--navy); }
.lg-gc.er { border-right: 3px solid var(--navy); }
.lg-gc.eb { border-bottom: 3px solid var(--navy); }
.lg-gc.x { color: var(--red); background: #fff7f6; }
.lg-gc.yes { color: #fff; background: var(--green); }
.lg-gc.pending { background: #fff3c4; }
.lg-gc.hinted { box-shadow: inset 0 0 0 3px var(--yellow); }
.lg-gc.bad { background: #ffe1de; }

@media (max-width: 600px) {
  .lg-wrap { gap: 12px; }
  .lg-pad { gap: 8px; }
  .lg-pad button { width: 54px; height: 54px; }
  .lg-keys { grid-template-columns: repeat(5, 54px); gap: 8px; }
  .lg-clue { font-size: .95rem; }
}
