.ng-shell {
  max-width: 980px;
  margin: 0 auto;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.ng-toolbar,
.ng-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ng-toolbar {
  flex-wrap: wrap;
}

.ng-tabs,
.ng-actions,
.ng-mode,
.ng-meta,
.ng-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ng-tab,
.ng-btn,
.ng-icon-btn,
.ng-mode-btn {
  min-height: 44px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.ng-tab,
.ng-btn,
.ng-mode-btn {
  padding: 0 14px;
}

.ng-icon-btn {
  width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.ng-icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ng-tab:hover,
.ng-btn:hover,
.ng-icon-btn:hover,
.ng-mode-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(18, 122, 137, 0.45);
}

.ng-tab:focus-visible,
.ng-btn:focus-visible,
.ng-icon-btn:focus-visible,
.ng-mode-btn:focus-visible,
.ng-cell:focus-visible {
  outline: 3px solid rgba(49, 95, 157, 0.34);
  outline-offset: 2px;
}

.ng-tab.ng-active,
.ng-mode-btn.ng-active {
  border-color: var(--cg-teal);
  background: rgba(18, 122, 137, 0.09);
  box-shadow: inset 0 0 0 2px rgba(18, 122, 137, 0.13);
}

.ng-btn:disabled,
.ng-cell:disabled {
  cursor: default;
  opacity: 0.62;
}

.ng-danger {
  color: var(--cg-red);
}

.ng-stats,
.ng-meta {
  gap: 6px;
}

.ng-stat {
  min-width: 72px;
  padding: 7px 10px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.ng-stat-label {
  display: block;
  color: var(--cg-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.ng-stat-value {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  line-height: 1.15;
}

.ng-status {
  padding: 10px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.ng-board-wrap {
  display: grid;
  justify-items: center;
  padding: 14px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  box-shadow: var(--cg-shadow);
}

.ng-puzzle {
  --ng-clues: clamp(50px, 17vw, 110px);
  display: grid;
  width: min(100%, 640px);
  grid-template-columns: var(--ng-clues) minmax(0, 1fr);
  grid-template-rows: var(--ng-clues) minmax(0, 1fr);
  touch-action: none;
  user-select: none;
}

.ng-corner {
  border-right: 1px solid var(--cg-line);
  border-bottom: 1px solid var(--cg-line);
}

.ng-top-clues,
.ng-left-clues,
.ng-board {
  display: grid;
}

.ng-top-clues {
  grid-template-columns: repeat(var(--ng-size), minmax(0, 1fr));
  border-bottom: 1px solid var(--cg-line);
}

.ng-left-clues {
  grid-template-rows: repeat(var(--ng-size), minmax(0, 1fr));
  border-right: 1px solid var(--cg-line);
}

.ng-board {
  aspect-ratio: 1;
  width: 100%;
  grid-template-columns: repeat(var(--ng-size), minmax(0, 1fr));
  grid-template-rows: repeat(var(--ng-size), minmax(0, 1fr));
  background: var(--cg-line);
  gap: 1px;
}

.ng-row-clue,
.ng-col-clue {
  display: flex;
  gap: 3px;
  color: var(--cg-ink);
  font-size: clamp(10px, 2.35vw, 14px);
  font-weight: 900;
  transition: color 140ms ease, opacity 140ms ease;
}

.ng-row-clue {
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  padding: 0 7px 0 2px;
}

.ng-col-clue {
  align-items: flex-end;
  justify-content: center;
  min-height: 0;
  padding: 2px 0 7px;
  flex-direction: column;
}

.ng-row-clue.ng-complete,
.ng-col-clue.ng-complete {
  color: var(--cg-muted);
  opacity: 0.42;
}

.ng-clue-num {
  line-height: 1;
}

.ng-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #fbfcf8;
  color: var(--cg-red);
  font: inherit;
  font-size: clamp(10px, 2.4vw, 18px);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition: background 90ms ease, color 90ms ease, transform 90ms ease;
}

.ng-cell.ng-filled {
  background: var(--cg-teal);
  color: var(--cg-panel);
}

.ng-cell.ng-x {
  background: #f4f1e9;
}

.ng-cell.ng-cross:not(.ng-filled) {
  background: #edf7f5;
}

.ng-cell.ng-hot {
  box-shadow: inset 0 0 0 2px rgba(196, 122, 23, 0.45);
  z-index: 1;
}

.ng-cell.ng-guide-left {
  border-left: 5px solid rgba(30, 37, 40, 0.48);
}

.ng-cell.ng-guide-top {
  border-top: 5px solid rgba(30, 37, 40, 0.48);
}

.ng-won .ng-cell {
  transition: background 220ms ease, color 220ms ease, transform 220ms ease;
  transition-delay: calc(var(--ng-i) * 7ms);
}

.ng-won .ng-cell.ng-win-cell {
  background: var(--cg-ink);
  color: var(--cg-panel);
  transform: scale(0.94);
}

.ng-finish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(29, 127, 98, 0.24);
  border-radius: 8px;
  background: rgba(29, 127, 98, 0.08);
  text-align: center;
}

.ng-finish-title {
  font-size: 18px;
}

.ng-finish-time {
  color: var(--cg-muted);
  font-weight: 800;
}

.ng-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(30, 37, 40, 0.38);
}

.ng-overlay[hidden] {
  display: none;
}

.ng-help {
  width: min(100%, 460px);
  padding: 18px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  box-shadow: var(--cg-shadow);
}

.ng-help-text {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--cg-ink);
  line-height: 1.45;
}

.ng-help-text p {
  margin: 0;
}

@media (max-width: 700px) {
  .ng-toolbar,
  .ng-status {
    align-items: stretch;
  }

  .ng-toolbar,
  .ng-status,
  .ng-tabs,
  .ng-actions,
  .ng-mode,
  .ng-meta,
  .ng-stats {
    justify-content: center;
  }

  .ng-status {
    flex-direction: column;
  }

  .ng-board-wrap {
    padding: 8px;
  }

  .ng-puzzle {
    --ng-clues: clamp(46px, 18vw, 76px);
  }

  .ng-stat {
    min-width: 66px;
  }
}
