:root{
  --ng-bg: rgba(255,255,255,.02);
  --ng-br: rgba(255,255,255,.08);
  --ng-br2: rgba(255,255,255,.14);

  --ng-cell-bg: rgba(255,255,255,.04);
  --ng-cell-br: rgba(255,255,255,.10);
  --ng-cell-br2: rgba(255,255,255,.16);

  --ng-filled-bg: rgba(255,255,255,.90);
  --ng-filled-fg: rgba(11,15,20,.92);

  /* X mark + gridline */
  --ng-x: rgba(255,255,255,.38);
  --ng-gridline: rgba(255,255,255,.10);

  /* satisfied / invalid */
  --ng-sat-bg: rgba(0,255,140,.10);
  --ng-sat-br: rgba(0,255,140,.24);

  --ng-bad-bg: rgba(255,60,60,.10);
  --ng-bad-br: rgba(255,60,60,.28);

  --ng-shadow: 0 10px 24px rgba(0,0,0,.22);

  /* layout vars driven by JS */
  --clueW: 84px;
  --clueH: 84px;
  --cell: 34px;
  --gap: 2px;
}

/* LIGHT MODE — make red/green + X more visible */
:root[data-theme="light"]{
  --ng-bg: rgba(11,15,20,.02);
  --ng-br: rgba(11,15,20,.10);
  --ng-br2: rgba(11,15,20,.16);

  --ng-cell-bg: rgba(255,255,255,.86);
  --ng-cell-br: rgba(11,15,20,.12);
  --ng-cell-br2: rgba(11,15,20,.16);

  --ng-filled-bg: rgba(11,15,20,.92);
  --ng-filled-fg: rgba(255,255,255,.94);

  /* ↑ stronger so X is obvious */
  --ng-x: rgba(11,15,20,.62);
  --ng-gridline: rgba(11,15,20,.12);

  /* ↑ stronger green/red so you can actually see it */
  --ng-sat-bg: rgba(0,160,90,.16);
  --ng-sat-br: rgba(0,160,90,.36);

  --ng-bad-bg: rgba(255,60,60,.16);
  --ng-bad-br: rgba(255,60,60,.34);

  --ng-shadow: 0 10px 22px rgba(0,0,0,.10);
}

header.wrap { padding-bottom: 6px; }
main.wrap { padding-top: 6px; }

.card.ngCard { padding: 10px 10px 12px; }
@media (max-width:520px){
  .wrap { padding-left: 10px; padding-right: 10px; }
  .card.ngCard { padding: 8px 8px 10px; }
}

/* H1 tag */
.ngH1Tag{
  opacity: .72;
  font-weight: 800;
  letter-spacing: .01em;
  margin-left: .35rem;
  font-size: .92em;
}
@media (max-width:420px){
  .ngH1Tag{ display:none; }
}

/* Premium tagline pill — FULL WIDTH (fix wrap) */
.sub{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  gap: .45rem;

  width:100%;
  max-width:none;
  box-sizing:border-box;

  text-align:center;
  margin: 8px 0 0;
  padding: .5rem .75rem;

  font-size: .92rem;
  line-height: 1.15;
  border-radius: 999px;
  letter-spacing: .01em;

  background: rgba(0,0,0,.04);
  border: 1px solid rgba(0,0,0,.06);

  text-wrap: normal;
}
:root[data-theme="dark"] .sub{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.10);
}
@media (max-width:520px){
  .sub{ font-size: .86rem; }
}

.ngTopRow{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 10px;
}

.ngMeta{ display:flex; flex-direction:column; gap:6px; }
.ngModeLine{ font-size: 13px; opacity: .9; }
.ngRule{ font-size: 12px; opacity: .78; max-width: 60ch; }

.ngStats{
  display:flex;
  gap:10px;
  align-items:flex-end;
}
.ngStat{
  text-align:right;
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width: 78px;
}
.ngStatVal{ font-size: 18px; line-height: 1; }

/* prevent right overflow on mobile */
.ngBoardWrap{
  display:flex;
  justify-content:center;
  padding-top: 2px;
  overflow-x: hidden;
}

/* IMPORTANT: make it 100% of container not vw */
.ngBoardShell{
  width: min(560px, 100%);
  max-width: 100%;

  display:grid;
  grid-template-columns: var(--clueW) auto;
  grid-template-rows: var(--clueH) auto;
  gap: 10px;

  padding: 10px;
  border-radius: 18px;
  background: var(--ng-bg);
  border: 1px solid var(--ng-br);
  box-shadow: var(--ng-shadow);
}

/* box-sizing fix */
.ngBoardShell,
.ngCorner,
.ngGrid,
.ngRowClue,
.ngColClue{
  box-sizing: border-box;
}

.ngCorner{
  border-radius: 14px;
  background: rgba(255,255,255,.02);
  border: 1px dashed rgba(255,255,255,.08);
}
:root[data-theme="light"] .ngCorner{
  background: rgba(11,15,20,.02);
  border-color: rgba(11,15,20,.14);
}

.ngColClues{
  display:grid;
  grid-template-columns: repeat(var(--n), var(--cell));
  gap: var(--gap);
  align-items:end;
}

.ngRowClues{
  display:grid;
  grid-template-rows: repeat(var(--n), var(--cell));
  gap: var(--gap);
  align-items:center;
}

.ngGrid{
  display:grid;
  grid-template-columns: repeat(var(--n), var(--cell));
  grid-template-rows: repeat(var(--n), var(--cell));
  gap: var(--gap);
  border-radius: 14px;
  padding: var(--gap);
  background: rgba(255,255,255,.02);
  border: 1px solid var(--ng-br);
  overflow:hidden;
}
:root[data-theme="light"] .ngGrid{
  background: rgba(11,15,20,.02);
}

.ngColClue,
.ngRowClue{
  display:flex;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.08);
  user-select:none;

  /* make bg change feel more “present” */
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
:root[data-theme="light"] .ngColClue,
:root[data-theme="light"] .ngRowClue{
  background: rgba(11,15,20,.02);
  border-color: rgba(11,15,20,.12);
}

.ngColClue{
  height: var(--clueH);
  justify-content:flex-end;
  align-items:center;
  flex-direction:column;
  padding: 6px 4px;
}

.ngRowClue{
  width: var(--clueW);
  justify-content:flex-end;
  align-items:center;
  padding: 6px 8px;
  flex-direction:row;
}

.ngClueNum{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight: 900;
  font-size: clamp(10px, calc(var(--cell) * 0.30), 14px);
  line-height: 1;
  opacity: .92;
}

.ngColClue.sat,
.ngRowClue.sat{
  border-color: var(--ng-sat-br);
  background: var(--ng-sat-bg);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--ng-sat-bg), transparent 40%) inset;
}

.ngColClue.bad,
.ngRowClue.bad{
  border-color: var(--ng-bad-br);
  background: var(--ng-bad-bg);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--ng-bad-bg), transparent 40%) inset;
}

.ngCell{
  width: var(--cell);
  height: var(--cell);
  border-radius: 10px;
  background: var(--ng-cell-bg);
  border: 1px solid var(--ng-cell-br);
  cursor:pointer;
  padding:0;
  position:relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;

  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}
.ngCell:hover{ border-color: var(--ng-cell-br2); }
.ngCell:active{ transform: translateY(0.5px) scale(0.995); }

.ngCell.filled{
  background: var(--ng-filled-bg);
  border-color: color-mix(in oklab, var(--ng-filled-bg), black 12%);
  box-shadow: 0 6px 14px rgba(0,0,0,.18);
}

/* ✅ CLEAN X MARK (replaces the curved “roof” look) */
.ngCell.mark::before,
.ngCell.mark::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width: 68%;
  height: 2.5px;
  background: var(--ng-x);
  border-radius: 999px;
  transform-origin: center;
  pointer-events:none;
}
.ngCell.mark::before{ transform: translate(-50%,-50%) rotate(45deg); }
.ngCell.mark::after { transform: translate(-50%,-50%) rotate(-45deg); }

.ngBar{
  margin-top: 12px;
  display:flex;
  gap:8px;
  justify-content:center;
  flex-wrap:wrap;
}

.ngMiniRow{
  margin-top:10px;
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
}

.ngStatsPill{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
  font-size: 13px;
  box-shadow: 0 10px 22px rgba(0,0,0,.10);
}
:root[data-theme="light"] .ngStatsPill{
  background: rgba(255,255,255,.86);
  border-color: rgba(11,15,20,.14);
}

.ngMoreWrap{
  margin-top: 12px;
  display:flex;
  justify-content:center;
}
.ngMoreBtn{
  text-decoration:none;
  padding: 12px 16px;
  border-radius: 16px;
  box-shadow: 0 10px 22px rgba(0,0,0,.10);
  animation: ngMorePulse 2.8s ease-in-out infinite;
}
@keyframes ngMorePulse{
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(-1px); }
}

.msg{
  display:none;
  margin: 8px auto 0;
  text-align:center;
  font-weight: 900;
  letter-spacing:.01em;
}

.ngHelpDlg,
.ngWinDlg,
.ngShareDlg{
  padding: 0;
  border: 0;
  background: transparent;
  width: fit-content;
  max-width: calc(100vw - 24px);
  margin: auto;
}
.ngHelpDlg::backdrop,
.ngWinDlg::backdrop,
.ngShareDlg::backdrop{ background: rgba(0,0,0,.55); }
:root[data-theme="light"] .ngHelpDlg::backdrop,
:root[data-theme="light"] .ngWinDlg::backdrop,
:root[data-theme="light"] .ngShareDlg::backdrop{ background: rgba(0,0,0,.35); }

.ngHelp{
  padding: 10px 10px 12px;
  max-width: 560px;
}
.ngHelpScroll{
  max-height: 70vh;
  overflow: auto;
  padding-right: 2px;
}
.ngHelpBox{
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.02);
  border-radius: 12px;
  padding: 9px 10px;
  margin: 8px 0;
}
:root[data-theme="light"] .ngHelpBox{
  border-color: rgba(11,15,20,.12);
  background: rgba(11,15,20,.02);
}
.ngHelpKicker{
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .78;
  margin-bottom: 6px;
}
.ngHelpList{ margin:0; padding-left: 18px; }
.ngHelpList li{ margin:5px 0; }
.ngHelpActions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-top: 8px;
}

.ngWinActions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-top: 12px;
}
.ngPbLine{
  margin-top: 8px;
  font-weight: 900;
  letter-spacing: .01em;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ng-sat-bg);
  border: 1px solid var(--ng-sat-br);
}

/* Light mode: make selected seg a touch more obvious */
:root[data-theme="light"] .seg.on{
  box-shadow: 0 0 0 3px rgba(0,120,255,.18) inset;
}

@media (prefers-reduced-motion: reduce){
  .ngCell{ transition:none !important; }
  .ngMoreBtn{ animation:none !important; }
}

/* Mode pills always 1 row */
.ngCard .modeSeg{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}
.ngCard .modeSeg .seg{
  width:100%;
  min-width:0;
  white-space:nowrap;
  padding: 10px 10px;
  font-size: 13px;
}
@media (max-width: 360px){
  .ngCard .modeSeg{ gap:5px; }
  .ngCard .modeSeg .seg{ padding: 9px 8px; font-size: 12.5px; }
}

@media (max-width: 420px){
  .ngBoardShell{ padding: 8px; gap: 8px; }
  .ngRowClue{ padding: 6px 6px; } /* slightly slimmer left clue pills */
}









/* --- Light mode: make sat/bad fill feel like dark mode (stronger “pill fill”) --- */
:root[data-theme="light"]{
  /* stronger base tints */
  --ng-sat-bg: rgba(0,160,90,.24);
  --ng-sat-br: rgba(0,160,90,.50);

  --ng-bad-bg: rgba(255,60,60,.24);
  --ng-bad-br: rgba(255,60,60,.48);
}

/* satisfied (green) */
:root[data-theme="light"] .ngColClue.sat,
:root[data-theme="light"] .ngRowClue.sat{
  background: linear-gradient(180deg,
    rgba(0,160,90,.30),
    rgba(0,160,90,.18)
  );
  border-color: var(--ng-sat-br);
  box-shadow:
    0 0 0 2px rgba(0,160,90,.16) inset,
    0 10px 18px rgba(0,160,90,.10);
}

/* invalid (red) */
:root[data-theme="light"] .ngColClue.bad,
:root[data-theme="light"] .ngRowClue.bad{
  background: linear-gradient(180deg,
    rgba(255,60,60,.30),
    rgba(255,60,60,.18)
  );
  border-color: var(--ng-bad-br);
  box-shadow:
    0 0 0 2px rgba(255,60,60,.14) inset,
    0 10px 18px rgba(255,60,60,.08);
}




/* =========================
   NonogramGlyph SEO card premium spacing
   ========================= */

.ngSeoCard .learnGrid{ gap: 14px; }
@media (min-width: 720px){
  .ngSeoCard .learnGrid{ gap: 16px; }
}

.ngSeoCard .agTips{ margin-top: 14px; }

/* Better spacing between FAQ items and tip cards */
.ngSeoCard .agTipsGrid{
  display:grid;
  gap: 12px;
}
@media (min-width: 720px){
  .ngSeoCard .agTipsGrid{ gap: 14px; }
}

/* Premium card feel */
.ngSeoCard .agTipCard{
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}
:root[data-theme="light"] .ngSeoCard .agTipCard{
  border: 1px solid rgba(11,15,20,.10);
  background: rgba(11,15,20,.03);
}

.ngSeoCard .agTipTitle{ margin-bottom: 6px; }
.ngSeoCard .agTipCard p{ margin: 0; line-height: 1.55; }

/* FAQ gets extra breathing room */
.ngSeoCard .agTips.faq .agTipsGrid{ gap: 14px; }
@media (min-width: 720px){
  .ngSeoCard .agTips.faq .agTipsGrid{ gap: 16px; }
}
.ngSeoCard .agTips.faq .agTipCard{ padding: 14px 16px; }

/* Chips spacing polish */
.ngSeoCard .chips{ gap: 8px; }
.ngSeoCard .chip{ padding: 7px 10px; border-radius: 999px; }

/* Slightly nicer headings spacing inside the SEO card */
.ngSeoCard h3{ margin-top: 0; }

