* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

.app {
  max-width: 980px;
  margin: 24px auto;
  padding: 0 16px 32px;
}

h1 {
  margin-bottom: 8px;
}

.hint {
  margin-top: 0;
  color: #4b5563;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 14px 0;
}

.lives {
  font-weight: 700;
  color: #b91c1c;
}

.square-output {
  margin-left: 6px;
  font-weight: 700;
  color: #1d4ed8;
}

button,
select {
  font: inherit;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

button {
  cursor: pointer;
}

button:hover {
  background: #f1f5f9;
}

.status {
  padding: 10px 12px;
  border-radius: 10px;
  background: #e2e8f0;
  margin-bottom: 14px;
}

.status.success {
  background: #dcfce7;
  color: #166534;
}

.status.warn {
  background: #fef3c7;
  color: #92400e;
}

.board-wrapper {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #dbe1ea;
  border-radius: 12px;
  padding: 14px;
}

.nonogram {
  border-collapse: collapse;
  user-select: none;
}

.nonogram td,
.nonogram th {
  border: 1px solid #d1d5db;
  text-align: center;
}

.corner {
  background: #eef2ff;
  min-width: 90px;
  width: 90px;
}

.clue-col {
  width: 34px;
  min-width: 34px;
  height: 90px;
  background: #f8fafc;
  vertical-align: bottom;
}

.clue-row {
  width: 90px;
  min-width: 90px;
  height: 34px;
  background: #f8fafc;
  text-align: right;
  padding-right: 6px;
}

.clue-stack {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}

.clue-col .clue-stack {
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-height: 88px;
  padding: 3px 0;
}

.cell {
  width: 34px;
  height: 34px;
  cursor: pointer;
  background: #fff;
  position: relative;
}

.cell.locked {
  cursor: not-allowed;
}

.cell.filled {
  background: #111827;
}

.cell.cross::before,
.cell.cross::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  border-top: 2px solid #ef4444;
}

.cell.cross::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.cell.cross::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.cell.border-strong-right {
  border-right: 2px solid #6b7280;
}

.cell.border-strong-bottom {
  border-bottom: 2px solid #6b7280;
}

.clue-col.border-strong-right,
.clue-row.border-strong-bottom {
  border-right: 2px solid #6b7280;
  border-bottom: 2px solid #6b7280;
}
