:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  background: radial-gradient(1200px 800px at 20% -10%, #1e293b, #0b1120 60%);
  color: #e2e8f0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
.app { max-width: 640px; margin: 0 auto; padding: 18px 14px 40px; }
h1 { font-size: 1.5rem; margin: 4px 0 14px; letter-spacing: 1px; }
h1 .sub { font-size: .8rem; color: #7dd3fc; font-weight: 400; margin-left: 8px; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 10px; }
.controls label { display: flex; flex-direction: column; font-size: .75rem; color: #94a3b8; gap: 4px; }
.controls input {
  width: 96px; padding: 7px 8px; border-radius: 8px; border: 1px solid #334155;
  background: #0f172a; color: #e2e8f0; font-size: .95rem;
}
button {
  padding: 9px 14px; border-radius: 999px; border: 1px solid #38bdf8;
  background: linear-gradient(180deg, #0ea5e9, #0369a1); color: white;
  font-size: .9rem; cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.15); }
button:disabled { opacity: .35; cursor: not-allowed; }
#undo, #reset { background: linear-gradient(180deg, #475569, #1e293b); border-color: #64748b; }

.stats { display: flex; flex-wrap: wrap; gap: 14px; font-size: .85rem; color: #94a3b8; margin: 8px 0; }
.stats b { color: #f1f5f9; font-variant-numeric: tabular-nums; }
.nnstatus { color: #34d399; font-size: .78rem; }

.meta { font-size: .72rem; color: #64748b; word-break: break-all; margin: 2px 0 8px; }

.board-wrap { position: relative; }
.board {
  display: grid; gap: 5px; width: min(92vw, 480px); aspect-ratio: 1;
  background: #111c33; border: 1px solid #1e293b; border-radius: 14px;
  padding: 8px; margin: 0 auto; touch-action: manipulation;
}
.cell { border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.cell.blank { background: #0b1120; }
.cell.tile {
  cursor: pointer; color: #fff; font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 2px 6px rgba(0,0,0,.4);
  user-select: none; transition: transform .06s ease;
}
.cell.tile:hover { transform: scale(1.04); }
.cell.tile.ok { outline: 1px solid rgba(52, 211, 153, .8); }
.cell.tile.hinted { animation: pulse 0.9s ease-in-out infinite; outline: 3px solid #fbbf24; z-index: 2; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251,191,36,.7); }
  50% { box-shadow: 0 0 0 10px rgba(251,191,36,0); }
}

.banner {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 800; color: #34d399;
  background: rgba(2, 6, 23, .72); border-radius: 14px; backdrop-filter: blur(2px);
}
.banner.hidden { display: none; }

.hintline { min-height: 1.4em; text-align: center; color: #fbbf24; font-size: .95rem; margin: 12px 0 0; }
.foot { text-align: center; color: #475569; font-size: .7rem; margin-top: 16px; word-break: break-all; }
